openlit 1.33.18__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.
Files changed (80) hide show
  1. openlit/__helpers.py +11 -41
  2. openlit/__init__.py +3 -3
  3. openlit/evals/utils.py +7 -7
  4. openlit/guard/utils.py +7 -7
  5. openlit/instrumentation/ag2/ag2.py +24 -24
  6. openlit/instrumentation/ai21/ai21.py +3 -3
  7. openlit/instrumentation/ai21/async_ai21.py +3 -3
  8. openlit/instrumentation/ai21/utils.py +59 -59
  9. openlit/instrumentation/anthropic/anthropic.py +2 -2
  10. openlit/instrumentation/anthropic/async_anthropic.py +2 -2
  11. openlit/instrumentation/anthropic/utils.py +34 -34
  12. openlit/instrumentation/assemblyai/assemblyai.py +24 -24
  13. openlit/instrumentation/astra/astra.py +3 -3
  14. openlit/instrumentation/astra/async_astra.py +3 -3
  15. openlit/instrumentation/astra/utils.py +39 -39
  16. openlit/instrumentation/azure_ai_inference/async_azure_ai_inference.py +10 -10
  17. openlit/instrumentation/azure_ai_inference/azure_ai_inference.py +10 -10
  18. openlit/instrumentation/azure_ai_inference/utils.py +38 -38
  19. openlit/instrumentation/bedrock/__init__.py +2 -1
  20. openlit/instrumentation/bedrock/bedrock.py +32 -214
  21. openlit/instrumentation/bedrock/utils.py +252 -0
  22. openlit/instrumentation/chroma/chroma.py +57 -57
  23. openlit/instrumentation/cohere/async_cohere.py +88 -88
  24. openlit/instrumentation/cohere/cohere.py +88 -88
  25. openlit/instrumentation/controlflow/controlflow.py +15 -15
  26. openlit/instrumentation/crawl4ai/async_crawl4ai.py +14 -14
  27. openlit/instrumentation/crawl4ai/crawl4ai.py +14 -14
  28. openlit/instrumentation/crewai/crewai.py +22 -22
  29. openlit/instrumentation/dynamiq/dynamiq.py +19 -19
  30. openlit/instrumentation/elevenlabs/async_elevenlabs.py +24 -25
  31. openlit/instrumentation/elevenlabs/elevenlabs.py +23 -25
  32. openlit/instrumentation/embedchain/embedchain.py +15 -15
  33. openlit/instrumentation/firecrawl/firecrawl.py +10 -10
  34. openlit/instrumentation/google_ai_studio/async_google_ai_studio.py +33 -33
  35. openlit/instrumentation/google_ai_studio/google_ai_studio.py +33 -33
  36. openlit/instrumentation/gpt4all/gpt4all.py +78 -78
  37. openlit/instrumentation/gpu/__init__.py +8 -8
  38. openlit/instrumentation/groq/async_groq.py +74 -74
  39. openlit/instrumentation/groq/groq.py +74 -74
  40. openlit/instrumentation/haystack/haystack.py +6 -6
  41. openlit/instrumentation/julep/async_julep.py +14 -14
  42. openlit/instrumentation/julep/julep.py +14 -14
  43. openlit/instrumentation/langchain/async_langchain.py +39 -39
  44. openlit/instrumentation/langchain/langchain.py +39 -39
  45. openlit/instrumentation/letta/letta.py +26 -26
  46. openlit/instrumentation/litellm/async_litellm.py +94 -94
  47. openlit/instrumentation/litellm/litellm.py +94 -94
  48. openlit/instrumentation/llamaindex/llamaindex.py +7 -7
  49. openlit/instrumentation/mem0/mem0.py +13 -13
  50. openlit/instrumentation/milvus/milvus.py +47 -47
  51. openlit/instrumentation/mistral/async_mistral.py +88 -88
  52. openlit/instrumentation/mistral/mistral.py +88 -88
  53. openlit/instrumentation/multion/async_multion.py +21 -21
  54. openlit/instrumentation/multion/multion.py +21 -21
  55. openlit/instrumentation/ollama/async_ollama.py +3 -3
  56. openlit/instrumentation/ollama/ollama.py +3 -3
  57. openlit/instrumentation/ollama/utils.py +50 -50
  58. openlit/instrumentation/openai/async_openai.py +225 -225
  59. openlit/instrumentation/openai/openai.py +225 -225
  60. openlit/instrumentation/openai_agents/openai_agents.py +11 -11
  61. openlit/instrumentation/phidata/phidata.py +15 -15
  62. openlit/instrumentation/pinecone/pinecone.py +43 -43
  63. openlit/instrumentation/premai/premai.py +86 -86
  64. openlit/instrumentation/qdrant/async_qdrant.py +95 -95
  65. openlit/instrumentation/qdrant/qdrant.py +99 -99
  66. openlit/instrumentation/reka/async_reka.py +33 -33
  67. openlit/instrumentation/reka/reka.py +33 -33
  68. openlit/instrumentation/together/async_together.py +90 -90
  69. openlit/instrumentation/together/together.py +90 -90
  70. openlit/instrumentation/transformers/transformers.py +26 -26
  71. openlit/instrumentation/vertexai/async_vertexai.py +64 -64
  72. openlit/instrumentation/vertexai/vertexai.py +64 -64
  73. openlit/instrumentation/vllm/vllm.py +24 -24
  74. openlit/otel/metrics.py +11 -11
  75. openlit/semcov/__init__.py +3 -3
  76. {openlit-1.33.18.dist-info → openlit-1.33.20.dist-info}/METADATA +8 -8
  77. openlit-1.33.20.dist-info/RECORD +131 -0
  78. {openlit-1.33.18.dist-info → openlit-1.33.20.dist-info}/WHEEL +1 -1
  79. openlit-1.33.18.dist-info/RECORD +0 -130
  80. {openlit-1.33.18.dist-info → openlit-1.33.20.dist-info}/LICENSE +0 -0
