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
@@ -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__)
@@ -71,168 +71,168 @@ def async_general_wrap(gen_ai_endpoint, version, environment, application_name,
71
71
 
72
72
  try:
73
73
  span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
74
- span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
74
+ span.set_attribute(SemanticConvention.GEN_AI_ENDPOINT,
75
75
  gen_ai_endpoint)
76
76
  span.set_attribute(DEPLOYMENT_ENVIRONMENT,
77
77
  environment)
78
78
  span.set_attribute(SERVICE_NAME,
79
79
  application_name)
80
- span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
81
- SemanticConvetion.GEN_AI_OPERATION_TYPE_VECTORDB)
82
- span.set_attribute(SemanticConvetion.DB_SYSTEM_NAME,
83
- SemanticConvetion.DB_SYSTEM_QDRANT)
80
+ span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
81
+ SemanticConvention.GEN_AI_OPERATION_TYPE_VECTORDB)
82
+ span.set_attribute(SemanticConvention.DB_SYSTEM_NAME,
83
+ SemanticConvention.DB_SYSTEM_QDRANT)
84
84
 
85
85
  if gen_ai_endpoint == "qdrant.create_collection":
86
- db_operation = SemanticConvetion.DB_OPERATION_CREATE_COLLECTION
87
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
88
- SemanticConvetion.DB_OPERATION_CREATE_COLLECTION)
89
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
86
+ db_operation = SemanticConvention.DB_OPERATION_CREATE_COLLECTION
87
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
88
+ SemanticConvention.DB_OPERATION_CREATE_COLLECTION)
89
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
90
90
  kwargs.get("collection_name", ""))
91
91
 
92
92
  elif gen_ai_endpoint == "qdrant.upload_collection":
93
- db_operation = SemanticConvetion.DB_OPERATION_CREATE_COLLECTION
94
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
95
- SemanticConvetion.DB_OPERATION_CREATE_COLLECTION)
96
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
93
+ db_operation = SemanticConvention.DB_OPERATION_CREATE_COLLECTION
94
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
95
+ SemanticConvention.DB_OPERATION_CREATE_COLLECTION)
96
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
97
97
  kwargs.get("collection_name", ""))
98
98
 
99
99
  elif gen_ai_endpoint == "qdrant.delete_collection":
100
- db_operation = SemanticConvetion.DB_OPERATION_DELETE_COLLECTION
101
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
102
- SemanticConvetion.DB_OPERATION_DELETE_COLLECTION)
103
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
100
+ db_operation = SemanticConvention.DB_OPERATION_DELETE_COLLECTION
101
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
102
+ SemanticConvention.DB_OPERATION_DELETE_COLLECTION)
103
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
104
104
  kwargs.get("collection_name", ""))
105
105
 
106
106
  elif gen_ai_endpoint == "qdrant.update_collection":
107
- db_operation = SemanticConvetion.DB_OPERATION_UPDATE_COLLECTION
108
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
109
- SemanticConvetion.DB_OPERATION_UPDATE_COLLECTION)
110
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
107
+ db_operation = SemanticConvention.DB_OPERATION_UPDATE_COLLECTION
108
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
109
+ SemanticConvention.DB_OPERATION_UPDATE_COLLECTION)
110
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
111
111
  kwargs.get("collection_name", ""))
112
112
 
113
113
  elif gen_ai_endpoint == "qdrant.set_payload":
114
- db_operation = SemanticConvetion.DB_OPERATION_ADD
115
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
116
- SemanticConvetion.DB_OPERATION_ADD)
117
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
114
+ db_operation = SemanticConvention.DB_OPERATION_ADD
115
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
116
+ SemanticConvention.DB_OPERATION_ADD)
117
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
118
118
  kwargs.get("collection_name", ""))
119
- span.set_attribute(SemanticConvetion.DB_OPERATION_STATUS,
119
+ span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
120
120
  response.status)
121
- span.set_attribute(SemanticConvetion.DB_VECTOR_COUNT,
121
+ span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
122
122
  object_count(kwargs.get("points", [])))
