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.
Files changed (79) hide show
  1. openlit/__helpers.py +7 -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/async_ollama.py +3 -3
  55. openlit/instrumentation/ollama/ollama.py +3 -3
  56. openlit/instrumentation/ollama/utils.py +50 -50
  57. openlit/instrumentation/openai/async_openai.py +225 -225
  58. openlit/instrumentation/openai/openai.py +225 -225
  59. openlit/instrumentation/openai_agents/openai_agents.py +11 -11
  60. openlit/instrumentation/phidata/phidata.py +15 -15
  61. openlit/instrumentation/pinecone/pinecone.py +43 -43
  62. openlit/instrumentation/premai/premai.py +86 -86
  63. openlit/instrumentation/qdrant/async_qdrant.py +95 -95
  64. openlit/instrumentation/qdrant/qdrant.py +99 -99
  65. openlit/instrumentation/reka/async_reka.py +33 -33
  66. openlit/instrumentation/reka/reka.py +33 -33
  67. openlit/instrumentation/together/async_together.py +90 -90
  68. openlit/instrumentation/together/together.py +90 -90
  69. openlit/instrumentation/transformers/transformers.py +26 -26
  70. openlit/instrumentation/vertexai/async_vertexai.py +64 -64
  71. openlit/instrumentation/vertexai/vertexai.py +64 -64
  72. openlit/instrumentation/vllm/vllm.py +24 -24
  73. openlit/otel/metrics.py +11 -11
  74. openlit/semcov/__init__.py +3 -3
  75. {openlit-1.33.19.dist-info → openlit-1.33.20.dist-info}/METADATA +8 -8
  76. openlit-1.33.20.dist-info/RECORD +131 -0
  77. {openlit-1.33.19.dist-info → openlit-1.33.20.dist-info}/WHEEL +1 -1
  78. openlit-1.33.19.dist-info/RECORD +0 -131
  79. {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
  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 async_embed(version, environment, application_name, tracer,
58
58
  server_address, server_port = set_server_address_and_port(instance, "api.cohere.com", 443)
59
59
  request_model = kwargs.get("model", "mbed-english-v3.0")
60
60
 
61
- span_name = f"{SemanticConvetion.GEN_AI_OPERATION_TYPE_EMBEDDING} {request_model}"
61
+ span_name = f"{SemanticConvention.GEN_AI_OPERATION_TYPE_EMBEDDING} {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()
@@ -74,23 +74,23 @@ def async_embed(version, environment, application_name, tracer,
74
74
 
75
75
  # Set Span attributes (OTel Semconv)
76
76
  span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
77
- span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
78
- SemanticConvetion.GEN_AI_OPERATION_TYPE_EMBEDDING)
79
- span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
80
- SemanticConvetion.GEN_AI_SYSTEM_COHERE)
81
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
77
+ span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
78
+ SemanticConvention.GEN_AI_OPERATION_TYPE_EMBEDDING)
79
+ span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
80
+ SemanticConvention.GEN_AI_SYSTEM_COHERE)
81
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
82
82
  request_model)
83
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_ENCODING_FORMATS,
83
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_ENCODING_FORMATS,
84
84
  kwargs.get('embedding_types', ['float']))
85
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_MODEL,
85
+ span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
86
86
  request_model)
87
- span.set_attribute(SemanticConvetion.SERVER_ADDRESS,
87
+ span.set_attribute(SemanticConvention.SERVER_ADDRESS,
88
88
  server_address)
89
- span.set_attribute(SemanticConvetion.SERVER_PORT,
89
+ span.set_attribute(SemanticConvention.SERVER_PORT,
90
90
  server_port)
91
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_INPUT_TOKENS,
91
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS,
92
92
  input_tokens)
93
- span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
93
+ span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
94
94
  response_dict.get('response_type'))
95
95
 
96
96
  # Set Span attributes (Extras)
@@ -98,18 +98,18 @@ def async_embed(version, environment, application_name, tracer,
98
98
  environment)
99
99
  span.set_attribute(SERVICE_NAME,
100
100
  application_name)
101
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
101
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS,
102
102
  input_tokens)
103
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
103
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
104
104
  cost)
105
- span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
105
+ span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION,
106
106
  version)
107
107
 
108
108
  if capture_message_content:
109
109
  span.add_event(
110
- name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
110
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
111
111
  attributes={
112
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: str(kwargs.get("texts", "")),
112
+ SemanticConvention.GEN_AI_CONTENT_PROMPT: str(kwargs.get("texts", "")),
113
113
  },
114
114
  )
115
115
 
