openlit 1.2.0__py3-none-any.whl → 1.4.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 +9 -0
- openlit/instrumentation/anthropic/anthropic.py +1 -1
- openlit/instrumentation/anthropic/async_anthropic.py +1 -1
- openlit/instrumentation/chroma/chroma.py +1 -1
- openlit/instrumentation/cohere/cohere.py +1 -1
- openlit/instrumentation/groq/__init__.py +50 -0
- openlit/instrumentation/groq/async_groq.py +331 -0
- openlit/instrumentation/groq/groq.py +331 -0
- openlit/instrumentation/haystack/__init__.py +49 -0
- openlit/instrumentation/haystack/haystack.py +84 -0
- openlit/instrumentation/langchain/langchain.py +1 -1
- openlit/instrumentation/llamaindex/__init__.py +55 -0
- openlit/instrumentation/llamaindex/llamaindex.py +86 -0
- openlit/instrumentation/mistral/async_mistral.py +1 -1
- openlit/instrumentation/mistral/mistral.py +1 -1
- openlit/instrumentation/pinecone/pinecone.py +1 -1
- openlit/otel/tracing.py +3 -0
- openlit/semcov/__init__.py +3 -0
- {openlit-1.2.0.dist-info → openlit-1.4.0.dist-info}/METADATA +26 -19
- {openlit-1.2.0.dist-info → openlit-1.4.0.dist-info}/RECORD +22 -15
- {openlit-1.2.0.dist-info → openlit-1.4.0.dist-info}/LICENSE +0 -0
- {openlit-1.2.0.dist-info → openlit-1.4.0.dist-info}/WHEEL +0 -0
openlit/__init__.py
CHANGED
@@ -19,7 +19,10 @@ from openlit.instrumentation.cohere import CohereInstrumentor
|
|
19
19
|
from openlit.instrumentation.mistral import MistralInstrumentor
|
20
20
|
from openlit.instrumentation.bedrock import BedrockInstrumentor
|
21
21
|
from openlit.instrumentation.vertexai import VertexAIInstrumentor
|
22
|
+
from openlit.instrumentation.groq import GroqInstrumentor
|
22
23
|
from openlit.instrumentation.langchain import LangChainInstrumentor
|
24
|
+
from openlit.instrumentation.llamaindex import LlamaIndexInstrumentor
|
25
|
+
from openlit.instrumentation.haystack import HaystackInstrumentor
|
23
26
|
from openlit.instrumentation.chroma import ChromaInstrumentor
|
24
27
|
from openlit.instrumentation.pinecone import PineconeInstrumentor
|
25
28
|
from openlit.instrumentation.transformers import TransformersInstrumentor
|
@@ -149,7 +152,10 @@ def init(environment="default", application_name="default", tracer=None, otlp_en
|
|
149
152
|
"mistral": "mistralai",
|
150
153
|
"bedrock": "boto3",
|
151
154
|
"vertexai": "vertexai",
|
155
|
+
"groq": "groq",
|
152
156
|
"langchain": "langchain",
|
157
|
+
"llama_index": "llama_index",
|
158
|
+
"haystack": "haystack",
|
153
159
|
"chroma": "chromadb",
|
154
160
|
"pinecone": "pinecone",
|
155
161
|
"transformers": "transformers"
|
@@ -197,7 +203,10 @@ def init(environment="default", application_name="default", tracer=None, otlp_en
|
|
197
203
|
"mistral": MistralInstrumentor(),
|
198
204
|
"bedrock": BedrockInstrumentor(),
|
199
205
|
"vertexai": VertexAIInstrumentor(),
|
206
|
+
"groq": GroqInstrumentor(),
|
200
207
|
"langchain": LangChainInstrumentor(),
|
208
|
+
"llama_index": LlamaIndexInstrumentor(),
|
209
|
+
"haystack": HaystackInstrumentor(),
|
201
210
|
"chroma": ChromaInstrumentor(),
|
202
211
|
"pinecone": PineconeInstrumentor(),
|
203
212
|
"transformers": TransformersInstrumentor()
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument
|
1
|
+
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument, possibly-used-before-assignment
|
2
2
|
"""
|
3
3
|
Module for monitoring Anthropic API calls.
|
4
4
|
"""
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument
|
1
|
+
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument, possibly-used-before-assignment
|
2
2
|
"""
|
3
3
|
Module for monitoring Anthropic API calls.
|
4
4
|
"""
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument
|
1
|
+
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument, possibly-used-before-assignment
|
2
2
|
"""
|
3
3
|
Module for monitoring Cohere API calls.
|
4
4
|
"""
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# pylint: disable=useless-return, bad-staticmethod-argument, disable=duplicate-code
|
2
|
+
"""Initializer of Auto Instrumentation of Groq 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.groq.groq import chat
|
10
|
+
from openlit.instrumentation.groq.async_groq import async_chat
|
11
|
+
|
12
|
+
_instruments = ("groq >= 0.5.0",)
|
13
|
+
|
14
|
+
class GroqInstrumentor(BaseInstrumentor):
|
15
|
+
"""
|
16
|
+
An instrumentor for Groq's client library.
|
17
|
+
"""
|
18
|
+
|
19
|
+
def instrumentation_dependencies(self) -> Collection[str]:
|
20
|
+
return _instruments
|
21
|
+
|
22
|
+
def _instrument(self, **kwargs):
|
23
|
+
application_name = kwargs.get("application_name", "default_application")
|
24
|
+
environment = kwargs.get("environment", "default_environment")
|
25
|
+
tracer = kwargs.get("tracer")
|
26
|
+
metrics = kwargs.get("metrics_dict")
|
27
|
+
pricing_info = kwargs.get("pricing_info", {})
|
28
|
+
trace_content = kwargs.get("trace_content", False)
|
29
|
+
disable_metrics = kwargs.get("disable_metrics")
|
30
|
+
version = importlib.metadata.version("groq")
|
31
|
+
|
32
|
+
#sync
|
33
|
+
wrap_function_wrapper(
|
34
|
+
"groq.resources.chat.completions",
|
35
|
+
"Completions.create",
|
36
|
+
chat("groq.chat.completions", version, environment, application_name,
|
37
|
+
tracer, pricing_info, trace_content, metrics, disable_metrics),
|
38
|
+
)
|
39
|
+
|
40
|
+
#async
|
41
|
+
wrap_function_wrapper(
|
42
|
+
"groq.resources.chat.completions",
|
43
|
+
"AsyncCompletions.create",
|
44
|
+
async_chat("groq.chat.completions", version, environment, application_name,
|
45
|
+
tracer, pricing_info, trace_content, metrics, disable_metrics),
|
46
|
+
)
|
47
|
+
|
48
|
+
def _uninstrument(self, **kwargs):
|
49
|
+
# Proper uninstrumentation logic to revert patched methods
|
50
|
+
pass
|
@@ -0,0 +1,331 @@
|
|
1
|
+
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument, used-before-assignment, too-many-branches
|
2
|
+
"""
|
3
|
+
Module for monitoring Groq 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 get_chat_model_cost, handle_exception
|
10
|
+
from openlit.semcov import SemanticConvetion
|
11
|
+
|
12
|
+
# Initialize logger for logging potential issues and operations
|
13
|
+
logger = logging.getLogger(__name__)
|
14
|
+
|
15
|
+
def async_chat(gen_ai_endpoint, version, environment, application_name,
|
16
|
+
tracer, pricing_info, trace_content, metrics, disable_metrics):
|
17
|
+
"""
|
18
|
+
Generates a telemetry wrapper for chat completions 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 Groq API.
|
25
|
+
tracer: OpenTelemetry tracer for creating spans.
|
26
|
+
pricing_info: Information used for calculating the cost of Groq usage.
|
27
|
+
trace_content: Flag indicating whether to trace the actual content.
|
28
|
+
|
29
|
+
Returns:
|
30
|
+
A function that wraps the chat completions method to add telemetry.
|
31
|
+
"""
|
32
|
+
|
33
|
+
async def wrapper(wrapped, instance, args, kwargs):
|
34
|
+
"""
|
35
|
+
Wraps the 'chat.completions' 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 'chat.completions' method to be wrapped.
|
42
|
+
instance: The instance of the class where the original method is defined.
|
43
|
+
args: Positional arguments for the 'chat.completions' method.
|
44
|
+
kwargs: Keyword arguments for the 'chat.completions' method.
|
45
|
+
|
46
|
+
Returns:
|
47
|
+
The response from the original 'chat.completions' method.
|
48
|
+
"""
|
49
|
+
|
50
|
+
# Check if streaming is enabled for the API call
|
51
|
+
streaming = kwargs.get("stream", 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
|
+
async 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
|
+
async for chunk in await wrapped(*args, **kwargs):
|
63
|
+
# Collect message IDs and aggregated response from events
|
64
|
+
if len(chunk.choices) > 0:
|
65
|
+
# pylint: disable=line-too-long
|
66
|
+
if hasattr(chunk.choices[0], "delta") and hasattr(chunk.choices[0].delta, "content"):
|
67
|
+
content = chunk.choices[0].delta.content
|
68
|
+
if content:
|
69
|
+
llmresponse += content
|
70
|
+
if chunk.x_groq is not None and chunk.x_groq.usage is not None:
|
71
|
+
prompt_tokens = chunk.x_groq.usage.prompt_tokens
|
72
|
+
completion_tokens = chunk.x_groq.usage.completion_tokens
|
73
|
+
total_tokens = chunk.x_groq.usage.total_tokens
|
74
|
+
response_id = chunk.x_groq.id
|
75
|
+
yield chunk
|
76
|
+
|
77
|
+
# Handling exception ensure observability without disrupting operation
|
78
|
+
try:
|
79
|
+
# Format 'messages' into a single string
|
80
|
+
message_prompt = kwargs.get("messages", "")
|
81
|
+
formatted_messages = []
|
82
|
+
for message in message_prompt:
|
83
|
+
role = message["role"]
|
84
|
+
content = message["content"]
|
85
|
+
|
86
|
+
if isinstance(content, list):
|
87
|
+
content_str = ", ".join(
|
88
|
+
# pylint: disable=line-too-long
|
89
|
+
f'{item["type"]}: {item["text"] if "text" in item else item["image_url"]}'
|
90
|
+
if "type" in item else f'text: {item["text"]}'
|
91
|
+
for item in content
|
92
|
+
)
|
93
|
+
formatted_messages.append(f"{role}: {content_str}")
|
94
|
+
else:
|
95
|
+
formatted_messages.append(f"{role}: {content}")
|
96
|
+
prompt = "\n".join(formatted_messages)
|
97
|
+
|
98
|
+
# Calculate cost of the operation
|
99
|
+
cost = get_chat_model_cost(kwargs.get("model", "gpt-3.5-turbo"),
|
100
|
+
pricing_info, prompt_tokens,
|
101
|
+
completion_tokens)
|
102
|
+
|
103
|
+
# Set Span attributes
|
104
|
+
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
|
105
|
+
span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
|
106
|
+
SemanticConvetion.GEN_AI_SYSTEM_GROQ)
|
107
|
+
span.set_attribute(SemanticConvetion.GEN_AI_TYPE,
|
108
|
+
SemanticConvetion.GEN_AI_TYPE_CHAT)
|
109
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
|
110
|
+
gen_ai_endpoint)
|
111
|
+
span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_ID,
|
112
|
+
response_id)
|
113
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENVIRONMENT,
|
114
|
+
environment)
|
115
|
+
span.set_attribute(SemanticConvetion.GEN_AI_APPLICATION_NAME,
|
116
|
+
application_name)
|
117
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
|
118
|
+
kwargs.get("model", "gpt-3.5-turbo"))
|
119
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_USER,
|
120
|
+
kwargs.get("user", ""))
|
121
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
|
122
|
+
kwargs.get("top_p", 1))
|
123
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
|
124
|
+
kwargs.get("max_tokens", ""))
|
125
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
|
126
|
+
kwargs.get("temperature", 1))
|
127
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_PRESENCE_PENALTY,
|
128
|
+
kwargs.get("presence_penalty", 0))
|
129
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY,
|
130
|
+
kwargs.get("frequency_penalty", 0))
|
131
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_SEED,
|
132
|
+
kwargs.get("seed", ""))
|
133
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
|
134
|
+
True)
|
135
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
|
136
|
+
prompt_tokens)
|
137
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COMPLETION_TOKENS,
|
138
|
+
completion_tokens)
|
139
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
|
140
|
+
prompt_tokens + completion_tokens)
|
141
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
142
|
+
cost)
|
143
|
+
if trace_content:
|
144
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_PROMPT,
|
145
|
+
prompt)
|
146
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_COMPLETION,
|
147
|
+
llmresponse)
|
148
|
+
|
149
|
+
span.set_status(Status(StatusCode.OK))
|
150
|
+
|
151
|
+
if disable_metrics is False:
|
152
|
+
attributes = {
|
153
|
+
TELEMETRY_SDK_NAME:
|
154
|
+
"openlit",
|
155
|
+
SemanticConvetion.GEN_AI_APPLICATION_NAME:
|
156
|
+
application_name,
|
157
|
+
SemanticConvetion.GEN_AI_SYSTEM:
|
158
|
+
SemanticConvetion.GEN_AI_SYSTEM_GROQ,
|
159
|
+
SemanticConvetion.GEN_AI_ENVIRONMENT:
|
160
|
+
environment,
|
161
|
+
SemanticConvetion.GEN_AI_TYPE:
|
162
|
+
SemanticConvetion.GEN_AI_TYPE_CHAT,
|
163
|
+
SemanticConvetion.GEN_AI_REQUEST_MODEL:
|
164
|
+
kwargs.get("model", "gpt-3.5-turbo")
|
165
|
+
}
|
166
|
+
|
167
|
+
metrics["genai_requests"].add(1, attributes)
|
168
|
+
metrics["genai_total_tokens"].add(
|
169
|
+
total_tokens, attributes
|
170
|
+
)
|
171
|
+
metrics["genai_completion_tokens"].add(completion_tokens, attributes)
|
172
|
+
metrics["genai_prompt_tokens"].add(prompt_tokens, attributes)
|
173
|
+
metrics["genai_cost"].record(cost, attributes)
|
174
|
+
|
175
|
+
except Exception as e:
|
176
|
+
handle_exception(span, e)
|
177
|
+
logger.error("Error in trace creation: %s", e)
|
178
|
+
|
179
|
+
return stream_generator()
|
180
|
+
|
181
|
+
# Handling for non-streaming responses
|
182
|
+
else:
|
183
|
+
# pylint: disable=line-too-long
|
184
|
+
with tracer.start_as_current_span(gen_ai_endpoint, kind= SpanKind.CLIENT) as span:
|
185
|
+
response = await wrapped(*args, **kwargs)
|
186
|
+
|
187
|
+
try:
|
188
|
+
# Format 'messages' into a single string
|
189
|
+
message_prompt = kwargs.get("messages", "")
|
190
|
+
formatted_messages = []
|
191
|
+
for message in message_prompt:
|
192
|
+
role = message["role"]
|
193
|
+
content = message["content"]
|
194
|
+
|
195
|
+
if isinstance(content, list):
|
196
|
+
content_str = ", ".join(
|
197
|
+
# pylint: disable=line-too-long
|
198
|
+
f'{item["type"]}: {item["text"] if "text" in item else item["image_url"]}'
|
199
|
+
if "type" in item else f'text: {item["text"]}'
|
200
|
+
for item in content
|
201
|
+
)
|
202
|
+
formatted_messages.append(f"{role}: {content_str}")
|
203
|
+
else:
|
204
|
+
formatted_messages.append(f"{role}: {content}")
|
205
|
+
prompt = "\n".join(formatted_messages)
|
206
|
+
|
207
|
+
# Set base span attribues
|
208
|
+
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
|
209
|
+
span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
|
210
|
+
SemanticConvetion.GEN_AI_SYSTEM_GROQ)
|
211
|
+
span.set_attribute(SemanticConvetion.GEN_AI_TYPE,
|
212
|
+
SemanticConvetion.GEN_AI_TYPE_CHAT)
|
213
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
|
214
|
+
gen_ai_endpoint)
|
215
|
+
span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_ID,
|
216
|
+
response.x_groq["id"])
|
217
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENVIRONMENT,
|
218
|
+
environment)
|
219
|
+
span.set_attribute(SemanticConvetion.GEN_AI_APPLICATION_NAME,
|
220
|
+
application_name)
|
221
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
|
222
|
+
kwargs.get("model", "llama3-8b-8192"))
|
223
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
|
224
|
+
kwargs.get("top_p", 1))
|
225
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
|
226
|
+
kwargs.get("max_tokens", ""))
|
227
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_USER,
|
228
|
+
kwargs.get("name", ""))
|
229
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
|
230
|
+
kwargs.get("temperature", 1))
|
231
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_PRESENCE_PENALTY,
|
232
|
+
kwargs.get("presence_penalty", 0))
|
233
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY,
|
234
|
+
kwargs.get("frequency_penalty", 0))
|
235
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_SEED,
|
236
|
+
kwargs.get("seed", ""))
|
237
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
|
238
|
+
False)
|
239
|
+
if trace_content:
|
240
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_PROMPT,
|
241
|
+
prompt)
|
242
|
+
|
243
|
+
# Set span attributes when tools is not passed to the function call
|
244
|
+
if "tools" not in kwargs:
|
245
|
+
# Calculate cost of the operation
|
246
|
+
cost = get_chat_model_cost(kwargs.get("model", "llama3-8b-8192"),
|
247
|
+
pricing_info, response.usage.prompt_tokens,
|
248
|
+
response.usage.completion_tokens)
|
249
|
+
|
250
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
|
251
|
+
response.usage.prompt_tokens)
|
252
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COMPLETION_TOKENS,
|
253
|
+
response.usage.completion_tokens)
|
254
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
|
255
|
+
response.usage.total_tokens)
|
256
|
+
span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
|
257
|
+
response.choices[0].finish_reason)
|
258
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
259
|
+
cost)
|
260
|
+
|
261
|
+
# Set span attributes for when n = 1 (default)
|
262
|
+
if "n" not in kwargs or kwargs["n"] == 1:
|
263
|
+
if trace_content:
|
264
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_COMPLETION,
|
265
|
+
response.choices[0].message.content)
|
266
|
+
|
267
|
+
# Set span attributes for when n > 0
|
268
|
+
else:
|
269
|
+
i = 0
|
270
|
+
while i < kwargs["n"] and trace_content is True:
|
271
|
+
attribute_name = f"gen_ai.content.completion.{i}"
|
272
|
+
span.set_attribute(attribute_name,
|
273
|
+
response.choices[i].message.content)
|
274
|
+
i += 1
|
275
|
+
|
276
|
+
# Return original response
|
277
|
+
return response
|
278
|
+
|
279
|
+
# Set span attributes when tools is passed to the function call
|
280
|
+
elif "tools" in kwargs:
|
281
|
+
# Calculate cost of the operation
|
282
|
+
cost = get_chat_model_cost(kwargs.get("model", "gpt-3.5-turbo"),
|
283
|
+
pricing_info, response.usage.prompt_tokens,
|
284
|
+
response.usage.completion_tokens)
|
285
|
+
|
286
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_COMPLETION,
|
287
|
+
"Function called with tools")
|
288
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
|
289
|
+
response.usage.prompt_tokens)
|
290
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COMPLETION_TOKENS,
|
291
|
+
response.usage.completion_tokens)
|
292
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
|
293
|
+
response.usage.total_tokens)
|
294
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
295
|
+
cost)
|
296
|
+
|
297
|
+
span.set_status(Status(StatusCode.OK))
|
298
|
+
|
299
|
+
if disable_metrics is False:
|
300
|
+
attributes = {
|
301
|
+
TELEMETRY_SDK_NAME:
|
302
|
+
"openlit",
|
303
|
+
SemanticConvetion.GEN_AI_APPLICATION_NAME:
|
304
|
+
application_name,
|
305
|
+
SemanticConvetion.GEN_AI_SYSTEM:
|
306
|
+
SemanticConvetion.GEN_AI_SYSTEM_GROQ,
|
307
|
+
SemanticConvetion.GEN_AI_ENVIRONMENT:
|
308
|
+
environment,
|
309
|
+
SemanticConvetion.GEN_AI_TYPE:
|
310
|
+
SemanticConvetion.GEN_AI_TYPE_CHAT,
|
311
|
+
SemanticConvetion.GEN_AI_REQUEST_MODEL:
|
312
|
+
kwargs.get("model", "gpt-3.5-turbo")
|
313
|
+
}
|
314
|
+
|
315
|
+
metrics["genai_requests"].add(1, attributes)
|
316
|
+
metrics["genai_total_tokens"].add(response.usage.total_tokens, attributes)
|
317
|
+
metrics["genai_completion_tokens"].add(response.usage.completion_tokens, attributes)
|
318
|
+
metrics["genai_prompt_tokens"].add(response.usage.prompt_tokens, attributes)
|
319
|
+
metrics["genai_cost"].record(cost, attributes)
|
320
|
+
|
321
|
+
# Return original response
|
322
|
+
return response
|
323
|
+
|
324
|
+
except Exception as e:
|
325
|
+
handle_exception(span, e)
|
326
|
+
logger.error("Error in trace creation: %s", e)
|
327
|
+
|
328
|
+
# Return original response
|
329
|
+
return response
|
330
|
+
|
331
|
+
return wrapper
|
@@ -0,0 +1,331 @@
|
|
1
|
+
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument, used-before-assignment, too-many-branches
|
2
|
+
"""
|
3
|
+
Module for monitoring Groq 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 get_chat_model_cost, handle_exception
|
10
|
+
from openlit.semcov import SemanticConvetion
|
11
|
+
|
12
|
+
# Initialize logger for logging potential issues and operations
|
13
|
+
logger = logging.getLogger(__name__)
|
14
|
+
|
15
|
+
def chat(gen_ai_endpoint, version, environment, application_name,
|
16
|
+
tracer, pricing_info, trace_content, metrics, disable_metrics):
|
17
|
+
"""
|
18
|
+
Generates a telemetry wrapper for chat completions 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 Groq API.
|
25
|
+
tracer: OpenTelemetry tracer for creating spans.
|
26
|
+
pricing_info: Information used for calculating the cost of Groq usage.
|
27
|
+
trace_content: Flag indicating whether to trace the actual content.
|
28
|
+
|
29
|
+
Returns:
|
30
|
+
A function that wraps the chat completions method to add telemetry.
|
31
|
+
"""
|
32
|
+
|
33
|
+
def wrapper(wrapped, instance, args, kwargs):
|
34
|
+
"""
|
35
|
+
Wraps the 'chat.completions' 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 'chat.completions' method to be wrapped.
|
42
|
+
instance: The instance of the class where the original method is defined.
|
43
|
+
args: Positional arguments for the 'chat.completions' method.
|
44
|
+
kwargs: Keyword arguments for the 'chat.completions' method.
|
45
|
+
|
46
|
+
Returns:
|
47
|
+
The response from the original 'chat.completions' method.
|
48
|
+
"""
|
49
|
+
|
50
|
+
# Check if streaming is enabled for the API call
|
51
|
+
streaming = kwargs.get("stream", 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 message IDs and aggregated response from events
|
64
|
+
if len(chunk.choices) > 0:
|
65
|
+
# pylint: disable=line-too-long
|
66
|
+
if hasattr(chunk.choices[0], "delta") and hasattr(chunk.choices[0].delta, "content"):
|
67
|
+
content = chunk.choices[0].delta.content
|
68
|
+
if content:
|
69
|
+
llmresponse += content
|
70
|
+
if chunk.x_groq is not None and chunk.x_groq.usage is not None:
|
71
|
+
prompt_tokens = chunk.x_groq.usage.prompt_tokens
|
72
|
+
completion_tokens = chunk.x_groq.usage.completion_tokens
|
73
|
+
total_tokens = chunk.x_groq.usage.total_tokens
|
74
|
+
response_id = chunk.x_groq.id
|
75
|
+
yield chunk
|
76
|
+
|
77
|
+
# Handling exception ensure observability without disrupting operation
|
78
|
+
try:
|
79
|
+
# Format 'messages' into a single string
|
80
|
+
message_prompt = kwargs.get("messages", "")
|
81
|
+
formatted_messages = []
|
82
|
+
for message in message_prompt:
|
83
|
+
role = message["role"]
|
84
|
+
content = message["content"]
|
85
|
+
|
86
|
+
if isinstance(content, list):
|
87
|
+
content_str = ", ".join(
|
88
|
+
# pylint: disable=line-too-long
|
89
|
+
f'{item["type"]}: {item["text"] if "text" in item else item["image_url"]}'
|
90
|
+
if "type" in item else f'text: {item["text"]}'
|
91
|
+
for item in content
|
92
|
+
)
|
93
|
+
formatted_messages.append(f"{role}: {content_str}")
|
94
|
+
else:
|
95
|
+
formatted_messages.append(f"{role}: {content}")
|
96
|
+
prompt = "\n".join(formatted_messages)
|
97
|
+
|
98
|
+
# Calculate cost of the operation
|
99
|
+
cost = get_chat_model_cost(kwargs.get("model", "gpt-3.5-turbo"),
|
100
|
+
pricing_info, prompt_tokens,
|
101
|
+
completion_tokens)
|
102
|
+
|
103
|
+
# Set Span attributes
|
104
|
+
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
|
105
|
+
span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
|
106
|
+
SemanticConvetion.GEN_AI_SYSTEM_GROQ)
|
107
|
+
span.set_attribute(SemanticConvetion.GEN_AI_TYPE,
|
108
|
+
SemanticConvetion.GEN_AI_TYPE_CHAT)
|
109
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
|
110
|
+
gen_ai_endpoint)
|
111
|
+
span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_ID,
|
112
|
+
response_id)
|
113
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENVIRONMENT,
|
114
|
+
environment)
|
115
|
+
span.set_attribute(SemanticConvetion.GEN_AI_APPLICATION_NAME,
|
116
|
+
application_name)
|
117
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
|
118
|
+
kwargs.get("model", "gpt-3.5-turbo"))
|
119
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_USER,
|
120
|
+
kwargs.get("user", ""))
|
121
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
|
122
|
+
kwargs.get("top_p", 1))
|
123
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
|
124
|
+
kwargs.get("max_tokens", ""))
|
125
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
|
126
|
+
kwargs.get("temperature", 1))
|
127
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_PRESENCE_PENALTY,
|
128
|
+
kwargs.get("presence_penalty", 0))
|
129
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY,
|
130
|
+
kwargs.get("frequency_penalty", 0))
|
131
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_SEED,
|
132
|
+
kwargs.get("seed", ""))
|
133
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
|
134
|
+
True)
|
135
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
|
136
|
+
prompt_tokens)
|
137
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COMPLETION_TOKENS,
|
138
|
+
completion_tokens)
|
139
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
|
140
|
+
prompt_tokens + completion_tokens)
|
141
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
142
|
+
cost)
|
143
|
+
if trace_content:
|
144
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_PROMPT,
|
145
|
+
prompt)
|
146
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_COMPLETION,
|
147
|
+
llmresponse)
|
148
|
+
|
149
|
+
span.set_status(Status(StatusCode.OK))
|
150
|
+
|
151
|
+
if disable_metrics is False:
|
152
|
+
attributes = {
|
153
|
+
TELEMETRY_SDK_NAME:
|
154
|
+
"openlit",
|
155
|
+
SemanticConvetion.GEN_AI_APPLICATION_NAME:
|
156
|
+
application_name,
|
157
|
+
SemanticConvetion.GEN_AI_SYSTEM:
|
158
|
+
SemanticConvetion.GEN_AI_SYSTEM_GROQ,
|
159
|
+
SemanticConvetion.GEN_AI_ENVIRONMENT:
|
160
|
+
environment,
|
161
|
+
SemanticConvetion.GEN_AI_TYPE:
|
162
|
+
SemanticConvetion.GEN_AI_TYPE_CHAT,
|
163
|
+
SemanticConvetion.GEN_AI_REQUEST_MODEL:
|
164
|
+
kwargs.get("model", "gpt-3.5-turbo")
|
165
|
+
}
|
166
|
+
|
167
|
+
metrics["genai_requests"].add(1, attributes)
|
168
|
+
metrics["genai_total_tokens"].add(
|
169
|
+
total_tokens, attributes
|
170
|
+
)
|
171
|
+
metrics["genai_completion_tokens"].add(completion_tokens, attributes)
|
172
|
+
metrics["genai_prompt_tokens"].add(prompt_tokens, attributes)
|
173
|
+
metrics["genai_cost"].record(cost, attributes)
|
174
|
+
|
175
|
+
except Exception as e:
|
176
|
+
handle_exception(span, e)
|
177
|
+
logger.error("Error in trace creation: %s", e)
|
178
|
+
|
179
|
+
return stream_generator()
|
180
|
+
|
181
|
+
# Handling for non-streaming responses
|
182
|
+
else:
|
183
|
+
# pylint: disable=line-too-long
|
184
|
+
with tracer.start_as_current_span(gen_ai_endpoint, kind= SpanKind.CLIENT) as span:
|
185
|
+
response = wrapped(*args, **kwargs)
|
186
|
+
|
187
|
+
try:
|
188
|
+
# Format 'messages' into a single string
|
189
|
+
message_prompt = kwargs.get("messages", "")
|
190
|
+
formatted_messages = []
|
191
|
+
for message in message_prompt:
|
192
|
+
role = message["role"]
|
193
|
+
content = message["content"]
|
194
|
+
|
195
|
+
if isinstance(content, list):
|
196
|
+
content_str = ", ".join(
|
197
|
+
# pylint: disable=line-too-long
|
198
|
+
f'{item["type"]}: {item["text"] if "text" in item else item["image_url"]}'
|
199
|
+
if "type" in item else f'text: {item["text"]}'
|
200
|
+
for item in content
|
201
|
+
)
|
202
|
+
formatted_messages.append(f"{role}: {content_str}")
|
203
|
+
else:
|
204
|
+
formatted_messages.append(f"{role}: {content}")
|
205
|
+
prompt = "\n".join(formatted_messages)
|
206
|
+
|
207
|
+
# Set base span attribues
|
208
|
+
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
|
209
|
+
span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
|
210
|
+
SemanticConvetion.GEN_AI_SYSTEM_GROQ)
|
211
|
+
span.set_attribute(SemanticConvetion.GEN_AI_TYPE,
|
212
|
+
SemanticConvetion.GEN_AI_TYPE_CHAT)
|
213
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
|
214
|
+
gen_ai_endpoint)
|
215
|
+
span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_ID,
|
216
|
+
response.x_groq["id"])
|
217
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENVIRONMENT,
|
218
|
+
environment)
|
219
|
+
span.set_attribute(SemanticConvetion.GEN_AI_APPLICATION_NAME,
|
220
|
+
application_name)
|
221
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
|
222
|
+
kwargs.get("model", "llama3-8b-8192"))
|
223
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
|
224
|
+
kwargs.get("top_p", 1))
|
225
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MAX_TOKENS,
|
226
|
+
kwargs.get("max_tokens", ""))
|
227
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_USER,
|
228
|
+
kwargs.get("name", ""))
|
229
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
|
230
|
+
kwargs.get("temperature", 1))
|
231
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_PRESENCE_PENALTY,
|
232
|
+
kwargs.get("presence_penalty", 0))
|
233
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_FREQUENCY_PENALTY,
|
234
|
+
kwargs.get("frequency_penalty", 0))
|
235
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_SEED,
|
236
|
+
kwargs.get("seed", ""))
|
237
|
+
span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
|
238
|
+
False)
|
239
|
+
if trace_content:
|
240
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_PROMPT,
|
241
|
+
prompt)
|
242
|
+
|
243
|
+
# Set span attributes when tools is not passed to the function call
|
244
|
+
if "tools" not in kwargs:
|
245
|
+
# Calculate cost of the operation
|
246
|
+
cost = get_chat_model_cost(kwargs.get("model", "llama3-8b-8192"),
|
247
|
+
pricing_info, response.usage.prompt_tokens,
|
248
|
+
response.usage.completion_tokens)
|
249
|
+
|
250
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
|
251
|
+
response.usage.prompt_tokens)
|
252
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COMPLETION_TOKENS,
|
253
|
+
response.usage.completion_tokens)
|
254
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
|
255
|
+
response.usage.total_tokens)
|
256
|
+
span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
|
257
|
+
response.choices[0].finish_reason)
|
258
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
259
|
+
cost)
|
260
|
+
|
261
|
+
# Set span attributes for when n = 1 (default)
|
262
|
+
if "n" not in kwargs or kwargs["n"] == 1:
|
263
|
+
if trace_content:
|
264
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_COMPLETION,
|
265
|
+
response.choices[0].message.content)
|
266
|
+
|
267
|
+
# Set span attributes for when n > 0
|
268
|
+
else:
|
269
|
+
i = 0
|
270
|
+
while i < kwargs["n"] and trace_content is True:
|
271
|
+
attribute_name = f"gen_ai.content.completion.{i}"
|
272
|
+
span.set_attribute(attribute_name,
|
273
|
+
response.choices[i].message.content)
|
274
|
+
i += 1
|
275
|
+
|
276
|
+
# Return original response
|
277
|
+
return response
|
278
|
+
|
279
|
+
# Set span attributes when tools is passed to the function call
|
280
|
+
elif "tools" in kwargs:
|
281
|
+
# Calculate cost of the operation
|
282
|
+
cost = get_chat_model_cost(kwargs.get("model", "gpt-3.5-turbo"),
|
283
|
+
pricing_info, response.usage.prompt_tokens,
|
284
|
+
response.usage.completion_tokens)
|
285
|
+
|
286
|
+
span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_COMPLETION,
|
287
|
+
"Function called with tools")
|
288
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
|
289
|
+
response.usage.prompt_tokens)
|
290
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COMPLETION_TOKENS,
|
291
|
+
response.usage.completion_tokens)
|
292
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_TOTAL_TOKENS,
|
293
|
+
response.usage.total_tokens)
|
294
|
+
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
295
|
+
cost)
|
296
|
+
|
297
|
+
span.set_status(Status(StatusCode.OK))
|
298
|
+
|
299
|
+
if disable_metrics is False:
|
300
|
+
attributes = {
|
301
|
+
TELEMETRY_SDK_NAME:
|
302
|
+
"openlit",
|
303
|
+
SemanticConvetion.GEN_AI_APPLICATION_NAME:
|
304
|
+
application_name,
|
305
|
+
SemanticConvetion.GEN_AI_SYSTEM:
|
306
|
+
SemanticConvetion.GEN_AI_SYSTEM_GROQ,
|
307
|
+
SemanticConvetion.GEN_AI_ENVIRONMENT:
|
308
|
+
environment,
|
309
|
+
SemanticConvetion.GEN_AI_TYPE:
|
310
|
+
SemanticConvetion.GEN_AI_TYPE_CHAT,
|
311
|
+
SemanticConvetion.GEN_AI_REQUEST_MODEL:
|
312
|
+
kwargs.get("model", "gpt-3.5-turbo")
|
313
|
+
}
|
314
|
+
|
315
|
+
metrics["genai_requests"].add(1, attributes)
|
316
|
+
metrics["genai_total_tokens"].add(response.usage.total_tokens, attributes)
|
317
|
+
metrics["genai_completion_tokens"].add(response.usage.completion_tokens, attributes)
|
318
|
+
metrics["genai_prompt_tokens"].add(response.usage.prompt_tokens, attributes)
|
319
|
+
metrics["genai_cost"].record(cost, attributes)
|
320
|
+
|
321
|
+
# Return original response
|
322
|
+
return response
|
323
|
+
|
324
|
+
except Exception as e:
|
325
|
+
handle_exception(span, e)
|
326
|
+
logger.error("Error in trace creation: %s", e)
|
327
|
+
|
328
|
+
# Return original response
|
329
|
+
return response
|
330
|
+
|
331
|
+
return wrapper
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# pylint: disable=useless-return, bad-staticmethod-argument, disable=duplicate-code
|
2
|
+
"""Initializer of Auto Instrumentation of Haystack Functions"""
|
3
|
+
from typing import Collection
|
4
|
+
import importlib.metadata
|
5
|
+
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
6
|
+
from wrapt import wrap_function_wrapper
|
7
|
+
|
8
|
+
from openlit.instrumentation.haystack.haystack import join_data
|
9
|
+
|
10
|
+
_instruments = ("haystack-ai >= 2.0.0",)
|
11
|
+
|
12
|
+
WRAPPED_METHODS = [
|
13
|
+
{
|
14
|
+
"package": "haystack.components.joiners.document_joiner",
|
15
|
+
"object": "DocumentJoiner",
|
16
|
+
"endpoint": "haystack.join_data",
|
17
|
+
"wrapper": join_data,
|
18
|
+
}
|
19
|
+
]
|
20
|
+
|
21
|
+
class HaystackInstrumentor(BaseInstrumentor):
|
22
|
+
"""An instrumentor for Cohere's client library."""
|
23
|
+
|
24
|
+
def instrumentation_dependencies(self) -> Collection[str]:
|
25
|
+
return _instruments
|
26
|
+
|
27
|
+
def _instrument(self, **kwargs):
|
28
|
+
application_name = kwargs.get("application_name")
|
29
|
+
environment = kwargs.get("environment")
|
30
|
+
tracer = kwargs.get("tracer")
|
31
|
+
pricing_info = kwargs.get("pricing_info")
|
32
|
+
trace_content = kwargs.get("trace_content")
|
33
|
+
version = importlib.metadata.version("haystack-ai")
|
34
|
+
|
35
|
+
for wrapped_method in WRAPPED_METHODS:
|
36
|
+
wrap_package = wrapped_method.get("package")
|
37
|
+
wrap_object = wrapped_method.get("object")
|
38
|
+
gen_ai_endpoint = wrapped_method.get("endpoint")
|
39
|
+
wrapper = wrapped_method.get("wrapper")
|
40
|
+
wrap_function_wrapper(
|
41
|
+
wrap_package,
|
42
|
+
wrap_object,
|
43
|
+
wrapper(gen_ai_endpoint, version, environment, application_name,
|
44
|
+
tracer, pricing_info, trace_content),
|
45
|
+
)
|
46
|
+
|
47
|
+
@staticmethod
|
48
|
+
def _uninstrument(self, **kwargs):
|
49
|
+
pass
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument
|
2
|
+
"""
|
3
|
+
Module for monitoring Haystack applications.
|
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
|
10
|
+
from openlit.semcov import SemanticConvetion
|
11
|
+
|
12
|
+
# Initialize logger for logging potential issues and operations
|
13
|
+
logger = logging.getLogger(__name__)
|
14
|
+
|
15
|
+
def join_data(gen_ai_endpoint, version, environment, application_name,
|
16
|
+
tracer, pricing_info, trace_content):
|
17
|
+
"""
|
18
|
+
Creates a wrapper around a function call to trace and log its execution metrics.
|
19
|
+
|
20
|
+
This function wraps any given function to measure its execution time,
|
21
|
+
log its operation, and trace its execution using OpenTelemetry.
|
22
|
+
|
23
|
+
Parameters:
|
24
|
+
- gen_ai_endpoint (str): A descriptor or name for the endpoint being traced.
|
25
|
+
- version (str): The version of the Haystack application.
|
26
|
+
- environment (str): The deployment environment (e.g., 'production', 'development').
|
27
|
+
- application_name (str): Name of the Haystack application.
|
28
|
+
- tracer (opentelemetry.trace.Tracer): The tracer object used for OpenTelemetry tracing.
|
29
|
+
- pricing_info (dict): Information about the pricing for internal metrics (currently not used).
|
30
|
+
- trace_content (bool): Flag indicating whether to trace the content of the response.
|
31
|
+
|
32
|
+
Returns:
|
33
|
+
- function: A higher-order function that takes a function 'wrapped' and returns
|
34
|
+
a new function that wraps 'wrapped' with additional tracing and logging.
|
35
|
+
"""
|
36
|
+
|
37
|
+
def wrapper(wrapped, instance, args, kwargs):
|
38
|
+
"""
|
39
|
+
An inner wrapper function that executes the wrapped function, measures execution
|
40
|
+
time, and records trace data using OpenTelemetry.
|
41
|
+
|
42
|
+
Parameters:
|
43
|
+
- wrapped (Callable): The original function that this wrapper will execute.
|
44
|
+
- instance (object): The instance to which the wrapped function belongs. This
|
45
|
+
is used for instance methods. For static and classmethods,
|
46
|
+
this may be None.
|
47
|
+
- args (tuple): Positional arguments passed to the wrapped function.
|
48
|
+
- kwargs (dict): Keyword arguments passed to the wrapped function.
|
49
|
+
|
50
|
+
Returns:
|
51
|
+
- The result of the wrapped function call.
|
52
|
+
|
53
|
+
The wrapper initiates a span with the provided tracer, sets various attributes
|
54
|
+
on the span based on the function's execution and response, and ensures
|
55
|
+
errors are handled and logged appropriately.
|
56
|
+
"""
|
57
|
+
with tracer.start_as_current_span(gen_ai_endpoint, kind= SpanKind.CLIENT) as span:
|
58
|
+
response = wrapped(*args, **kwargs)
|
59
|
+
|
60
|
+
try:
|
61
|
+
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
|
62
|
+
span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
|
63
|
+
SemanticConvetion.GEN_AI_SYSTEM_HAYSTACK)
|
64
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
|
65
|
+
gen_ai_endpoint)
|
66
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENVIRONMENT,
|
67
|
+
environment)
|
68
|
+
span.set_attribute(SemanticConvetion.GEN_AI_TYPE,
|
69
|
+
SemanticConvetion.GEN_AI_TYPE_FRAMEWORK)
|
70
|
+
span.set_attribute(SemanticConvetion.GEN_AI_APPLICATION_NAME,
|
71
|
+
application_name)
|
72
|
+
span.set_status(Status(StatusCode.OK))
|
73
|
+
|
74
|
+
# Return original response
|
75
|
+
return response
|
76
|
+
|
77
|
+
except Exception as e:
|
78
|
+
handle_exception(span, e)
|
79
|
+
logger.error("Error in trace creation: %s", e)
|
80
|
+
|
81
|
+
# Return original response
|
82
|
+
return response
|
83
|
+
|
84
|
+
return wrapper
|
@@ -60,7 +60,7 @@ def general_wrap(gen_ai_endpoint, version, environment, application_name,
|
|
60
60
|
try:
|
61
61
|
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
|
62
62
|
span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
|
63
|
-
|
63
|
+
SemanticConvetion.GEN_AI_SYSTEM_LANGCHAIN)
|
64
64
|
span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
|
65
65
|
gen_ai_endpoint)
|
66
66
|
span.set_attribute(SemanticConvetion.GEN_AI_ENVIRONMENT,
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# pylint: disable=useless-return, bad-staticmethod-argument, disable=duplicate-code
|
2
|
+
"""Initializer of Auto Instrumentation of LlamaIndex Functions"""
|
3
|
+
from typing import Collection
|
4
|
+
import importlib.metadata
|
5
|
+
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
6
|
+
from wrapt import wrap_function_wrapper
|
7
|
+
|
8
|
+
from openlit.instrumentation.llamaindex.llamaindex import load_data
|
9
|
+
|
10
|
+
_instruments = ("llama-index >= 0.10.0",)
|
11
|
+
|
12
|
+
WRAPPED_METHODS = [
|
13
|
+
{
|
14
|
+
"package": "llama_index.core.readers",
|
15
|
+
"object": "SimpleDirectoryReader.load_data",
|
16
|
+
"endpoint": "llamaindex.load_data",
|
17
|
+
"wrapper": load_data,
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"package": "llama_index.core.node_parser",
|
21
|
+
"object": "SentenceSplitter.get_nodes_from_documents",
|
22
|
+
"endpoint": "llamaindex.data_splitter",
|
23
|
+
"wrapper": load_data,
|
24
|
+
},
|
25
|
+
]
|
26
|
+
|
27
|
+
class LlamaIndexInstrumentor(BaseInstrumentor):
|
28
|
+
"""An instrumentor for Cohere's client library."""
|
29
|
+
|
30
|
+
def instrumentation_dependencies(self) -> Collection[str]:
|
31
|
+
return _instruments
|
32
|
+
|
33
|
+
def _instrument(self, **kwargs):
|
34
|
+
application_name = kwargs.get("application_name")
|
35
|
+
environment = kwargs.get("environment")
|
36
|
+
tracer = kwargs.get("tracer")
|
37
|
+
pricing_info = kwargs.get("pricing_info")
|
38
|
+
trace_content = kwargs.get("trace_content")
|
39
|
+
version = importlib.metadata.version("llama-index")
|
40
|
+
|
41
|
+
for wrapped_method in WRAPPED_METHODS:
|
42
|
+
wrap_package = wrapped_method.get("package")
|
43
|
+
wrap_object = wrapped_method.get("object")
|
44
|
+
gen_ai_endpoint = wrapped_method.get("endpoint")
|
45
|
+
wrapper = wrapped_method.get("wrapper")
|
46
|
+
wrap_function_wrapper(
|
47
|
+
wrap_package,
|
48
|
+
wrap_object,
|
49
|
+
wrapper(gen_ai_endpoint, version, environment, application_name,
|
50
|
+
tracer, pricing_info, trace_content),
|
51
|
+
)
|
52
|
+
|
53
|
+
@staticmethod
|
54
|
+
def _uninstrument(self, **kwargs):
|
55
|
+
pass
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument
|
2
|
+
"""
|
3
|
+
Module for monitoring LlamaIndex applications.
|
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
|
10
|
+
from openlit.semcov import SemanticConvetion
|
11
|
+
|
12
|
+
# Initialize logger for logging potential issues and operations
|
13
|
+
logger = logging.getLogger(__name__)
|
14
|
+
|
15
|
+
def load_data(gen_ai_endpoint, version, environment, application_name,
|
16
|
+
tracer, pricing_info, trace_content):
|
17
|
+
"""
|
18
|
+
Creates a wrapper around a function call to trace and log its execution metrics.
|
19
|
+
|
20
|
+
This function wraps any given function to measure its execution time,
|
21
|
+
log its operation, and trace its execution using OpenTelemetry.
|
22
|
+
|
23
|
+
Parameters:
|
24
|
+
- gen_ai_endpoint (str): A descriptor or name for the endpoint being traced.
|
25
|
+
- version (str): The version of the LlamaIndex application.
|
26
|
+
- environment (str): The deployment environment (e.g., 'production', 'development').
|
27
|
+
- application_name (str): Name of the LlamaIndex application.
|
28
|
+
- tracer (opentelemetry.trace.Tracer): The tracer object used for OpenTelemetry tracing.
|
29
|
+
- pricing_info (dict): Information about the pricing for internal metrics (currently not used).
|
30
|
+
- trace_content (bool): Flag indicating whether to trace the content of the response.
|
31
|
+
|
32
|
+
Returns:
|
33
|
+
- function: A higher-order function that takes a function 'wrapped' and returns
|
34
|
+
a new function that wraps 'wrapped' with additional tracing and logging.
|
35
|
+
"""
|
36
|
+
|
37
|
+
def wrapper(wrapped, instance, args, kwargs):
|
38
|
+
"""
|
39
|
+
An inner wrapper function that executes the wrapped function, measures execution
|
40
|
+
time, and records trace data using OpenTelemetry.
|
41
|
+
|
42
|
+
Parameters:
|
43
|
+
- wrapped (Callable): The original function that this wrapper will execute.
|
44
|
+
- instance (object): The instance to which the wrapped function belongs. This
|
45
|
+
is used for instance methods. For static and classmethods,
|
46
|
+
this may be None.
|
47
|
+
- args (tuple): Positional arguments passed to the wrapped function.
|
48
|
+
- kwargs (dict): Keyword arguments passed to the wrapped function.
|
49
|
+
|
50
|
+
Returns:
|
51
|
+
- The result of the wrapped function call.
|
52
|
+
|
53
|
+
The wrapper initiates a span with the provided tracer, sets various attributes
|
54
|
+
on the span based on the function's execution and response, and ensures
|
55
|
+
errors are handled and logged appropriately.
|
56
|
+
"""
|
57
|
+
with tracer.start_as_current_span(gen_ai_endpoint, kind= SpanKind.CLIENT) as span:
|
58
|
+
response = wrapped(*args, **kwargs)
|
59
|
+
|
60
|
+
try:
|
61
|
+
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
|
62
|
+
span.set_attribute(SemanticConvetion.GEN_AI_SYSTEM,
|
63
|
+
SemanticConvetion.GEN_AI_SYSTEM_LLAMAINDEX)
|
64
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
|
65
|
+
gen_ai_endpoint)
|
66
|
+
span.set_attribute(SemanticConvetion.GEN_AI_ENVIRONMENT,
|
67
|
+
environment)
|
68
|
+
span.set_attribute(SemanticConvetion.GEN_AI_TYPE,
|
69
|
+
SemanticConvetion.GEN_AI_TYPE_FRAMEWORK)
|
70
|
+
span.set_attribute(SemanticConvetion.GEN_AI_APPLICATION_NAME,
|
71
|
+
application_name)
|
72
|
+
span.set_attribute(SemanticConvetion.GEN_AI_RETRIEVAL_SOURCE,
|
73
|
+
response[0].metadata["file_path"])
|
74
|
+
span.set_status(Status(StatusCode.OK))
|
75
|
+
|
76
|
+
# Return original response
|
77
|
+
return response
|
78
|
+
|
79
|
+
except Exception as e:
|
80
|
+
handle_exception(span, e)
|
81
|
+
logger.error("Error in trace creation: %s", e)
|
82
|
+
|
83
|
+
# Return original response
|
84
|
+
return response
|
85
|
+
|
86
|
+
return wrapper
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument
|
1
|
+
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument, possibly-used-before-assignment
|
2
2
|
"""
|
3
3
|
Module for monitoring Mistral API calls.
|
4
4
|
"""
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument
|
1
|
+
# pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument, possibly-used-before-assignment
|
2
2
|
"""
|
3
3
|
Module for monitoring Mistral API calls.
|
4
4
|
"""
|
openlit/otel/tracing.py
CHANGED
@@ -40,6 +40,9 @@ def setup_tracing(application_name, environment, tracer, otlp_endpoint, otlp_hea
|
|
40
40
|
global TRACER_SET
|
41
41
|
|
42
42
|
try:
|
43
|
+
#Disable Haystack Auto Tracing
|
44
|
+
os.environ["HAYSTACK_AUTO_TRACE_ENABLED"] = "false"
|
45
|
+
|
43
46
|
if not TRACER_SET:
|
44
47
|
# Create a resource with the service name attribute.
|
45
48
|
resource = Resource(attributes={
|
openlit/semcov/__init__.py
CHANGED
@@ -87,7 +87,10 @@ class SemanticConvetion:
|
|
87
87
|
GEN_AI_SYSTEM_MISTRAL = "mistral"
|
88
88
|
GEN_AI_SYSTEM_BEDROCK = "bedrock"
|
89
89
|
GEN_AI_SYSTEM_VERTEXAI = "vertexai"
|
90
|
+
GEN_AI_SYSTEM_GROQ = "groq"
|
90
91
|
GEN_AI_SYSTEM_LANGCHAIN = "langchain"
|
92
|
+
GEN_AI_SYSTEM_LLAMAINDEX = "llama_index"
|
93
|
+
GEN_AI_SYSTEM_HAYSTACK = "haystack"
|
91
94
|
|
92
95
|
# Vector DB
|
93
96
|
DB_REQUESTS = "db.total.requests"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: openlit
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.4.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
|
@@ -49,30 +49,37 @@ This project adheres to the [Semantic Conventions](https://github.com/open-telem
|
|
49
49
|
## What can be Auto Instrumented?
|
50
50
|
|
51
51
|
### LLMs
|
52
|
-
- ✅ OpenAI
|
53
|
-
- ✅ Anthropic
|
54
|
-
- ✅ Cohere
|
55
|
-
- ✅ Mistral
|
56
|
-
- ✅ Azure OpenAI
|
57
|
-
- ✅ HuggingFace Transformers
|
52
|
+
- [✅ OpenAI](https://docs.openlit.io/latest/integrations/openai)
|
53
|
+
- [✅ Anthropic](https://docs.openlit.io/latest/integrations/anthropic)
|
54
|
+
- [✅ Cohere](https://docs.openlit.io/latest/integrations/cohere)
|
55
|
+
- [✅ Mistral](https://docs.openlit.io/latest/integrations/mistral)
|
56
|
+
- [✅ Azure OpenAI](https://docs.openlit.io/latest/integrations/azure-openai)
|
57
|
+
- [✅ HuggingFace Transformers](https://docs.openlit.io/latest/integrations/huggingface)
|
58
|
+
- [✅ Amazon Bedrock](https://docs.openlit.io/latest/integrations/bedrock)
|
59
|
+
- [✅ Vertex AI](https://docs.openlit.io/latest/integrations/vertexai)
|
60
|
+
- [✅ Groq](https://docs.openlit.io/latest/integrations/groq)
|
58
61
|
|
59
62
|
### Vector DBs
|
60
|
-
- ✅ ChromaDB
|
61
|
-
- ✅ Pinecone
|
63
|
+
- [✅ ChromaDB](https://docs.openlit.io/latest/integrations/chromadb)
|
64
|
+
- [✅ Pinecone](https://docs.openlit.io/latest/integrations/pinecone)
|
62
65
|
|
63
66
|
### Frameworks
|
64
|
-
- ✅ Langchain
|
65
|
-
- ✅ LiteLLM
|
67
|
+
- [✅ Langchain](https://docs.openlit.io/latest/integrations/langchain)
|
68
|
+
- [✅ LiteLLM](https://docs.openlit.io/latest/integrations/litellm)
|
69
|
+
- [✅ LlamaIndex](https://docs.openlit.io/latest/integrations/llama-index)
|
70
|
+
- [✅ Haystack](https://docs.openlit.io/latest/integrations/haystack)
|
66
71
|
|
67
72
|
## Supported Destinations
|
68
|
-
- ✅ OpenTelemetry Collector
|
69
|
-
- ✅
|
70
|
-
- ✅
|
71
|
-
- ✅
|
72
|
-
- ✅
|
73
|
-
- ✅
|
74
|
-
- ✅
|
75
|
-
- ✅
|
73
|
+
- [✅ OpenTelemetry Collector](https://docs.openlit.io/latest/connections/otelcol)
|
74
|
+
- [✅ Prometheus + Tempo](https://docs.openlit.io/latest/connections/prometheus-tempo)
|
75
|
+
- [✅ Prometheus + Jaeger](https://docs.openlit.io/latest/connections/prometheus-jaeger)
|
76
|
+
- [✅ Grafana Cloud](https://docs.openlit.io/latest/connections/grafanacloud)
|
77
|
+
- [✅ DataDog](https://docs.openlit.io/latest/connections/datadog)
|
78
|
+
- [✅ New Relic](https://docs.openlit.io/latest/connections/new-relic)
|
79
|
+
- [✅ SigNoz](https://docs.openlit.io/latest/connections/signoz)
|
80
|
+
- [✅ Dynatrace](https://docs.openlit.io/latest/connections/dynatrace)
|
81
|
+
- [✅ OpenObserve](https://docs.openlit.io/latest/connections/openobserve)
|
82
|
+
- [✅ Highlight.io](https://docs.openlit.io/latest/connections/highlight)
|
76
83
|
|
77
84
|
## 💿 Installation
|
78
85
|
|
@@ -1,35 +1,42 @@
|
|
1
1
|
openlit/__helpers.py,sha256=EEbLEUKuCiBp0WiieAvUnGcaU5D7grFgNVDCBgMKjQE,4651
|
2
|
-
openlit/__init__.py,sha256=
|
2
|
+
openlit/__init__.py,sha256=Ue43Sq_9gi-XvsfqzMDQw_ZSK5UGfAaD6azCBTIp8EQ,9506
|
3
3
|
openlit/instrumentation/anthropic/__init__.py,sha256=oaU53BOPyfUKbEzYvLr1DPymDluurSnwo4Hernf2XdU,1955
|
4
|
-
openlit/instrumentation/anthropic/anthropic.py,sha256=
|
5
|
-
openlit/instrumentation/anthropic/async_anthropic.py,sha256=
|
4
|
+
openlit/instrumentation/anthropic/anthropic.py,sha256=CYBui5eEfWdSfFF0xtCQjh1xO-gCVJc_V9Hli0szVZE,16026
|
5
|
+
openlit/instrumentation/anthropic/async_anthropic.py,sha256=NW84kTQ3BkUx1zZuMRps_J7zTYkmq5BxOrqSjqWInBs,16068
|
6
6
|
openlit/instrumentation/bedrock/__init__.py,sha256=QPvDMQde6Meodu5JvosHdZsnyExS19lcoP5Li4YrOkw,1540
|
7
7
|
openlit/instrumentation/bedrock/bedrock.py,sha256=Q5t5283LGEvhyrUCr9ofEQF22JTkc1UvT2_6u7e7gmA,22278
|
8
8
|
openlit/instrumentation/chroma/__init__.py,sha256=61lFpHlUEQUobsUJZHXdvOViKwsOH8AOvSfc4VgCmiM,3253
|
9
|
-
openlit/instrumentation/chroma/chroma.py,sha256=
|
9
|
+
openlit/instrumentation/chroma/chroma.py,sha256=j_xaiSLaScmRHU7SRM-vi8LgRBjsTr1daRLc4RXNyIA,10407
|
10
10
|
openlit/instrumentation/cohere/__init__.py,sha256=PC5T1qIg9pwLNocBP_WjG5B_6p_z019s8quk_fNLAMs,1920
|
11
|
-
openlit/instrumentation/cohere/cohere.py,sha256=
|
11
|
+
openlit/instrumentation/cohere/cohere.py,sha256=_TXAB64-sujs51-JQVu30HqwBaNengNWHEL0hgAAgJA,20381
|
12
|
+
openlit/instrumentation/groq/__init__.py,sha256=uW_0G6HSanQyK2dIXYhzR604pDiyPQfybzc37DsfSew,1911
|
13
|
+
openlit/instrumentation/groq/async_groq.py,sha256=WQwHpC-NJoyEf-jAJlxEcdnpd5jmlfAsDtEBRJ47CxA,19084
|
14
|
+
openlit/instrumentation/groq/groq.py,sha256=4uiEFUjxJ0q-c3GlgPAMc4NijG1YLgQp7o3wcwFrxeg,19048
|
15
|
+
openlit/instrumentation/haystack/__init__.py,sha256=QK6XxxZUHX8vMv2Crk7rNBOc64iOOBLhJGL_lPlAZ8s,1758
|
16
|
+
openlit/instrumentation/haystack/haystack.py,sha256=oQIZiDhdp3gnJnhYQ1OouJMc9YT0pQ-_31cmNuopa68,3891
|
12
17
|
openlit/instrumentation/langchain/__init__.py,sha256=TW1ZR7I1i9Oig-wDWp3j1gmtQFO76jNBXQRBGGKzoOo,2531
|
13
|
-
openlit/instrumentation/langchain/langchain.py,sha256=
|
18
|
+
openlit/instrumentation/langchain/langchain.py,sha256=G66UytYwWW0DdvChomzkc5_MJ-sjupuDwlxe4KqlGhY,7639
|
19
|
+
openlit/instrumentation/llamaindex/__init__.py,sha256=FwE0iozGbZcd2dWo9uk4EO6qKPAe55byhZBuzuFyxXA,1973
|
20
|
+
openlit/instrumentation/llamaindex/llamaindex.py,sha256=uiIigbwhonSbJWA7LpgOVI1R4kxxPODS1K5wyHIQ4hM,4048
|
14
21
|
openlit/instrumentation/mistral/__init__.py,sha256=zJCIpFWRbsYrvooOJYuqwyuKeSOQLWbyXWCObL-Snks,3156
|
15
|
-
openlit/instrumentation/mistral/async_mistral.py,sha256=
|
16
|
-
openlit/instrumentation/mistral/mistral.py,sha256=
|
22
|
+
openlit/instrumentation/mistral/async_mistral.py,sha256=PXpiLwkonTtAPVOUh9pXMSYeabwH0GFG_HRDWrEKhMM,21361
|
23
|
+
openlit/instrumentation/mistral/mistral.py,sha256=nbAyMlPiuA9hihePkM_nnxAjahZSndT-B-qXRO5VIhk,21212
|
17
24
|
openlit/instrumentation/openai/__init__.py,sha256=AZ2cPr3TMKkgGdMl_yXMeSi7bWhtmMqOW1iHdzHHGHA,16265
|
18
25
|
openlit/instrumentation/openai/async_azure_openai.py,sha256=QE_5KHaCHAndkf7Y2Iq66mZUc0I1qtqIJ6iYPnwiuXA,46297
|
19
26
|
openlit/instrumentation/openai/async_openai.py,sha256=qfJG_gIkSz3Gjau0zQ_G3tvkqkOd-md5LBK6wIjvH0U,45841
|
20
27
|
openlit/instrumentation/openai/azure_openai.py,sha256=8nm1hsGdWLhJt97fkV254_biYdGeVJiZP2_Yb3pKSEU,46091
|
21
28
|
openlit/instrumentation/openai/openai.py,sha256=VVl0fuQfxitH-V4hVeP5VxB31-yWMI74Xz4katlsG78,46522
|
22
29
|
openlit/instrumentation/pinecone/__init__.py,sha256=Mv9bElqNs07_JQkYyNnO0wOM3hdbprmw7sttdMeKC7g,2526
|
23
|
-
openlit/instrumentation/pinecone/pinecone.py,sha256=
|
30
|
+
openlit/instrumentation/pinecone/pinecone.py,sha256=0EhLmtOuvwWVvAKh3e56wyd8wzQq1oaLOmF15SVHxVE,8765
|
24
31
|
openlit/instrumentation/transformers/__init__.py,sha256=9-KLjq-aPTh13gTBYsWltV6hokGwt3mP4759SwsaaCk,1478
|
25
32
|
openlit/instrumentation/transformers/transformers.py,sha256=peT0BGskYt7AZ0b93TZ7qECXfZRgDQMasUeamexYdZI,7592
|
26
33
|
openlit/instrumentation/vertexai/__init__.py,sha256=N3E9HtzefD-zC0fvmfGYiDmSqssoavp_i59wfuYLyMw,6079
|
27
34
|
openlit/instrumentation/vertexai/async_vertexai.py,sha256=PMHYyLf1J4gZpC_-KZ_ZVx1xIHhZDJSNa7mrjNXZ5M0,52372
|
28
35
|
openlit/instrumentation/vertexai/vertexai.py,sha256=UvpNKBHPoV9idVMfGigZnmWuEQiyqSwZn0zK9-U7Lzw,52125
|
29
36
|
openlit/otel/metrics.py,sha256=O7NoaDz0bY19mqpE4-0PcKwEe-B-iJFRgOCaanAuZAc,4291
|
30
|
-
openlit/otel/tracing.py,sha256=
|
31
|
-
openlit/semcov/__init__.py,sha256=
|
32
|
-
openlit-1.
|
33
|
-
openlit-1.
|
34
|
-
openlit-1.
|
35
|
-
openlit-1.
|
37
|
+
openlit/otel/tracing.py,sha256=vL1ifMbARPBpqK--yXYsCM6y5dSu5LFIKqkhZXtYmUc,3712
|
38
|
+
openlit/semcov/__init__.py,sha256=6TnH8BtcEHzMZeGZH3wucjvhHOadnGrgUDBBipLFcFs,5881
|
39
|
+
openlit-1.4.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
40
|
+
openlit-1.4.0.dist-info/METADATA,sha256=s3Ox1SphAFtfZEuUBVRn5vrfjFXgBcdEKZ2QB9X8-Zw,12079
|
41
|
+
openlit-1.4.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
42
|
+
openlit-1.4.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|