openlit 1.33.19__py3-none-any.whl → 1.33.20__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/__helpers.py +7 -7
- openlit/__init__.py +3 -3
- openlit/evals/utils.py +7 -7
- openlit/guard/utils.py +7 -7
- openlit/instrumentation/ag2/ag2.py +24 -24
- openlit/instrumentation/ai21/ai21.py +3 -3
- openlit/instrumentation/ai21/async_ai21.py +3 -3
- openlit/instrumentation/ai21/utils.py +59 -59
- openlit/instrumentation/anthropic/anthropic.py +2 -2
- openlit/instrumentation/anthropic/async_anthropic.py +2 -2
- openlit/instrumentation/anthropic/utils.py +34 -34
- openlit/instrumentation/assemblyai/assemblyai.py +24 -24
- openlit/instrumentation/astra/astra.py +3 -3
- openlit/instrumentation/astra/async_astra.py +3 -3
- openlit/instrumentation/astra/utils.py +39 -39
- openlit/instrumentation/azure_ai_inference/async_azure_ai_inference.py +2 -2
- openlit/instrumentation/azure_ai_inference/azure_ai_inference.py +2 -2
- openlit/instrumentation/azure_ai_inference/utils.py +36 -36
- openlit/instrumentation/bedrock/bedrock.py +2 -2
- openlit/instrumentation/bedrock/utils.py +35 -35
- openlit/instrumentation/chroma/chroma.py +57 -57
- openlit/instrumentation/cohere/async_cohere.py +88 -88
- openlit/instrumentation/cohere/cohere.py +88 -88
- openlit/instrumentation/controlflow/controlflow.py +15 -15
- openlit/instrumentation/crawl4ai/async_crawl4ai.py +14 -14
- openlit/instrumentation/crawl4ai/crawl4ai.py +14 -14
- openlit/instrumentation/crewai/crewai.py +22 -22
- openlit/instrumentation/dynamiq/dynamiq.py +19 -19
- openlit/instrumentation/elevenlabs/async_elevenlabs.py +24 -25
- openlit/instrumentation/elevenlabs/elevenlabs.py +23 -25
- openlit/instrumentation/embedchain/embedchain.py +15 -15
- openlit/instrumentation/firecrawl/firecrawl.py +10 -10
- openlit/instrumentation/google_ai_studio/async_google_ai_studio.py +33 -33
- openlit/instrumentation/google_ai_studio/google_ai_studio.py +33 -33
- openlit/instrumentation/gpt4all/gpt4all.py +78 -78
- openlit/instrumentation/gpu/__init__.py +8 -8
- openlit/instrumentation/groq/async_groq.py +74 -74
- openlit/instrumentation/groq/groq.py +74 -74
- openlit/instrumentation/haystack/haystack.py +6 -6
- openlit/instrumentation/julep/async_julep.py +14 -14
- openlit/instrumentation/julep/julep.py +14 -14
- openlit/instrumentation/langchain/async_langchain.py +39 -39
- openlit/instrumentation/langchain/langchain.py +39 -39
- openlit/instrumentation/letta/letta.py +26 -26
- openlit/instrumentation/litellm/async_litellm.py +94 -94
- openlit/instrumentation/litellm/litellm.py +94 -94
- openlit/instrumentation/llamaindex/llamaindex.py +7 -7
- openlit/instrumentation/mem0/mem0.py +13 -13
- openlit/instrumentation/milvus/milvus.py +47 -47
- openlit/instrumentation/mistral/async_mistral.py +88 -88
- openlit/instrumentation/mistral/mistral.py +88 -88
- openlit/instrumentation/multion/async_multion.py +21 -21
- openlit/instrumentation/multion/multion.py +21 -21
- openlit/instrumentation/ollama/async_ollama.py +3 -3
- openlit/instrumentation/ollama/ollama.py +3 -3
- openlit/instrumentation/ollama/utils.py +50 -50
- openlit/instrumentation/openai/async_openai.py +225 -225
- openlit/instrumentation/openai/openai.py +225 -225
- openlit/instrumentation/openai_agents/openai_agents.py +11 -11
- openlit/instrumentation/phidata/phidata.py +15 -15
- openlit/instrumentation/pinecone/pinecone.py +43 -43
- openlit/instrumentation/premai/premai.py +86 -86
- openlit/instrumentation/qdrant/async_qdrant.py +95 -95
- openlit/instrumentation/qdrant/qdrant.py +99 -99
- openlit/instrumentation/reka/async_reka.py +33 -33
- openlit/instrumentation/reka/reka.py +33 -33
- openlit/instrumentation/together/async_together.py +90 -90
- openlit/instrumentation/together/together.py +90 -90
- openlit/instrumentation/transformers/transformers.py +26 -26
- openlit/instrumentation/vertexai/async_vertexai.py +64 -64
- openlit/instrumentation/vertexai/vertexai.py +64 -64
- openlit/instrumentation/vllm/vllm.py +24 -24
- openlit/otel/metrics.py +11 -11
- openlit/semcov/__init__.py +3 -3
- {openlit-1.33.19.dist-info → openlit-1.33.20.dist-info}/METADATA +8 -8
- openlit-1.33.20.dist-info/RECORD +131 -0
- {openlit-1.33.19.dist-info → openlit-1.33.20.dist-info}/WHEEL +1 -1
- openlit-1.33.19.dist-info/RECORD +0 -131
- {openlit-1.33.19.dist-info → openlit-1.33.20.dist-info}/LICENSE +0 -0
@@ -16,7 +16,7 @@ from openlit.__helpers import (
|
|
16
16
|
calculate_tbt,
|
17
17
|
create_metrics_attributes,
|
18
18
|
)
|
19
|
-
from openlit.semcov import
|
19
|
+
from openlit.semcov import SemanticConvention
|
20
20
|
|
21
21
|
# Initialize logger for logging potential issues and operations
|
22
22
|
logger = logging.getLogger(__name__)
|
@@ -151,51 +151,51 @@ def acompletion(version, environment, application_name,
|
|
151
151
|
|
152
152
|
# Set Span attributes (OTel Semconv)
|
153
153
|
self._span.set_attribute(TELEMETRY_SDK_NAME, 'openlit')
|
154
|
-
self._span.set_attribute(
|
155
|
-
|
156
|
-
self._span.set_attribute(
|
157
|
-
|
158
|
-
self._span.set_attribute(
|
154
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
|
155
|
+
SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT)
|
156
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
|
157
|
+
SemanticConvention.GEN_AI_SYSTEM_LITELLM)
|
158
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
|
159
159
|
request_model)
|
160
|
-
self._span.set_attribute(
|
160
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_SEED,
|
161
161
|
self._kwargs.get('seed', ''))
|
162
|
-
self._span.set_attribute(
|
162
|
+
self._span.set_attribute(SemanticConvention.SERVER_PORT,
|
163
163
|
self._server_port)
|
164
|
-
self._span.set_attribute(
|
164
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_FREQUENCY_PENALTY,
|
165
165
|
self._kwargs.get('frequency_penalty', 0.0))
|
166
|
-
self._span.set_attribute(
|
166
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS,
|
167
167
|
self._kwargs.get('max_tokens', -1))
|
168
|
-
self._span.set_attribute(
|
168
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_PRESENCE_PENALTY,
|
169
169
|
self._kwargs.get('presence_penalty', 0.0))
|
170
|
-
self._span.set_attribute(
|
170
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_STOP_SEQUENCES,
|
171
171
|
self._kwargs.get('stop', []))
|
172
|
-
self._span.set_attribute(
|
172
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE,
|
173
173
|
self._kwargs.get('temperature', 1.0))
|
174
|
-
self._span.set_attribute(
|
174
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TOP_P,
|
175
175
|
self._kwargs.get('top_p', 1.0))
|
176
|
-
self._span.set_attribute(
|
176
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON,
|
177
177
|
[self._finish_reason])
|
178
|
-
self._span.set_attribute(
|
178
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_ID,
|
179
179
|
self._response_id)
|
180
|
-
self._span.set_attribute(
|
180
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
|
181
181
|
self._response_model)
|
182
|
-
self._span.set_attribute(
|
182
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS,
|
183
183
|
input_tokens)
|
184
|
-
self._span.set_attribute(
|
184
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS,
|
185
185
|
output_tokens)
|
186
|
-
self._span.set_attribute(
|
186
|
+
self._span.set_attribute(SemanticConvention.SERVER_ADDRESS,
|
187
187
|
self._server_address)
|
188
|
-
self._span.set_attribute(
|
188
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_SERVICE_TIER,
|
189
189
|
self._kwargs.get('service_tier', 'auto'))
|
190
|
-
self._span.set_attribute(
|
190
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_SERVICE_TIER,
|
191
191
|
self._response_service_tier)
|
192
|
-
self._span.set_attribute(
|
192
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_SYSTEM_FINGERPRINT,
|
193
193
|
self._response_service_tier)
|
194
194
|
if isinstance(self._llmresponse, str):
|
195
|
-
self._span.set_attribute(
|
195
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
|
196
196
|
'text')
|
197
197
|
else:
|
198
|
-
self._span.set_attribute(
|
198
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
|
199
199
|
'json')
|
200
200
|
|
201
201
|
# Set Span attributes (Extra)
|
@@ -203,31 +203,31 @@ def acompletion(version, environment, application_name,
|
|
203
203
|
environment)
|
204
204
|
self._span.set_attribute(SERVICE_NAME,
|
205
205
|
application_name)
|
206
|
-
self._span.set_attribute(
|
206
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_USER,
|
207
207
|
self._kwargs.get('user', ''))
|
208
|
-
self._span.set_attribute(
|
208
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM,
|
209
209
|
True)
|
210
|
-
self._span.set_attribute(
|
210
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS,
|
211
211
|
input_tokens + output_tokens)
|
212
|
-
self._span.set_attribute(
|
212
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
|
213
213
|
cost)
|
214
|
-
self._span.set_attribute(
|
214
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_SERVER_TBT,
|
215
215
|
self._tbt)
|
216
|
-
self._span.set_attribute(
|
216
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_SERVER_TTFT,
|
217
217
|
self._ttft)
|
218
|
-
self._span.set_attribute(
|
218
|
+
self._span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION,
|
219
219
|
version)
|
220
220
|
if capture_message_content:
|
221
221
|
self._span.add_event(
|
222
|
-
name=
|
222
|
+
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
|
223
223
|
attributes={
|
224
|
-
|
224
|
+
SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
|
225
225
|
},
|
226
226
|
)
|
227
227
|
self._span.add_event(
|
228
|
-
name=
|
228
|
+
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
|
229
229
|
attributes={
|
230
|
-
|
230
|
+
SemanticConvention.GEN_AI_CONTENT_COMPLETION: self._llmresponse,
|
231
231
|
},
|
232
232
|
)
|
233
233
|
self._span.set_status(Status(StatusCode.OK))
|
@@ -236,8 +236,8 @@ def acompletion(version, environment, application_name,
|
|
236
236
|
attributes = create_metrics_attributes(
|
237
237
|
service_name=application_name,
|
238
238
|
deployment_environment=environment,
|
239
|
-
operation=
|
240
|
-
system=
|
239
|
+
operation=SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT,
|
240
|
+
system=SemanticConvention.GEN_AI_SYSTEM_LITELLM,
|
241
241
|
request_model=request_model,
|
242
242
|
server_address=self._server_address,
|
243
243
|
server_port=self._server_port,
|
@@ -290,7 +290,7 @@ def acompletion(version, environment, application_name,
|
|
290
290
|
server_address, server_port = 'NOT_FOUND', 'NOT_FOUND'
|
291
291
|
request_model = kwargs.get('model', 'openai/gpt-4o')
|
292
292
|
|
293
|
-
span_name = f'{
|
293
|
+
span_name = f'{SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT} {request_model}'
|
294
294
|
|
295
295
|
# pylint: disable=no-else-return
|
296
296
|
if streaming:
|
@@ -339,41 +339,41 @@ def acompletion(version, environment, application_name,
|
|
339
339
|
|
340
340
|
# Set base span attribues (OTel Semconv)
|
341
341
|
span.set_attribute(TELEMETRY_SDK_NAME, 'openlit')
|
342
|
-
span.set_attribute(
|
343
|
-
|
344
|
-
span.set_attribute(
|
345
|
-
|
346
|
-
span.set_attribute(
|
342
|
+
span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
|
343
|
+
SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT)
|
344
|
+
span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
|
345
|
+
SemanticConvention.GEN_AI_SYSTEM_LITELLM)
|
346
|
+
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
|
347
347
|
request_model)
|
348
|
-
span.set_attribute(
|
348
|
+
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_SEED,
|
349
349
|
kwargs.get('seed', ''))
|
350
|
-
span.set_attribute(
|
350
|
+
span.set_attribute(SemanticConvention.SERVER_PORT,
|
351
351
|
server_port)
|
352
|
-
span.set_attribute(
|
352
|
+
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_FREQUENCY_PENALTY,
|
353
353
|
kwargs.get('frequency_penalty', 0.0))
|
354
|
-
span.set_attribute(
|
354
|
+
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS,
|
355
355
|
kwargs.get('max_tokens', -1))
|
356
|
-
span.set_attribute(
|
356
|
+
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_PRESENCE_PENALTY,
|
357
357
|
kwargs.get('presence_penalty', 0.0))
|
358
|
-
span.set_attribute(
|
358
|
+
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_STOP_SEQUENCES,
|
359
359
|
kwargs.get('stop', []))
|
360
|
-
span.set_attribute(
|
360
|
+
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE,
|
361
361
|
kwargs.get('temperature', 1.0))
|
362
|
-
span.set_attribute(
|
362
|
+
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TOP_P,
|
363
363
|
kwargs.get('top_p', 1.0))
|
364
|
-
span.set_attribute(
|
364
|
+
span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_ID,
|
365
365
|
response_dict.get('id'))
|
366
|
-
span.set_attribute(
|
366
|
+
span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
|
367
367
|
response_dict.get('model'))
|
368
|
-
span.set_attribute(
|
368
|
+
span.set_attribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS,
|
369
369
|
input_tokens)
|
370
|
-
span.set_attribute(
|
370
|
+
span.set_attribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS,
|
371
371
|
output_tokens)
|
372
|
-
span.set_attribute(
|
372
|
+
span.set_attribute(SemanticConvention.SERVER_ADDRESS,
|
373
373
|
server_address)
|
374
|
-
span.set_attribute(
|
374
|
+
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_SERVICE_TIER,
|
375
375
|
kwargs.get('service_tier', 'auto'))
|
376
|
-
span.set_attribute(
|
376
|
+
span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_SYSTEM_FINGERPRINT,
|
377
377
|
str(response_dict.get('system_fingerprint')))
|
378
378
|
|
379
379
|
# Set base span attribues (Extras)
|
@@ -381,46 +381,46 @@ def acompletion(version, environment, application_name,
|
|
381
381
|
environment)
|
382
382
|
span.set_attribute(SERVICE_NAME,
|
383
383
|
application_name)
|
384
|
-
span.set_attribute(
|
384
|
+
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_USER,
|
385
385
|
kwargs.get('user', ''))
|
386
|
-
span.set_attribute(
|
386
|
+
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM,
|
387
387
|
False)
|
388
|
-
span.set_attribute(
|
388
|
+
span.set_attribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS,
|
389
389
|
input_tokens + output_tokens)
|
390
|
-
span.set_attribute(
|
390
|
+
span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
|
391
391
|
cost)
|
392
|
-
span.set_attribute(
|
392
|
+
span.set_attribute(SemanticConvention.GEN_AI_SERVER_TTFT,
|
393
393
|
end_time - start_time)
|
394
|
-
span.set_attribute(
|
394
|
+
span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION,
|
395
395
|
version)
|
396
396
|
if capture_message_content:
|
397
397
|
span.add_event(
|
398
|
-
name=
|
398
|
+
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
|
399
399
|
attributes={
|
400
|
-
|
400
|
+
SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
|
401
401
|
},
|
402
402
|
)
|
403
403
|
|
404
404
|
for i in range(kwargs.get('n',1)):
|
405
|
-
span.set_attribute(
|
405
|
+
span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON,
|
406
406
|
[response_dict.get('choices')[i].get('finish_reason')])
|
407
407
|
if capture_message_content:
|
408
408
|
span.add_event(
|
409
|
-
name=
|
409
|
+
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
|
410
410
|
attributes={
|
411
411
|
# pylint: disable=line-too-long
|
412
|
-
|
412
|
+
SemanticConvention.GEN_AI_CONTENT_COMPLETION: str(response_dict.get('choices')[i].get('message').get('content')),
|
413
413
|
},
|
414
414
|
)
|
415
415
|
if kwargs.get('tools'):
|
416
|
-
span.set_attribute(
|
416
|
+
span.set_attribute(SemanticConvention.GEN_AI_TOOL_CALLS,
|
417
417
|
str(response_dict.get('choices')[i].get('message').get('tool_calls')))
|
418
418
|
|
419
419
|
if isinstance(response_dict.get('choices')[i].get('message').get('content'), str):
|
420
|
-
span.set_attribute(
|
420
|
+
span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
|
421
421
|
'text')
|
422
422
|
elif response_dict.get('choices')[i].get('message').get('content') is not None:
|
423
|
-
span.set_attribute(
|
423
|
+
span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
|
424
424
|
'json')
|
425
425
|
|
426
426
|
span.set_status(Status(StatusCode.OK))
|
@@ -429,8 +429,8 @@ def acompletion(version, environment, application_name,
|
|
429
429
|
attributes = create_metrics_attributes(
|
430
430
|
service_name=application_name,
|
431
431
|
deployment_environment=environment,
|
432
|
-
operation=
|
433
|
-
system=
|
432
|
+
operation=SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT,
|
433
|
+
system=SemanticConvention.GEN_AI_SYSTEM_LITELLM,
|
434
434
|
request_model=request_model,
|
435
435
|
server_address=server_address,
|
436
436
|
server_port=server_port,
|
@@ -500,7 +500,7 @@ def aembedding(version, environment, application_name,
|
|
500
500
|
server_address, server_port = 'NOT_FOUND', 'NOT_FOUND'
|
501
501
|
request_model = kwargs.get('model', 'text-embedding-ada-002')
|
502
502
|
|
503
|
-
span_name = f'{
|
503
|
+
span_name = f'{SemanticConvention.GEN_AI_OPERATION_TYPE_EMBEDDING} {request_model}'
|
504
504
|
|
505
505
|
with tracer.start_as_current_span(span_name, kind= SpanKind.CLIENT) as span:
|
506
506
|
start_time = time.time()
|
@@ -517,21 +517,21 @@ def aembedding(version, environment, application_name,
|
|
517
517
|
|
518
518
|
# Set Span attributes (OTel Semconv)
|
519
519
|
span.set_attribute(TELEMETRY_SDK_NAME, 'openlit')
|
520
|
-
span.set_attribute(
|
521
|
-
|
522
|
-
span.set_attribute(
|
523
|
-
|
524
|
-
span.set_attribute(
|
520
|
+
span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
|
521
|
+
SemanticConvention.GEN_AI_OPERATION_TYPE_EMBEDDING)
|
522
|
+
span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
|
523
|
+
SemanticConvention.GEN_AI_SYSTEM_LITELLM)
|
524
|
+
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
|
525
525
|
request_model)
|
526
|
-
span.set_attribute(
|
526
|
+
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_ENCODING_FORMATS,
|
527
527
|
[kwargs.get('encoding_format', 'float')])
|
528
|
-
span.set_attribute(
|
528
|
+
span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
|
529
529
|
response_dict.get('model'))
|
530
|
-
span.set_attribute(
|
530
|
+
span.set_attribute(SemanticConvention.SERVER_ADDRESS,
|
531
531
|
server_address)
|
532
|
-
span.set_attribute(
|
532
|
+
span.set_attribute(SemanticConvention.SERVER_PORT,
|
533
533
|
server_port)
|
534
|
-
span.set_attribute(
|
534
|
+
span.set_attribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS,
|
535
535
|
input_tokens)
|
536
536
|
|
537
537
|
# Set Span attributes (Extras)
|
@@ -539,20 +539,20 @@ def aembedding(version, environment, application_name,
|
|
539
539
|
environment)
|
540
540
|
span.set_attribute(SERVICE_NAME,
|
541
541
|
application_name)
|
542
|
-
span.set_attribute(
|
542
|
+
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_USER,
|
543
543
|
kwargs.get('user', ''))
|
544
|
-
span.set_attribute(
|
544
|
+
span.set_attribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS,
|
545
545
|
input_tokens)
|
546
|
-
span.set_attribute(
|
546
|
+
span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
|
547
547
|
cost)
|
548
|
-
span.set_attribute(
|
548
|
+
span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION,
|
549
549
|
version)
|
550
550
|
|
551
551
|
if capture_message_content:
|
552
552
|
span.add_event(
|
553
|
-
name=
|
553
|
+
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
|
554
554
|
attributes={
|
555
|
-
|
555
|
+
SemanticConvention.GEN_AI_CONTENT_PROMPT: str(kwargs.get('input', '')),
|
556
556
|
},
|
557
557
|
)
|
558
558
|
|
@@ -562,8 +562,8 @@ def aembedding(version, environment, application_name,
|
|
562
562
|
attributes = create_metrics_attributes(
|
563
563
|
service_name=application_name,
|
564
564
|
deployment_environment=environment,
|
565
|
-
operation=
|
566
|
-
system=
|
565
|
+
operation=SemanticConvention.GEN_AI_OPERATION_TYPE_EMBEDDING,
|
566
|
+
system=SemanticConvention.GEN_AI_SYSTEM_LITELLM,
|
567
567
|
request_model=request_model,
|
568
568
|
server_address=server_address,
|
569
569
|
server_port=server_port,
|