openlit 1.16.0__py3-none-any.whl → 1.17.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openlit/instrumentation/anthropic/anthropic.py +30 -12
- openlit/instrumentation/anthropic/async_anthropic.py +29 -12
- openlit/instrumentation/bedrock/__init__.py +3 -3
- openlit/instrumentation/bedrock/bedrock.py +77 -307
- openlit/instrumentation/cohere/cohere.py +35 -14
- openlit/instrumentation/elevenlabs/async_elevenlabs.py +6 -2
- openlit/instrumentation/elevenlabs/elevenlabs.py +6 -2
- openlit/instrumentation/gpt4all/gpt4all.py +30 -10
- openlit/instrumentation/groq/async_groq.py +41 -21
- openlit/instrumentation/groq/groq.py +41 -21
- openlit/instrumentation/mistral/async_mistral.py +37 -16
- openlit/instrumentation/mistral/mistral.py +37 -16
- openlit/instrumentation/ollama/async_ollama.py +57 -20
- openlit/instrumentation/ollama/ollama.py +57 -20
- openlit/instrumentation/openai/async_azure_openai.py +106 -47
- openlit/instrumentation/openai/async_openai.py +78 -37
- openlit/instrumentation/openai/azure_openai.py +101 -43
- openlit/instrumentation/openai/openai.py +78 -39
- openlit/instrumentation/transformers/transformers.py +21 -17
- openlit/instrumentation/vertexai/async_vertexai.py +104 -35
- openlit/instrumentation/vertexai/vertexai.py +104 -35
- openlit/semcov/__init__.py +6 -4
- {openlit-1.16.0.dist-info → openlit-1.17.0.dist-info}/METADATA +2 -2
- {openlit-1.16.0.dist-info → openlit-1.17.0.dist-info}/RECORD +26 -26
- {openlit-1.16.0.dist-info → openlit-1.17.0.dist-info}/LICENSE +0 -0
- {openlit-1.16.0.dist-info → openlit-1.17.0.dist-info}/WHEEL +0 -0
@@ -123,15 +123,15 @@ def chat_completions(gen_ai_endpoint, version, environment, application_name,
|
|
123
123
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_USER,
|
124
124
|
kwargs.get("user", ""))
|
125
125
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
|
126
|
-
kwargs.get("top_p", 1))
|
126
|
+
kwargs.get("top_p", 1.0))
|
127
127
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
|
128
|
-
kwargs.get("max_tokens",
|
128
|
+
kwargs.get("max_tokens", -1))
|
129
129
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
|
130
|
-
kwargs.get("temperature", 1))
|
130
|
+
kwargs.get("temperature", 1.0))
|
131
131
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_PRESENCE_PENALTY,
|
132
|
-
kwargs.get("presence_penalty", 0))
|
132
|
+
kwargs.get("presence_penalty", 0.0))
|
133
133
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY,
|
134
|
-
kwargs.get("frequency_penalty", 0))
|
134
|
+
kwargs.get("frequency_penalty", 0.0))
|
135
135
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_SEED,
|
136
136
|
kwargs.get("seed", ""))
|
137
137
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
|
@@ -145,10 +145,18 @@ def chat_completions(gen_ai_endpoint, version, environment, application_name,
|
|
145
145
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
146
146
|
cost)
|
147
147
|
if trace_content:
|
148
|
-
span.
|
149
|
-
|
150
|
-
|
151
|
-
|
148
|
+
span.add_event(
|
149
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
150
|
+
attributes={
|
151
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
|
152
|
+
},
|
153
|
+
)
|
154
|
+
span.add_event(
|
155
|
+
name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
|
156
|
+
attributes={
|
157
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: llmresponse,
|
158
|
+
},
|
159
|
+
)
|
152
160
|
|
153
161
|
span.set_status(Status(StatusCode.OK))
|
154
162
|
|
@@ -225,24 +233,28 @@ def chat_completions(gen_ai_endpoint, version, environment, application_name,
|
|
225
233
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
|
226
234
|
kwargs.get("model", "gpt-3.5-turbo"))
|
227
235
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
|
228
|
-
kwargs.get("top_p", 1))
|
236
|
+
kwargs.get("top_p", 1.0))
|
229
237
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
|
230
|
-
kwargs.get("max_tokens",
|
238
|
+
kwargs.get("max_tokens", -1))
|
231
239
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_USER,
|
232
240
|
kwargs.get("user", ""))
|
233
241
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
|
234
|
-
kwargs.get("temperature", 1))
|
242
|
+
kwargs.get("temperature", 1.0))
|
235
243
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_PRESENCE_PENALTY,
|
236
|
-
kwargs.get("presence_penalty", 0))
|
244
|
+
kwargs.get("presence_penalty", 0.0))
|
237
245
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY,
|
238
|
-
kwargs.get("frequency_penalty", 0))
|
246
|
+
kwargs.get("frequency_penalty", 0.0))
|
239
247
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_SEED,
|
240
248
|
kwargs.get("seed", ""))
|
241
249
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
|
242
250
|
False)
|
243
251
|
if trace_content:
|
244
|
-
span.
|
245
|
-
|
252
|
+
span.add_event(
|
253
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
254
|
+
attributes={
|
255
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
|
256
|
+
},
|
257
|
+
)
|
246
258
|
|
247
259
|
# Set span attributes when tools is not passed to the function call
|
248
260
|
if "tools" not in kwargs:
|
@@ -258,23 +270,31 @@ def chat_completions(gen_ai_endpoint, version, environment, application_name,
|
|
258
270
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
|
259
271
|
response.usage.total_tokens)
|
260
272
|
span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
|
261
|
-
response.choices[0].finish_reason)
|
273
|
+
[response.choices[0].finish_reason])
|
262
274
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
263
275
|
cost)
|
264
276
|
|
265
277
|
# Set span attributes for when n = 1 (default)
|
266
278
|
if "n" not in kwargs or kwargs["n"] == 1:
|
267
279
|
if trace_content:
|
268
|
-
span.
|
269
|
-
|
280
|
+
span.add_event(
|
281
|
+
name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
|
282
|
+
attributes={
|
283
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: response.choices[0].message.content,
|
284
|
+
},
|
285
|
+
)
|
270
286
|
|
271
287
|
# Set span attributes for when n > 0
|
272
288
|
else:
|
273
289
|
i = 0
|
274
290
|
while i < kwargs["n"] and trace_content is True:
|
275
|
-
attribute_name = f"gen_ai.completion.{i}"
|
276
|
-
span.
|
277
|
-
|
291
|
+
attribute_name = f"gen_ai.content.completion.{i}"
|
292
|
+
span.add_event(
|
293
|
+
name=attribute_name,
|
294
|
+
attributes={
|
295
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: response.choices[i].message.content,
|
296
|
+
},
|
297
|
+
)
|
278
298
|
i += 1
|
279
299
|
|
280
300
|
# Return original response
|
@@ -286,9 +306,12 @@ def chat_completions(gen_ai_endpoint, version, environment, application_name,
|
|
286
306
|
cost = get_chat_model_cost(kwargs.get("model", "gpt-3.5-turbo"),
|
287
307
|
pricing_info, response.usage.prompt_tokens,
|
288
308
|
response.usage.completion_tokens)
|
289
|
-
|
290
|
-
|
291
|
-
|
309
|
+
span.add_event(
|
310
|
+
name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
|
311
|
+
attributes={
|
312
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: "Function called with tools",
|
313
|
+
},
|
314
|
+
)
|
292
315
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
|
293
316
|
response.usage.prompt_tokens)
|
294
317
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COMPLETION_TOKENS,
|
@@ -404,8 +427,12 @@ def embedding(gen_ai_endpoint, version, environment, application_name,
|
|
404
427
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
405
428
|
cost)
|
406
429
|
if trace_content:
|
407
|
-
span.
|
408
|
-
|
430
|
+
span.add_event(
|
431
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
432
|
+
attributes={
|
433
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: kwargs.get("input", ""),
|
434
|
+
},
|
435
|
+
)
|
409
436
|
|
410
437
|
span.set_status(Status(StatusCode.OK))
|
411
438
|
|
@@ -626,12 +653,19 @@ def image_generate(gen_ai_endpoint, version, environment, application_name,
|
|
626
653
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_USER,
|
627
654
|
kwargs.get("user", ""))
|
628
655
|
if trace_content:
|
629
|
-
span.
|
630
|
-
|
631
|
-
|
656
|
+
span.add_event(
|
657
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
658
|
+
attributes={
|
659
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: kwargs.get("prompt", ""),
|
660
|
+
},
|
661
|
+
)
|
632
662
|
attribute_name = f"gen_ai.response.image.{images_count}"
|
633
|
-
span.
|
634
|
-
|
663
|
+
span.add_event(
|
664
|
+
name=attribute_name,
|
665
|
+
attributes={
|
666
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: getattr(items, image),
|
667
|
+
},
|
668
|
+
)
|
635
669
|
|
636
670
|
images_count+=1
|
637
671
|
|
@@ -744,12 +778,13 @@ def image_variatons(gen_ai_endpoint, version, environment, application_name,
|
|
744
778
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_QUALITY,
|
745
779
|
"standard")
|
746
780
|
if trace_content:
|
747
|
-
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_PROMPT,
|
748
|
-
kwargs.get(SemanticConvetion.GEN_AI_TYPE_IMAGE, ""))
|
749
|
-
|
750
781
|
attribute_name = f"gen_ai.response.image.{images_count}"
|
751
|
-
span.
|
752
|
-
|
782
|
+
span.add_event(
|
783
|
+
name=attribute_name,
|
784
|
+
attributes={
|
785
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: getattr(items, image),
|
786
|
+
},
|
787
|
+
)
|
753
788
|
|
754
789
|
images_count+=1
|
755
790
|
|
@@ -854,8 +889,12 @@ def audio_create(gen_ai_endpoint, version, environment, application_name,
|
|
854
889
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
855
890
|
cost)
|
856
891
|
if trace_content:
|
857
|
-
span.
|
858
|
-
|
892
|
+
span.add_event(
|
893
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
894
|
+
attributes={
|
895
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: kwargs.get("input", ""),
|
896
|
+
},
|
897
|
+
)
|
859
898
|
|
860
899
|
span.set_status(Status(StatusCode.OK))
|
861
900
|
|
@@ -87,30 +87,34 @@ def text_wrap(gen_ai_endpoint, version, environment, application_name,
|
|
87
87
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
|
88
88
|
forward_params.get("top_p", "null"))
|
89
89
|
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
|
90
|
-
forward_params.get("max_length",
|
91
|
-
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_PROMPT,
|
92
|
-
prompt)
|
90
|
+
forward_params.get("max_length", -1))
|
93
91
|
if trace_content:
|
94
|
-
span.
|
95
|
-
|
92
|
+
span.add_event(
|
93
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
94
|
+
attributes={
|
95
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
|
96
|
+
},
|
97
|
+
)
|
98
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
|
99
|
+
prompt_tokens)
|
96
100
|
|
97
101
|
i = 0
|
98
102
|
completion_tokens = 0
|
99
103
|
for completion in response:
|
100
104
|
if len(response) > 1:
|
101
|
-
attribute_name = f"gen_ai.completion.{i}"
|
105
|
+
attribute_name = f"gen_ai.content.completion.{i}"
|
102
106
|
else:
|
103
|
-
attribute_name = SemanticConvetion.
|
104
|
-
if
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
107
|
+
attribute_name = SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT
|
108
|
+
if trace_content:
|
109
|
+
span.add_event(
|
110
|
+
name=attribute_name,
|
111
|
+
attributes={
|
112
|
+
# pylint: disable=line-too-long
|
113
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: completion["generated_text"],
|
114
|
+
},
|
115
|
+
)
|
116
|
+
completion_tokens += general_tokens(completion["generated_text"])
|
117
|
+
|
114
118
|
i=i+1
|
115
119
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COMPLETION_TOKENS,
|
116
120
|
completion_tokens)
|
@@ -103,10 +103,18 @@ def generate_content_async(gen_ai_endpoint, version, environment, application_na
|
|
103
103
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
104
104
|
cost)
|
105
105
|
if trace_content:
|
106
|
-
span.
|
107
|
-
|
108
|
-
|
109
|
-
|
106
|
+
span.add_event(
|
107
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
108
|
+
attributes={
|
109
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
|
110
|
+
},
|
111
|
+
)
|
112
|
+
span.add_event(
|
113
|
+
name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
|
114
|
+
attributes={
|
115
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: llmresponse,
|
116
|
+
},
|
117
|
+
)
|
110
118
|
|
111
119
|
span.set_status(Status(StatusCode.OK))
|
112
120
|
|
@@ -181,10 +189,19 @@ def generate_content_async(gen_ai_endpoint, version, environment, application_na
|
|
181
189
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
182
190
|
cost)
|
183
191
|
if trace_content:
|
184
|
-
span.
|
185
|
-
|
186
|
-
|
187
|
-
|
192
|
+
span.add_event(
|
193
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
194
|
+
attributes={
|
195
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
|
196
|
+
},
|
197
|
+
)
|
198
|
+
span.add_event(
|
199
|
+
name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
|
200
|
+
attributes={
|
201
|
+
# pylint: disable=line-too-long
|
202
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: response.candidates[0].content.parts[0].text,
|
203
|
+
},
|
204
|
+
)
|
188
205
|
|
189
206
|
span.set_status(Status(StatusCode.OK))
|
190
207
|
|
@@ -316,10 +333,18 @@ def send_message_async(gen_ai_endpoint, version, environment, application_name,
|
|
316
333
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
317
334
|
cost)
|
318
335
|
if trace_content:
|
319
|
-
span.
|
320
|
-
|
321
|
-
|
322
|
-
|
336
|
+
span.add_event(
|
337
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
338
|
+
attributes={
|
339
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
|
340
|
+
},
|
341
|
+
)
|
342
|
+
span.add_event(
|
343
|
+
name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
|
344
|
+
attributes={
|
345
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: llmresponse,
|
346
|
+
},
|
347
|
+
)
|
323
348
|
|
324
349
|
span.set_status(Status(StatusCode.OK))
|
325
350
|
|
@@ -394,11 +419,19 @@ def send_message_async(gen_ai_endpoint, version, environment, application_name,
|
|
394
419
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
395
420
|
cost)
|
396
421
|
if trace_content:
|
397
|
-
span.
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
422
|
+
span.add_event(
|
423
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
424
|
+
attributes={
|
425
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
|
426
|
+
},
|
427
|
+
)
|
428
|
+
span.add_event(
|
429
|
+
name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
|
430
|
+
attributes={
|
431
|
+
# pylint: disable=line-too-long
|
432
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: response.candidates[0].content.parts[0].text,
|
433
|
+
},
|
434
|
+
)
|
402
435
|
|
403
436
|
span.set_status(Status(StatusCode.OK))
|
404
437
|
|
@@ -516,10 +549,18 @@ def predict_async(gen_ai_endpoint, version, environment, application_name, trace
|
|
516
549
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
517
550
|
cost)
|
518
551
|
if trace_content:
|
519
|
-
span.
|
520
|
-
|
521
|
-
|
522
|
-
|
552
|
+
span.add_event(
|
553
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
554
|
+
attributes={
|
555
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
|
556
|
+
},
|
557
|
+
)
|
558
|
+
span.add_event(
|
559
|
+
name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
|
560
|
+
attributes={
|
561
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: response.text,
|
562
|
+
},
|
563
|
+
)
|
523
564
|
|
524
565
|
span.set_status(Status(StatusCode.OK))
|
525
566
|
|
@@ -648,10 +689,18 @@ def predict_streaming_async(gen_ai_endpoint, version, environment, application_n
|
|
648
689
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
649
690
|
cost)
|
650
691
|
if trace_content:
|
651
|
-
span.
|
652
|
-
|
653
|
-
|
654
|
-
|
692
|
+
span.add_event(
|
693
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
694
|
+
attributes={
|
695
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
|
696
|
+
},
|
697
|
+
)
|
698
|
+
span.add_event(
|
699
|
+
name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
|
700
|
+
attributes={
|
701
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: llmresponse,
|
702
|
+
},
|
703
|
+
)
|
655
704
|
|
656
705
|
span.set_status(Status(StatusCode.OK))
|
657
706
|
|
@@ -765,10 +814,18 @@ def start_chat_async(gen_ai_endpoint, version, environment, application_name, tr
|
|
765
814
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
766
815
|
cost)
|
767
816
|
if trace_content:
|
768
|
-
span.
|
769
|
-
|
770
|
-
|
771
|
-
|
817
|
+
span.add_event(
|
818
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
819
|
+
attributes={
|
820
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
|
821
|
+
},
|
822
|
+
)
|
823
|
+
span.add_event(
|
824
|
+
name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
|
825
|
+
attributes={
|
826
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: response.text,
|
827
|
+
},
|
828
|
+
)
|
772
829
|
|
773
830
|
span.set_status(Status(StatusCode.OK))
|
774
831
|
|
@@ -895,10 +952,18 @@ def start_chat_streaming_async(gen_ai_endpoint, version, environment, applicatio
|
|
895
952
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
896
953
|
cost)
|
897
954
|
if trace_content:
|
898
|
-
span.
|
899
|
-
|
900
|
-
|
901
|
-
|
955
|
+
span.add_event(
|
956
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
957
|
+
attributes={
|
958
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
|
959
|
+
},
|
960
|
+
)
|
961
|
+
span.add_event(
|
962
|
+
name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
|
963
|
+
attributes={
|
964
|
+
SemanticConvetion.GEN_AI_CONTENT_COMPLETION: llmresponse,
|
965
|
+
},
|
966
|
+
)
|
902
967
|
|
903
968
|
span.set_status(Status(StatusCode.OK))
|
904
969
|
|
@@ -1006,8 +1071,12 @@ def embeddings_async(gen_ai_endpoint, version, environment, application_name, tr
|
|
1006
1071
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
1007
1072
|
cost)
|
1008
1073
|
if trace_content:
|
1009
|
-
span.
|
1010
|
-
|
1074
|
+
span.add_event(
|
1075
|
+
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
1076
|
+
attributes={
|
1077
|
+
SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
|
1078
|
+
},
|
1079
|
+
)
|
1011
1080
|
|
1012
1081
|
span.set_status(Status(StatusCode.OK))
|
1013
1082
|
|