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
@@ -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 dynamiq_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_DYNAMIQ)
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_DYNAMIQ)
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,32 +68,32 @@ def dynamiq_wrap(gen_ai_endpoint, version, environment, application_name,
68
68
  environment)
69
69
 
70
70
  if gen_ai_endpoint == "dynamiq.agent_run":
71
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_ID,
71
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_ID,
72
72
  getattr(instance, 'id', '') or '')
73
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_ROLE,
73
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_ROLE,
74
74
  getattr(instance, 'name', '') or '')
75
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
75
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
76
76
  getattr(getattr(instance, 'llm', None), 'model', '') or '')
77
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_TYPE,
77
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_TYPE,
78
78
  str(getattr(instance, 'type', '')) or '')
79
79
 
80
80
  elif gen_ai_endpoint == "dynamiq.workflow_run":
81
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_ID,
81
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_ID,
82
82
  getattr(instance, 'id', '') or '')
83
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
83
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
84
84
  getattr(getattr(instance.flow, 'nodes', [None])[0], 'model', 'default_model'))
85
85
 
86
86
  elif gen_ai_endpoint == "dynamiq.memory_add":
87
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
88
- SemanticConvetion.DB_OPERATION_ADD)
89
- span.set_attribute(SemanticConvetion.DB_METADATA, str(kwargs.get('metadata', '')))
87
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
88
+ SemanticConvention.DB_OPERATION_ADD)
89
+ span.set_attribute(SemanticConvention.DB_METADATA, str(kwargs.get('metadata', '')))
90
90
 
91
91
  elif gen_ai_endpoint == "dynamiq.memory_search":
92
92
  query_value = kwargs.get('query', '') or (args[0] if args else '')
93
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
94
- SemanticConvetion.DB_OPERATION_GET)
95
- span.set_attribute(SemanticConvetion.DB_FILTER, str(kwargs.get('filters', '')))
96
- span.set_attribute(SemanticConvetion.DB_STATEMENT, query_value)
93
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
94
+ SemanticConvention.DB_OPERATION_GET)
95
+ span.set_attribute(SemanticConvention.DB_FILTER, str(kwargs.get('filters', '')))
96
+ span.set_attribute(SemanticConvention.DB_STATEMENT, query_value)
97
97
 
98
98
  span.set_status(Status(StatusCode.OK))
99
99
 
@@ -4,7 +4,6 @@ Module for monitoring Ollama API calls.
4
4
 
5
5
  import logging
6
6
  import time
7
- from urllib.parse import urlparse
8
7
  from opentelemetry.trace import SpanKind, Status, StatusCode
9
8
  from opentelemetry.sdk.resources import SERVICE_NAME, TELEMETRY_SDK_NAME, DEPLOYMENT_ENVIRONMENT
