openlit 1.10.0__py3-none-any.whl → 1.11.0__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/__init__.py +3 -0
- openlit/instrumentation/gpt4all/__init__.py +52 -0
- openlit/instrumentation/gpt4all/gpt4all.py +352 -0
- openlit/semcov/__init__.py +1 -0
- {openlit-1.10.0.dist-info → openlit-1.11.0.dist-info}/METADATA +12 -11
- {openlit-1.10.0.dist-info → openlit-1.11.0.dist-info}/RECORD +8 -6
- {openlit-1.10.0.dist-info → openlit-1.11.0.dist-info}/LICENSE +0 -0
- {openlit-1.10.0.dist-info → openlit-1.11.0.dist-info}/WHEEL +0 -0
openlit/__init__.py
CHANGED
@@ -21,6 +21,7 @@ from openlit.instrumentation.bedrock import BedrockInstrumentor
|
|
21
21
|
from openlit.instrumentation.vertexai import VertexAIInstrumentor
|
22
22
|
from openlit.instrumentation.groq import GroqInstrumentor
|
23
23
|
from openlit.instrumentation.ollama import OllamaInstrumentor
|
24
|
+
from openlit.instrumentation.gpt4all import GPT4AllInstrumentor
|
24
25
|
from openlit.instrumentation.langchain import LangChainInstrumentor
|
25
26
|
from openlit.instrumentation.llamaindex import LlamaIndexInstrumentor
|
26
27
|
from openlit.instrumentation.haystack import HaystackInstrumentor
|
@@ -161,6 +162,7 @@ def init(environment="default", application_name="default", tracer=None, otlp_en
|
|
161
162
|
"vertexai": "vertexai",
|
162
163
|
"groq": "groq",
|
163
164
|
"ollama": "ollama",
|
165
|
+
"gpt4all": "gpt4all",
|
164
166
|
"langchain": "langchain",
|
165
167
|
"llama_index": "llama_index",
|
166
168
|
"haystack": "haystack",
|
@@ -216,6 +218,7 @@ def init(environment="default", application_name="default", tracer=None, otlp_en
|
|
216
218
|
"vertexai": VertexAIInstrumentor(),
|
217
219
|
"groq": GroqInstrumentor(),
|
218
220
|
"ollama": OllamaInstrumentor(),
|
221
|
+
"gpt4all": GPT4AllInstrumentor(),
|
219
222
|
"langchain": LangChainInstrumentor(),
|
220
223
|
"llama_index": LlamaIndexInstrumentor(),
|
221
224
|
"haystack": HaystackInstrumentor(),
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# pylint: disable=useless-return, bad-staticmethod-argument, disable=duplicate-code
|
2
|
+
"""Initializer of Auto Instrumentation of GPT4All Functions"""
|
3
|
+
|
4
|
+
from typing import Collection
|
5
|
+
import importlib.metadata
|
6
|
+
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
7
|
+
from wrapt import wrap_function_wrapper
|
8
|
+
|
9
|
+
from openlit.instrumentation.gpt4all.gpt4all import (
|
10
|
+
embed, generate
|
11
|
+
)
|
12
|
+
|
13
|
+
_instruments = ("gpt4all >= 2.6.0",)
|
14
|
+
|
15
|
+
class GPT4AllInstrumentor(BaseInstrumentor):
|
16
|
+
"""
|
17
|
+
An instrumentor for GPT4All's client library.
|
18
|
+
"""
|
19
|
+
|
20
|
+
def instrumentation_dependencies(self) -> Collection[str]:
|
21
|
+
return _instruments
|
22
|
+
|
23
|
+
def _instrument(self, **kwargs):
|
24
|
+
application_name = kwargs.get("application_name", "default_application")
|
25
|
+
environment = kwargs.get("environment", "default_environment")
|
26
|
+
tracer = kwargs.get("tracer")
|
27
|
+
metrics = kwargs.get("metrics_dict")
|
28
|
+
pricing_info = kwargs.get("pricing_info", {})
|
29
|
+
trace_content = kwargs.get("trace_content", False)
|
30
|
+
disable_metrics = kwargs.get("disable_metrics")
|
31
|
+
version = importlib.metadata.version("gpt4all")
|
32
|
+
|
33
|
+
# generate
|
34
|
+
wrap_function_wrapper(
|
35
|
+
"gpt4all",
|
36
|
+
"GPT4All.generate",
|
37
|
+
generate("gpt4all.generate", version, environment, application_name,
|
38
|
+
tracer, pricing_info, trace_content, metrics, disable_metrics),
|
39
|
+
)
|
40
|
+
|
41
|
+
# embed
|
42
|
+
wrap_function_wrapper(
|
43
|
+
"gpt4all",
|
44
|
+
"Embed4All.embed",
|
45
|
+
embed("gpt4all.embed", version, environment, application_name,
|
46
|
+
tracer, pricing_info, trace_content, metrics, disable_metrics),
|
47
|
+
)
|
48
|
+
|
49
|
+
|
50
|
+
def _uninstrument(self, **kwargs):
|
51
|
+
# Proper uninstrumentation logic to revert patched methods
|
52
|
+
pass
|
@@ -0,0 +1,352 @@
|
|
1
|
+
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument, possibly-used-before-assignment
|
2
|
+
"""
|
3
|
+
Module for monitoring GPT4All API calls.
|
4
|
+
"""
|
5
|
+
|
6
|
+
import logging
|
7
|
+
from opentelemetry.trace import SpanKind, Status, StatusCode
|
8
|
+
from opentelemetry.sdk.resources import TELEMETRY_SDK_NAME
|
9
|
+
from openlit.__helpers import handle_exception, general_tokens
|
10
|
+
from openlit.semcov import SemanticConvetion
|
11
|
+
|
12
|
+
# Initialize logger for logging potential issues and operations
|
13
|
+
logger = logging.getLogger(__name__)
|
14
|
+
|
15
|
+
def generate(gen_ai_endpoint, version, environment, application_name,
|
16
|
+
tracer, pricing_info, trace_content, metrics, disable_metrics):
|
17
|
+
"""
|
18
|
+
Generates a telemetry wrapper for generate to collect metrics.
|
19
|
+
|
20
|
+
Args:
|
21
|
+
gen_ai_endpoint: Endpoint identifier for logging and tracing.
|
22
|
+
version: Version of the monitoring package.
|
23
|
+
environment: Deployment environment (e.g., production, staging).
|
24
|
+
application_name: Name of the application using the GPT4All API.
|
25
|
+
tracer: OpenTelemetry tracer for creating spans.
|
26
|
+
pricing_info: Information used for calculating the cost of GPT4All usage.
|
27
|
+
trace_content: Flag indicating whether to trace the actual content.
|
28
|
+
|
29
|
+
Returns:
|
30
|
+
A function that wraps the generate method to add telemetry.
|
31
|
+
"""
|
32
|
+
|
33
|
+
def wrapper(wrapped, instance, args, kwargs):
|
34
|
+
"""
|
35
|
+
Wraps the 'generate' API call to add telemetry.
|
36
|
+
|
37
|
+
This collects metrics such as execution time, cost, and token usage, and handles errors
|
38
|
+
gracefully, adding details to the trace for observability.
|
39
|
+
|
40
|
+
Args:
|
41
|
+
wrapped: The original 'generate' method to be wrapped.
|
42
|
+
instance: The instance of the class where the original method is defined.
|
43
|
+
args: Positional arguments for the 'generate' method.
|
44
|
+
kwargs: Keyword arguments for the 'generate' method.
|
45
|
+
|
46
|
+
Returns:
|
47
|
+
The response from the original 'generate' method.
|
48
|
+
"""
|
49
|
+
|
50
|
+
# Check if streaming is enabled for the API call
|
51
|
+
streaming = kwargs.get("streaming", False)
|
52
|
+
|
53
|
+
# pylint: disable=no-else-return
|
54
|
+
if streaming:
|
55
|
+
# Special handling for streaming response to accommodate the nature of data flow
|
56
|
+
def stream_generator():
|
57
|
+
with tracer.start_as_current_span(gen_ai_endpoint, kind= SpanKind.CLIENT) as span:
|
58
|
+
# Placeholder for aggregating streaming response
|
59
|
+
llmresponse = ""
|
60
|
+
|
61
|
+
# Loop through streaming events capturing relevant details
|
62
|
+
for chunk in wrapped(*args, **kwargs):
|
63
|
+
# Collect aggregated response from events
|
64
|
+
llmresponse += chunk
|
65
|
+
|
66
|
+
yield chunk
|
67
|
+
|
68
|
+
# Handling exception ensure observability without disrupting operation
|
69
|
+
try:
|
70
|
+
# Calculate cost of the operation
|
71
|
+
cost = 0
|
72
|
+
|
73
|
+
# pylint: disable=line-too-long
|
74
|
+
model = str(instance.model.model_path).rsplit('/', maxsplit=1)[-1] or "orca-mini-3b-gguf2-q4_0.gguf"
|
75
|
+
prompt = kwargs.get("prompt") or args[0] or ""
|
76
|
+
|
77
|
+
# Calculate cost of the operation
|
78
|
+
cost = 0
|
79
|
+
prompt_tokens = general_tokens(prompt)
|
80
|
+
completion_tokens = general_tokens(llmresponse)
|
81
|
+
total_tokens = prompt_tokens + completion_tokens
|
82
|
+
|
83
|
+
# Set base span attribues
|
84
|
+
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
|
85
|
+
span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
|
86
|
+
SemanticConvetion.GEN_AI_SYSTEM_GPT4ALL)
|
87
|
+
span.set_attribute(SemanticConvetion.GEN_AI_TYPE,
|
88
|
+
SemanticConvetion.GEN_AI_TYPE_CHAT)
|
89
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
|
90
|
+
gen_ai_endpoint)
|
91
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENVIRONMENT,
|
92
|
+
environment)
|
93
|
+
span.set_attribute(SemanticConvetion.GEN_AI_APPLICATION_NAME,
|
94
|
+
application_name)
|
95
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
|
96
|
+
model)
|
97
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_K,
|
98
|
+
kwargs.get("top_k", 40))
|
99
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
|
100
|
+
kwargs.get("top_p", 0.4))
|
101
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
|
102
|
+
kwargs.get("max_tokens", 200))
|
103
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
|
104
|
+
kwargs.get("temperature", 0.7))
|
105
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY,
|
106
|
+
kwargs.get("frequency_penalty", 1.18))
|
107
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
|
108
|
+
True)
|
109
|
+
if trace_content:
|
110
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_PROMPT,
|
111
|
+
prompt)
|
112
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_COMPLETION,
|
113
|
+
llmresponse)
|
114
|
+
|
115
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
|
116
|
+
prompt_tokens)
|
117
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COMPLETION_TOKENS,
|
118
|
+
completion_tokens)
|
119
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
|
120
|
+
total_tokens)
|
121
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
122
|
+
cost)
|
123
|
+
|
124
|
+
span.set_status(Status(StatusCode.OK))
|
125
|
+
|
126
|
+
if disable_metrics is False:
|
127
|
+
attributes = {
|
128
|
+
TELEMETRY_SDK_NAME:
|
129
|
+
"openlit",
|
130
|
+
SemanticConvetion.GEN_AI_APPLICATION_NAME:
|
131
|
+
application_name,
|
132
|
+
SemanticConvetion.GEN_AI_SYSTEM:
|
133
|
+
SemanticConvetion.GEN_AI_SYSTEM_GPT4ALL,
|
134
|
+
SemanticConvetion.GEN_AI_ENVIRONMENT:
|
135
|
+
environment,
|
136
|
+
SemanticConvetion.GEN_AI_TYPE:
|
137
|
+
SemanticConvetion.GEN_AI_TYPE_CHAT,
|
138
|
+
SemanticConvetion.GEN_AI_REQUEST_MODEL:
|
139
|
+
model
|
140
|
+
}
|
141
|
+
|
142
|
+
metrics["genai_requests"].add(1, attributes)
|
143
|
+
metrics["genai_total_tokens"].add(total_tokens, attributes)
|
144
|
+
metrics["genai_completion_tokens"].add(completion_tokens, attributes)
|
145
|
+
metrics["genai_prompt_tokens"].add(prompt_tokens, attributes)
|
146
|
+
metrics["genai_cost"].record(cost, attributes)
|
147
|
+
|
148
|
+
except Exception as e:
|
149
|
+
handle_exception(span, e)
|
150
|
+
logger.error("Error in trace creation: %s", e)
|
151
|
+
|
152
|
+
return stream_generator()
|
153
|
+
|
154
|
+
# Handling for non-streaming responses
|
155
|
+
else:
|
156
|
+
# pylint: disable=line-too-long
|
157
|
+
with tracer.start_as_current_span(gen_ai_endpoint, kind= SpanKind.CLIENT) as span:
|
158
|
+
response = wrapped(*args, **kwargs)
|
159
|
+
|
160
|
+
# pylint: disable=line-too-long
|
161
|
+
model = str(instance.model.model_path).rsplit('/', maxsplit=1)[-1] or "orca-mini-3b-gguf2-q4_0.gguf"
|
162
|
+
prompt = kwargs.get("prompt") or args[0] or ""
|
163
|
+
|
164
|
+
# Calculate cost of the operation
|
165
|
+
cost = 0
|
166
|
+
prompt_tokens = general_tokens(prompt)
|
167
|
+
completion_tokens = general_tokens(response)
|
168
|
+
total_tokens = prompt_tokens + completion_tokens
|
169
|
+
|
170
|
+
try:
|
171
|
+
# Set base span attribues
|
172
|
+
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
|
173
|
+
span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
|
174
|
+
SemanticConvetion.GEN_AI_SYSTEM_GPT4ALL)
|
175
|
+
span.set_attribute(SemanticConvetion.GEN_AI_TYPE,
|
176
|
+
SemanticConvetion.GEN_AI_TYPE_CHAT)
|
177
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
|
178
|
+
gen_ai_endpoint)
|
179
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENVIRONMENT,
|
180
|
+
environment)
|
181
|
+
span.set_attribute(SemanticConvetion.GEN_AI_APPLICATION_NAME,
|
182
|
+
application_name)
|
183
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
|
184
|
+
model)
|
185
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_K,
|
186
|
+
kwargs.get("top_k", 40))
|
187
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
|
188
|
+
kwargs.get("top_p", 0.4))
|
189
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
|
190
|
+
kwargs.get("max_tokens", 200))
|
191
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
|
192
|
+
kwargs.get("temperature", 0.7))
|
193
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY,
|
194
|
+
kwargs.get("frequency_penalty", 1.18))
|
195
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
|
196
|
+
False)
|
197
|
+
if trace_content:
|
198
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_PROMPT,
|
199
|
+
prompt)
|
200
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_COMPLETION,
|
201
|
+
response)
|
202
|
+
|
203
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
|
204
|
+
prompt_tokens)
|
205
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COMPLETION_TOKENS,
|
206
|
+
completion_tokens)
|
207
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
|
208
|
+
total_tokens)
|
209
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
210
|
+
cost)
|
211
|
+
|
212
|
+
span.set_status(Status(StatusCode.OK))
|
213
|
+
|
214
|
+
if disable_metrics is False:
|
215
|
+
attributes = {
|
216
|
+
TELEMETRY_SDK_NAME:
|
217
|
+
"openlit",
|
218
|
+
SemanticConvetion.GEN_AI_APPLICATION_NAME:
|
219
|
+
application_name,
|
220
|
+
SemanticConvetion.GEN_AI_SYSTEM:
|
221
|
+
SemanticConvetion.GEN_AI_SYSTEM_GPT4ALL,
|
222
|
+
SemanticConvetion.GEN_AI_ENVIRONMENT:
|
223
|
+
environment,
|
224
|
+
SemanticConvetion.GEN_AI_TYPE:
|
225
|
+
SemanticConvetion.GEN_AI_TYPE_CHAT,
|
226
|
+
SemanticConvetion.GEN_AI_REQUEST_MODEL:
|
227
|
+
model
|
228
|
+
}
|
229
|
+
|
230
|
+
metrics["genai_requests"].add(1, attributes)
|
231
|
+
metrics["genai_total_tokens"].add(total_tokens, attributes)
|
232
|
+
metrics["genai_completion_tokens"].add(completion_tokens, attributes)
|
233
|
+
metrics["genai_prompt_tokens"].add(prompt_tokens, attributes)
|
234
|
+
metrics["genai_cost"].record(cost, attributes)
|
235
|
+
|
236
|
+
# Return original response
|
237
|
+
return response
|
238
|
+
|
239
|
+
except Exception as e:
|
240
|
+
handle_exception(span, e)
|
241
|
+
logger.error("Error in trace creation: %s", e)
|
242
|
+
|
243
|
+
# Return original response
|
244
|
+
return response
|
245
|
+
|
246
|
+
return wrapper
|
247
|
+
|
248
|
+
def embed(gen_ai_endpoint, version, environment, application_name,
|
249
|
+
tracer, pricing_info, trace_content, metrics, disable_metrics):
|
250
|
+
"""
|
251
|
+
Generates a telemetry wrapper for embeddings to collect metrics.
|
252
|
+
|
253
|
+
Args:
|
254
|
+
gen_ai_endpoint: Endpoint identifier for logging and tracing.
|
255
|
+
version: Version of the monitoring package.
|
256
|
+
environment: Deployment environment (e.g., production, staging).
|
257
|
+
application_name: Name of the application using the GPT4All API.
|
258
|
+
tracer: OpenTelemetry tracer for creating spans.
|
259
|
+
pricing_info: Information used for calculating the cost of GPT4All usage.
|
260
|
+
trace_content: Flag indicating whether to trace the actual content.
|
261
|
+
|
262
|
+
Returns:
|
263
|
+
A function that wraps the embeddings method to add telemetry.
|
264
|
+
"""
|
265
|
+
|
266
|
+
def wrapper(wrapped, instance, args, kwargs):
|
267
|
+
"""
|
268
|
+
Wraps the 'embeddings' API call to add telemetry.
|
269
|
+
|
270
|
+
This collects metrics such as execution time, cost, and token usage, and handles errors
|
271
|
+
gracefully, adding details to the trace for observability.
|
272
|
+
|
273
|
+
Args:
|
274
|
+
wrapped: The original 'embeddings' method to be wrapped.
|
275
|
+
instance: The instance of the class where the original method is defined.
|
276
|
+
args: Positional arguments for the 'embeddings' method.
|
277
|
+
kwargs: Keyword arguments for the 'embeddings' method.
|
278
|
+
|
279
|
+
Returns:
|
280
|
+
The response from the original 'embeddings' method.
|
281
|
+
"""
|
282
|
+
|
283
|
+
with tracer.start_as_current_span(gen_ai_endpoint, kind= SpanKind.CLIENT) as span:
|
284
|
+
response = wrapped(*args, **kwargs)
|
285
|
+
|
286
|
+
try:
|
287
|
+
# pylint: disable=line-too-long
|
288
|
+
model = str(instance.gpt4all.model.model_path).rsplit('/', maxsplit=1)[-1] or "all-MiniLM-L6-v2.gguf2.f16.gguf"
|
289
|
+
prompt = kwargs.get("prompt") or args[0] or ""
|
290
|
+
|
291
|
+
# Calculate cost of the operation
|
292
|
+
cost = 0
|
293
|
+
prompt_tokens = general_tokens(prompt)
|
294
|
+
|
295
|
+
# Set Span attributes
|
296
|
+
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
|
297
|
+
span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
|
298
|
+
SemanticConvetion.GEN_AI_SYSTEM_GPT4ALL)
|
299
|
+
span.set_attribute(SemanticConvetion.GEN_AI_TYPE,
|
300
|
+
SemanticConvetion.GEN_AI_TYPE_EMBEDDING)
|
301
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
|
302
|
+
gen_ai_endpoint)
|
303
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENVIRONMENT,
|
304
|
+
environment)
|
305
|
+
span.set_attribute(SemanticConvetion.GEN_AI_APPLICATION_NAME,
|
306
|
+
application_name)
|
307
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
|
308
|
+
model)
|
309
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
|
310
|
+
prompt_tokens)
|
311
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
|
312
|
+
prompt_tokens)
|
313
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
314
|
+
cost)
|
315
|
+
if trace_content:
|
316
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_PROMPT,
|
317
|
+
prompt)
|
318
|
+
|
319
|
+
span.set_status(Status(StatusCode.OK))
|
320
|
+
|
321
|
+
if disable_metrics is False:
|
322
|
+
attributes = {
|
323
|
+
TELEMETRY_SDK_NAME:
|
324
|
+
"openlit",
|
325
|
+
SemanticConvetion.GEN_AI_APPLICATION_NAME:
|
326
|
+
application_name,
|
327
|
+
SemanticConvetion.GEN_AI_SYSTEM:
|
328
|
+
SemanticConvetion.GEN_AI_SYSTEM_GPT4ALL,
|
329
|
+
SemanticConvetion.GEN_AI_ENVIRONMENT:
|
330
|
+
environment,
|
331
|
+
SemanticConvetion.GEN_AI_TYPE:
|
332
|
+
SemanticConvetion.GEN_AI_TYPE_EMBEDDING,
|
333
|
+
SemanticConvetion.GEN_AI_REQUEST_MODEL:
|
334
|
+
model
|
335
|
+
}
|
336
|
+
|
337
|
+
metrics["genai_requests"].add(1, attributes)
|
338
|
+
metrics["genai_total_tokens"].add(prompt_tokens, attributes)
|
339
|
+
metrics["genai_prompt_tokens"].add(prompt_tokens, attributes)
|
340
|
+
metrics["genai_cost"].record(cost, attributes)
|
341
|
+
|
342
|
+
# Return original response
|
343
|
+
return response
|
344
|
+
|
345
|
+
except Exception as e:
|
346
|
+
handle_exception(span, e)
|
347
|
+
logger.error("Error in trace creation: %s", e)
|
348
|
+
|
349
|
+
# Return original response
|
350
|
+
return response
|
351
|
+
|
352
|
+
return wrapper
|
openlit/semcov/__init__.py
CHANGED
@@ -95,6 +95,7 @@ class SemanticConvetion:
|
|
95
95
|
GEN_AI_SYSTEM_VERTEXAI = "vertexai"
|
96
96
|
GEN_AI_SYSTEM_GROQ = "groq"
|
97
97
|
GEN_AI_SYSTEM_OLLAMA = "ollama"
|
98
|
+
GEN_AI_SYSTEM_GPT4ALL = "gpt4all"
|
98
99
|
GEN_AI_SYSTEM_LANGCHAIN = "langchain"
|
99
100
|
GEN_AI_SYSTEM_LLAMAINDEX = "llama_index"
|
100
101
|
GEN_AI_SYSTEM_HAYSTACK = "haystack"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: openlit
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.11.0
|
4
4
|
Summary: OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications, facilitating the integration of observability into your GenAI-driven projects
|
5
5
|
Home-page: https://github.com/openlit/openlit/tree/main/openlit/python
|
6
6
|
Keywords: OpenTelemetry,otel,otlp,llm,tracing,openai,anthropic,claude,cohere,llm monitoring,observability,monitoring,gpt,Generative AI,chatGPT
|
@@ -51,18 +51,19 @@ This project adheres to the [Semantic Conventions](https://github.com/open-telem
|
|
51
51
|
|
52
52
|
## Auto Instrumentation Capabilities
|
53
53
|
|
54
|
-
| LLMs
|
55
|
-
|
56
|
-
| [✅ OpenAI](https://docs.openlit.io/latest/integrations/openai)
|
57
|
-
| [✅ Ollama](https://docs.openlit.io/latest/integrations/ollama)
|
58
|
-
| [✅ Anthropic](https://docs.openlit.io/latest/integrations/anthropic)
|
59
|
-
| [✅
|
60
|
-
| [✅
|
61
|
-
| [✅
|
54
|
+
| LLMs | Vector DBs | Frameworks |
|
55
|
+
|-----------------------------------------------------------------|----------------------------------------------|----------------------------------------------|
|
56
|
+
| [✅ OpenAI](https://docs.openlit.io/latest/integrations/openai) | [✅ ChromaDB](https://docs.openlit.io/latest/integrations/chromadb) | [✅ Langchain](https://docs.openlit.io/latest/integrations/langchain) |
|
57
|
+
| [✅ Ollama](https://docs.openlit.io/latest/integrations/ollama) | [✅ Pinecone](https://docs.openlit.io/latest/integrations/pinecone) | [✅ LiteLLM](https://docs.openlit.io/latest/integrations/litellm) |
|
58
|
+
| [✅ Anthropic](https://docs.openlit.io/latest/integrations/anthropic) | [✅ Qdrant](https://docs.openlit.io/latest/integrations/qdrant) | [✅ LlamaIndex](https://docs.openlit.io/latest/integrations/llama-index) |
|
59
|
+
| [✅ GPT4All](https://docs.openlit.io/latest/integrations/gpt4all) | [✅ Milvus](https://docs.openlit.io/latest/integrations/milvus) | [✅ Haystack](https://docs.openlit.io/latest/integrations/haystack) |
|
60
|
+
| [✅ Cohere](https://docs.openlit.io/latest/integrations/cohere) | | [✅ EmbedChain](https://docs.openlit.io/latest/integrations/embedchain) |
|
61
|
+
| [✅ Mistral](https://docs.openlit.io/latest/integrations/mistral) | |
|
62
|
+
| [✅ Azure OpenAI](https://docs.openlit.io/latest/integrations/azure-openai) | |
|
62
63
|
| [✅ HuggingFace Transformers](https://docs.openlit.io/latest/integrations/huggingface) | |
|
63
|
-
| [✅ Amazon Bedrock](https://docs.openlit.io/latest/integrations/bedrock)
|
64
|
+
| [✅ Amazon Bedrock](https://docs.openlit.io/latest/integrations/bedrock) | |
|
64
65
|
| [✅ Vertex AI](https://docs.openlit.io/latest/integrations/vertexai) | |
|
65
|
-
| [✅ Groq](https://docs.openlit.io/latest/integrations/groq)
|
66
|
+
| [✅ Groq](https://docs.openlit.io/latest/integrations/groq) |
|
66
67
|
|
67
68
|
## Supported Destinations
|
68
69
|
- [✅ OpenTelemetry Collector](https://docs.openlit.io/latest/connections/otelcol)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
openlit/__helpers.py,sha256=lrn4PBs9owDudiCY2NBoVbAi7AU_HtUpyOj0oqPBsPY,5545
|
2
|
-
openlit/__init__.py,sha256=
|
2
|
+
openlit/__init__.py,sha256=uW32Zg5R6NK3qqy3rfQhUnFi_YfvhnM4TFJSLo6Yr54,10439
|
3
3
|
openlit/instrumentation/anthropic/__init__.py,sha256=oaU53BOPyfUKbEzYvLr1DPymDluurSnwo4Hernf2XdU,1955
|
4
4
|
openlit/instrumentation/anthropic/anthropic.py,sha256=CYBui5eEfWdSfFF0xtCQjh1xO-gCVJc_V9Hli0szVZE,16026
|
5
5
|
openlit/instrumentation/anthropic/async_anthropic.py,sha256=NW84kTQ3BkUx1zZuMRps_J7zTYkmq5BxOrqSjqWInBs,16068
|
@@ -11,6 +11,8 @@ openlit/instrumentation/cohere/__init__.py,sha256=PC5T1qIg9pwLNocBP_WjG5B_6p_z01
|
|
11
11
|
openlit/instrumentation/cohere/cohere.py,sha256=GvxIp55TJIu4YyG0_FwLBDHvAMUlAXyvMNIFhl2CQP4,20437
|
12
12
|
openlit/instrumentation/embedchain/__init__.py,sha256=8TYk1OEbz46yF19dr-gB_x80VZMagU3kJ8-QihPXTeA,1929
|
13
13
|
openlit/instrumentation/embedchain/embedchain.py,sha256=SLlr7qieT3kp4M6OYSRy8FaVCXQ2t3oPyIiE99ioNE4,7892
|
14
|
+
openlit/instrumentation/gpt4all/__init__.py,sha256=-59CP2B3-HGZJ_vC-fI9Dt-0BuQXRhSCWCjnaGeU15Q,1802
|
15
|
+
openlit/instrumentation/gpt4all/gpt4all.py,sha256=iDu8CAat4j5VPAlhIdkGOclZvhFPG-u7zKwadsKeJps,17948
|
14
16
|
openlit/instrumentation/groq/__init__.py,sha256=uW_0G6HSanQyK2dIXYhzR604pDiyPQfybzc37DsfSew,1911
|
15
17
|
openlit/instrumentation/groq/async_groq.py,sha256=WQwHpC-NJoyEf-jAJlxEcdnpd5jmlfAsDtEBRJ47CxA,19084
|
16
18
|
openlit/instrumentation/groq/groq.py,sha256=4uiEFUjxJ0q-c3GlgPAMc4NijG1YLgQp7o3wcwFrxeg,19048
|
@@ -44,8 +46,8 @@ openlit/instrumentation/vertexai/async_vertexai.py,sha256=PMHYyLf1J4gZpC_-KZ_ZVx
|
|
44
46
|
openlit/instrumentation/vertexai/vertexai.py,sha256=UvpNKBHPoV9idVMfGigZnmWuEQiyqSwZn0zK9-U7Lzw,52125
|
45
47
|
openlit/otel/metrics.py,sha256=O7NoaDz0bY19mqpE4-0PcKwEe-B-iJFRgOCaanAuZAc,4291
|
46
48
|
openlit/otel/tracing.py,sha256=vL1ifMbARPBpqK--yXYsCM6y5dSu5LFIKqkhZXtYmUc,3712
|
47
|
-
openlit/semcov/__init__.py,sha256=
|
48
|
-
openlit-1.
|
49
|
-
openlit-1.
|
50
|
-
openlit-1.
|
51
|
-
openlit-1.
|
49
|
+
openlit/semcov/__init__.py,sha256=6t5P_0_oS4TtorvKsfLtCQchO0HtIzTenxSye_F4G2Y,6687
|
50
|
+
openlit-1.11.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
51
|
+
openlit-1.11.0.dist-info/METADATA,sha256=EAwsft48mdWV1fOxy_XghH1H1rnvhdTOpIrvKviIXSE,13055
|
52
|
+
openlit-1.11.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
53
|
+
openlit-1.11.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|