@@ -16,7 +16,7 @@ from openlit.__helpers import (
16
16
  create_metrics_attributes,
17
17
  set_server_address_and_port
18
18
  )
19
- from openlit.semcov import SemanticConvetion
19
+ from openlit.semcov import SemanticConvention
20
20
 
21
21
  # Initialize logger for logging potential issues and operations
22
22
  logger = logging.getLogger(__name__)
@@ -58,7 +58,7 @@ def chat(version, environment, application_name, tracer,
58
58
  server_address, server_port = set_server_address_and_port(instance, 'api.mistral.ai', 443)
59
59
  request_model = kwargs.get('model', 'mistral-small-latest')
60
60
 
61
- span_name = f'{SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT} {request_model}'
61
+ span_name = f'{SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT} {request_model}'
62
62
 
63
63
  with tracer.start_as_current_span(span_name, kind=SpanKind.CLIENT) as span:
64
64
  start_time = time.time()
@@ -96,37 +96,37 @@ def chat(version, environment, application_name, tracer,
96
96
 
97
97
  # Set base span attribues (OTel Semconv)
98
98
  span.set_attribute(TELEMETRY_SDK_NAME, 'openlit')
99
- span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
100
- SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT)
101
- span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
102
- SemanticConvetion.GEN_AI_SYSTEM_MISTRAL)
103
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
99
+ span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
100
+ SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT)
101
+ span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
102
+ SemanticConvention.GEN_AI_SYSTEM_MISTRAL)
103
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
104
104
  request_model)
105
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_SEED,
105
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_SEED,
106
106
  kwargs.get('seed', ''))
107
- span.set_attribute(SemanticConvetion.SERVER_PORT,
107
+ span.set_attribute(SemanticConvention.SERVER_PORT,
108
108
  server_port)
109
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY,
109
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_FREQUENCY_PENALTY,
110
110
  kwargs.get('frequency_penalty', 0.0))