123
- span.set_attribute(SemanticConvetion.DB_PAYLOAD_COUNT,
123
+ span.set_attribute(SemanticConvention.DB_PAYLOAD_COUNT,
124
124
  object_count(kwargs.get("payload", [])))
125
125
 
126
126
  elif gen_ai_endpoint == "qdrant.retrieve":
127
- db_operation = SemanticConvetion.DB_OPERATION_QUERY
128
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
129
- SemanticConvetion.DB_OPERATION_QUERY)
130
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
127
+ db_operation = SemanticConvention.DB_OPERATION_QUERY
128
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
129
+ SemanticConvention.DB_OPERATION_QUERY)
130
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
131
131
  kwargs.get("collection_name", ""))
132
- span.set_attribute(SemanticConvetion.DB_STATEMENT,
132
+ span.set_attribute(SemanticConvention.DB_STATEMENT,
133
133
  str(kwargs.get("ids", "")))
134
134
 
135
135
  elif gen_ai_endpoint == "qdrant.scroll":
136
- db_operation = SemanticConvetion.DB_OPERATION_QUERY
137
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
138
- SemanticConvetion.DB_OPERATION_QUERY)
139
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
136
+ db_operation = SemanticConvention.DB_OPERATION_QUERY
137
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
138
+ SemanticConvention.DB_OPERATION_QUERY)
139
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
140
140
  kwargs.get("collection_name", ""))
141
- span.set_attribute(SemanticConvetion.DB_STATEMENT,
141
+ span.set_attribute(SemanticConvention.DB_STATEMENT,
142
142
  str(kwargs.get("scroll_filter", "")))
143
143
 
144
144
  elif gen_ai_endpoint in ["qdrant.search", "qdrant.search_groups"]:
145
- db_operation = SemanticConvetion.DB_OPERATION_QUERY
146
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
147
- SemanticConvetion.DB_OPERATION_QUERY)
148
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
145
+ db_operation = SemanticConvention.DB_OPERATION_QUERY
146
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
147
+ SemanticConvention.DB_OPERATION_QUERY)
148
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
149
149
  kwargs.get("collection_name", ""))
150
- span.set_attribute(SemanticConvetion.DB_STATEMENT,
150
+ span.set_attribute(SemanticConvention.DB_STATEMENT,
151
151
  str(kwargs.get("query_vector", "")))
152
152
 
153
153
  elif gen_ai_endpoint == "qdrant.recommend":
154
- db_operation = SemanticConvetion.DB_OPERATION_QUERY
155
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
156
- SemanticConvetion.DB_OPERATION_QUERY)
157
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
154
+ db_operation = SemanticConvention.DB_OPERATION_QUERY
155
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
156
+ SemanticConvention.DB_OPERATION_QUERY)
157
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
158
158
  kwargs.get("collection_name", ""))
159
- span.set_attribute(SemanticConvetion.DB_STATEMENT,
159
+ span.set_attribute(SemanticConvention.DB_STATEMENT,
160
160
  "positive:" + str(kwargs.get("positive", "")) +
161
161
  " negative:" + str(kwargs.get("negative", "")))
162
162
 
163
163
  elif gen_ai_endpoint == "qdrant.upload_points":
164
- db_operation = SemanticConvetion.DB_OPERATION_ADD
165
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
166
- SemanticConvetion.DB_OPERATION_ADD)
167
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
164
+ db_operation = SemanticConvention.DB_OPERATION_ADD
165
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
166
+ SemanticConvention.DB_OPERATION_ADD)
167
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
168
168
  kwargs.get("collection_name", ""))
169
- span.set_attribute(SemanticConvetion.DB_VECTOR_COUNT,
169
+ span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
170
170
  object_count(kwargs.get("points")))
171
171
 
172
172
  elif gen_ai_endpoint == "qdrant.update_vectors":
173
- db_operation = SemanticConvetion.DB_OPERATION_UPDATE
174
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
175
- SemanticConvetion.DB_OPERATION_UPDATE)
176
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
173
+ db_operation = SemanticConvention.DB_OPERATION_UPDATE
174
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
175
+ SemanticConvention.DB_OPERATION_UPDATE)
176
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
177
177
  kwargs.get("collection_name", ""))