10
9
  from openlit.__helpers import (
@@ -12,7 +11,7 @@ from openlit.__helpers import (
12
11
  handle_exception,
13
12
  create_metrics_attributes,
14
13
  )
15
- from openlit.semcov import SemanticConvetion
14
+ from openlit.semcov import SemanticConvention
16
15
 
17
16
  # Initialize logger for logging potential issues and operations
18
17
  logger = logging.getLogger(__name__)
@@ -50,11 +49,11 @@ def async_generate(gen_ai_endpoint, version, environment, application_name,
50
49
  Returns:
51
50
  The response from the original 'generate' method.
52
51
  """
53
- url = urlparse(instance._client_wrapper._base_url)
54
- server_address, server_port = url.hostname, url.port or 443
52
+
53
+ server_address, server_port = "api.elevenlabs.io", 443
55
54
  request_model = kwargs.get('model', kwargs.get('model_id', 'eleven_multilingual_v2'))
56
55
 
57
- span_name = f'{SemanticConvetion.GEN_AI_OPERATION_TYPE_AUDIO} {request_model}'
56
+ span_name = f'{SemanticConvention.GEN_AI_OPERATION_TYPE_AUDIO} {request_model}'
58
57
 
59
58
  with tracer.start_as_current_span(span_name, kind= SpanKind.CLIENT) as span:
60
59
  start_time = time.time()
@@ -68,48 +67,48 @@ def async_generate(gen_ai_endpoint, version, environment, application_name,
68
67
 
69
68
  # Set Span attributes
70
69
  span.set_attribute(TELEMETRY_SDK_NAME, 'openlit')
71
- span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
72
- SemanticConvetion.GEN_AI_OPERATION_TYPE_AUDIO)
73
- span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
74
- SemanticConvetion.GEN_AI_SYSTEM_ASSEMBLYAI)
75
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
70
+ span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
71
+ SemanticConvention.GEN_AI_OPERATION_TYPE_AUDIO)
72
+ span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
73
+ SemanticConvention.GEN_AI_SYSTEM_ASSEMBLYAI)
74
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
76
75
  request_model)
77
- span.set_attribute(SemanticConvetion.SERVER_ADDRESS,
76
+ span.set_attribute(SemanticConvention.SERVER_ADDRESS,
78
77
  server_address)
79
- span.set_attribute(SemanticConvetion.SERVER_PORT,
78
+ span.set_attribute(SemanticConvention.SERVER_PORT,
80
79
  server_port)
81
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_MODEL,
80
+ span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
82
81
  request_model)
83
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
82
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
84
83
  request_model)
85
- span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
84
+ span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
86
85
  'audio')
87
86
 
88
87
  # Set Span attributes (Extras)
89
88
  if gen_ai_endpoint == 'elevenlabs.generate':
90
89
  if isinstance(kwargs.get('voice', 'Rachel'), str):
91
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_AUDIO_VOICE,
90
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_AUDIO_VOICE,
92
91
  kwargs.get('voice', 'Rachel'))
93
92
  else:
94
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_AUDIO_VOICE,
93
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_AUDIO_VOICE,
95
94
  kwargs.get('voice_id', ''))
96
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_AUDIO_RESPONSE_FORMAT,
95
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_AUDIO_RESPONSE_FORMAT,
97
96
  kwargs.get('output_format', 'mp3'))
98
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_AUDIO_SETTINGS,
97
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_AUDIO_SETTINGS,
99
98
  str(kwargs.get('voice_settings', '')))
100
99
  span.set_attribute(DEPLOYMENT_ENVIRONMENT,
101
100
  environment)
102
101
  span.set_attribute(SERVICE_NAME,
103
102
  application_name)
104
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
103
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
105
104
  cost)
106
- span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
105
+ span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION,
107
106
  version)
108
107
  if capture_message_content:
109
108
  span.add_event(
110
- name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
109
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
111
110
  attributes={
112
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: str(kwargs.get('text', '')),
111
+ SemanticConvention.GEN_AI_CONTENT_PROMPT: str(kwargs.get('text', '')),
113
112
  },
114
113
  )
115
114
 
@@ -119,8 +118,8 @@ def async_generate(gen_ai_endpoint, version, environment, application_name,
119
118
  attributes = create_metrics_attributes(
120
119
  service_name=application_name,
121
120
  deployment_environment=environment,
122
- operation=SemanticConvetion.GEN_AI_OPERATION_TYPE_AUDIO,
123
- system=SemanticConvetion.GEN_AI_SYSTEM_ELEVENLABS,
121
+ operation=SemanticConvention.GEN_AI_OPERATION_TYPE_AUDIO,
122
+ system=SemanticConvention.GEN_AI_SYSTEM_ELEVENLABS,
124
123
  request_model=request_model,
125
124
  server_address=server_address,
126
125
  server_port=server_port,
@@ -4,7 +4,6 @@ Module for monitoring Ollama API calls.
4
4
 
5
5
  import logging
6
6
  import time
7
- from urllib.parse import urlparse
8
7
  from opentelemetry.trace import SpanKind, Status, StatusCode
9
8
  from opentelemetry.sdk.resources import SERVICE_NAME, TELEMETRY_SDK_NAME, DEPLOYMENT_ENVIRONMENT
10
9
  from openlit.__helpers import (
@@ -12,7 +11,7 @@ from openlit.__helpers import (
12
11
  handle_exception,
13
12
  create_metrics_attributes,
14
13
  )
15
- from openlit.semcov import SemanticConvetion
14
+ from openlit.semcov import SemanticConvention
16
15
 
17
16
  # Initialize logger for logging potential issues and operations
18
17
  logger = logging.getLogger(__name__)
@@ -51,11 +50,10 @@ def generate(gen_ai_endpoint, version, environment, application_name,
51
50
  The response from the original 'generate' method.
52
51
  """
53
52
 
54
- url = urlparse(instance._client_wrapper._base_url)
55
- server_address, server_port = url.hostname, url.port or 443
53
+ server_address, server_port = "api.elevenlabs.io", 443
56
54
  request_model = kwargs.get('model', kwargs.get('model_id', 'eleven_multilingual_v2'))
57
55
 
58
- span_name = f'{SemanticConvetion.GEN_AI_OPERATION_TYPE_AUDIO} {request_model}'
56
+ span_name = f'{SemanticConvention.GEN_AI_OPERATION_TYPE_AUDIO} {request_model}'
59
57
 
60
58
  with tracer.start_as_current_span(span_name, kind= SpanKind.CLIENT) as span:
61
59
  start_time = time.time()
@@ -69,48 +67,48 @@ def generate(gen_ai_endpoint, version, environment, application_name,
69
67
 
70
68
  # Set Span attributes
71
69
  span.set_attribute(TELEMETRY_SDK_NAME, 'openlit')
72
- span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
73
- SemanticConvetion.GEN_AI_OPERATION_TYPE_AUDIO)
74
- span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
75
- SemanticConvetion.GEN_AI_SYSTEM_ASSEMBLYAI)
76
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
70
+ span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
71
+ SemanticConvention.GEN_AI_OPERATION_TYPE_AUDIO)
72
+ span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
73
+ SemanticConvention.GEN_AI_SYSTEM_ASSEMBLYAI)
74
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
77
75
  request_model)
