openlit 1.34.30__py3-none-any.whl → 1.34.31__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 +235 -86
- openlit/__init__.py +16 -13
- openlit/_instrumentors.py +2 -1
- openlit/evals/all.py +50 -21
- openlit/evals/bias_detection.py +47 -20
- openlit/evals/hallucination.py +53 -22
- openlit/evals/toxicity.py +50 -21
- openlit/evals/utils.py +54 -30
- openlit/guard/all.py +61 -19
- openlit/guard/prompt_injection.py +34 -14
- openlit/guard/restrict_topic.py +46 -15
- openlit/guard/sensitive_topic.py +34 -14
- openlit/guard/utils.py +58 -22
- openlit/instrumentation/ag2/__init__.py +24 -8
- openlit/instrumentation/ag2/ag2.py +34 -13
- openlit/instrumentation/ag2/async_ag2.py +34 -13
- openlit/instrumentation/ag2/utils.py +133 -30
- openlit/instrumentation/ai21/__init__.py +43 -14
- openlit/instrumentation/ai21/ai21.py +47 -21
- openlit/instrumentation/ai21/async_ai21.py +47 -21
- openlit/instrumentation/ai21/utils.py +299 -78
- openlit/instrumentation/anthropic/__init__.py +21 -4
- openlit/instrumentation/anthropic/anthropic.py +28 -17
- openlit/instrumentation/anthropic/async_anthropic.py +28 -17
- openlit/instrumentation/anthropic/utils.py +145 -35
- openlit/instrumentation/assemblyai/__init__.py +11 -2
- openlit/instrumentation/assemblyai/assemblyai.py +15 -4
- openlit/instrumentation/assemblyai/utils.py +120 -25
- openlit/instrumentation/astra/__init__.py +43 -10
- openlit/instrumentation/astra/astra.py +28 -5
- openlit/instrumentation/astra/async_astra.py +28 -5
- openlit/instrumentation/astra/utils.py +151 -55
- openlit/instrumentation/azure_ai_inference/__init__.py +43 -10
- openlit/instrumentation/azure_ai_inference/async_azure_ai_inference.py +53 -21
- openlit/instrumentation/azure_ai_inference/azure_ai_inference.py +53 -21
- openlit/instrumentation/azure_ai_inference/utils.py +307 -83
- openlit/instrumentation/bedrock/__init__.py +21 -4
- openlit/instrumentation/bedrock/bedrock.py +63 -25
- openlit/instrumentation/bedrock/utils.py +139 -30
- openlit/instrumentation/chroma/__init__.py +89 -16
- openlit/instrumentation/chroma/chroma.py +28 -6
- openlit/instrumentation/chroma/utils.py +167 -51
- openlit/instrumentation/cohere/__init__.py +63 -18
- openlit/instrumentation/cohere/async_cohere.py +63 -24
- openlit/instrumentation/cohere/cohere.py +63 -24
- openlit/instrumentation/cohere/utils.py +286 -73
- openlit/instrumentation/controlflow/__init__.py +35 -9
- openlit/instrumentation/controlflow/controlflow.py +66 -33
- openlit/instrumentation/crawl4ai/__init__.py +25 -10
- openlit/instrumentation/crawl4ai/async_crawl4ai.py +78 -31
- openlit/instrumentation/crawl4ai/crawl4ai.py +78 -31
- openlit/instrumentation/crewai/__init__.py +40 -15
- openlit/instrumentation/crewai/async_crewai.py +32 -7
- openlit/instrumentation/crewai/crewai.py +32 -7
- openlit/instrumentation/crewai/utils.py +159 -56
- openlit/instrumentation/dynamiq/__init__.py +46 -12
- openlit/instrumentation/dynamiq/dynamiq.py +74 -33
- openlit/instrumentation/elevenlabs/__init__.py +23 -4
- openlit/instrumentation/elevenlabs/async_elevenlabs.py +16 -4
- openlit/instrumentation/elevenlabs/elevenlabs.py +16 -4
- openlit/instrumentation/elevenlabs/utils.py +128 -25
- openlit/instrumentation/embedchain/__init__.py +11 -2
- openlit/instrumentation/embedchain/embedchain.py +68 -35
- openlit/instrumentation/firecrawl/__init__.py +24 -7
- openlit/instrumentation/firecrawl/firecrawl.py +46 -20
- openlit/instrumentation/google_ai_studio/__init__.py +45 -10
- openlit/instrumentation/google_ai_studio/async_google_ai_studio.py +67 -44
- openlit/instrumentation/google_ai_studio/google_ai_studio.py +67 -44
- openlit/instrumentation/google_ai_studio/utils.py +180 -67
- openlit/instrumentation/gpt4all/__init__.py +22 -7
- openlit/instrumentation/gpt4all/gpt4all.py +67 -29
- openlit/instrumentation/gpt4all/utils.py +285 -61
- openlit/instrumentation/gpu/__init__.py +128 -47
- openlit/instrumentation/groq/__init__.py +21 -4
- openlit/instrumentation/groq/async_groq.py +33 -21
- openlit/instrumentation/groq/groq.py +33 -21
- openlit/instrumentation/groq/utils.py +192 -55
- openlit/instrumentation/haystack/__init__.py +70 -24
- openlit/instrumentation/haystack/async_haystack.py +28 -6
- openlit/instrumentation/haystack/haystack.py +28 -6
- openlit/instrumentation/haystack/utils.py +196 -74
- openlit/instrumentation/julep/__init__.py +69 -19
- openlit/instrumentation/julep/async_julep.py +53 -27
- openlit/instrumentation/julep/julep.py +53 -28
- openlit/instrumentation/langchain/__init__.py +74 -63
- openlit/instrumentation/langchain/callback_handler.py +1100 -0
- openlit/instrumentation/langchain_community/__init__.py +13 -2
- openlit/instrumentation/langchain_community/async_langchain_community.py +23 -5
- openlit/instrumentation/langchain_community/langchain_community.py +23 -5
- openlit/instrumentation/langchain_community/utils.py +35 -9
- openlit/instrumentation/letta/__init__.py +68 -15
- openlit/instrumentation/letta/letta.py +99 -54
- openlit/instrumentation/litellm/__init__.py +43 -14
- openlit/instrumentation/litellm/async_litellm.py +51 -26
- openlit/instrumentation/litellm/litellm.py +51 -26
- openlit/instrumentation/litellm/utils.py +304 -102
- openlit/instrumentation/llamaindex/__init__.py +267 -90
- openlit/instrumentation/llamaindex/async_llamaindex.py +28 -6
- openlit/instrumentation/llamaindex/llamaindex.py +28 -6
- openlit/instrumentation/llamaindex/utils.py +204 -91
- openlit/instrumentation/mem0/__init__.py +11 -2
- openlit/instrumentation/mem0/mem0.py +50 -29
- openlit/instrumentation/milvus/__init__.py +10 -2
- openlit/instrumentation/milvus/milvus.py +31 -6
- openlit/instrumentation/milvus/utils.py +166 -67
- openlit/instrumentation/mistral/__init__.py +63 -18
- openlit/instrumentation/mistral/async_mistral.py +63 -24
- openlit/instrumentation/mistral/mistral.py +63 -24
- openlit/instrumentation/mistral/utils.py +277 -69
- openlit/instrumentation/multion/__init__.py +69 -19
- openlit/instrumentation/multion/async_multion.py +57 -26
- openlit/instrumentation/multion/multion.py +57 -26
- openlit/instrumentation/ollama/__init__.py +39 -18
- openlit/instrumentation/ollama/async_ollama.py +57 -26
- openlit/instrumentation/ollama/ollama.py +57 -26
- openlit/instrumentation/ollama/utils.py +226 -50
- openlit/instrumentation/openai/__init__.py +156 -32
- openlit/instrumentation/openai/async_openai.py +147 -67
- openlit/instrumentation/openai/openai.py +150 -67
- openlit/instrumentation/openai/utils.py +657 -185
- openlit/instrumentation/openai_agents/__init__.py +5 -1
- openlit/instrumentation/openai_agents/processor.py +110 -90
- openlit/instrumentation/phidata/__init__.py +13 -5
- openlit/instrumentation/phidata/phidata.py +67 -32
- openlit/instrumentation/pinecone/__init__.py +48 -9
- openlit/instrumentation/pinecone/async_pinecone.py +27 -5
- openlit/instrumentation/pinecone/pinecone.py +27 -5
- openlit/instrumentation/pinecone/utils.py +153 -47
- openlit/instrumentation/premai/__init__.py +22 -7
- openlit/instrumentation/premai/premai.py +51 -26
- openlit/instrumentation/premai/utils.py +246 -59
- openlit/instrumentation/pydantic_ai/__init__.py +49 -22
- openlit/instrumentation/pydantic_ai/pydantic_ai.py +69 -16
- openlit/instrumentation/pydantic_ai/utils.py +89 -24
- openlit/instrumentation/qdrant/__init__.py +19 -4
- openlit/instrumentation/qdrant/async_qdrant.py +33 -7
- openlit/instrumentation/qdrant/qdrant.py +33 -7
- openlit/instrumentation/qdrant/utils.py +228 -93
- openlit/instrumentation/reka/__init__.py +23 -10
- openlit/instrumentation/reka/async_reka.py +17 -11
- openlit/instrumentation/reka/reka.py +17 -11
- openlit/instrumentation/reka/utils.py +138 -36
- openlit/instrumentation/together/__init__.py +44 -12
- openlit/instrumentation/together/async_together.py +50 -27
- openlit/instrumentation/together/together.py +50 -27
- openlit/instrumentation/together/utils.py +301 -71
- openlit/instrumentation/transformers/__init__.py +2 -1
- openlit/instrumentation/transformers/transformers.py +13 -3
- openlit/instrumentation/transformers/utils.py +139 -36
- openlit/instrumentation/vertexai/__init__.py +81 -16
- openlit/instrumentation/vertexai/async_vertexai.py +33 -15
- openlit/instrumentation/vertexai/utils.py +123 -27
- openlit/instrumentation/vertexai/vertexai.py +33 -15
- openlit/instrumentation/vllm/__init__.py +12 -5
- openlit/instrumentation/vllm/utils.py +121 -31
- openlit/instrumentation/vllm/vllm.py +16 -10
- openlit/otel/events.py +35 -10
- openlit/otel/metrics.py +32 -24
- openlit/otel/tracing.py +24 -9
- openlit/semcov/__init__.py +72 -6
- {openlit-1.34.30.dist-info → openlit-1.34.31.dist-info}/METADATA +2 -1
- openlit-1.34.31.dist-info/RECORD +166 -0
- openlit/instrumentation/langchain/async_langchain.py +0 -102
- openlit/instrumentation/langchain/langchain.py +0 -102
- openlit/instrumentation/langchain/utils.py +0 -252
- openlit-1.34.30.dist-info/RECORD +0 -168
- {openlit-1.34.30.dist-info → openlit-1.34.31.dist-info}/LICENSE +0 -0
- {openlit-1.34.30.dist-info → openlit-1.34.31.dist-info}/WHEEL +0 -0
@@ -1,20 +1,32 @@
|
|
1
1
|
"""Initializer of Auto Instrumentation of OpenAI Functions"""
|
2
|
+
|
2
3
|
from typing import Collection
|
3
4
|
import importlib.metadata
|
4
5
|
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
5
6
|
from wrapt import wrap_function_wrapper
|
6
7
|
|
7
8
|
from openlit.instrumentation.openai.openai import (
|
8
|
-
chat_completions,
|
9
|
-
|
9
|
+
chat_completions,
|
10
|
+
embedding,
|
11
|
+
responses,
|
12
|
+
chat_completions_parse,
|
13
|
+
image_generate,
|
14
|
+
image_variatons,
|
15
|
+
audio_create,
|
10
16
|
)
|
11
17
|
from openlit.instrumentation.openai.async_openai import (
|
12
|
-
async_chat_completions,
|
13
|
-
|
18
|
+
async_chat_completions,
|
19
|
+
async_embedding,
|
20
|
+
async_chat_completions_parse,
|
21
|
+
async_image_generate,
|
22
|
+
async_image_variations,
|
23
|
+
async_audio_create,
|
24
|
+
async_responses,
|
14
25
|
)
|
15
26
|
|
16
27
|
_instruments = ("openai >= 1.92.0",)
|
17
28
|
|
29
|
+
|
18
30
|
class OpenAIInstrumentor(BaseInstrumentor):
|
19
31
|
"""
|
20
32
|
An instrumentor for OpenAI client library.
|
@@ -37,105 +49,217 @@ class OpenAIInstrumentor(BaseInstrumentor):
|
|
37
49
|
wrap_function_wrapper(
|
38
50
|
"openai.resources.chat.completions",
|
39
51
|
"Completions.create",
|
40
|
-
chat_completions(
|
41
|
-
|
52
|
+
chat_completions(
|
53
|
+
version,
|
54
|
+
environment,
|
55
|
+
application_name,
|
56
|
+
tracer,
|
57
|
+
pricing_info,
|
58
|
+
capture_message_content,
|
59
|
+
metrics,
|
60
|
+
disable_metrics,
|
61
|
+
),
|
42
62
|
)
|
43
63
|
|
44
64
|
wrap_function_wrapper(
|
45
65
|
"openai.resources.chat.completions",
|
46
66
|
"AsyncCompletions.create",
|
47
|
-
async_chat_completions(
|
48
|
-
|
67
|
+
async_chat_completions(
|
68
|
+
version,
|
69
|
+
environment,
|
70
|
+
application_name,
|
71
|
+
tracer,
|
72
|
+
pricing_info,
|
73
|
+
capture_message_content,
|
74
|
+
metrics,
|
75
|
+
disable_metrics,
|
76
|
+
),
|
49
77
|
)
|
50
78
|
|
51
79
|
# chat completions parse
|
52
80
|
wrap_function_wrapper(
|
53
81
|
"openai.resources.chat.completions",
|
54
82
|
"Completions.parse",
|
55
|
-
chat_completions_parse(
|
56
|
-
|
83
|
+
chat_completions_parse(
|
84
|
+
version,
|
85
|
+
environment,
|
86
|
+
application_name,
|
87
|
+
tracer,
|
88
|
+
pricing_info,
|
89
|
+
capture_message_content,
|
90
|
+
metrics,
|
91
|
+
disable_metrics,
|
92
|
+
),
|
57
93
|
)
|
58
94
|
|
59
95
|
wrap_function_wrapper(
|
60
96
|
"openai.resources.chat.completions",
|
61
97
|
"AsyncCompletions.parse",
|
62
|
-
async_chat_completions_parse(
|
63
|
-
|
98
|
+
async_chat_completions_parse(
|
99
|
+
version,
|
100
|
+
environment,
|
101
|
+
application_name,
|
102
|
+
tracer,
|
103
|
+
pricing_info,
|
104
|
+
capture_message_content,
|
105
|
+
metrics,
|
106
|
+
disable_metrics,
|
107
|
+
),
|
64
108
|
)
|
65
109
|
|
66
110
|
# responses
|
67
111
|
wrap_function_wrapper(
|
68
112
|
"openai.resources.responses.responses",
|
69
113
|
"Responses.create",
|
70
|
-
responses(
|
71
|
-
|
114
|
+
responses(
|
115
|
+
version,
|
116
|
+
environment,
|
117
|
+
application_name,
|
118
|
+
tracer,
|
119
|
+
pricing_info,
|
120
|
+
capture_message_content,
|
121
|
+
metrics,
|
122
|
+
disable_metrics,
|
123
|
+
),
|
72
124
|
)
|
73
125
|
|
74
126
|
wrap_function_wrapper(
|
75
127
|
"openai.resources.responses.responses",
|
76
128
|
"AsyncResponses.create",
|
77
|
-
async_responses(
|
78
|
-
|
129
|
+
async_responses(
|
130
|
+
version,
|
131
|
+
environment,
|
132
|
+
application_name,
|
133
|
+
tracer,
|
134
|
+
pricing_info,
|
135
|
+
capture_message_content,
|
136
|
+
metrics,
|
137
|
+
disable_metrics,
|
138
|
+
),
|
79
139
|
)
|
80
140
|
|
81
141
|
# embeddings
|
82
142
|
wrap_function_wrapper(
|
83
143
|
"openai.resources.embeddings",
|
84
144
|
"Embeddings.create",
|
85
|
-
embedding(
|
86
|
-
|
145
|
+
embedding(
|
146
|
+
version,
|
147
|
+
environment,
|
148
|
+
application_name,
|
149
|
+
tracer,
|
150
|
+
pricing_info,
|
151
|
+
capture_message_content,
|
152
|
+
metrics,
|
153
|
+
disable_metrics,
|
154
|
+
),
|
87
155
|
)
|
88
156
|
|
89
157
|
wrap_function_wrapper(
|
90
158
|
"openai.resources.embeddings",
|
91
159
|
"AsyncEmbeddings.create",
|
92
|
-
async_embedding(
|
93
|
-
|
160
|
+
async_embedding(
|
161
|
+
version,
|
162
|
+
environment,
|
163
|
+
application_name,
|
164
|
+
tracer,
|
165
|
+
pricing_info,
|
166
|
+
capture_message_content,
|
167
|
+
metrics,
|
168
|
+
disable_metrics,
|
169
|
+
),
|
94
170
|
)
|
95
171
|
|
96
172
|
# image generation
|
97
173
|
wrap_function_wrapper(
|
98
174
|
"openai.resources.images",
|
99
175
|
"Images.generate",
|
100
|
-
image_generate(
|
101
|
-
|
176
|
+
image_generate(
|
177
|
+
version,
|
178
|
+
environment,
|
179
|
+
application_name,
|
180
|
+
tracer,
|
181
|
+
pricing_info,
|
182
|
+
capture_message_content,
|
183
|
+
metrics,
|
184
|
+
disable_metrics,
|
185
|
+
),
|
102
186
|
)
|
103
187
|
|
104
188
|
wrap_function_wrapper(
|
105
189
|
"openai.resources.images",
|
106
190
|
"AsyncImages.generate",
|
107
|
-
async_image_generate(
|
108
|
-
|
191
|
+
async_image_generate(
|
192
|
+
version,
|
193
|
+
environment,
|
194
|
+
application_name,
|
195
|
+
tracer,
|
196
|
+
pricing_info,
|
197
|
+
capture_message_content,
|
198
|
+
metrics,
|
199
|
+
disable_metrics,
|
200
|
+
),
|
109
201
|
)
|
110
202
|
|
111
203
|
# image variations
|
112
204
|
wrap_function_wrapper(
|
113
205
|
"openai.resources.images",
|
114
206
|
"Images.create_variation",
|
115
|
-
image_variatons(
|
116
|
-
|
207
|
+
image_variatons(
|
208
|
+
version,
|
209
|
+
environment,
|
210
|
+
application_name,
|
211
|
+
tracer,
|
212
|
+
pricing_info,
|
213
|
+
capture_message_content,
|
214
|
+
metrics,
|
215
|
+
disable_metrics,
|
216
|
+
),
|
117
217
|
)
|
118
218
|
|
119
219
|
wrap_function_wrapper(
|
120
220
|
"openai.resources.images",
|
121
221
|
"AsyncImages.create_variation",
|
122
|
-
async_image_variations(
|
123
|
-
|
222
|
+
async_image_variations(
|
223
|
+
version,
|
224
|
+
environment,
|
225
|
+
application_name,
|
226
|
+
tracer,
|
227
|
+
pricing_info,
|
228
|
+
capture_message_content,
|
229
|
+
metrics,
|
230
|
+
disable_metrics,
|
231
|
+
),
|
124
232
|
)
|
125
233
|
|
126
234
|
# audio generation
|
127
235
|
wrap_function_wrapper(
|
128
236
|
"openai.resources.audio.speech",
|
129
237
|
"Speech.create",
|
130
|
-
audio_create(
|
131
|
-
|
238
|
+
audio_create(
|
239
|
+
version,
|
240
|
+
environment,
|
241
|
+
application_name,
|
242
|
+
tracer,
|
243
|
+
pricing_info,
|
244
|
+
capture_message_content,
|
245
|
+
metrics,
|
246
|
+
disable_metrics,
|
247
|
+
),
|
132
248
|
)
|
133
249
|
|
134
250
|
wrap_function_wrapper(
|
135
251
|
"openai.resources.audio.speech",
|
136
252
|
"AsyncSpeech.create",
|
137
|
-
async_audio_create(
|
138
|
-
|
253
|
+
async_audio_create(
|
254
|
+
version,
|
255
|
+
environment,
|
256
|
+
application_name,
|
257
|
+
tracer,
|
258
|
+
pricing_info,
|
259
|
+
capture_message_content,
|
260
|
+
metrics,
|
261
|
+
disable_metrics,
|
262
|
+
),
|
139
263
|
)
|
140
264
|
|
141
265
|
def _uninstrument(self, **kwargs):
|