111
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
111
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS,
112
112
  kwargs.get('max_tokens', -1))
113
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_PRESENCE_PENALTY,
113
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_PRESENCE_PENALTY,
114
114
  kwargs.get('presence_penalty', 0.0))
115
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_STOP_SEQUENCES,
115
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_STOP_SEQUENCES,
116
116
  kwargs.get('stop', []))
117
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
117
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE,
118
118
  kwargs.get('temperature', 1.0))
119
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
119
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TOP_P,
120
120
  kwargs.get('top_p', 1.0))
121
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_ID,
121
+ span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_ID,
122
122
  response_dict.get('id'))
123
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_MODEL,
123
+ span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
124
124
  response_dict.get('model'))
125
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_INPUT_TOKENS,
125
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS,
126
126
  input_tokens)
127
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_OUTPUT_TOKENS,
127
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS,
128
128
  output_tokens)
129
- span.set_attribute(SemanticConvetion.SERVER_ADDRESS,
129
+ span.set_attribute(SemanticConvention.SERVER_ADDRESS,
130
130
  server_address)
131
131
 
132
132
  # Set base span attribues (Extras)
@@ -134,44 +134,44 @@ def chat(version, environment, application_name, tracer,
134
134
  environment)
135
135
  span.set_attribute(SERVICE_NAME,
136
136
  application_name)
137
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
137
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM,
138
138
  False)
139
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
139
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS,
140
140
  input_tokens + output_tokens)
141
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
141
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
142
142
  cost)
143
- span.set_attribute(SemanticConvetion.GEN_AI_SERVER_TTFT,
143
+ span.set_attribute(SemanticConvention.GEN_AI_SERVER_TTFT,
144
144
  end_time - start_time)
145
- span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
145
+ span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION,
146
146
  version)
147
147
  if capture_message_content:
148
148
  span.add_event(
149
- name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
149
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
150
150
  attributes={
151
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
151
+ SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
152
152
  },
153
153
  )
154
154
 
155
155
  for i in range(kwargs.get('n',1)):
156
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
156
+ span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON,
157
157
  [response_dict.get('choices')[i].get('finish_reason')])
158
158
  if capture_message_content:
159
159
  span.add_event(
160
- name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
160
+ name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
161
161
  attributes={
162
162
  # pylint: disable=line-too-long
163
- SemanticConvetion.GEN_AI_CONTENT_COMPLETION: str(response_dict.get('choices')[i].get('message').get('content')),
163
+ SemanticConvention.GEN_AI_CONTENT_COMPLETION: str(response_dict.get('choices')[i].get('message').get('content')),
164
164
  },
165
165
  )
166
166
  if kwargs.get('tools'):
167
- span.set_attribute(SemanticConvetion.GEN_AI_TOOL_CALLS,
167
+ span.set_attribute(SemanticConvention.GEN_AI_TOOL_CALLS,
168
168
  str(response_dict.get('choices')[i].get('message').get('tool_calls')))
169
169
 
170
170
  if isinstance(response_dict.get('choices')[i].get('message').get('content'), str):
171
- span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
171
+ span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
172
172
  'text')
173
173
  elif response_dict.get('choices')[i].get('message').get('content') is not None:
174
- span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
174
+ span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
175
175
  'json')
176
176
 
177
177
  span.set_status(Status(StatusCode.OK))
@@ -180,8 +180,8 @@ def chat(version, environment, application_name, tracer,
180
180
  attributes = create_metrics_attributes(
181
181
  service_name=application_name,
182
182
  deployment_environment=environment,
183
- operation=SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT,
184
- system=SemanticConvetion.GEN_AI_SYSTEM_MISTRAL,
183
+ operation=SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT,
184
+ system=SemanticConvention.GEN_AI_SYSTEM_MISTRAL,
185
185
  request_model=request_model,
186
186
  server_address=server_address,
187
187
  server_port=server_port,
@@ -361,48 +361,48 @@ def chat_stream(version, environment, application_name,
361
361
 
362
362
  # Set Span attributes (OTel Semconv)
363
363
  self._span.set_attribute(TELEMETRY_SDK_NAME, 'openlit')
364
- self._span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
365
- SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT)
366
- self._span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
367
- SemanticConvetion.GEN_AI_SYSTEM_MISTRAL)
368
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
364
+ self._span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
365
+ SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT)
366
+ self._span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
367
+ SemanticConvention.GEN_AI_SYSTEM_MISTRAL)
368
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
369
369
  request_model)
