openlit 1.33.19__py3-none-any.whl → 1.33.21__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 (82) hide show
  1. openlit/__helpers.py +64 -7
  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 +2 -2
  17. openlit/instrumentation/azure_ai_inference/azure_ai_inference.py +2 -2
  18. openlit/instrumentation/azure_ai_inference/utils.py +36 -36
  19. openlit/instrumentation/bedrock/bedrock.py +2 -2
  20. openlit/instrumentation/bedrock/utils.py +35 -35
  21. openlit/instrumentation/chroma/chroma.py +57 -57
  22. openlit/instrumentation/cohere/async_cohere.py +88 -88
  23. openlit/instrumentation/cohere/cohere.py +88 -88
  24. openlit/instrumentation/controlflow/controlflow.py +15 -15
  25. openlit/instrumentation/crawl4ai/async_crawl4ai.py +14 -14
  26. openlit/instrumentation/crawl4ai/crawl4ai.py +14 -14
  27. openlit/instrumentation/crewai/crewai.py +22 -22
  28. openlit/instrumentation/dynamiq/dynamiq.py +19 -19
  29. openlit/instrumentation/elevenlabs/async_elevenlabs.py +24 -25
  30. openlit/instrumentation/elevenlabs/elevenlabs.py +23 -25
  31. openlit/instrumentation/embedchain/embedchain.py +15 -15
  32. openlit/instrumentation/firecrawl/firecrawl.py +10 -10
  33. openlit/instrumentation/google_ai_studio/async_google_ai_studio.py +33 -33
  34. openlit/instrumentation/google_ai_studio/google_ai_studio.py +33 -33
  35. openlit/instrumentation/gpt4all/gpt4all.py +78 -78
  36. openlit/instrumentation/gpu/__init__.py +8 -8
  37. openlit/instrumentation/groq/async_groq.py +74 -74
  38. openlit/instrumentation/groq/groq.py +74 -74
  39. openlit/instrumentation/haystack/haystack.py +6 -6
  40. openlit/instrumentation/julep/async_julep.py +14 -14
  41. openlit/instrumentation/julep/julep.py +14 -14
  42. openlit/instrumentation/langchain/async_langchain.py +39 -39
  43. openlit/instrumentation/langchain/langchain.py +39 -39
  44. openlit/instrumentation/letta/letta.py +26 -26
  45. openlit/instrumentation/litellm/async_litellm.py +94 -94
  46. openlit/instrumentation/litellm/litellm.py +94 -94
  47. openlit/instrumentation/llamaindex/llamaindex.py +7 -7
  48. openlit/instrumentation/mem0/mem0.py +13 -13
  49. openlit/instrumentation/milvus/milvus.py +47 -47
  50. openlit/instrumentation/mistral/async_mistral.py +88 -88
  51. openlit/instrumentation/mistral/mistral.py +88 -88
  52. openlit/instrumentation/multion/async_multion.py +21 -21
  53. openlit/instrumentation/multion/multion.py +21 -21
  54. openlit/instrumentation/ollama/__init__.py +47 -34
  55. openlit/instrumentation/ollama/async_ollama.py +7 -5
  56. openlit/instrumentation/ollama/ollama.py +7 -5
  57. openlit/instrumentation/ollama/utils.py +58 -54
  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/__init__.py +11 -7
  71. openlit/instrumentation/transformers/transformers.py +32 -168
  72. openlit/instrumentation/transformers/utils.py +183 -0
  73. openlit/instrumentation/vertexai/async_vertexai.py +64 -64
  74. openlit/instrumentation/vertexai/vertexai.py +64 -64
  75. openlit/instrumentation/vllm/vllm.py +24 -24
  76. openlit/otel/metrics.py +11 -11
  77. openlit/semcov/__init__.py +3 -3
  78. {openlit-1.33.19.dist-info → openlit-1.33.21.dist-info}/METADATA +8 -8
  79. openlit-1.33.21.dist-info/RECORD +132 -0
  80. {openlit-1.33.19.dist-info → openlit-1.33.21.dist-info}/WHEEL +1 -1
  81. openlit-1.33.19.dist-info/RECORD +0 -131
  82. {openlit-1.33.19.dist-info → openlit-1.33.21.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 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__)