@@ -119,8 +119,8 @@ def async_embed(version, environment, application_name, tracer,
119
119
  attributes = create_metrics_attributes(
120
120
  service_name=application_name,
121
121
  deployment_environment=environment,
122
- operation=SemanticConvetion.GEN_AI_OPERATION_TYPE_EMBEDDING,
123
- system=SemanticConvetion.GEN_AI_SYSTEM_COHERE,
122
+ operation=SemanticConvention.GEN_AI_OPERATION_TYPE_EMBEDDING,
123
+ system=SemanticConvention.GEN_AI_SYSTEM_COHERE,
124
124
  request_model=request_model,
125
125
  server_address=server_address,
126
126
  server_port=server_port,
@@ -185,7 +185,7 @@ def async_chat(version, environment, application_name, tracer,
185
185
  server_address, server_port = set_server_address_and_port(instance, "api.cohere.com", 443)
186
186
  request_model = kwargs.get("model", "command-r-plus-08-2024")
187
187
 
188
- span_name = f"{SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT} {request_model}"
188
+ span_name = f"{SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT} {request_model}"
189
189
 
190
190
  with tracer.start_as_current_span(span_name, kind=SpanKind.CLIENT) as span:
191
191
  start_time = time.time()
@@ -224,45 +224,45 @@ def async_chat(version, environment, application_name, tracer,
224
224
 
225
225
  # Set base span attribues (OTel Semconv)
226
226
  span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
227
- span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
228
- SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT)
229
- span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
230
- SemanticConvetion.GEN_AI_SYSTEM_COHERE)
231
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
227
+ span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
228
+ SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT)
229
+ span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
230
+ SemanticConvention.GEN_AI_SYSTEM_COHERE)
231
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
232
232
  request_model)
233
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_SEED,
233
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_SEED,
234
234
  kwargs.get("seed", ""))
235
- span.set_attribute(SemanticConvetion.SERVER_PORT,
235
+ span.set_attribute(SemanticConvention.SERVER_PORT,
236
236
  server_port)
237
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY,
237
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_FREQUENCY_PENALTY,
238
238
  kwargs.get("frequency_penalty", 0.0))
239
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
239
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS,
240
240
  kwargs.get("max_tokens", -1))
241
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_PRESENCE_PENALTY,
241
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_PRESENCE_PENALTY,
242
242
  kwargs.get("presence_penalty", 0.0))
243
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_STOP_SEQUENCES,
243
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_STOP_SEQUENCES,
244
244
  kwargs.get("stop_sequences", []))
245
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
245
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE,
246
246
  kwargs.get("temperature", 0.3))
247
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_K,
247
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TOP_K,
248
248
  kwargs.get("k", 1.0))
249
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
249
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TOP_P,
250
250
  kwargs.get("p", 1.0))
251
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_ID,
251
+ span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_ID,
252
252
  response_dict.get("id"))
253
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_MODEL,
253
+ span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
254
254
  request_model)
255
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_INPUT_TOKENS,
255
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS,
256
256
  input_tokens)
257
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_OUTPUT_TOKENS,
257
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS,
258
258
  output_tokens)
259
- span.set_attribute(SemanticConvetion.SERVER_ADDRESS,
259
+ span.set_attribute(SemanticConvention.SERVER_ADDRESS,
260
260
  server_address)
261
261
  if isinstance(llm_response, str):
262
- span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
262
+ span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
263
263
  "text")
264
264
  else:
265
- span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
265
+ span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
266
266
  "json")
267
267
 
268
268
  # Set base span attribues (Extras)
@@ -270,28 +270,28 @@ def async_chat(version, environment, application_name, tracer,
270
270
  environment)
271
271
  span.set_attribute(SERVICE_NAME,
272
272
  application_name)
273
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
273
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM,
274
274
  False)
275
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
275
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS,
276
276
  input_tokens + output_tokens)
277
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
277
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
278
278
  cost)
279
- span.set_attribute(SemanticConvetion.GEN_AI_SERVER_TTFT,
279
+ span.set_attribute(SemanticConvention.GEN_AI_SERVER_TTFT,
280
280
  end_time - start_time)
281
- span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
281
+ span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION,
282
282
  version)
283
283
 
284
284
  if capture_message_content:
285
285
  span.add_event(
286
- name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
286
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
287
287
  attributes={
288
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
288
+ SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
289
289
  },
290
290
  )
291
291
  span.add_event(
292
- name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
292
+ name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
293
293
  attributes={
294
- SemanticConvetion.GEN_AI_CONTENT_COMPLETION: llm_response,
294
+ SemanticConvention.GEN_AI_CONTENT_COMPLETION: llm_response,
295
295
  },
296
296
  )
297
297
 
@@ -301,8 +301,8 @@ def async_chat(version, environment, application_name, tracer,
301
301
  attributes = create_metrics_attributes(
302
302
  service_name=application_name,
303
303
  deployment_environment=environment,
304
- operation=SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT,
305
- system=SemanticConvetion.GEN_AI_SYSTEM_COHERE,
304
+ operation=SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT,
305
+ system=SemanticConvention.GEN_AI_SYSTEM_COHERE,
306
306
  request_model=request_model,
307
307
  server_address=server_address,
308
308
  server_port=server_port,
@@ -486,48 +486,48 @@ def async_chat_stream(version, environment, application_name,
486
486
 
487
487
  # Set Span attributes (OTel Semconv)
488
488
  self._span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
489
- self._span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
490
- SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT)
491
- self._span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
492
- SemanticConvetion.GEN_AI_SYSTEM_COHERE)
493
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
489
+ self._span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
490
+ SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT)
491
+ self._span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
492
+ SemanticConvention.GEN_AI_SYSTEM_COHERE)
493
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
494
494
  request_model)