370
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_SEED,
370
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_SEED,
371
371
  self._kwargs.get('seed', ''))
372
- self._span.set_attribute(SemanticConvetion.SERVER_PORT,
372
+ self._span.set_attribute(SemanticConvention.SERVER_PORT,
373
373
  self._server_port)
374
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY,
374
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_FREQUENCY_PENALTY,
375
375
  self._kwargs.get('frequency_penalty', 0.0))
376
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
376
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS,
377
377
  self._kwargs.get('max_tokens', -1))
378
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_PRESENCE_PENALTY,
378
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_PRESENCE_PENALTY,
379
379
  self._kwargs.get('presence_penalty', 0.0))
380
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_STOP_SEQUENCES,
380
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_STOP_SEQUENCES,
381
381
  self._kwargs.get('stop_sequences', []))
382
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
382
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE,
383
383
  self._kwargs.get('temperature', 0.3))
384
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_K,
384
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TOP_K,
385
385
  self._kwargs.get('k', 1.0))
386
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
386
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TOP_P,
387
387
  self._kwargs.get('p', 1.0))
388
- self._span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
388
+ self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON,
389
389
  [self._finish_reason])
390
- self._span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_ID,
390
+ self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_ID,
391
391
  self._response_id)
392
- self._span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_MODEL,
392
+ self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
393
393
  self._response_model)
394
- self._span.set_attribute(SemanticConvetion.GEN_AI_USAGE_INPUT_TOKENS,
394
+ self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS,
395
395
  self._input_tokens)
396
- self._span.set_attribute(SemanticConvetion.GEN_AI_USAGE_OUTPUT_TOKENS,
396
+ self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS,
397
397
  self._output_tokens)
398
- self._span.set_attribute(SemanticConvetion.SERVER_ADDRESS,
398
+ self._span.set_attribute(SemanticConvention.SERVER_ADDRESS,
399
399
  self._server_address)
400
400
 
401
401
  if isinstance(self._llmresponse, str):
402
- self._span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
402
+ self._span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
403
403
  'text')
404
404
  else:
405
- self._span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
405
+ self._span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
406
406
  'json')
407
407
 
408
408
  # Set Span attributes (Extra)
@@ -410,29 +410,29 @@ def chat_stream(version, environment, application_name,
410
410
  environment)
411
411
  self._span.set_attribute(SERVICE_NAME,
412
412
  application_name)
413
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
413
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM,
414
414
  True)
415
- self._span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
415
+ self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS,
416
416
  self._input_tokens + self._output_tokens)
417
- self._span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
417
+ self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
418
418
  cost)