@@ -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(SemanticConvetion.GEN_AI_OPERATION,
155
- SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT)
156
- self._span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
157
- SemanticConvetion.GEN_AI_SYSTEM_LITELLM)
158
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
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(SemanticConvetion.GEN_AI_REQUEST_SEED,
160
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_SEED,
161
161
  self._kwargs.get('seed', ''))
162
- self._span.set_attribute(SemanticConvetion.SERVER_PORT,
162
+ self._span.set_attribute(SemanticConvention.SERVER_PORT,
163
163
  self._server_port)
164
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY,
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(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
166
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS,
167
167
  self._kwargs.get('max_tokens', -1))
168
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_PRESENCE_PENALTY,
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(SemanticConvetion.GEN_AI_REQUEST_STOP_SEQUENCES,
170
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_STOP_SEQUENCES,
171
171
  self._kwargs.get('stop', []))
172
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
172
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE,
173
173
  self._kwargs.get('temperature', 1.0))
174
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
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(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
176
+ self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON,
177
177
  [self._finish_reason])
178
- self._span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_ID,
178
+ self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_ID,
179
179
  self._response_id)
180
- self._span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_MODEL,
180
+ self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
181
181
  self._response_model)
182
- self._span.set_attribute(SemanticConvetion.GEN_AI_USAGE_INPUT_TOKENS,
182
+ self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS,
183
183
  input_tokens)
184
- self._span.set_attribute(SemanticConvetion.GEN_AI_USAGE_OUTPUT_TOKENS,
184
+ self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS,
185
185
  output_tokens)
186
- self._span.set_attribute(SemanticConvetion.SERVER_ADDRESS,
186
+ self._span.set_attribute(SemanticConvention.SERVER_ADDRESS,
187
187
  self._server_address)
188
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_SERVICE_TIER,
188
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_SERVICE_TIER,
189
189
  self._kwargs.get('service_tier', 'auto'))
190
- self._span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_SERVICE_TIER,
190
+ self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_SERVICE_TIER,
191
191
  self._response_service_tier)
192
- self._span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_SYSTEM_FINGERPRINT,
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(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
195
+ self._span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
196
196
  'text')
197
197
  else:
198
- self._span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
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(SemanticConvetion.GEN_AI_REQUEST_USER,
206
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_USER,
207
207
  self._kwargs.get('user', ''))
208
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
208
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM,
209
209
  True)
210
- self._span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
210
+ self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS,
211
211
  input_tokens + output_tokens)
212
- self._span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
212
+ self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
213
213
  cost)
214
- self._span.set_attribute(SemanticConvetion.GEN_AI_SERVER_TBT,
214
+ self._span.set_attribute(SemanticConvention.GEN_AI_SERVER_TBT,
215
215
  self._tbt)
216
- self._span.set_attribute(SemanticConvetion.GEN_AI_SERVER_TTFT,
216
+ self._span.set_attribute(SemanticConvention.GEN_AI_SERVER_TTFT,
217
217
  self._ttft)
218
- self._span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
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=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
222
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
223
223
  attributes={
224
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
224
+ SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
225
225
  },
226
226
  )
227
227
  self._span.add_event(
228
- name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
228
+ name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
229
229
  attributes={
230
- SemanticConvetion.GEN_AI_CONTENT_COMPLETION: self._llmresponse,
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=SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT,
240
- system=SemanticConvetion.GEN_AI_SYSTEM_LITELLM,
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'{SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT} {request_model}'
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(SemanticConvetion.GEN_AI_OPERATION,
343
- SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT)
344
- span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
345
- SemanticConvetion.GEN_AI_SYSTEM_LITELLM)
346
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
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(SemanticConvetion.GEN_AI_REQUEST_SEED,
348
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_SEED,
349
349
  kwargs.get('seed', ''))
350
- span.set_attribute(SemanticConvetion.SERVER_PORT,
350
+ span.set_attribute(SemanticConvention.SERVER_PORT,
351
351
  server_port)
352
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY,
352
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_FREQUENCY_PENALTY,
353
353
  kwargs.get('frequency_penalty', 0.0))
354
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
354
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS,
355
355
  kwargs.get('max_tokens', -1))
356
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_PRESENCE_PENALTY,
356
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_PRESENCE_PENALTY,
357
357
  kwargs.get('presence_penalty', 0.0))
