openlit 1.10.0__py3-none-any.whl → 1.12.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 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
@@ -268,7 +268,7 @@ def async_chat(gen_ai_endpoint, version, environment, application_name,
268
268
  else:
269
269
  i = 0
270
270
  while i < kwargs["n"] and trace_content is True:
271
- attribute_name = f"gen_ai.content.completion.{i}"
271
+ attribute_name = f"gen_ai.completion.{i}"
272
272
  span.set_attribute(attribute_name,
273
273
  response.choices[i].message.content)
274
274
  i += 1
@@ -268,7 +268,7 @@ def chat(gen_ai_endpoint, version, environment, application_name,
268
268
  else:
269
269
  i = 0
270
270
  while i < kwargs["n"] and trace_content is True:
271
- attribute_name = f"gen_ai.content.completion.{i}"
271
+ attribute_name = f"gen_ai.completion.{i}"
272
272
  span.set_attribute(attribute_name,
273
273
  response.choices[i].message.content)
274
274
  i += 1
@@ -269,7 +269,7 @@ def azure_async_chat_completions(gen_ai_endpoint, version, environment, applicat
269
269
  else:
270
270
  i = 0
271
271
  while i < kwargs["n"] and trace_content is True:
272
- attribute_name = f"gen_ai.content.completion.{i}"
272
+ attribute_name = f"gen_ai.completion.{i}"
273
273
  span.set_attribute(attribute_name,
274
274
  response.choices[i].message.content)
275
275
  i += 1
@@ -550,7 +550,7 @@ def azure_async_completions(gen_ai_endpoint, version, environment, application_n
550
550
  else:
551
551
  i = 0
552
552
  while i < kwargs["n"] and trace_content is True:
553
- attribute_name = f"gen_ai.content.completion.{i}"
553
+ attribute_name = f"gen_ai.completion.{i}"
554
554
  span.set_attribute(attribute_name,
555
555
  response.choices[i].text)
556
556
  i += 1
@@ -273,7 +273,7 @@ def async_chat_completions(gen_ai_endpoint, version, environment, application_na
273
273
  else:
274
274
  i = 0
275
275
  while i < kwargs["n"] and trace_content is True:
276
- attribute_name = f"gen_ai.content.completion.{i}"
276
+ attribute_name = f"gen_ai.completion.{i}"
277
277
  span.set_attribute(attribute_name,
278
278
  response.choices[i].message.content)
279
279
  i += 1
@@ -269,7 +269,7 @@ def azure_chat_completions(gen_ai_endpoint, version, environment, application_na
269
269
  else:
270
270
  i = 0
271
271
  while i < kwargs["n"] and trace_content is True:
272
- attribute_name = f"gen_ai.content.completion.{i}"
272
+ attribute_name = f"gen_ai.completion.{i}"
273
273
  span.set_attribute(attribute_name,
274
274
  response.choices[i].message.content)
275
275
  i += 1
@@ -548,7 +548,7 @@ def azure_completions(gen_ai_endpoint, version, environment, application_name,
548
548
  else:
549
549
  i = 0
550
550
  while i < kwargs["n"] and trace_content is True:
551
- attribute_name = f"gen_ai.content.completion.{i}"
551
+ attribute_name = f"gen_ai.completion.{i}"
552
552
  span.set_attribute(attribute_name,
553
553
  response.choices[i].text)
554
554
  i += 1
@@ -272,7 +272,7 @@ def chat_completions(gen_ai_endpoint, version, environment, application_name,
272
272
  else:
273
273
  i = 0
274
274
  while i < kwargs["n"] and trace_content is True:
275
- attribute_name = f"gen_ai.content.completion.{i}"
275
+ attribute_name = f"gen_ai.completion.{i}"
276
276
  span.set_attribute(attribute_name,
277
277
  response.choices[i].message.content)
278
278
  i += 1
@@ -98,7 +98,7 @@ def text_wrap(gen_ai_endpoint, version, environment, application_name,
98
98
  completion_tokens = 0
99
99
  for completion in response:
100
100
  if len(response) > 1:
101
- attribute_name = f"gen_ai.content.completion.{i}"
101
+ attribute_name = f"gen_ai.completion.{i}"
102
102
  else:
103
103
  attribute_name = SemanticConvetion.GEN_AI_CONTENT_COMPLETION
104
104
  if i == 0:
@@ -21,7 +21,7 @@ class SemanticConvetion:
21
21
  GEN_AI_SYSTEM = "gen_ai.system"
22
22
  GEN_AI_ENVIRONMENT = "gen_ai.environment"
23
23
  GEN_AI_APPLICATION_NAME = "gen_ai.application_name"
24
- GEN_AI_TYPE = "gen_ai.type"
24
+ GEN_AI_TYPE = "gen_ai.operation.name"
25
25
  GEN_AI_HUB_OWNER = "gen_ai.hub.owner"
26
26
  GEN_AI_HUB_REPO = "gen_ai.hub.repo"
27
27
  GEN_AI_RETRIEVAL_SOURCE = "gen_ai.retrieval.source"
@@ -68,8 +68,8 @@ class SemanticConvetion:
68
68
  GEN_AI_RESPONSE_IMAGE_STYLE = "gen_ai.request.image_style"
69
69
 
70
70
  # GenAI Content
71
- GEN_AI_CONTENT_PROMPT = "gen_ai.content.prompt"
72
- GEN_AI_CONTENT_COMPLETION = "gen_ai.content.completion"
71
+ GEN_AI_CONTENT_PROMPT = "gen_ai.prompt"
72
+ GEN_AI_CONTENT_COMPLETION = "gen_ai.completion"
73
73
  GEN_AI_CONTENT_REVISED_PROMPT = "gen_ai.content.revised_prompt"
74
74
 
75
75
  # GenAI Evaluation Metrics
@@ -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.10.0
3
+ Version: 1.12.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,26 +51,28 @@ This project adheres to the [Semantic Conventions](https://github.com/open-telem
51
51
 
52
52
  ## Auto Instrumentation Capabilities
53
53
 
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
- | [✅ Cohere](https://docs.openlit.io/latest/integrations/cohere) | [✅ Milvus](https://docs.openlit.io/latest/integrations/milvus) | [✅ Haystack](https://docs.openlit.io/latest/integrations/haystack) |
60
- | [✅ Mistral](https://docs.openlit.io/latest/integrations/mistral) | |
61
- | [✅ Azure OpenAI](https://docs.openlit.io/latest/integrations/azure-openai) | |
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)
69
70
  - [✅ Prometheus + Tempo](https://docs.openlit.io/latest/connections/prometheus-tempo)
70
71
  - [✅ Prometheus + Jaeger](https://docs.openlit.io/latest/connections/prometheus-jaeger)
71
72
  - [✅ Grafana Cloud](https://docs.openlit.io/latest/connections/grafanacloud)
72
- - [✅ DataDog](https://docs.openlit.io/latest/connections/datadog)
73
73
  - [✅ New Relic](https://docs.openlit.io/latest/connections/new-relic)
74
+ - [✅ Elastic](https://docs.openlit.io/latest/connections/elastic)
75
+ - [✅ DataDog](https://docs.openlit.io/latest/connections/datadog)
74
76
  - [✅ SigNoz](https://docs.openlit.io/latest/connections/signoz)
75
77
  - [✅ Dynatrace](https://docs.openlit.io/latest/connections/dynatrace)
76
78
  - [✅ OpenObserve](https://docs.openlit.io/latest/connections/openobserve)
@@ -1,5 +1,5 @@
1
1
  openlit/__helpers.py,sha256=lrn4PBs9owDudiCY2NBoVbAi7AU_HtUpyOj0oqPBsPY,5545
2
- openlit/__init__.py,sha256=rKjXPouODce9nDeysIwf5k8YWA27Fpnr8J6PDCg4k4Q,10299
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,9 +11,11 @@ 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
- openlit/instrumentation/groq/async_groq.py,sha256=WQwHpC-NJoyEf-jAJlxEcdnpd5jmlfAsDtEBRJ47CxA,19084
16
- openlit/instrumentation/groq/groq.py,sha256=4uiEFUjxJ0q-c3GlgPAMc4NijG1YLgQp7o3wcwFrxeg,19048
17
+ openlit/instrumentation/groq/async_groq.py,sha256=aOwgoUrEqIgLSlnAtJnaGIF8T_LUlpTnOzPNBIUwez4,19076
18
+ openlit/instrumentation/groq/groq.py,sha256=iMh4TPwBEJ7Eg6Gi4x6KYpELtQKDXIsgLrh6kQHVkHc,19040
17
19
  openlit/instrumentation/haystack/__init__.py,sha256=QK6XxxZUHX8vMv2Crk7rNBOc64iOOBLhJGL_lPlAZ8s,1758
18
20
  openlit/instrumentation/haystack/haystack.py,sha256=oQIZiDhdp3gnJnhYQ1OouJMc9YT0pQ-_31cmNuopa68,3891
19
21
  openlit/instrumentation/langchain/__init__.py,sha256=TW1ZR7I1i9Oig-wDWp3j1gmtQFO76jNBXQRBGGKzoOo,2531
@@ -29,23 +31,23 @@ openlit/instrumentation/ollama/__init__.py,sha256=cOax8PiypDuo_FC4WvDCYBRo7lH5nV
29
31
  openlit/instrumentation/ollama/async_ollama.py,sha256=ESk1zZTj2hPmkWIH5F2owuoo0apleDSSx5VORlO3e3w,28991
30
32
  openlit/instrumentation/ollama/ollama.py,sha256=PLGF9RB3TRNZ9GSGqeGVvKFBtgUK8Hc8xwvk-3NPeGI,28901
31
33
  openlit/instrumentation/openai/__init__.py,sha256=AZ2cPr3TMKkgGdMl_yXMeSi7bWhtmMqOW1iHdzHHGHA,16265
32
- openlit/instrumentation/openai/async_azure_openai.py,sha256=QE_5KHaCHAndkf7Y2Iq66mZUc0I1qtqIJ6iYPnwiuXA,46297
33
- openlit/instrumentation/openai/async_openai.py,sha256=qfJG_gIkSz3Gjau0zQ_G3tvkqkOd-md5LBK6wIjvH0U,45841
34
- openlit/instrumentation/openai/azure_openai.py,sha256=8nm1hsGdWLhJt97fkV254_biYdGeVJiZP2_Yb3pKSEU,46091
35
- openlit/instrumentation/openai/openai.py,sha256=VVl0fuQfxitH-V4hVeP5VxB31-yWMI74Xz4katlsG78,46522
34
+ openlit/instrumentation/openai/async_azure_openai.py,sha256=Lkclj_EraztqBpuYldDMwhqApa0iUb1s5gcUlgkwMkA,46281
35
+ openlit/instrumentation/openai/async_openai.py,sha256=KtY_nGbUjDXE4jU3udGT51XbV-FVJwPMj8uoHfiAvi8,45833
36
+ openlit/instrumentation/openai/azure_openai.py,sha256=q1o2tnxOY5Abm3YV7cNqkgLJPNzIxlETZ2gET6FRdxI,46075
37
+ openlit/instrumentation/openai/openai.py,sha256=kTGe7BjByIVRSWEALwFc1D3ZYLioTmKlZ4m76luupoQ,46514
36
38
  openlit/instrumentation/pinecone/__init__.py,sha256=Mv9bElqNs07_JQkYyNnO0wOM3hdbprmw7sttdMeKC7g,2526
37
39
  openlit/instrumentation/pinecone/pinecone.py,sha256=0EhLmtOuvwWVvAKh3e56wyd8wzQq1oaLOmF15SVHxVE,8765
38
40
  openlit/instrumentation/qdrant/__init__.py,sha256=OJIg17-IGmBEvBYVKjCHcJ0hFXuEL7XV_jzUTqkolN8,4799
39
41
  openlit/instrumentation/qdrant/qdrant.py,sha256=4uHKYGvWQtRAEVLUWo3o4joJw7hFm2NxVuBu5YKZKiI,14456
40
42
  openlit/instrumentation/transformers/__init__.py,sha256=9-KLjq-aPTh13gTBYsWltV6hokGwt3mP4759SwsaaCk,1478
41
- openlit/instrumentation/transformers/transformers.py,sha256=peT0BGskYt7AZ0b93TZ7qECXfZRgDQMasUeamexYdZI,7592
43
+ openlit/instrumentation/transformers/transformers.py,sha256=Kh7WlEDT4ZNGQTMO8V-eYCc45nj-OPrkXXN-Ss4V5no,7584
42
44
  openlit/instrumentation/vertexai/__init__.py,sha256=N3E9HtzefD-zC0fvmfGYiDmSqssoavp_i59wfuYLyMw,6079
43
45
  openlit/instrumentation/vertexai/async_vertexai.py,sha256=PMHYyLf1J4gZpC_-KZ_ZVx1xIHhZDJSNa7mrjNXZ5M0,52372
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=sjbSzGH2p25cLrdm3OZxHxxv2gF2eh9Ij1hPamQtMdM,6649
48
- openlit-1.10.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
49
- openlit-1.10.0.dist-info/METADATA,sha256=0oJJupg32D01gTLE2_YTna8zgf4TOF5hxpHJC2d3_Wk,12841
50
- openlit-1.10.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
51
- openlit-1.10.0.dist-info/RECORD,,
49
+ openlit/semcov/__init__.py,sha256=fZve0UdvbZCcXBBiYhQhwm6gFe9JPkZznyr8W3wiI68,6681
50
+ openlit-1.12.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
51
+ openlit-1.12.0.dist-info/METADATA,sha256=4N0gOurCVrWMv_5yMkqFqLxPFwjeACSF6Tutc2WOOxc,13123
52
+ openlit-1.12.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
53
+ openlit-1.12.0.dist-info/RECORD,,