78
- span.set_attribute(SemanticConvetion.SERVER_ADDRESS,
76
+ span.set_attribute(SemanticConvention.SERVER_ADDRESS,
79
77
  server_address)
80
- span.set_attribute(SemanticConvetion.SERVER_PORT,
78
+ span.set_attribute(SemanticConvention.SERVER_PORT,
81
79
  server_port)
82
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_MODEL,
80
+ span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
83
81
  request_model)
84
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
82
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
85
83
  request_model)
86
- span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
84
+ span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
87
85
  'audio')
88
86
 
89
87
  # Set Span attributes (Extras)
90
88
  if gen_ai_endpoint == 'elevenlabs.generate':
91
89
  if isinstance(kwargs.get('voice', 'Rachel'), str):
92
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_AUDIO_VOICE,
90
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_AUDIO_VOICE,
93
91
  kwargs.get('voice', 'Rachel'))
94
92
  else:
95
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_AUDIO_VOICE,
93
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_AUDIO_VOICE,
96
94
  kwargs.get('voice_id', ''))
97
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_AUDIO_RESPONSE_FORMAT,
95
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_AUDIO_RESPONSE_FORMAT,
98
96
  kwargs.get('output_format', 'mp3'))
99
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_AUDIO_SETTINGS,
97
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_AUDIO_SETTINGS,
100
98
  str(kwargs.get('voice_settings', '')))
101
99
  span.set_attribute(DEPLOYMENT_ENVIRONMENT,
102
100
  environment)
103
101
  span.set_attribute(SERVICE_NAME,
104
102
  application_name)
105
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
103
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
106
104
  cost)
107
- span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
105
+ span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION,
108
106
  version)
109
107
  if capture_message_content:
110
108
  span.add_event(
111
- name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
109
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
112
110
  attributes={
113
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: str(kwargs.get('text', '')),
111
+ SemanticConvention.GEN_AI_CONTENT_PROMPT: str(kwargs.get('text', '')),
114
112
  },
115
113
  )
116
114
 
@@ -120,8 +118,8 @@ def generate(gen_ai_endpoint, version, environment, application_name,
120
118
  attributes = create_metrics_attributes(
121
119
  service_name=application_name,
122
120
  deployment_environment=environment,
123
- operation=SemanticConvetion.GEN_AI_OPERATION_TYPE_AUDIO,
124
- system=SemanticConvetion.GEN_AI_SYSTEM_ELEVENLABS,
121
+ operation=SemanticConvention.GEN_AI_OPERATION_TYPE_AUDIO,
122
+ system=SemanticConvention.GEN_AI_SYSTEM_ELEVENLABS,
125
123
  request_model=request_model,
126
124
  server_address=server_address,
127
125
  server_port=server_port,
@@ -7,7 +7,7 @@ import logging
7
7
  from opentelemetry.trace import SpanKind, Status, StatusCode
8
8
  from opentelemetry.sdk.resources import SERVICE_NAME, TELEMETRY_SDK_NAME, DEPLOYMENT_ENVIRONMENT
9
9
  from openlit.__helpers import handle_exception
10
- from openlit.semcov import SemanticConvetion
10
+ from openlit.semcov import SemanticConvention
11
11
 
12
12
  # Initialize logger for logging potential issues and operations
13
13
  logger = logging.getLogger(__name__)
@@ -59,21 +59,21 @@ def evaluate(gen_ai_endpoint, version, environment, application_name,
59
59
 
60
60
  try:
61
61
  span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
62
- span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
63
- SemanticConvetion.GEN_AI_SYSTEM_EMBEDCHAIN)
64
- span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
62
+ span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
63
+ SemanticConvention.GEN_AI_SYSTEM_EMBEDCHAIN)
64
+ span.set_attribute(SemanticConvention.GEN_AI_ENDPOINT,
65
65
  gen_ai_endpoint)
66
66
  span.set_attribute(DEPLOYMENT_ENVIRONMENT,
67
67
  environment)
68
- span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
69
- SemanticConvetion.GEN_AI_OPERATION_TYPE_FRAMEWORK)
68
+ span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
69
+ SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK)
70
70
  span.set_attribute(SERVICE_NAME,
71
71
  application_name)
72
- span.set_attribute(SemanticConvetion.GEN_AI_EVAL_CONTEXT_RELEVANCY,
72
+ span.set_attribute(SemanticConvention.GEN_AI_EVAL_CONTEXT_RELEVANCY,
73
73
  response["context_relevancy"])
74
- span.set_attribute(SemanticConvetion.GEN_AI_EVAL_ANSWER_RELEVANCY,
74
+ span.set_attribute(SemanticConvention.GEN_AI_EVAL_ANSWER_RELEVANCY,
75
75
  response["answer_relevancy"])
76
- span.set_attribute(SemanticConvetion.GEN_AI_EVAL_GROUNDEDNESS,
76
+ span.set_attribute(SemanticConvention.GEN_AI_EVAL_GROUNDEDNESS,
77
77
  response["groundedness"])
78
78
 
79
79
  span.set_status(Status(StatusCode.OK))
@@ -137,17 +137,17 @@ def get_data_sources(gen_ai_endpoint, version, environment, application_name,
137
137
 
138
138
  try:
139
139
  span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
140
- span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
141
- SemanticConvetion.GEN_AI_SYSTEM_EMBEDCHAIN)
142
- span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
140
+ span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
141
+ SemanticConvention.GEN_AI_SYSTEM_EMBEDCHAIN)
142
+ span.set_attribute(SemanticConvention.GEN_AI_ENDPOINT,
143
143
  gen_ai_endpoint)
144
144
  span.set_attribute(DEPLOYMENT_ENVIRONMENT,
145
145
  environment)
146
- span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
147
- SemanticConvetion.GEN_AI_OPERATION_TYPE_FRAMEWORK)
146
+ span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
147
+ SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK)
148
148
  span.set_attribute(SERVICE_NAME,
149
149
  application_name)
