openlit 1.33.8__py3-none-any.whl → 1.33.9__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.
- openlit/__helpers.py +83 -0
- openlit/__init__.py +1 -1
- openlit/instrumentation/ag2/ag2.py +2 -2
- openlit/instrumentation/ai21/__init__.py +4 -4
- openlit/instrumentation/ai21/ai21.py +370 -319
- openlit/instrumentation/ai21/async_ai21.py +371 -319
- openlit/instrumentation/anthropic/__init__.py +4 -4
- openlit/instrumentation/anthropic/anthropic.py +321 -189
- openlit/instrumentation/anthropic/async_anthropic.py +323 -190
- openlit/instrumentation/assemblyai/__init__.py +1 -1
- openlit/instrumentation/assemblyai/assemblyai.py +59 -43
- openlit/instrumentation/astra/astra.py +4 -4
- openlit/instrumentation/astra/async_astra.py +4 -4
- openlit/instrumentation/azure_ai_inference/__init__.py +4 -4
- openlit/instrumentation/azure_ai_inference/async_azure_ai_inference.py +406 -252
- openlit/instrumentation/azure_ai_inference/azure_ai_inference.py +406 -252
- openlit/instrumentation/bedrock/__init__.py +1 -1
- openlit/instrumentation/bedrock/bedrock.py +115 -58
- openlit/instrumentation/chroma/chroma.py +4 -4
- openlit/instrumentation/cohere/__init__.py +33 -10
- openlit/instrumentation/cohere/async_cohere.py +610 -0
- openlit/instrumentation/cohere/cohere.py +410 -219
- openlit/instrumentation/controlflow/controlflow.py +2 -2
- openlit/instrumentation/crawl4ai/async_crawl4ai.py +2 -2
- openlit/instrumentation/crawl4ai/crawl4ai.py +2 -2
- openlit/instrumentation/crewai/crewai.py +2 -2
- openlit/instrumentation/dynamiq/dynamiq.py +2 -2
- openlit/instrumentation/elevenlabs/async_elevenlabs.py +73 -47
- openlit/instrumentation/elevenlabs/elevenlabs.py +73 -52
- openlit/instrumentation/embedchain/embedchain.py +4 -4
- openlit/instrumentation/firecrawl/firecrawl.py +2 -2
- openlit/instrumentation/google_ai_studio/__init__.py +9 -9
- openlit/instrumentation/google_ai_studio/async_google_ai_studio.py +183 -219
- openlit/instrumentation/google_ai_studio/google_ai_studio.py +183 -220
- openlit/instrumentation/gpt4all/gpt4all.py +17 -17
- openlit/instrumentation/groq/async_groq.py +14 -14
- openlit/instrumentation/groq/groq.py +14 -14
- openlit/instrumentation/haystack/haystack.py +2 -2
- openlit/instrumentation/julep/async_julep.py +2 -2
- openlit/instrumentation/julep/julep.py +2 -2
- openlit/instrumentation/langchain/langchain.py +36 -31
- openlit/instrumentation/letta/letta.py +6 -6
- openlit/instrumentation/litellm/async_litellm.py +20 -20
- openlit/instrumentation/litellm/litellm.py +20 -20
- openlit/instrumentation/llamaindex/llamaindex.py +2 -2
- openlit/instrumentation/mem0/mem0.py +2 -2
- openlit/instrumentation/milvus/milvus.py +4 -4
- openlit/instrumentation/mistral/async_mistral.py +18 -18
- openlit/instrumentation/mistral/mistral.py +18 -18
- openlit/instrumentation/multion/async_multion.py +2 -2
- openlit/instrumentation/multion/multion.py +2 -2
- openlit/instrumentation/ollama/async_ollama.py +29 -29
- openlit/instrumentation/ollama/ollama.py +29 -29
- openlit/instrumentation/openai/__init__.py +11 -230
- openlit/instrumentation/openai/async_openai.py +434 -409
- openlit/instrumentation/openai/openai.py +415 -393
- openlit/instrumentation/phidata/phidata.py +2 -2
- openlit/instrumentation/pinecone/pinecone.py +4 -4
- openlit/instrumentation/premai/premai.py +20 -20
- openlit/instrumentation/qdrant/async_qdrant.py +4 -4
- openlit/instrumentation/qdrant/qdrant.py +4 -4
- openlit/instrumentation/reka/async_reka.py +6 -6
- openlit/instrumentation/reka/reka.py +6 -6
- openlit/instrumentation/together/async_together.py +18 -18
- openlit/instrumentation/together/together.py +18 -18
- openlit/instrumentation/transformers/transformers.py +6 -6
- openlit/instrumentation/vertexai/async_vertexai.py +53 -53
- openlit/instrumentation/vertexai/vertexai.py +53 -53
- openlit/instrumentation/vllm/vllm.py +6 -6
- openlit/otel/metrics.py +98 -7
- openlit/semcov/__init__.py +113 -80
- {openlit-1.33.8.dist-info → openlit-1.33.9.dist-info}/METADATA +1 -1
- openlit-1.33.9.dist-info/RECORD +121 -0
- {openlit-1.33.8.dist-info → openlit-1.33.9.dist-info}/WHEEL +1 -1
- openlit/instrumentation/openai/async_azure_openai.py +0 -900
- openlit/instrumentation/openai/azure_openai.py +0 -898
- openlit-1.33.8.dist-info/RECORD +0 -122
- {openlit-1.33.8.dist-info → openlit-1.33.9.dist-info}/LICENSE +0 -0
@@ -5,20 +5,12 @@ import importlib.metadata
|
|
5
5
|
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
6
6
|
from wrapt import wrap_function_wrapper
|
7
7
|
|
8
|
-
from openlit.instrumentation.openai.openai import chat_completions, embedding
|
8
|
+
from openlit.instrumentation.openai.openai import chat_completions, embedding
|
9
9
|
from openlit.instrumentation.openai.openai import image_generate, image_variatons, audio_create
|
10
10
|
from openlit.instrumentation.openai.async_openai import async_chat_completions, async_embedding
|
11
|
-
from openlit.instrumentation.openai.async_openai import async_finetune
|
12
11
|
from openlit.instrumentation.openai.async_openai import async_image_generate, async_image_variatons
|
13
12
|
from openlit.instrumentation.openai.async_openai import async_audio_create
|
14
13
|
|
15
|
-
from openlit.instrumentation.openai.azure_openai import azure_chat_completions, azure_completions
|
16
|
-
from openlit.instrumentation.openai.azure_openai import azure_image_generate, azure_embedding
|
17
|
-
from openlit.instrumentation.openai.async_azure_openai import azure_async_chat_completions
|
18
|
-
from openlit.instrumentation.openai.async_azure_openai import azure_async_completions
|
19
|
-
from openlit.instrumentation.openai.async_azure_openai import azure_async_image_generate
|
20
|
-
from openlit.instrumentation.openai.async_azure_openai import azure_async_embedding
|
21
|
-
|
22
14
|
_instruments = ("openai >= 1.1.1",)
|
23
15
|
|
24
16
|
class OpenAIInstrumentor(BaseInstrumentor):
|
@@ -40,7 +32,7 @@ class OpenAIInstrumentor(BaseInstrumentor):
|
|
40
32
|
wrap_function_wrapper(
|
41
33
|
"openai.resources.chat.completions",
|
42
34
|
"Completions.create",
|
43
|
-
|
35
|
+
chat_completions(version, environment, application_name,
|
44
36
|
tracer, pricing_info, trace_content,
|
45
37
|
metrics, disable_metrics),
|
46
38
|
)
|
@@ -48,7 +40,7 @@ class OpenAIInstrumentor(BaseInstrumentor):
|
|
48
40
|
wrap_function_wrapper(
|
49
41
|
"openai.resources.chat.completions",
|
50
42
|
"AsyncCompletions.create",
|
51
|
-
|
43
|
+
async_chat_completions(version, environment, application_name,
|
52
44
|
tracer, pricing_info, trace_content,
|
53
45
|
metrics, disable_metrics),
|
54
46
|
)
|
@@ -56,7 +48,7 @@ class OpenAIInstrumentor(BaseInstrumentor):
|
|
56
48
|
wrap_function_wrapper(
|
57
49
|
"openai.resources.images",
|
58
50
|
"Images.generate",
|
59
|
-
|
51
|
+
image_generate(version, environment, application_name,
|
60
52
|
tracer, pricing_info, trace_content,
|
61
53
|
metrics, disable_metrics),
|
62
54
|
)
|
@@ -64,7 +56,7 @@ class OpenAIInstrumentor(BaseInstrumentor):
|
|
64
56
|
wrap_function_wrapper(
|
65
57
|
"openai.resources.images",
|
66
58
|
"AsyncImages.generate",
|
67
|
-
|
59
|
+
async_image_generate(version, environment, application_name,
|
68
60
|
tracer, pricing_info, trace_content,
|
69
61
|
metrics, disable_metrics),
|
70
62
|
)
|
@@ -72,7 +64,7 @@ class OpenAIInstrumentor(BaseInstrumentor):
|
|
72
64
|
wrap_function_wrapper(
|
73
65
|
"openai.resources.embeddings",
|
74
66
|
"Embeddings.create",
|
75
|
-
|
67
|
+
embedding(version, environment, application_name,
|
76
68
|
tracer, pricing_info, trace_content,
|
77
69
|
metrics, disable_metrics),
|
78
70
|
)
|
@@ -80,24 +72,7 @@ class OpenAIInstrumentor(BaseInstrumentor):
|
|
80
72
|
wrap_function_wrapper(
|
81
73
|
"openai.resources.embeddings",
|
82
74
|
"AsyncEmbeddings.create",
|
83
|
-
|
84
|
-
tracer, pricing_info, trace_content,
|
85
|
-
metrics, disable_metrics),
|
86
|
-
)
|
87
|
-
|
88
|
-
wrap_function_wrapper(
|
89
|
-
"openai.resources.completions",
|
90
|
-
"Completions.create",
|
91
|
-
azure_completions("azure_openai.completions", version, environment, application_name,
|
92
|
-
tracer, pricing_info, trace_content,
|
93
|
-
metrics, disable_metrics),
|
94
|
-
)
|
95
|
-
|
96
|
-
wrap_function_wrapper(
|
97
|
-
"openai.resources.completions",
|
98
|
-
"AsyncCompletions.create",
|
99
|
-
azure_async_completions("azure_openai.completions", version,
|
100
|
-
environment, application_name,
|
75
|
+
async_embedding(version, environment, application_name,
|
101
76
|
tracer, pricing_info, trace_content,
|
102
77
|
metrics, disable_metrics),
|
103
78
|
)
|
@@ -105,7 +80,7 @@ class OpenAIInstrumentor(BaseInstrumentor):
|
|
105
80
|
wrap_function_wrapper(
|
106
81
|
"openai.resources.images",
|
107
82
|
"Images.create_variation",
|
108
|
-
image_variatons(
|
83
|
+
image_variatons(version,
|
109
84
|
environment, application_name,
|
110
85
|
tracer, pricing_info, trace_content,
|
111
86
|
metrics, disable_metrics),
|
@@ -114,7 +89,7 @@ class OpenAIInstrumentor(BaseInstrumentor):
|
|
114
89
|
wrap_function_wrapper(
|
115
90
|
"openai.resources.images",
|
116
91
|
"AsyncImages.create_variation",
|
117
|
-
async_image_variatons(
|
92
|
+
async_image_variatons(version,
|
118
93
|
environment, application_name,
|
119
94
|
tracer, pricing_info, trace_content,
|
120
95
|
metrics, disable_metrics),
|
@@ -123,7 +98,7 @@ class OpenAIInstrumentor(BaseInstrumentor):
|
|
123
98
|
wrap_function_wrapper(
|
124
99
|
"openai.resources.audio.speech",
|
125
100
|
"Speech.create",
|
126
|
-
audio_create(
|
101
|
+
audio_create(version, environment, application_name,
|
127
102
|
tracer, pricing_info, trace_content,
|
128
103
|
metrics, disable_metrics),
|
129
104
|
)
|
@@ -131,205 +106,11 @@ class OpenAIInstrumentor(BaseInstrumentor):
|
|
131
106
|
wrap_function_wrapper(
|
132
107
|
"openai.resources.audio.speech",
|
133
108
|
"AsyncSpeech.create",
|
134
|
-
async_audio_create(
|
109
|
+
async_audio_create(version, environment, application_name,
|
135
110
|
tracer, pricing_info, trace_content,
|
136
111
|
metrics, disable_metrics),
|
137
112
|
)
|
138
113
|
|
139
|
-
wrap_function_wrapper(
|
140
|
-
"openai.resources.fine_tuning.jobs",
|
141
|
-
"Jobs.create",
|
142
|
-
finetune("openai.audio.speech", version, environment, application_name,
|
143
|
-
tracer, pricing_info, trace_content,
|
144
|
-
metrics, disable_metrics),
|
145
|
-
)
|
146
|
-
|
147
|
-
wrap_function_wrapper(
|
148
|
-
"openai.resources.fine_tuning.jobs",
|
149
|
-
"AsyncJobs.create",
|
150
|
-
async_finetune("openai.fine_tuning.jo", version, environment, application_name,
|
151
|
-
tracer, pricing_info, trace_content,
|
152
|
-
metrics, disable_metrics),
|
153
|
-
)
|
154
|
-
|
155
114
|
@staticmethod
|
156
115
|
def _uninstrument(self, **kwargs):
|
157
116
|
pass
|
158
|
-
|
159
|
-
def chat_wrapper(version, environment, application_name, tracer, pricing_info, trace_content,
|
160
|
-
metrics, disable_metrics):
|
161
|
-
"""
|
162
|
-
Decorator for making a custom wrapper execute conditionally,
|
163
|
-
based on whether the instance is for Azure OpenAI or not.
|
164
|
-
"""
|
165
|
-
def wrapper(wrapped, instance, args, kwargs):
|
166
|
-
# Default to using the standard OpenAI chat completions
|
167
|
-
completion_func = chat_completions("openai.chat.completions", version, environment,
|
168
|
-
application_name, tracer, pricing_info, trace_content,
|
169
|
-
metrics, disable_metrics)
|
170
|
-
|
171
|
-
# Check if it's an Azure instance by inspecting `base_url`
|
172
|
-
try:
|
173
|
-
base_url = getattr(instance, 'base_url', '')
|
174
|
-
if 'azure.com' in base_url:
|
175
|
-
# Switch to the Azure-specific chat completions logic
|
176
|
-
completion_func = azure_chat_completions("azure_openai.chat.completions",
|
177
|
-
version, environment, application_name,
|
178
|
-
tracer, pricing_info, trace_content,
|
179
|
-
metrics, disable_metrics)
|
180
|
-
except AttributeError:
|
181
|
-
pass # base_url attribute not found, proceed with the default
|
182
|
-
|
183
|
-
# Execute the selected completion function
|
184
|
-
return completion_func(wrapped, instance, args, kwargs)
|
185
|
-
|
186
|
-
return wrapper
|
187
|
-
|
188
|
-
def async_chat_wrapper(version, environment, application_name, tracer, pricing_info,
|
189
|
-
trace_content, metrics, disable_metrics):
|
190
|
-
"""
|
191
|
-
Decorator for making a custom wrapper execute conditionally,
|
192
|
-
based on whether the instance is for Azure OpenAI or not.
|
193
|
-
"""
|
194
|
-
def wrapper(wrapped, instance, args, kwargs):
|
195
|
-
# Default to using the standard OpenAI chat completions
|
196
|
-
completion_func = async_chat_completions("openai.chat.completions", version, environment,
|
197
|
-
application_name, tracer,
|
198
|
-
pricing_info, trace_content,
|
199
|
-
metrics, disable_metrics)
|
200
|
-
|
201
|
-
# Check if it's an Azure instance by inspecting `base_url`
|
202
|
-
try:
|
203
|
-
base_url = getattr(instance, 'base_url', '')
|
204
|
-
if 'azure.com' in base_url:
|
205
|
-
# Switch to the Azure-specific chat completions logic
|
206
|
-
completion_func = azure_async_chat_completions("azure_openai.chat.completions",
|
207
|
-
version, environment,
|
208
|
-
application_name, tracer,
|
209
|
-
pricing_info, trace_content,
|
210
|
-
metrics, disable_metrics)
|
211
|
-
except AttributeError:
|
212
|
-
pass # base_url attribute not found, proceed with the default
|
213
|
-
|
214
|
-
# Execute the selected completion function
|
215
|
-
return completion_func(wrapped, instance, args, kwargs)
|
216
|
-
|
217
|
-
return wrapper
|
218
|
-
|
219
|
-
def image_generate_wrapper(version, environment, application_name, tracer, pricing_info,
|
220
|
-
trace_content, metrics, disable_metrics):
|
221
|
-
"""
|
222
|
-
Decorator for making a custom wrapper execute conditionally,
|
223
|
-
based on whether the instance is for Azure OpenAI or not.
|
224
|
-
"""
|
225
|
-
def wrapper(wrapped, instance, args, kwargs):
|
226
|
-
# Default to using the standard OpenAI chat completions
|
227
|
-
completion_func = image_generate("openai.images.generate", version, environment,
|
228
|
-
application_name, tracer, pricing_info, trace_content,
|
229
|
-
metrics, disable_metrics)
|
230
|
-
|
231
|
-
# Check if it's an Azure instance by inspecting `base_url`
|
232
|
-
try:
|
233
|
-
base_url = getattr(instance, 'base_url', '')
|
234
|
-
if 'azure.com' in base_url:
|
235
|
-
# Switch to the Azure-specific chat completions logic
|
236
|
-
completion_func = azure_image_generate("azure_openai.images.generate",
|
237
|
-
version, environment, application_name,
|
238
|
-
tracer, pricing_info, trace_content,
|
239
|
-
metrics, disable_metrics)
|
240
|
-
except AttributeError:
|
241
|
-
pass # base_url attribute not found, proceed with the default
|
242
|
-
|
243
|
-
# Execute the selected completion function
|
244
|
-
return completion_func(wrapped, instance, args, kwargs)
|
245
|
-
|
246
|
-
return wrapper
|
247
|
-
|
248
|
-
def async_image_generate_wrapper(version, environment, application_name, tracer,
|
249
|
-
pricing_info, trace_content, metrics, disable_metrics):
|
250
|
-
"""
|
251
|
-
Decorator for making a custom wrapper execute conditionally,
|
252
|
-
based on whether the instance is for Azure OpenAI or not.
|
253
|
-
"""
|
254
|
-
def wrapper(wrapped, instance, args, kwargs):
|
255
|
-
# Default to using the standard OpenAI chat completions
|
256
|
-
completion_func = async_image_generate("openai.images.generate", version,
|
257
|
-
environment, application_name, tracer,
|
258
|
-
pricing_info, trace_content,
|
259
|
-
metrics, disable_metrics)
|
260
|
-
|
261
|
-
# Check if it's an Azure instance by inspecting `base_url`
|
262
|
-
try:
|
263
|
-
base_url = getattr(instance, 'base_url', '')
|
264
|
-
if 'azure.com' in base_url:
|
265
|
-
# Switch to the Azure-specific chat completions logic
|
266
|
-
completion_func = azure_async_image_generate("azure_openai.images.generate",
|
267
|
-
version, environment,
|
268
|
-
application_name, tracer,
|
269
|
-
pricing_info, trace_content,
|
270
|
-
metrics, disable_metrics)
|
271
|
-
except AttributeError:
|
272
|
-
pass # base_url attribute not found, proceed with the default
|
273
|
-
|
274
|
-
# Execute the selected completion function
|
275
|
-
return completion_func(wrapped, instance, args, kwargs)
|
276
|
-
|
277
|
-
return wrapper
|
278
|
-
|
279
|
-
def embedding_wrapper(version, environment, application_name, tracer, pricing_info,
|
280
|
-
trace_content, metrics, disable_metrics):
|
281
|
-
"""
|
282
|
-
Decorator for making a custom wrapper execute conditionally,
|
283
|
-
based on whether the instance is for Azure OpenAI or not.
|
284
|
-
"""
|
285
|
-
def wrapper(wrapped, instance, args, kwargs):
|
286
|
-
# Default to using the standard OpenAI chat completions
|
287
|
-
completion_func = embedding("openai.embeddings", version, environment,
|
288
|
-
application_name, tracer, pricing_info, trace_content,
|
289
|
-
metrics, disable_metrics)
|
290
|
-
|
291
|
-
# Check if it's an Azure instance by inspecting `base_url`
|
292
|
-
try:
|
293
|
-
base_url = getattr(instance, 'base_url', '')
|
294
|
-
if 'azure.com' in base_url:
|
295
|
-
# Switch to the Azure-specific chat completions logic
|
296
|
-
completion_func = azure_embedding("azure_openai.embeddings",
|
297
|
-
version, environment, application_name,
|
298
|
-
tracer, pricing_info, trace_content,
|
299
|
-
metrics, disable_metrics)
|
300
|
-
except AttributeError:
|
301
|
-
pass # base_url attribute not found, proceed with the default
|
302
|
-
|
303
|
-
# Execute the selected completion function
|
304
|
-
return completion_func(wrapped, instance, args, kwargs)
|
305
|
-
|
306
|
-
return wrapper
|
307
|
-
|
308
|
-
def async_embedding_wrapper(version, environment, application_name, tracer,
|
309
|
-
pricing_info, trace_content, metrics, disable_metrics):
|
310
|
-
"""
|
311
|
-
Decorator for making a custom wrapper execute conditionally,
|
312
|
-
based on whether the instance is for Azure OpenAI or not.
|
313
|
-
"""
|
314
|
-
def wrapper(wrapped, instance, args, kwargs):
|
315
|
-
# Default to using the standard OpenAI chat completions
|
316
|
-
completion_func = async_embedding("openai.embeddings", version, environment,
|
317
|
-
application_name, tracer, pricing_info, trace_content,
|
318
|
-
metrics, disable_metrics)
|
319
|
-
|
320
|
-
# Check if it's an Azure instance by inspecting `base_url`
|
321
|
-
try:
|
322
|
-
base_url = getattr(instance, 'base_url', '')
|
323
|
-
if 'azure.com' in base_url:
|
324
|
-
# Switch to the Azure-specific chat completions logic
|
325
|
-
completion_func = azure_async_embedding("azure_openai.embeddings", version,
|
326
|
-
environment, application_name, tracer,
|
327
|
-
pricing_info, trace_content,
|
328
|
-
metrics, disable_metrics)
|
329
|
-
except AttributeError:
|
330
|
-
pass # base_url attribute not found, proceed with the default
|
331
|
-
|
332
|
-
# Execute the selected completion function
|
333
|
-
return completion_func(wrapped, instance, args, kwargs)
|
334
|
-
|
335
|
-
return wrapper
|