178
- span.set_attribute(SemanticConvetion.DB_OPERATION_STATUS,
178
+ span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
179
179
  response.status)
180
- span.set_attribute(SemanticConvetion.DB_VECTOR_COUNT,
180
+ span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
181
181
  object_count(kwargs.get("points")))
182
182
 
183
183
  elif gen_ai_endpoint == "qdrant.overwrite_payload":
184
- db_operation = SemanticConvetion.DB_OPERATION_UPDATE
185
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
186
- SemanticConvetion.DB_OPERATION_UPDATE)
187
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
184
+ db_operation = SemanticConvention.DB_OPERATION_UPDATE
185
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
186
+ SemanticConvention.DB_OPERATION_UPDATE)
187
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
188
188
  kwargs.get("collection_name", ""))
189
- span.set_attribute(SemanticConvetion.DB_OPERATION_STATUS,
189
+ span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
190
190
  response.status)
191
- span.set_attribute(SemanticConvetion.DB_VECTOR_COUNT,
191
+ span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
192
192
  object_count(kwargs.get("points")))
193
- span.set_attribute(SemanticConvetion.DB_PAYLOAD_COUNT,
193
+ span.set_attribute(SemanticConvention.DB_PAYLOAD_COUNT,
194
194
  object_count(kwargs.get("payload")))
195
195
 
196
196
  elif gen_ai_endpoint == "qdrant.upsert":
197
- db_operation = SemanticConvetion.DB_OPERATION_UPSERT
198
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
197
+ db_operation = SemanticConvention.DB_OPERATION_UPSERT
198
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
199
199
  kwargs.get("collection_name", ""))
200
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
201
- SemanticConvetion.DB_OPERATION_UPSERT)
202
- span.set_attribute(SemanticConvetion.DB_OPERATION_STATUS,
200
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
201
+ SemanticConvention.DB_OPERATION_UPSERT)
202
+ span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
203
203
  response.status)
204
- span.set_attribute(SemanticConvetion.DB_VECTOR_COUNT,
204
+ span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
205
205
  object_count(kwargs.get("points")))
206
206
 
207
207
  elif gen_ai_endpoint in ["qdrant.delete_payload", "qdrant.delete_vectors"]:
208
- db_operation = SemanticConvetion.DB_OPERATION_DELETE
209
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
210
- SemanticConvetion.DB_OPERATION_DELETE)
211
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
208
+ db_operation = SemanticConvention.DB_OPERATION_DELETE
209
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
210
+ SemanticConvention.DB_OPERATION_DELETE)
211
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
212
212
  kwargs.get("collection_name", ""))
213
- span.set_attribute(SemanticConvetion.DB_OPERATION_STATUS,
213
+ span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
214
214
  response.status)
215
- span.set_attribute(SemanticConvetion.DB_VECTOR_COUNT,
215
+ span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
216
216
  object_count(kwargs.get("points")))
217
217
 
218
218
  elif gen_ai_endpoint in ["qdrant.clear_payload", "qdrant.delete"]:
219
- db_operation = SemanticConvetion.DB_OPERATION_DELETE
220
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
221
- SemanticConvetion.DB_OPERATION_DELETE)
222
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
219
+ db_operation = SemanticConvention.DB_OPERATION_DELETE
220
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
221
+ SemanticConvention.DB_OPERATION_DELETE)
222
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
223
223
  kwargs.get("collection_name", ""))
224
- span.set_attribute(SemanticConvetion.DB_OPERATION_STATUS,
224
+ span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
225
225
  response.status)
226
- span.set_attribute(SemanticConvetion.DB_VECTOR_COUNT,
226
+ span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
227
227
  object_count(kwargs.get("points_selector")))
228
228
 
229
229
  elif gen_ai_endpoint == "qdrant.create_payload_index":
230
- db_operation = SemanticConvetion.DB_OPERATION_CREATE_INDEX
231
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
232
- SemanticConvetion.DB_OPERATION_CREATE_INDEX)
233
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
230
+ db_operation = SemanticConvention.DB_OPERATION_CREATE_INDEX
231
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
232
+ SemanticConvention.DB_OPERATION_CREATE_INDEX)
233
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
234
234
  kwargs.get("collection_name", ""))