150
- span.set_attribute(SemanticConvetion.GEN_AI_DATA_SOURCES,
150
+ span.set_attribute(SemanticConvention.GEN_AI_DATA_SOURCES,
151
151
  len(response))
152
152
 
153
153
  span.set_status(Status(StatusCode.OK))
@@ -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,24 +56,24 @@ def wrap_crawl(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_FIRECRAWL)
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_FIRECRAWL)
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)
67
67
  span.set_attribute(DEPLOYMENT_ENVIRONMENT,
68
68
  environment)
69
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_TYPE,
70
- SemanticConvetion.GEN_AI_AGENT_TYPE_BROWSER)
71
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_PARAMS,
69
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_TYPE,
70
+ SemanticConvention.GEN_AI_AGENT_TYPE_BROWSER)
71
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_PARAMS,
72
72
  str(kwargs.get("params")))
73
73
 
74
74
  url = kwargs.get("url") if "url" in kwargs else str(args[0]) if args else None
75
75
  if url is not None:
76
- span.set_attribute(SemanticConvetion.GEN_AI_AGENT_BROWSE_URL, url)
76
+ span.set_attribute(SemanticConvention.GEN_AI_AGENT_BROWSE_URL, url)
77
77
 
78
78
  span.set_status(Status(StatusCode.OK))
79
79
 
@@ -13,7 +13,7 @@ from openlit.__helpers import (
13
13
  create_metrics_attributes,
14
14
  set_server_address_and_port
15
15
  )
16
- from openlit.semcov import SemanticConvetion
16
+ from openlit.semcov import SemanticConvention
17
17
 
18
18
  # Initialize logger for logging potential issues and operations
19
19
  logger = logging.getLogger(__name__)
@@ -56,7 +56,7 @@ def async_generate(version, environment, application_name,
56
56
  server_address, server_port = set_server_address_and_port(instance, "generativelanguage.googleapis.com", 443)
57
57
  request_model = kwargs.get("model", "gemini-2.0-flash")
58
58
 
59
- span_name = f"{SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT} {request_model}"
59
+ span_name = f"{SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT} {request_model}"
60
60
 
61
61
  with tracer.start_as_current_span(span_name, kind=SpanKind.CLIENT) as span:
62
62
  start_time = time.time()
@@ -110,26 +110,26 @@ def async_generate(version, environment, application_name,
110
110
 
111
111
  # Set base span attribues (OTel Semconv)
112
112
  span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
113
- span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
114
- SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT)
115
- span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
116
- SemanticConvetion.GEN_AI_SYSTEM_GEMINI)
117
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
113
+ span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
114
+ SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT)
115
+ span.set_attribute(SemanticConvention.GEN_AI_SYSTEM,
116
+ SemanticConvention.GEN_AI_SYSTEM_GEMINI)
117
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL,
118
118
  request_model)