419
- self._span.set_attribute(SemanticConvetion.GEN_AI_SERVER_TBT,
419
+ self._span.set_attribute(SemanticConvention.GEN_AI_SERVER_TBT,
420
420
  self._tbt)
421
- self._span.set_attribute(SemanticConvetion.GEN_AI_SERVER_TTFT,
421
+ self._span.set_attribute(SemanticConvention.GEN_AI_SERVER_TTFT,
422
422
  self._ttft)
423
- self._span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
423
+ self._span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION,
424
424
  version)
425
425
  if capture_message_content:
426
426
  self._span.add_event(
427
- name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
427
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
428
428
  attributes={
429
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
429
+ SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
430
430
  },
431
431
  )
432
432
  self._span.add_event(
433
- name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
433
+ name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
434
434
  attributes={
435
- SemanticConvetion.GEN_AI_CONTENT_COMPLETION: self._llmresponse,
435
+ SemanticConvention.GEN_AI_CONTENT_COMPLETION: self._llmresponse,
436
436
  },
437
437
  )
438
438
  self._span.set_status(Status(StatusCode.OK))
@@ -441,8 +441,8 @@ def chat_stream(version, environment, application_name,
441
441
  attributes = create_metrics_attributes(
442
442
  service_name=application_name,
443
443
  deployment_environment=environment,
444
- operation=SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT,
445
- system=SemanticConvetion.GEN_AI_SYSTEM_MISTRAL,
444
+ operation=SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT,
445
+ system=SemanticConvention.GEN_AI_SYSTEM_MISTRAL,
446
446
  request_model=request_model,
447
447
  server_address=self._server_address,
448
448
  server_port=self._server_port,
@@ -476,7 +476,7 @@ def chat_stream(version, environment, application_name,
476
476
  server_address, server_port = set_server_address_and_port(instance, 'api.mistral.ai', 443)
477
477
  request_model = kwargs.get('model', 'mistral-small-latest')
478
478
 
479
- span_name = f'{SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT} {request_model}'
479
+ span_name = f'{SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT} {request_model}'
480
480
 
481
481
  awaited_wrapped = wrapped(*args, **kwargs)
482
482
  span = tracer.start_span(span_name, kind=SpanKind.CLIENT)
@@ -521,7 +521,7 @@ def embeddings(version, environment, application_name,
521
521
  server_address, server_port = set_server_address_and_port(instance, 'api.mistral.ai', 443)
522
522
  request_model = kwargs.get('model', 'mistral-embed')
523
523
 
524
- span_name = f'{SemanticConvetion.GEN_AI_OPERATION_TYPE_EMBEDDING} {request_model}'
524
+ span_name = f'{SemanticConvention.GEN_AI_OPERATION_TYPE_EMBEDDING} {request_model}'
525
525
 
526
526
  with tracer.start_as_current_span(span_name, kind= SpanKind.CLIENT) as span:
527
527
  start_time = time.time()
@@ -538,21 +538,21 @@ def embeddings(version, environment, application_name,
538
538
 
539
539
  # Set Span attributes (OTel Semconv)
540
540
  span.set_attribute(TELEMETRY_SDK_NAME, 'openlit')
541
- span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
542
- SemanticConvetion.GEN_AI_OPERATION_TYPE_EMBEDDING)
543
- span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
544
- SemanticConvetion.GEN_AI_SYSTEM_MISTRAL)
545
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
541
+ span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
542
+ SemanticConvention.GEN_AI_OPERATION_TYPE_EMBEDDING)
543
+ span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
544
+ SemanticConvention.GEN_AI_SYSTEM_MISTRAL)
545
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
546
546
  request_model)
547
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_ENCODING_FORMATS,
547
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_ENCODING_FORMATS,
548
548
  [kwargs.get('encoding_format', 'float')])
549
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_MODEL,
549
+ span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
550
550
  response_dict.get('model'))
551
- span.set_attribute(SemanticConvetion.SERVER_ADDRESS,
551
+ span.set_attribute(SemanticConvention.SERVER_ADDRESS,
552
552
  server_address)
553
- span.set_attribute(SemanticConvetion.SERVER_PORT,
553
+ span.set_attribute(SemanticConvention.SERVER_PORT,
554
554
  server_port)
555
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_INPUT_TOKENS,
555
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS,
556
556
  input_tokens)
557
557
 
558
558
  # Set Span attributes (Extras)
@@ -560,18 +560,18 @@ def embeddings(version, environment, application_name,
560
560
  environment)
561
561
  span.set_attribute(SERVICE_NAME,
562
562
  application_name)
563
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
563
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS,
564
564
  input_tokens)
565
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
565
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
566
566
  cost)
567
- span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
567
+ span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION,
568
568
  version)
569
569
 
570
570
  if capture_message_content:
571
571
  span.add_event(
572
- name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
572
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
573
573
  attributes={
574
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: str(kwargs.get('inputs', '')),
574
+ SemanticConvention.GEN_AI_CONTENT_PROMPT: str(kwargs.get('inputs', '')),
575
575
  },
576
576
  )
577
577
 
@@ -581,8 +581,8 @@ def embeddings(version, environment, application_name,
581
581
  attributes = create_metrics_attributes(
582
582
  service_name=application_name,
583
583
  deployment_environment=environment,
584
- operation=SemanticConvetion.GEN_AI_OPERATION_TYPE_EMBEDDING,
585
- system=SemanticConvetion.GEN_AI_SYSTEM_MISTRAL,
584
+ operation=SemanticConvention.GEN_AI_OPERATION_TYPE_EMBEDDING,
585
+ system=SemanticConvention.GEN_AI_SYSTEM_MISTRAL,
586
586
  request_model=request_model,
587
587
  server_address=server_address,
588
588
  server_port=server_port,
@@ -9,7 +9,7 @@ from opentelemetry.sdk.resources import SERVICE_NAME, TELEMETRY_SDK_NAME, DEPLOY
9
9
  from openlit.__helpers import (
10
10
  handle_exception,
11
11
  )
12
- from openlit.semcov import SemanticConvetion
12
+ from openlit.semcov import SemanticConvention
13
13
 
14
14
  # Initialize logger for logging potential issues and operations
15
15
  logger = logging.getLogger(__name__)
@@ -56,11 +56,11 @@ def async_multion_wrap(gen_ai_endpoint, version, environment, application_name,
56
56
  try:
57
57
  # Set base span attribues
58
58
  span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
59
- span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
60
- SemanticConvetion.GEN_AI_SYSTEM_MULTION)
61
- span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
62
- SemanticConvetion.GEN_AI_OPERATION_TYPE_AGENT)
63
- span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
59
+ span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
60
+ SemanticConvention.GEN_AI_SYSTEM_MULTION)
61
+ span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
62
+ SemanticConvention.GEN_AI_OPERATION_TYPE_AGENT)
63
+ span.set_attribute(SemanticConvention.GEN_AI_ENDPOINT,
64
64
  gen_ai_endpoint)
65
65
  span.set_attribute(SERVICE_NAME,
66
66
  application_name)
@@ -68,53 +68,53 @@ def async_multion_wrap(gen_ai_endpoint, version, environment, application_name,
68
68
  environment)
69
69
 
70
70
  if gen_ai_endpoint == "multion.browse":
71
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_BROWSE_URL,
71
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_BROWSE_URL,
72
72
  kwargs.get("url", ""))
73
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_STEP_COUNT,
73
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_STEP_COUNT,
74
74
  response.metadata.step_count)
75
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_RESPONSE_TIME,
75
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_RESPONSE_TIME,
76
76
  response.metadata.processing_time)
77
77
 
78
78
  if capture_message_content:
79
79
  span.add_event(
80
- name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
80
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
81
81
  attributes={
82
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: kwargs.get("cmd", ""),
82
+ SemanticConvention.GEN_AI_CONTENT_PROMPT: kwargs.get("cmd", ""),
83
83
  },
84
84
  )
85
85
  span.add_event(
86
- name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
86
+ name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
87
87
  attributes={
88
- SemanticConvetion.GEN_AI_CONTENT_COMPLETION: response.message,
88
+ SemanticConvention.GEN_AI_CONTENT_COMPLETION: response.message,
89
89
  },
90
90
  )
91
91
  elif gen_ai_endpoint == "multion.retrieve":
92
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_BROWSE_URL,
92
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_BROWSE_URL,
93
93
  kwargs.get("url", ""))
94
94
 
95
95
  if capture_message_content:
96
96
  span.add_event(
97
- name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
97
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
98
98
  attributes={
99
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: kwargs.get("cmd", ""),
99
+ SemanticConvention.GEN_AI_CONTENT_PROMPT: kwargs.get("cmd", ""),
100
100
  },
101
101
  )