235
- span.set_attribute(SemanticConvetion.DB_STATEMENT,
235
+ span.set_attribute(SemanticConvention.DB_STATEMENT,
236
236
  str(kwargs.get("query", "")))
237
237
 
238
238
  span.set_status(Status(StatusCode.OK))
@@ -243,13 +243,13 @@ def async_general_wrap(gen_ai_endpoint, version, environment, application_name,
243
243
  "openlit",
244
244
  SERVICE_NAME:
245
245
  application_name,
246
- SemanticConvetion.DB_SYSTEM_NAME:
247
- SemanticConvetion.DB_SYSTEM_QDRANT,
246
+ SemanticConvention.DB_SYSTEM_NAME:
247
+ SemanticConvention.DB_SYSTEM_QDRANT,
248
248
  DEPLOYMENT_ENVIRONMENT:
249
249
  environment,
250
- SemanticConvetion.GEN_AI_OPERATION:
251
- SemanticConvetion.GEN_AI_OPERATION_TYPE_VECTORDB,
252
- SemanticConvetion.DB_OPERATION_NAME:
250
+ SemanticConvention.GEN_AI_OPERATION:
251
+ SemanticConvention.GEN_AI_OPERATION_TYPE_VECTORDB,
252
+ SemanticConvention.DB_OPERATION_NAME:
253
253
  db_operation
254
254
  }
255
255
 
@@ -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__)
@@ -71,175 +71,175 @@ def general_wrap(gen_ai_endpoint, version, environment, application_name,
71
71
 
72
72
  try:
73
73
  span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
74
- span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
74
+ span.set_attribute(SemanticConvention.GEN_AI_ENDPOINT,
75
75
  gen_ai_endpoint)
76
76
  span.set_attribute(DEPLOYMENT_ENVIRONMENT,
77
77
  environment)
78
78
  span.set_attribute(SERVICE_NAME,
79
79
  application_name)
80
- span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
81
- SemanticConvetion.GEN_AI_OPERATION_TYPE_VECTORDB)
82
- span.set_attribute(SemanticConvetion.DB_SYSTEM_NAME,
83
- SemanticConvetion.DB_SYSTEM_QDRANT)
80
+ span.set_attribute(SemanticConvention.GEN_AI_OPERATION,
81
+ SemanticConvention.GEN_AI_OPERATION_TYPE_VECTORDB)
82
+ span.set_attribute(SemanticConvention.DB_SYSTEM_NAME,
83
+ SemanticConvention.DB_SYSTEM_QDRANT)
84
84
 
85
85
  if gen_ai_endpoint == "qdrant.create_collection":
86
- db_operation = SemanticConvetion.DB_OPERATION_CREATE_COLLECTION
87
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
88
- SemanticConvetion.DB_OPERATION_CREATE_COLLECTION)
89
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
86
+ db_operation = SemanticConvention.DB_OPERATION_CREATE_COLLECTION
87
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
88
+ SemanticConvention.DB_OPERATION_CREATE_COLLECTION)
89
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
90
90
  kwargs.get("collection_name", ""))
91
91
 
92
92
  elif gen_ai_endpoint == "qdrant.upload_collection":
93
- db_operation = SemanticConvetion.DB_OPERATION_CREATE_COLLECTION
94
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
95
- SemanticConvetion.DB_OPERATION_CREATE_COLLECTION)
96
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
93
+ db_operation = SemanticConvention.DB_OPERATION_CREATE_COLLECTION
94
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
95
+ SemanticConvention.DB_OPERATION_CREATE_COLLECTION)
96
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
97
97
  kwargs.get("collection_name", ""))
98
98
 
99
99
  elif gen_ai_endpoint == "qdrant.delete_collection":
