openlit 1.33.9__py3-none-any.whl → 1.33.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openlit/__helpers.py +78 -0
- openlit/__init__.py +41 -13
- openlit/instrumentation/ag2/__init__.py +9 -10
- openlit/instrumentation/ag2/ag2.py +134 -69
- openlit/instrumentation/ai21/__init__.py +6 -5
- openlit/instrumentation/ai21/ai21.py +71 -534
- openlit/instrumentation/ai21/async_ai21.py +71 -534
- openlit/instrumentation/ai21/utils.py +407 -0
- openlit/instrumentation/anthropic/__init__.py +3 -3
- openlit/instrumentation/anthropic/anthropic.py +5 -5
- openlit/instrumentation/anthropic/async_anthropic.py +5 -5
- openlit/instrumentation/assemblyai/__init__.py +2 -2
- openlit/instrumentation/assemblyai/assemblyai.py +3 -3
- openlit/instrumentation/astra/__init__.py +25 -25
- openlit/instrumentation/astra/astra.py +7 -7
- openlit/instrumentation/astra/async_astra.py +7 -7
- openlit/instrumentation/azure_ai_inference/__init__.py +5 -5
- openlit/instrumentation/azure_ai_inference/async_azure_ai_inference.py +11 -11
- openlit/instrumentation/azure_ai_inference/azure_ai_inference.py +11 -11
- openlit/instrumentation/bedrock/__init__.py +2 -2
- openlit/instrumentation/bedrock/bedrock.py +3 -3
- openlit/instrumentation/chroma/__init__.py +9 -9
- openlit/instrumentation/chroma/chroma.py +7 -7
- openlit/instrumentation/cohere/__init__.py +7 -7
- openlit/instrumentation/cohere/async_cohere.py +10 -10
- openlit/instrumentation/cohere/cohere.py +11 -11
- openlit/instrumentation/controlflow/__init__.py +4 -4
- openlit/instrumentation/controlflow/controlflow.py +5 -5
- openlit/instrumentation/crawl4ai/__init__.py +3 -3
- openlit/instrumentation/crawl4ai/async_crawl4ai.py +5 -5
- openlit/instrumentation/crawl4ai/crawl4ai.py +5 -5
- openlit/instrumentation/crewai/__init__.py +3 -3
- openlit/instrumentation/crewai/crewai.py +6 -4
- openlit/instrumentation/dynamiq/__init__.py +5 -5
- openlit/instrumentation/dynamiq/dynamiq.py +5 -5
- openlit/instrumentation/elevenlabs/__init__.py +5 -5
- openlit/instrumentation/elevenlabs/async_elevenlabs.py +4 -5
- openlit/instrumentation/elevenlabs/elevenlabs.py +4 -5
- openlit/instrumentation/embedchain/__init__.py +2 -2
- openlit/instrumentation/embedchain/embedchain.py +9 -9
- openlit/instrumentation/firecrawl/__init__.py +3 -3
- openlit/instrumentation/firecrawl/firecrawl.py +5 -5
- openlit/instrumentation/google_ai_studio/__init__.py +3 -3
- openlit/instrumentation/google_ai_studio/async_google_ai_studio.py +3 -3
- openlit/instrumentation/google_ai_studio/google_ai_studio.py +3 -3
- openlit/instrumentation/gpt4all/__init__.py +5 -5
- openlit/instrumentation/gpt4all/gpt4all.py +350 -225
- openlit/instrumentation/gpu/__init__.py +5 -5
- openlit/instrumentation/groq/__init__.py +5 -5
- openlit/instrumentation/groq/async_groq.py +359 -243
- openlit/instrumentation/groq/groq.py +359 -243
- openlit/instrumentation/haystack/__init__.py +2 -2
- openlit/instrumentation/haystack/haystack.py +5 -5
- openlit/instrumentation/julep/__init__.py +7 -7
- openlit/instrumentation/julep/async_julep.py +6 -6
- openlit/instrumentation/julep/julep.py +6 -6
- openlit/instrumentation/langchain/__init__.py +15 -9
- openlit/instrumentation/langchain/async_langchain.py +388 -0
- openlit/instrumentation/langchain/langchain.py +110 -497
- openlit/instrumentation/letta/__init__.py +7 -7
- openlit/instrumentation/letta/letta.py +10 -8
- openlit/instrumentation/litellm/__init__.py +9 -10
- openlit/instrumentation/litellm/async_litellm.py +321 -250
- openlit/instrumentation/litellm/litellm.py +319 -248
- openlit/instrumentation/llamaindex/__init__.py +2 -2
- openlit/instrumentation/llamaindex/llamaindex.py +5 -5
- openlit/instrumentation/mem0/__init__.py +2 -2
- openlit/instrumentation/mem0/mem0.py +5 -5
- openlit/instrumentation/milvus/__init__.py +2 -2
- openlit/instrumentation/milvus/milvus.py +7 -7
- openlit/instrumentation/mistral/__init__.py +13 -13
- openlit/instrumentation/mistral/async_mistral.py +426 -253
- openlit/instrumentation/mistral/mistral.py +424 -250
- openlit/instrumentation/multion/__init__.py +7 -7
- openlit/instrumentation/multion/async_multion.py +9 -7
- openlit/instrumentation/multion/multion.py +9 -7
- openlit/instrumentation/ollama/__init__.py +19 -39
- openlit/instrumentation/ollama/async_ollama.py +137 -563
- openlit/instrumentation/ollama/ollama.py +136 -563
- openlit/instrumentation/ollama/utils.py +333 -0
- openlit/instrumentation/openai/__init__.py +11 -11
- openlit/instrumentation/openai/async_openai.py +25 -27
- openlit/instrumentation/openai/openai.py +25 -27
- openlit/instrumentation/phidata/__init__.py +2 -2
- openlit/instrumentation/phidata/phidata.py +6 -4
- openlit/instrumentation/pinecone/__init__.py +6 -6
- openlit/instrumentation/pinecone/pinecone.py +7 -7
- openlit/instrumentation/premai/__init__.py +5 -5
- openlit/instrumentation/premai/premai.py +268 -219
- openlit/instrumentation/qdrant/__init__.py +2 -2
- openlit/instrumentation/qdrant/async_qdrant.py +7 -7
- openlit/instrumentation/qdrant/qdrant.py +7 -7
- openlit/instrumentation/reka/__init__.py +5 -5
- openlit/instrumentation/reka/async_reka.py +93 -55
- openlit/instrumentation/reka/reka.py +93 -55
- openlit/instrumentation/together/__init__.py +9 -9
- openlit/instrumentation/together/async_together.py +284 -242
- openlit/instrumentation/together/together.py +284 -242
- openlit/instrumentation/transformers/__init__.py +3 -3
- openlit/instrumentation/transformers/transformers.py +79 -48
- openlit/instrumentation/vertexai/__init__.py +19 -69
- openlit/instrumentation/vertexai/async_vertexai.py +333 -990
- openlit/instrumentation/vertexai/vertexai.py +333 -990
- openlit/instrumentation/vllm/__init__.py +3 -3
- openlit/instrumentation/vllm/vllm.py +65 -35
- openlit/otel/events.py +85 -0
- openlit/otel/tracing.py +3 -13
- openlit/semcov/__init__.py +16 -4
- {openlit-1.33.9.dist-info → openlit-1.33.11.dist-info}/METADATA +2 -2
- openlit-1.33.11.dist-info/RECORD +125 -0
- openlit-1.33.9.dist-info/RECORD +0 -121
- {openlit-1.33.9.dist-info → openlit-1.33.11.dist-info}/LICENSE +0 -0
- {openlit-1.33.9.dist-info → openlit-1.33.11.dist-info}/WHEEL +0 -0
@@ -26,7 +26,7 @@ class LettaInstrumentor(BaseInstrumentor):
|
|
26
26
|
tracer = kwargs.get("tracer")
|
27
27
|
metrics = kwargs.get("metrics_dict")
|
28
28
|
pricing_info = kwargs.get("pricing_info", {})
|
29
|
-
|
29
|
+
capture_message_content = kwargs.get("capture_message_content", False)
|
30
30
|
disable_metrics = kwargs.get("disable_metrics")
|
31
31
|
version = importlib.metadata.version("letta")
|
32
32
|
|
@@ -34,42 +34,42 @@ class LettaInstrumentor(BaseInstrumentor):
|
|
34
34
|
"letta.client.client",
|
35
35
|
"LocalClient.create_agent",
|
36
36
|
create_agent("letta.create_agent", version, environment, application_name,
|
37
|
-
tracer, pricing_info,
|
37
|
+
tracer, pricing_info, capture_message_content, metrics, disable_metrics),
|
38
38
|
)
|
39
39
|
|
40
40
|
wrap_function_wrapper(
|
41
41
|
"letta.client.client",
|
42
42
|
"LocalClient.get_agent",
|
43
43
|
create_agent("letta.get_agent", version, environment, application_name,
|
44
|
-
tracer, pricing_info,
|
44
|
+
tracer, pricing_info, capture_message_content, metrics, disable_metrics),
|
45
45
|
)
|
46
46
|
|
47
47
|
wrap_function_wrapper(
|
48
48
|
"letta.client.client",
|
49
49
|
"LocalClient.send_message",
|
50
50
|
send_message("letta.send_message", version, environment, application_name,
|
51
|
-
tracer, pricing_info,
|
51
|
+
tracer, pricing_info, capture_message_content, metrics, disable_metrics),
|
52
52
|
)
|
53
53
|
|
54
54
|
wrap_function_wrapper(
|
55
55
|
"letta.client.client",
|
56
56
|
"RESTClient.create_agent",
|
57
57
|
create_agent("letta.create_agent", version, environment, application_name,
|
58
|
-
tracer, pricing_info,
|
58
|
+
tracer, pricing_info, capture_message_content, metrics, disable_metrics),
|
59
59
|
)
|
60
60
|
|
61
61
|
wrap_function_wrapper(
|
62
62
|
"letta.client.client",
|
63
63
|
"RESTClient.get_agent",
|
64
64
|
create_agent("letta.get_agent", version, environment, application_name,
|
65
|
-
tracer, pricing_info,
|
65
|
+
tracer, pricing_info, capture_message_content, metrics, disable_metrics),
|
66
66
|
)
|
67
67
|
|
68
68
|
wrap_function_wrapper(
|
69
69
|
"letta.client.client",
|
70
70
|
"RESTClient.send_message",
|
71
71
|
send_message("letta.send_message", version, environment, application_name,
|
72
|
-
tracer, pricing_info,
|
72
|
+
tracer, pricing_info, capture_message_content, metrics, disable_metrics),
|
73
73
|
)
|
74
74
|
|
75
75
|
def _uninstrument(self, **kwargs):
|
@@ -5,7 +5,7 @@ Module for monitoring Letta calls.
|
|
5
5
|
|
6
6
|
import logging
|
7
7
|
from opentelemetry.trace import SpanKind, Status, StatusCode
|
8
|
-
from opentelemetry.sdk.resources import TELEMETRY_SDK_NAME
|
8
|
+
from opentelemetry.sdk.resources import SERVICE_NAME, TELEMETRY_SDK_NAME, DEPLOYMENT_ENVIRONMENT
|
9
9
|
from openlit.__helpers import (
|
10
10
|
handle_exception, get_chat_model_cost
|
11
11
|
)
|
@@ -15,7 +15,7 @@ from openlit.semcov import SemanticConvetion
|
|
15
15
|
logger = logging.getLogger(__name__)
|
16
16
|
|
17
17
|
def create_agent(gen_ai_endpoint, version, environment, application_name,
|
18
|
-
tracer, pricing_info,
|
18
|
+
tracer, pricing_info, capture_message_content, metrics, disable_metrics):
|
19
19
|
"""
|
20
20
|
Generates a telemetry wrapper for chat completions to collect metrics.
|
21
21
|
|
@@ -26,7 +26,7 @@ def create_agent(gen_ai_endpoint, version, environment, application_name,
|
|
26
26
|
application_name: Name of the application using the Letta Agent.
|
27
27
|
tracer: OpenTelemetry tracer for creating spans.
|
28
28
|
pricing_info: Information used for calculating the cost of Letta usage.
|
29
|
-
|
29
|
+
capture_message_content: Flag indicating whether to trace the actual content.
|
30
30
|
|
31
31
|
Returns:
|
32
32
|
A function that wraps the chat completions method to add telemetry.
|
@@ -62,8 +62,10 @@ def create_agent(gen_ai_endpoint, version, environment, application_name,
|
|
62
62
|
SemanticConvetion.GEN_AI_OPERATION_TYPE_AGENT)
|
63
63
|
span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
|
64
64
|
gen_ai_endpoint)
|
65
|
-
span.set_attribute(
|
65
|
+
span.set_attribute(SERVICE_NAME,
|
66
66
|
application_name)
|
67
|
+
span.set_attribute(DEPLOYMENT_ENVIRONMENT,
|
68
|
+
environment)
|
67
69
|
span.set_attribute(SemanticConvetion.GEN_AI_AGENT_ID,
|
68
70
|
response.id)
|
69
71
|
span.set_attribute(SemanticConvetion.GEN_AI_AGENT_ROLE,
|
@@ -92,7 +94,7 @@ def create_agent(gen_ai_endpoint, version, environment, application_name,
|
|
92
94
|
return wrapper
|
93
95
|
|
94
96
|
def send_message(gen_ai_endpoint, version, environment, application_name,
|
95
|
-
tracer, pricing_info,
|
97
|
+
tracer, pricing_info, capture_message_content, metrics, disable_metrics):
|
96
98
|
"""
|
97
99
|
Generates a telemetry wrapper for chat completions to collect metrics.
|
98
100
|
|
@@ -103,7 +105,7 @@ def send_message(gen_ai_endpoint, version, environment, application_name,
|
|
103
105
|
application_name: Name of the application using the Letta Agent.
|
104
106
|
tracer: OpenTelemetry tracer for creating spans.
|
105
107
|
pricing_info: Information used for calculating the cost of Letta usage.
|
106
|
-
|
108
|
+
capture_message_content: Flag indicating whether to trace the actual content.
|
107
109
|
|
108
110
|
Returns:
|
109
111
|
A function that wraps the chat completions method to add telemetry.
|
@@ -143,7 +145,7 @@ def send_message(gen_ai_endpoint, version, environment, application_name,
|
|
143
145
|
SemanticConvetion.GEN_AI_OPERATION_TYPE_AGENT)
|
144
146
|
span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
|
145
147
|
gen_ai_endpoint)
|
146
|
-
span.set_attribute(
|
148
|
+
span.set_attribute(SERVICE_NAME,
|
147
149
|
application_name)
|
148
150
|
span.set_attribute(SemanticConvetion.GEN_AI_AGENT_STEP_COUNT,
|
149
151
|
response.usage.step_count)
|
@@ -156,7 +158,7 @@ def send_message(gen_ai_endpoint, version, environment, application_name,
|
|
156
158
|
span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
|
157
159
|
cost)
|
158
160
|
|
159
|
-
if
|
161
|
+
if capture_message_content:
|
160
162
|
span.add_event(
|
161
163
|
name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
|
162
164
|
attributes={
|
@@ -29,7 +29,7 @@ class LiteLLMInstrumentor(BaseInstrumentor):
|
|
29
29
|
tracer = kwargs.get("tracer")
|
30
30
|
metrics = kwargs.get("metrics_dict")
|
31
31
|
pricing_info = kwargs.get("pricing_info", {})
|
32
|
-
|
32
|
+
capture_message_content = kwargs.get("capture_message_content", False)
|
33
33
|
disable_metrics = kwargs.get("disable_metrics")
|
34
34
|
version = importlib.metadata.version("litellm")
|
35
35
|
|
@@ -37,32 +37,31 @@ class LiteLLMInstrumentor(BaseInstrumentor):
|
|
37
37
|
wrap_function_wrapper(
|
38
38
|
"litellm",
|
39
39
|
"completion",
|
40
|
-
completion(
|
41
|
-
tracer, pricing_info,
|
40
|
+
completion(version, environment, application_name,
|
41
|
+
tracer, pricing_info, capture_message_content, metrics, disable_metrics),
|
42
42
|
)
|
43
43
|
|
44
44
|
wrap_function_wrapper(
|
45
45
|
"litellm",
|
46
46
|
"acompletion",
|
47
|
-
acompletion(
|
48
|
-
tracer, pricing_info,
|
47
|
+
acompletion(version, environment, application_name,
|
48
|
+
tracer, pricing_info, capture_message_content, metrics, disable_metrics),
|
49
49
|
)
|
50
50
|
|
51
51
|
wrap_function_wrapper(
|
52
52
|
"litellm",
|
53
53
|
"embedding",
|
54
|
-
embedding(
|
55
|
-
tracer, pricing_info,
|
54
|
+
embedding(version, environment, application_name,
|
55
|
+
tracer, pricing_info, capture_message_content, metrics, disable_metrics),
|
56
56
|
)
|
57
57
|
|
58
58
|
wrap_function_wrapper(
|
59
59
|
"litellm",
|
60
60
|
"aembedding",
|
61
|
-
aembedding(
|
62
|
-
tracer, pricing_info,
|
61
|
+
aembedding(version, environment, application_name,
|
62
|
+
tracer, pricing_info, capture_message_content, metrics, disable_metrics),
|
63
63
|
)
|
64
64
|
|
65
|
-
|
66
65
|
def _uninstrument(self, **kwargs):
|
67
66
|
# Proper uninstrumentation logic to revert patched methods
|
68
67
|
pass
|