102
102
  span.add_event(
103
- name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
103
+ name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
104
104
  attributes={
105
- SemanticConvetion.GEN_AI_CONTENT_COMPLETION: response.message,
105
+ SemanticConvention.GEN_AI_CONTENT_COMPLETION: response.message,
106
106
  },
107
107
  )
108
108
 
109
109
  elif gen_ai_endpoint == "multion.sessions.create":
110
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_BROWSE_URL,
110
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_BROWSE_URL,
111
111
  kwargs.get("url", ""))
112
112
 
113
113
  if capture_message_content:
114
114
  span.add_event(
115
- name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
115
+ name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
116
116
  attributes={
117
- SemanticConvetion.GEN_AI_CONTENT_COMPLETION: response.message,
117
+ SemanticConvention.GEN_AI_CONTENT_COMPLETION: response.message,
118
118
  },
119
119
  )
120
120
 
@@ -9,7 +9,7 @@ from opentelemetry.sdk.resources import SERVICE_NAME, TELEMETRY_SDK_NAME, DEPLOY
9
9
  from openlit.__helpers import (
10
10
  handle_exception,
11
11
  )
12
- from openlit.semcov import SemanticConvetion
12
+ from openlit.semcov import SemanticConvention
13
13
 
14
14
  # Initialize logger for logging potential issues and operations
15
15
  logger = logging.getLogger(__name__)
@@ -56,11 +56,11 @@ def multion_wrap(gen_ai_endpoint, version, environment, application_name,
56
56
  try:
57
57
  # Set base span attribues
58
58
  span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
59
- span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
60
- SemanticConvetion.GEN_AI_SYSTEM_MULTION)
61
- span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
62
- SemanticConvetion.GEN_AI_OPERATION_TYPE_AGENT)
63
- span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
59
+ span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
60
+ SemanticConvention.GEN_AI_SYSTEM_MULTION)
61
+ span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
62
+ SemanticConvention.GEN_AI_OPERATION_TYPE_AGENT)
63
+ span.set_attribute(SemanticConvention.GEN_AI_ENDPOINT,
64
64
  gen_ai_endpoint)
65
65
  span.set_attribute(SERVICE_NAME,
66
66
  application_name)
@@ -68,53 +68,53 @@ def multion_wrap(gen_ai_endpoint, version, environment, application_name,
68
68
  environment)
69
69
 
70
70
  if gen_ai_endpoint == "multion.browse":
71
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_BROWSE_URL,
71
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_BROWSE_URL,
72
72
  kwargs.get("url", ""))
73
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_STEP_COUNT,
73
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_STEP_COUNT,
74
74
  response.metadata.step_count)
75
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_RESPONSE_TIME,
75
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_RESPONSE_TIME,
76
76
  response.metadata.processing_time)
77
77
 
78
78
  if capture_message_content:
79
79
  span.add_event(
80
- name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
80
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
81
81
  attributes={
82
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: kwargs.get("cmd", ""),
82
+ SemanticConvention.GEN_AI_CONTENT_PROMPT: kwargs.get("cmd", ""),
83
83
  },
84
84
  )
85
85
  span.add_event(
86
- name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
86
+ name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
87
87
  attributes={
88
- SemanticConvetion.GEN_AI_CONTENT_COMPLETION: response.message,
88
+ SemanticConvention.GEN_AI_CONTENT_COMPLETION: response.message,
89
89
  },
90
90
  )
91
91
  elif gen_ai_endpoint == "multion.retrieve":
92
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_BROWSE_URL,
92
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_BROWSE_URL,
93
93
  kwargs.get("url", ""))
94
94
 
95
95
  if capture_message_content:
96
96
  span.add_event(
97
- name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
97
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
98
98
  attributes={
99
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: kwargs.get("cmd", ""),
99
+ SemanticConvention.GEN_AI_CONTENT_PROMPT: kwargs.get("cmd", ""),
100
100
  },
101
101
  )