100
- db_operation = SemanticConvetion.DB_OPERATION_DELETE_COLLECTION
101
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
102
- SemanticConvetion.DB_OPERATION_DELETE_COLLECTION)
103
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
100
+ db_operation = SemanticConvention.DB_OPERATION_DELETE_COLLECTION
101
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
102
+ SemanticConvention.DB_OPERATION_DELETE_COLLECTION)
103
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
104
104
  kwargs.get("collection_name", ""))
105
105
 
106
106
  elif gen_ai_endpoint == "qdrant.update_collection":
107
- db_operation = SemanticConvetion.DB_OPERATION_UPDATE_COLLECTION
108
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
109
- SemanticConvetion.DB_OPERATION_UPDATE_COLLECTION)
110
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
107
+ db_operation = SemanticConvention.DB_OPERATION_UPDATE_COLLECTION
108
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
109
+ SemanticConvention.DB_OPERATION_UPDATE_COLLECTION)
110
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
111
111
  kwargs.get("collection_name", ""))
112
112
 
113
113
  elif gen_ai_endpoint == "qdrant.set_payload":
114
- db_operation = SemanticConvetion.DB_OPERATION_ADD
115
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
116
- SemanticConvetion.DB_OPERATION_ADD)
117
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
114
+ db_operation = SemanticConvention.DB_OPERATION_ADD
115
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
116
+ SemanticConvention.DB_OPERATION_ADD)
117
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
118
118
  kwargs.get("collection_name", ""))
119
- span.set_attribute(SemanticConvetion.DB_OPERATION_STATUS,
119
+ span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
120
120
  response.status)
121
- span.set_attribute(SemanticConvetion.DB_VECTOR_COUNT,
121
+ span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
122
122
  object_count(kwargs.get("points", [])))
123
- span.set_attribute(SemanticConvetion.DB_PAYLOAD_COUNT,
123
+ span.set_attribute(SemanticConvention.DB_PAYLOAD_COUNT,
124
124
  object_count(kwargs.get("payload", [])))
125
125
 
126
126
  elif gen_ai_endpoint == "qdrant.retrieve":
127
- db_operation = SemanticConvetion.DB_OPERATION_QUERY
128
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
129
- SemanticConvetion.DB_OPERATION_QUERY)
130
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
127
+ db_operation = SemanticConvention.DB_OPERATION_QUERY
128
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
129
+ SemanticConvention.DB_OPERATION_QUERY)
130
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
131
131
  kwargs.get("collection_name", ""))
132
- span.set_attribute(SemanticConvetion.DB_STATEMENT,
132
+ span.set_attribute(SemanticConvention.DB_STATEMENT,
133
133
  str(kwargs.get("ids", "")))
134
134
 
135
135
  elif gen_ai_endpoint == "qdrant.scroll":
136
- db_operation = SemanticConvetion.DB_OPERATION_QUERY
137
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
138
- SemanticConvetion.DB_OPERATION_QUERY)
139
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
136
+ db_operation = SemanticConvention.DB_OPERATION_QUERY
137
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
138
+ SemanticConvention.DB_OPERATION_QUERY)
139
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
140
140
  kwargs.get("collection_name", ""))
141
- span.set_attribute(SemanticConvetion.DB_STATEMENT,
141
+ span.set_attribute(SemanticConvention.DB_STATEMENT,
142
142
  str(kwargs.get("scroll_filter", "")))
143
143
 
144
144
  elif gen_ai_endpoint in ["qdrant.search", "qdrant.search_groups"]:
145
- db_operation = SemanticConvetion.DB_OPERATION_QUERY
146
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
147
- SemanticConvetion.DB_OPERATION_QUERY)
148
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
145
+ db_operation = SemanticConvention.DB_OPERATION_QUERY
146
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
147
+ SemanticConvention.DB_OPERATION_QUERY)
148
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
149
149
  kwargs.get("collection_name", ""))
150
- span.set_attribute(SemanticConvetion.DB_STATEMENT,
150
+ span.set_attribute(SemanticConvention.DB_STATEMENT,
151
151
  str(kwargs.get("query_vector", "")))
152
152
 
153
153
  elif gen_ai_endpoint == "qdrant.recommend":
154
- db_operation = SemanticConvetion.DB_OPERATION_QUERY
155
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
156
- SemanticConvetion.DB_OPERATION_QUERY)
157
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
154
+ db_operation = SemanticConvention.DB_OPERATION_QUERY
155
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
156
+ SemanticConvention.DB_OPERATION_QUERY)
157
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
158
158
  kwargs.get("collection_name", ""))