119
- span.set_attribute(SemanticConvetion.SERVER_PORT,
119
+ span.set_attribute(SemanticConvention.SERVER_PORT,
120
120
  server_port)
121
121
 
122
122
  inference_config = kwargs.get('config', {})
123
123
 
124
124
  # List of attributes and their config keys
125
125
  attributes = [
126
- (SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY, 'frequency_penalty'),
127
- (SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS, 'max_tokens'),
128
- (SemanticConvetion.GEN_AI_REQUEST_PRESENCE_PENALTY, 'presence_penalty'),
129
- (SemanticConvetion.GEN_AI_REQUEST_STOP_SEQUENCES, 'stop_sequences'),
130
- (SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE, 'temperature'),
131
- (SemanticConvetion.GEN_AI_REQUEST_TOP_P, 'top_p'),
132
- (SemanticConvetion.GEN_AI_REQUEST_TOP_K, 'top_k'),
126
+ (SemanticConvention.GEN_AI_REQUEST_FREQUENCY_PENALTY, 'frequency_penalty'),
127
+ (SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS, 'max_tokens'),
128
+ (SemanticConvention.GEN_AI_REQUEST_PRESENCE_PENALTY, 'presence_penalty'),
129
+ (SemanticConvention.GEN_AI_REQUEST_STOP_SEQUENCES, 'stop_sequences'),
130
+ (SemanticConvention.GEN_AI_REQUEST_TEMPERATURE, 'temperature'),
131
+ (SemanticConvention.GEN_AI_REQUEST_TOP_P, 'top_p'),
132
+ (SemanticConvention.GEN_AI_REQUEST_TOP_K, 'top_k'),
133
133
  ]
134
134
 
135
135
  # Set each attribute if the corresponding value exists and is not None
@@ -139,15 +139,15 @@ def async_generate(version, environment, application_name,
139
139
  if value is not None:
140
140
  span.set_attribute(attribute, value)
141
141
 
142
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_MODEL,
142
+ span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL,
143
143
  response_dict.get('model_version'))
144
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_INPUT_TOKENS,
144
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS,
145
145
  input_tokens)
146
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_OUTPUT_TOKENS,
146
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS,
147
147
  output_tokens)
148
- span.set_attribute(SemanticConvetion.SERVER_ADDRESS,
148
+ span.set_attribute(SemanticConvention.SERVER_ADDRESS,
149
149
  server_address)
150
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
150
+ span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON,
151
151
  [str(response_dict.get('candidates')[0].get('finish_reason'))])
152
152
 
153
153
  # Set base span attribues (Extras)
@@ -155,35 +155,35 @@ def async_generate(version, environment, application_name,
155
155
  environment)
156
156
  span.set_attribute(SERVICE_NAME,
157
157
  application_name)
158
- span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
158
+ span.set_attribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM,
159
159
  False)
160
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
160
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_TOTAL_TOKENS,
161
161
  input_tokens + output_tokens)
162
- span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
162
+ span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST,
163
163
  cost)
164
- span.set_attribute(SemanticConvetion.GEN_AI_SERVER_TTFT,
164
+ span.set_attribute(SemanticConvention.GEN_AI_SERVER_TTFT,
165
165
  end_time - start_time)
166
- span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
166
+ span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION,
167
167
  version)
168
168
  if capture_message_content:
169
169
  span.add_event(
170
- name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
170
+ name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
171
171
  attributes={
172
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
172
+ SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
173
173
  },
174
174
  )
175
175
  span.add_event(
176
- name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
176
+ name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
177
177
  attributes={
178
- SemanticConvetion.GEN_AI_CONTENT_COMPLETION: response.text,
178
+ SemanticConvention.GEN_AI_CONTENT_COMPLETION: response.text,
179
179
  },
180
180
  )
181
181
 
182
182
  if isinstance(response_dict.get('text'), str):
183
- span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
183
+ span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
184
184
  "text")
185
185
  elif response_dict.get('text') is not None:
186
- span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
186
+ span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_TYPE,
187
187
  "json")
188
188
 
189
189
  span.set_status(Status(StatusCode.OK))
@@ -192,8 +192,8 @@ def async_generate(version, environment, application_name,
192
192
  attributes = create_metrics_attributes(
193
193
  service_name=application_name,
194
194
  deployment_environment=environment,
195
- operation=SemanticConvetion.GEN_AI_OPERATION_TYPE_CHAT,
196
- system=SemanticConvetion.GEN_AI_SYSTEM_GEMINI,
195
+ operation=SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT,
196
+ system=SemanticConvention.GEN_AI_SYSTEM_GEMINI,
197
197
  request_model=request_model,
198
198
  server_address=server_address,
199
199
  server_port=server_port,