@@ -30,7 +30,8 @@ def main_sync():
3030 try :
3131 basic_openai_call (distinct_id , trace_id , properties )
3232 streaming_openai_call (distinct_id , trace_id , properties )
33- non_instrumented_openai_call ()
33+ image_openai_call ()
34+ embedding_openai_call ()
3435 except Exception as e :
3536 print ("Error during OpenAI call:" , str (e ))
3637
@@ -44,6 +45,8 @@ async def main_async():
4445 try :
4546 await basic_async_openai_call (distinct_id , trace_id , properties )
4647 await streaming_async_openai_call (distinct_id , trace_id , properties )
48+ await embedding_async_openai_call ()
49+ await image_async_openai_call ()
4750 except Exception as e :
4851 print ("Error during OpenAI call:" , str (e ))
4952
@@ -134,11 +137,29 @@ async def streaming_async_openai_call(distinct_id, trace_id, properties):
134137 return response
135138
136139
137- def non_instrumented_openai_call ():
140+ # none instrumented
141+ def image_openai_call ():
138142 response = openai_client .images .generate (model = "dall-e-3" , prompt = "A cute baby hedgehog" , n = 1 , size = "1024x1024" )
139143 print (response )
140144 return response
141145
146+ # none instrumented
147+ async def image_async_openai_call ():
148+ response = await async_openai_client .images .generate (model = "dall-e-3" , prompt = "A cute baby hedgehog" , n = 1 , size = "1024x1024" )
149+ print (response )
150+ return response
151+
152+
153+ def embedding_openai_call ():
154+ response = openai_client .embeddings .create (input = "The hedgehog is cute" , model = "text-embedding-3-small" )
155+ print (response )
156+ return response
157+
158+ async def embedding_async_openai_call ():
159+ response = await async_openai_client .embeddings .create (input = "The hedgehog is cute" , model = "text-embedding-3-small" )
160+ print (response )
161+ return response
162+
142163
143164# HOW TO RUN:
144165# comment out one of these to run the other
0 commit comments