495
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_SEED,
495
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_SEED,
496
496
  self._kwargs.get("seed", ""))
497
- self._span.set_attribute(SemanticConvetion.SERVER_PORT,
497
+ self._span.set_attribute(SemanticConvention.SERVER_PORT,
498
498
  self._server_port)
499
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY,
499
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_FREQUENCY_PENALTY,
500
500
  self._kwargs.get("frequency_penalty", 0.0))
501
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
501
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS,
502
502
  self._kwargs.get("max_tokens", -1))
503
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_PRESENCE_PENALTY,
503
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_PRESENCE_PENALTY,
504
504
  self._kwargs.get("presence_penalty", 0.0))
505
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_STOP_SEQUENCES,
505
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_STOP_SEQUENCES,
506
506
  self._kwargs.get("stop_sequences", []))
507
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
507
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE,
508
508
  self._kwargs.get("temperature", 0.3))
509
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_K,
509
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TOP_K,
510
510
  self._kwargs.get("k", 1.0))
511
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
511
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TOP_P,
512
512
  self._kwargs.get("p", 1.0))
513
- self._span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
513
+ self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON,
514
514
  [self._finish_reason])
515
- self._span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_ID,
515
+ self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_ID,
516
516
  self._response_id)
517
- self._span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_MODEL,
517
+ self._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
518
518
  request_model)
519
- self._span.set_attribute(SemanticConvetion.GEN_AI_USAGE_INPUT_TOKENS,
519
+ self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS,
520
520
  self._input_tokens)
521
- self._span.set_attribute(SemanticConvetion.GEN_AI_USAGE_OUTPUT_TOKENS,
521
+ self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS,
522
522
  self._output_tokens)
523
- self._span.set_attribute(SemanticConvetion.SERVER_ADDRESS,
523
+ self._span.set_attribute(SemanticConvention.SERVER_ADDRESS,
524
524
  self._server_address)
525
525
 
526
526
  if isinstance(self._llmresponse, str):
527
- self._span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
527
+ self._span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
528
528
  "text")
529
529
  else:
530
- self._span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
530
+ self._span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
531
531
  "json")
532
532
 
533
533
  # Set Span attributes (Extra)
@@ -535,29 +535,29 @@ def async_chat_stream(version, environment, application_name,
535
535
  environment)
536
536
  self._span.set_attribute(SERVICE_NAME,
537
537
  application_name)
538
- self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
538
+ self._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM,
539
539
  True)
540
- self._span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
540
+ self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS,
541
541
  self._input_tokens + self._output_tokens)
542
- self._span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
542
+ self._span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
543
543
  cost)
544
- self._span.set_attribute(SemanticConvetion.GEN_AI_SERVER_TBT,
544
+ self._span.set_attribute(SemanticConvention.GEN_AI_SERVER_TBT,
545
545
  self._tbt)
546
- self._span.set_attribute(SemanticConvetion.GEN_AI_SERVER_TTFT,
546
+ self._span.set_attribute(SemanticConvention.GEN_AI_SERVER_TTFT,
547
547
  self._ttft)
548
- self._span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
548
+ self._span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION,
549
549
  version)
550
550
  if capture_message_content:
551
551
  self._span.add_event(
552
- name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
552
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
553
553
  attributes={
554
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
554
+ SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
555
555
  },
556
556
  )
557
557
  self._span.add_event(
558
- name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
558
+ name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
559
559
  attributes={
560
- SemanticConvetion.GEN_AI_CONTENT_COMPLETION: self._llmresponse,
560
+ SemanticConvention.GEN_AI_CONTENT_COMPLETION: self._llmresponse,
561
561
  },
562
562
  )
563
563
  self._span.set_status(Status(StatusCode.OK))
@@ -566,8 +566,8 @@ def async_chat_stream(version, environment, application_name,
566
566
  attributes = create_metrics_attributes(
567
567
  service_name=application_name,
568
568
  deployment_environment=environment,
569
- operation=SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT,
570
- system=SemanticConvetion.GEN_AI_SYSTEM_COHERE,
569
+ operation=SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT,
570
+ system=SemanticConvention.GEN_AI_SYSTEM_COHERE,
571
571
  request_model=request_model,
572
572
  server_address=self._server_address,
573
573
  server_port=self._server_port,
@@ -601,7 +601,7 @@ def async_chat_stream(version, environment, application_name,
601
601
  server_address, server_port = set_server_address_and_port(instance, "api.cohere.com", 443)
602
602
  request_model = kwargs.get("model", "command-r-plus")
603
603
 
604
- span_name = f"{SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT} {request_model}"
604
+ span_name = f"{SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT} {request_model}"
605
605
 
606
606
  awaited_wrapped = await wrapped(*args, **kwargs)
607
607
  span = tracer.start_span(span_name, kind=SpanKind.CLIENT)