102
102
  span.add_event(
103
- name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
103
+ name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
104
104
  attributes={
105
- SemanticConvetion.GEN_AI_CONTENT_COMPLETION: response.message,
105
+ SemanticConvention.GEN_AI_CONTENT_COMPLETION: response.message,
106
106
  },
107
107
  )
108
108
 
109
109
  elif gen_ai_endpoint == "multion.sessions.create":
110
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_BROWSE_URL,
110
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_BROWSE_URL,
111
111
  kwargs.get("url", ""))
112
112
 
113
113
  if capture_message_content:
114
114
  span.add_event(
115
- name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
115
+ name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
116
116
  attributes={
117
- SemanticConvetion.GEN_AI_CONTENT_COMPLETION: response.message,
117
+ SemanticConvention.GEN_AI_CONTENT_COMPLETION: response.message,
118
118
  },
119
119
  )
120
120
 
@@ -15,7 +15,7 @@ from openlit.instrumentation.ollama.utils import (
15
15
  process_streaming_chat_response,
16
16
  process_embedding_response
17
17
  )
18
- from openlit.semcov import SemanticConvetion
18
+ from openlit.semcov import SemanticConvention
19
19
 
20
20
  logger = logging.getLogger(__name__)
21
21
 
@@ -108,7 +108,7 @@ def async_chat(version, environment, application_name,
108
108
  server_address, server_port = set_server_address_and_port(instance, "127.0.0.1", 11434)
109
109
  request_model = kwargs.get("model", "gpt-4o")
110
110
 
111
- span_name = f"{SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT} {request_model}"
111
+ span_name = f"{SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT} {request_model}"
112
112
 
113
113
  # pylint: disable=no-else-return
114
114
  if streaming:
@@ -156,7 +156,7 @@ def async_embeddings(version, environment, application_name,
156
156
  server_address, server_port = set_server_address_and_port(instance, '127.0.0.1', 11434)
157
157
  request_model = kwargs.get('model', 'all-minilm')
158
158
 
159
- span_name = f'{SemanticConvetion.GEN_AI_OPERATION_TYPE_EMBEDDING} {request_model}'
159
+ span_name = f'{SemanticConvention.GEN_AI_OPERATION_TYPE_EMBEDDING} {request_model}'
160
160
 
161
161
  with tracer.start_as_current_span(span_name, kind= SpanKind.CLIENT) as span:
162
162
  start_time = time.time()
@@ -15,7 +15,7 @@ from openlit.instrumentation.ollama.utils import (
15
15
  process_streaming_chat_response,
16
16
  process_embedding_response
17
17
  )
18
- from openlit.semcov import SemanticConvetion
18
+ from openlit.semcov import SemanticConvention
19
19
 
20
20
  logger = logging.getLogger(__name__)
21
21
 
@@ -108,7 +108,7 @@ def chat(version, environment, application_name,
108
108
  server_address, server_port = set_server_address_and_port(instance, "127.0.0.1", 11434)
109
109
  request_model = kwargs.get("model", "gpt-4o")
110
110
 
111
- span_name = f"{SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT} {request_model}"
111
+ span_name = f"{SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT} {request_model}"
112
112
 
113
113
  # pylint: disable=no-else-return
114
114
  if streaming:
@@ -156,7 +156,7 @@ def embeddings(version, environment, application_name,
156
156
  server_address, server_port = set_server_address_and_port(instance, '127.0.0.1', 11434)
157
157
  request_model = kwargs.get('model', 'all-minilm')
158
158
 
159
- span_name = f'{SemanticConvetion.GEN_AI_OPERATION_TYPE_EMBEDDING} {request_model}'
159
+ span_name = f'{SemanticConvention.GEN_AI_OPERATION_TYPE_EMBEDDING} {request_model}'
160
160
 
161
161
  with tracer.start_as_current_span(span_name, kind= SpanKind.CLIENT) as span:
162
162
  start_time = time.time()