159
- span.set_attribute(SemanticConvetion.DB_STATEMENT,
159
+ span.set_attribute(SemanticConvention.DB_STATEMENT,
160
160
  "positive:" + str(kwargs.get("positive", "")) +
161
161
  " negative:" + str(kwargs.get("negative", "")))
162
162
 
163
163
  elif gen_ai_endpoint == "qdrant.upload_points":
164
- db_operation = SemanticConvetion.DB_OPERATION_ADD
165
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
166
- SemanticConvetion.DB_OPERATION_ADD)
167
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
164
+ db_operation = SemanticConvention.DB_OPERATION_ADD
165
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
166
+ SemanticConvention.DB_OPERATION_ADD)
167
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
168
168
  kwargs.get("collection_name", ""))
169
- span.set_attribute(SemanticConvetion.DB_VECTOR_COUNT,
169
+ span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
170
170
  object_count(kwargs.get("points")))
171
171
 
172
172
  elif gen_ai_endpoint == "qdrant.update_vectors":
173
- db_operation = SemanticConvetion.DB_OPERATION_UPDATE
174
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
175
- SemanticConvetion.DB_OPERATION_UPDATE)
176
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
173
+ db_operation = SemanticConvention.DB_OPERATION_UPDATE
174
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
175
+ SemanticConvention.DB_OPERATION_UPDATE)
176
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
177
177
  kwargs.get("collection_name", ""))
178
- span.set_attribute(SemanticConvetion.DB_OPERATION_STATUS,
178
+ span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
179
179
  response.status)
180
- span.set_attribute(SemanticConvetion.DB_VECTOR_COUNT,
180
+ span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
181
181
  object_count(kwargs.get("points")))
182
182
 
183
183
  elif gen_ai_endpoint == "qdrant.overwrite_payload":
184
- db_operation = SemanticConvetion.DB_OPERATION_UPDATE
185
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
186
- SemanticConvetion.DB_OPERATION_UPDATE)
187
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
184
+ db_operation = SemanticConvention.DB_OPERATION_UPDATE
185
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
186
+ SemanticConvention.DB_OPERATION_UPDATE)
187
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
188
188
  kwargs.get("collection_name", ""))
189
- span.set_attribute(SemanticConvetion.DB_OPERATION_STATUS,
189
+ span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
190
190
  response.status)
191
- span.set_attribute(SemanticConvetion.DB_VECTOR_COUNT,
191
+ span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
192
192
  object_count(kwargs.get("points")))
193
- span.set_attribute(SemanticConvetion.DB_PAYLOAD_COUNT,
193
+ span.set_attribute(SemanticConvention.DB_PAYLOAD_COUNT,
194
194
  object_count(kwargs.get("payload")))
195
195
 
196
196
  elif gen_ai_endpoint == "qdrant.upsert":
197
- db_operation = SemanticConvetion.DB_OPERATION_UPSERT
198
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
197
+ db_operation = SemanticConvention.DB_OPERATION_UPSERT
198
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
199
199
  kwargs.get("collection_name", ""))
200
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
201
- SemanticConvetion.DB_OPERATION_UPSERT)
202
- span.set_attribute(SemanticConvetion.DB_OPERATION_STATUS,
200
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
201
+ SemanticConvention.DB_OPERATION_UPSERT)
202
+ span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
203
203
  response.status)
204
- span.set_attribute(SemanticConvetion.DB_VECTOR_COUNT,
204
+ span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
205
205
  object_count(kwargs.get("points")))
206
206
 
207
207
  elif gen_ai_endpoint in ["qdrant.delete_payload", "qdrant.delete_vectors"]:
208
- db_operation = SemanticConvetion.DB_OPERATION_DELETE
209
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
210
- SemanticConvetion.DB_OPERATION_DELETE)
211
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
208
+ db_operation = SemanticConvention.DB_OPERATION_DELETE
209
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
210
+ SemanticConvention.DB_OPERATION_DELETE)
211
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
212
212
  kwargs.get("collection_name", ""))