358
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_STOP_SEQUENCES,
358
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_STOP_SEQUENCES,
359
359
  kwargs.get('stop', []))
360
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
360
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE,
361
361
  kwargs.get('temperature', 1.0))
362
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
362
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TOP_P,
363
363
  kwargs.get('top_p', 1.0))
364
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_ID,
364
+ span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_ID,
365
365
  response_dict.get('id'))
366
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_MODEL,
366
+ span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
367
367
  response_dict.get('model'))
368
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_INPUT_TOKENS,
368
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS,
369
369
  input_tokens)
370
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_OUTPUT_TOKENS,
370
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS,
371
371
  output_tokens)
372
- span.set_attribute(SemanticConvetion.SERVER_ADDRESS,
372
+ span.set_attribute(SemanticConvention.SERVER_ADDRESS,
373
373
  server_address)
374
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_SERVICE_TIER,
374
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_SERVICE_TIER,
375
375
  kwargs.get('service_tier', 'auto'))
376
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_SYSTEM_FINGERPRINT,
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(SemanticConvetion.GEN_AI_REQUEST_USER,
384
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_USER,
385
385
  kwargs.get('user', ''))
386
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
386
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM,
387
387
  False)
388
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
388
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS,
389
389
  input_tokens + output_tokens)
390
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
390
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
391
391
  cost)
392
- span.set_attribute(SemanticConvetion.GEN_AI_SERVER_TTFT,
392
+ span.set_attribute(SemanticConvention.GEN_AI_SERVER_TTFT,
393
393
  end_time - start_time)
394
- span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
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=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
398
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
399
399
  attributes={
400
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
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(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
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=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
409
+ name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
410
410
  attributes={
411
411
  # pylint: disable=line-too-long
412
- SemanticConvetion.GEN_AI_CONTENT_COMPLETION: str(response_dict.get('choices')[i].get('message').get('content')),
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(SemanticConvetion.GEN_AI_TOOL_CALLS,
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(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
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(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
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=SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT,
433
- system=SemanticConvetion.GEN_AI_SYSTEM_LITELLM,
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'{SemanticConvetion.GEN_AI_OPERATION_TYPE_EMBEDDING} {request_model}'
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(SemanticConvetion.GEN_AI_OPERATION,
521
- SemanticConvetion.GEN_AI_OPERATION_TYPE_EMBEDDING)
522
- span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
523
- SemanticConvetion.GEN_AI_SYSTEM_LITELLM)
524
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
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(SemanticConvetion.GEN_AI_REQUEST_ENCODING_FORMATS,
526
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_ENCODING_FORMATS,
527
527
  [kwargs.get('encoding_format', 'float')])
528
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_MODEL,
528
+ span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
529
529
  response_dict.get('model'))
530
- span.set_attribute(SemanticConvetion.SERVER_ADDRESS,
530
+ span.set_attribute(SemanticConvention.SERVER_ADDRESS,
531
531
  server_address)
532
- span.set_attribute(SemanticConvetion.SERVER_PORT,
532
+ span.set_attribute(SemanticConvention.SERVER_PORT,
533
533
  server_port)
534
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_INPUT_TOKENS,
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(SemanticConvetion.GEN_AI_REQUEST_USER,
542
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_USER,
543
543
  kwargs.get('user', ''))
544
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
544
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS,
545
545
  input_tokens)
546
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
546
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
547
547
  cost)
548
- span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
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=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
553
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
554
554
  attributes={
555
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: str(kwargs.get('input', '')),
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=SemanticConvetion.GEN_AI_OPERATION_TYPE_EMBEDDING,
566
- system=SemanticConvetion.GEN_AI_SYSTEM_LITELLM,
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,