213
- span.set_attribute(SemanticConvetion.DB_OPERATION_STATUS,
213
+ span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
214
214
  response.status)
215
- span.set_attribute(SemanticConvetion.DB_VECTOR_COUNT,
215
+ span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
216
216
  object_count(kwargs.get("points")))
217
217
 
218
218
  elif gen_ai_endpoint in ["qdrant.clear_payload", "qdrant.delete"]:
219
- db_operation = SemanticConvetion.DB_OPERATION_DELETE
220
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
221
- SemanticConvetion.DB_OPERATION_DELETE)
222
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
219
+ db_operation = SemanticConvention.DB_OPERATION_DELETE
220
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
221
+ SemanticConvention.DB_OPERATION_DELETE)
222
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
223
223
  kwargs.get("collection_name", ""))
224
- span.set_attribute(SemanticConvetion.DB_OPERATION_STATUS,
224
+ span.set_attribute(SemanticConvention.DB_OPERATION_STATUS,
225
225
  response.status)
226
- span.set_attribute(SemanticConvetion.DB_VECTOR_COUNT,
226
+ span.set_attribute(SemanticConvention.DB_VECTOR_COUNT,
227
227
  object_count(kwargs.get("points_selector")))
228
228
 
229
229
  elif gen_ai_endpoint == "qdrant.create_payload_index":
230
- db_operation = SemanticConvetion.DB_OPERATION_CREATE_INDEX
231
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
232
- SemanticConvetion.DB_OPERATION_CREATE_INDEX)
233
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
230
+ db_operation = SemanticConvention.DB_OPERATION_CREATE_INDEX
231
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
232
+ SemanticConvention.DB_OPERATION_CREATE_INDEX)
233
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
234
234
  kwargs.get("collection_name", ""))
235
235
 
236
236
  elif gen_ai_endpoint == "qdrant.query_points":
237
- db_operation = SemanticConvetion.DB_OPERATION_QUERY
238
- span.set_attribute(SemanticConvetion.DB_OPERATION_NAME,
239
- SemanticConvetion.DB_OPERATION_QUERY)
240
- span.set_attribute(SemanticConvetion.DB_COLLECTION_NAME,
237
+ db_operation = SemanticConvention.DB_OPERATION_QUERY
238
+ span.set_attribute(SemanticConvention.DB_OPERATION_NAME,
239
+ SemanticConvention.DB_OPERATION_QUERY)
240
+ span.set_attribute(SemanticConvention.DB_COLLECTION_NAME,
241
241
  kwargs.get("collection_name", ""))
242
- span.set_attribute(SemanticConvetion.DB_STATEMENT,
242
+ span.set_attribute(SemanticConvention.DB_STATEMENT,
243
243
  str(kwargs.get("query", "")))
244
244
 
245
245
  span.set_status(Status(StatusCode.OK))
@@ -250,13 +250,13 @@ def general_wrap(gen_ai_endpoint, version, environment, application_name,
250
250
  "openlit",
251
251
  SERVICE_NAME:
252
252
  application_name,
253
- SemanticConvetion.DB_SYSTEM_NAME:
254
- SemanticConvetion.DB_SYSTEM_QDRANT,
253
+ SemanticConvention.DB_SYSTEM_NAME:
254
+ SemanticConvention.DB_SYSTEM_QDRANT,
255
255
  DEPLOYMENT_ENVIRONMENT:
256
256
  environment,
257
- SemanticConvetion.GEN_AI_OPERATION:
258
- SemanticConvetion.GEN_AI_OPERATION_TYPE_VECTORDB,
259
- SemanticConvetion.DB_OPERATION_NAME:
257
+ SemanticConvention.GEN_AI_OPERATION:
258
+ SemanticConvention.GEN_AI_OPERATION_TYPE_VECTORDB,
259
+ SemanticConvention.DB_OPERATION_NAME:
260
260
  db_operation
261
261
  }
262
262