openlit 1.34.30__py3-none-any.whl → 1.34.31__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openlit/__helpers.py +235 -86
- openlit/__init__.py +16 -13
- openlit/_instrumentors.py +2 -1
- openlit/evals/all.py +50 -21
- openlit/evals/bias_detection.py +47 -20
- openlit/evals/hallucination.py +53 -22
- openlit/evals/toxicity.py +50 -21
- openlit/evals/utils.py +54 -30
- openlit/guard/all.py +61 -19
- openlit/guard/prompt_injection.py +34 -14
- openlit/guard/restrict_topic.py +46 -15
- openlit/guard/sensitive_topic.py +34 -14
- openlit/guard/utils.py +58 -22
- openlit/instrumentation/ag2/__init__.py +24 -8
- openlit/instrumentation/ag2/ag2.py +34 -13
- openlit/instrumentation/ag2/async_ag2.py +34 -13
- openlit/instrumentation/ag2/utils.py +133 -30
- openlit/instrumentation/ai21/__init__.py +43 -14
- openlit/instrumentation/ai21/ai21.py +47 -21
- openlit/instrumentation/ai21/async_ai21.py +47 -21
- openlit/instrumentation/ai21/utils.py +299 -78
- openlit/instrumentation/anthropic/__init__.py +21 -4
- openlit/instrumentation/anthropic/anthropic.py +28 -17
- openlit/instrumentation/anthropic/async_anthropic.py +28 -17
- openlit/instrumentation/anthropic/utils.py +145 -35
- openlit/instrumentation/assemblyai/__init__.py +11 -2
- openlit/instrumentation/assemblyai/assemblyai.py +15 -4
- openlit/instrumentation/assemblyai/utils.py +120 -25
- openlit/instrumentation/astra/__init__.py +43 -10
- openlit/instrumentation/astra/astra.py +28 -5
- openlit/instrumentation/astra/async_astra.py +28 -5
- openlit/instrumentation/astra/utils.py +151 -55
- openlit/instrumentation/azure_ai_inference/__init__.py +43 -10
- openlit/instrumentation/azure_ai_inference/async_azure_ai_inference.py +53 -21
- openlit/instrumentation/azure_ai_inference/azure_ai_inference.py +53 -21
- openlit/instrumentation/azure_ai_inference/utils.py +307 -83
- openlit/instrumentation/bedrock/__init__.py +21 -4
- openlit/instrumentation/bedrock/bedrock.py +63 -25
- openlit/instrumentation/bedrock/utils.py +139 -30
- openlit/instrumentation/chroma/__init__.py +89 -16
- openlit/instrumentation/chroma/chroma.py +28 -6
- openlit/instrumentation/chroma/utils.py +167 -51
- openlit/instrumentation/cohere/__init__.py +63 -18
- openlit/instrumentation/cohere/async_cohere.py +63 -24
- openlit/instrumentation/cohere/cohere.py +63 -24
- openlit/instrumentation/cohere/utils.py +286 -73
- openlit/instrumentation/controlflow/__init__.py +35 -9
- openlit/instrumentation/controlflow/controlflow.py +66 -33
- openlit/instrumentation/crawl4ai/__init__.py +25 -10
- openlit/instrumentation/crawl4ai/async_crawl4ai.py +78 -31
- openlit/instrumentation/crawl4ai/crawl4ai.py +78 -31
- openlit/instrumentation/crewai/__init__.py +40 -15
- openlit/instrumentation/crewai/async_crewai.py +32 -7
- openlit/instrumentation/crewai/crewai.py +32 -7
- openlit/instrumentation/crewai/utils.py +159 -56
- openlit/instrumentation/dynamiq/__init__.py +46 -12
- openlit/instrumentation/dynamiq/dynamiq.py +74 -33
- openlit/instrumentation/elevenlabs/__init__.py +23 -4
- openlit/instrumentation/elevenlabs/async_elevenlabs.py +16 -4
- openlit/instrumentation/elevenlabs/elevenlabs.py +16 -4
- openlit/instrumentation/elevenlabs/utils.py +128 -25
- openlit/instrumentation/embedchain/__init__.py +11 -2
- openlit/instrumentation/embedchain/embedchain.py +68 -35
- openlit/instrumentation/firecrawl/__init__.py +24 -7
- openlit/instrumentation/firecrawl/firecrawl.py +46 -20
- openlit/instrumentation/google_ai_studio/__init__.py +45 -10
- openlit/instrumentation/google_ai_studio/async_google_ai_studio.py +67 -44
- openlit/instrumentation/google_ai_studio/google_ai_studio.py +67 -44
- openlit/instrumentation/google_ai_studio/utils.py +180 -67
- openlit/instrumentation/gpt4all/__init__.py +22 -7
- openlit/instrumentation/gpt4all/gpt4all.py +67 -29
- openlit/instrumentation/gpt4all/utils.py +285 -61
- openlit/instrumentation/gpu/__init__.py +128 -47
- openlit/instrumentation/groq/__init__.py +21 -4
- openlit/instrumentation/groq/async_groq.py +33 -21
- openlit/instrumentation/groq/groq.py +33 -21
- openlit/instrumentation/groq/utils.py +192 -55
- openlit/instrumentation/haystack/__init__.py +70 -24
- openlit/instrumentation/haystack/async_haystack.py +28 -6
- openlit/instrumentation/haystack/haystack.py +28 -6
- openlit/instrumentation/haystack/utils.py +196 -74
- openlit/instrumentation/julep/__init__.py +69 -19
- openlit/instrumentation/julep/async_julep.py +53 -27
- openlit/instrumentation/julep/julep.py +53 -28
- openlit/instrumentation/langchain/__init__.py +74 -63
- openlit/instrumentation/langchain/callback_handler.py +1100 -0
- openlit/instrumentation/langchain_community/__init__.py +13 -2
- openlit/instrumentation/langchain_community/async_langchain_community.py +23 -5
- openlit/instrumentation/langchain_community/langchain_community.py +23 -5
- openlit/instrumentation/langchain_community/utils.py +35 -9
- openlit/instrumentation/letta/__init__.py +68 -15
- openlit/instrumentation/letta/letta.py +99 -54
- openlit/instrumentation/litellm/__init__.py +43 -14
- openlit/instrumentation/litellm/async_litellm.py +51 -26
- openlit/instrumentation/litellm/litellm.py +51 -26
- openlit/instrumentation/litellm/utils.py +304 -102
- openlit/instrumentation/llamaindex/__init__.py +267 -90
- openlit/instrumentation/llamaindex/async_llamaindex.py +28 -6
- openlit/instrumentation/llamaindex/llamaindex.py +28 -6
- openlit/instrumentation/llamaindex/utils.py +204 -91
- openlit/instrumentation/mem0/__init__.py +11 -2
- openlit/instrumentation/mem0/mem0.py +50 -29
- openlit/instrumentation/milvus/__init__.py +10 -2
- openlit/instrumentation/milvus/milvus.py +31 -6
- openlit/instrumentation/milvus/utils.py +166 -67
- openlit/instrumentation/mistral/__init__.py +63 -18
- openlit/instrumentation/mistral/async_mistral.py +63 -24
- openlit/instrumentation/mistral/mistral.py +63 -24
- openlit/instrumentation/mistral/utils.py +277 -69
- openlit/instrumentation/multion/__init__.py +69 -19
- openlit/instrumentation/multion/async_multion.py +57 -26
- openlit/instrumentation/multion/multion.py +57 -26
- openlit/instrumentation/ollama/__init__.py +39 -18
- openlit/instrumentation/ollama/async_ollama.py +57 -26
- openlit/instrumentation/ollama/ollama.py +57 -26
- openlit/instrumentation/ollama/utils.py +226 -50
- openlit/instrumentation/openai/__init__.py +156 -32
- openlit/instrumentation/openai/async_openai.py +147 -67
- openlit/instrumentation/openai/openai.py +150 -67
- openlit/instrumentation/openai/utils.py +657 -185
- openlit/instrumentation/openai_agents/__init__.py +5 -1
- openlit/instrumentation/openai_agents/processor.py +110 -90
- openlit/instrumentation/phidata/__init__.py +13 -5
- openlit/instrumentation/phidata/phidata.py +67 -32
- openlit/instrumentation/pinecone/__init__.py +48 -9
- openlit/instrumentation/pinecone/async_pinecone.py +27 -5
- openlit/instrumentation/pinecone/pinecone.py +27 -5
- openlit/instrumentation/pinecone/utils.py +153 -47
- openlit/instrumentation/premai/__init__.py +22 -7
- openlit/instrumentation/premai/premai.py +51 -26
- openlit/instrumentation/premai/utils.py +246 -59
- openlit/instrumentation/pydantic_ai/__init__.py +49 -22
- openlit/instrumentation/pydantic_ai/pydantic_ai.py +69 -16
- openlit/instrumentation/pydantic_ai/utils.py +89 -24
- openlit/instrumentation/qdrant/__init__.py +19 -4
- openlit/instrumentation/qdrant/async_qdrant.py +33 -7
- openlit/instrumentation/qdrant/qdrant.py +33 -7
- openlit/instrumentation/qdrant/utils.py +228 -93
- openlit/instrumentation/reka/__init__.py +23 -10
- openlit/instrumentation/reka/async_reka.py +17 -11
- openlit/instrumentation/reka/reka.py +17 -11
- openlit/instrumentation/reka/utils.py +138 -36
- openlit/instrumentation/together/__init__.py +44 -12
- openlit/instrumentation/together/async_together.py +50 -27
- openlit/instrumentation/together/together.py +50 -27
- openlit/instrumentation/together/utils.py +301 -71
- openlit/instrumentation/transformers/__init__.py +2 -1
- openlit/instrumentation/transformers/transformers.py +13 -3
- openlit/instrumentation/transformers/utils.py +139 -36
- openlit/instrumentation/vertexai/__init__.py +81 -16
- openlit/instrumentation/vertexai/async_vertexai.py +33 -15
- openlit/instrumentation/vertexai/utils.py +123 -27
- openlit/instrumentation/vertexai/vertexai.py +33 -15
- openlit/instrumentation/vllm/__init__.py +12 -5
- openlit/instrumentation/vllm/utils.py +121 -31
- openlit/instrumentation/vllm/vllm.py +16 -10
- openlit/otel/events.py +35 -10
- openlit/otel/metrics.py +32 -24
- openlit/otel/tracing.py +24 -9
- openlit/semcov/__init__.py +72 -6
- {openlit-1.34.30.dist-info → openlit-1.34.31.dist-info}/METADATA +2 -1
- openlit-1.34.31.dist-info/RECORD +166 -0
- openlit/instrumentation/langchain/async_langchain.py +0 -102
- openlit/instrumentation/langchain/langchain.py +0 -102
- openlit/instrumentation/langchain/utils.py +0 -252
- openlit-1.34.30.dist-info/RECORD +0 -168
- {openlit-1.34.30.dist-info → openlit-1.34.31.dist-info}/LICENSE +0 -0
- {openlit-1.34.30.dist-info → openlit-1.34.31.dist-info}/WHEEL +0 -0
@@ -4,48 +4,101 @@ Module for monitoring Pydantic AI API calls.
|
|
4
4
|
|
5
5
|
from openlit.instrumentation.pydantic_ai.utils import (
|
6
6
|
common_agent_run,
|
7
|
-
common_agent_create
|
7
|
+
common_agent_create,
|
8
8
|
)
|
9
9
|
|
10
|
-
def agent_create(version, environment, application_name,
|
11
|
-
tracer, pricing_info, capture_message_content, metrics, disable_metrics):
|
12
10
|
|
11
|
+
def agent_create(
|
12
|
+
version,
|
13
|
+
environment,
|
14
|
+
application_name,
|
15
|
+
tracer,
|
16
|
+
pricing_info,
|
17
|
+
capture_message_content,
|
18
|
+
metrics,
|
19
|
+
disable_metrics,
|
20
|
+
):
|
13
21
|
"""
|
14
22
|
Generates a telemetry wrapper for GenAI function call
|
15
23
|
"""
|
16
24
|
|
17
25
|
def wrapper(wrapped, instance, args, kwargs):
|
18
26
|
response = wrapped(*args, **kwargs)
|
19
|
-
return common_agent_create(
|
20
|
-
|
21
|
-
|
27
|
+
return common_agent_create(
|
28
|
+
wrapped,
|
29
|
+
instance,
|
30
|
+
args,
|
31
|
+
kwargs,
|
32
|
+
tracer,
|
33
|
+
version,
|
34
|
+
environment,
|
35
|
+
application_name,
|
36
|
+
capture_message_content,
|
37
|
+
response=response,
|
38
|
+
)
|
22
39
|
|
23
40
|
return wrapper
|
24
41
|
|
25
|
-
|
26
|
-
|
42
|
+
|
43
|
+
def agent_run(
|
44
|
+
version,
|
45
|
+
environment,
|
46
|
+
application_name,
|
47
|
+
tracer,
|
48
|
+
pricing_info,
|
49
|
+
capture_message_content,
|
50
|
+
metrics,
|
51
|
+
disable_metrics,
|
52
|
+
):
|
27
53
|
"""
|
28
54
|
Generates a telemetry wrapper for GenAI function call
|
29
55
|
"""
|
30
56
|
|
31
57
|
def wrapper(wrapped, instance, args, kwargs):
|
32
58
|
response = wrapped(*args, **kwargs)
|
33
|
-
return common_agent_run(
|
34
|
-
|
35
|
-
|
59
|
+
return common_agent_run(
|
60
|
+
wrapped,
|
61
|
+
instance,
|
62
|
+
args,
|
63
|
+
kwargs,
|
64
|
+
tracer,
|
65
|
+
version,
|
66
|
+
environment,
|
67
|
+
application_name,
|
68
|
+
capture_message_content,
|
69
|
+
response=response,
|
70
|
+
)
|
36
71
|
|
37
72
|
return wrapper
|
38
73
|
|
39
|
-
|
40
|
-
|
74
|
+
|
75
|
+
def async_agent_run(
|
76
|
+
version,
|
77
|
+
environment,
|
78
|
+
application_name,
|
79
|
+
tracer,
|
80
|
+
pricing_info,
|
81
|
+
capture_message_content,
|
82
|
+
metrics,
|
83
|
+
disable_metrics,
|
84
|
+
):
|
41
85
|
"""
|
42
86
|
Generates a telemetry wrapper for GenAI function call
|
43
87
|
"""
|
44
88
|
|
45
89
|
async def wrapper(wrapped, instance, args, kwargs):
|
46
90
|
response = await wrapped(*args, **kwargs)
|
47
|
-
return common_agent_run(
|
48
|
-
|
49
|
-
|
91
|
+
return common_agent_run(
|
92
|
+
wrapped,
|
93
|
+
instance,
|
94
|
+
args,
|
95
|
+
kwargs,
|
96
|
+
tracer,
|
97
|
+
version,
|
98
|
+
environment,
|
99
|
+
application_name,
|
100
|
+
capture_message_content,
|
101
|
+
response=response,
|
102
|
+
)
|
50
103
|
|
51
104
|
return wrapper
|
@@ -1,27 +1,42 @@
|
|
1
1
|
"""
|
2
2
|
Pydantic AI OpenTelemetry instrumentation utility functions
|
3
3
|
"""
|
4
|
+
|
4
5
|
import logging
|
5
|
-
from opentelemetry.sdk.resources import
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
from opentelemetry.sdk.resources import (
|
7
|
+
SERVICE_NAME,
|
8
|
+
TELEMETRY_SDK_NAME,
|
9
|
+
DEPLOYMENT_ENVIRONMENT,
|
9
10
|
)
|
11
|
+
from opentelemetry.trace import Status, StatusCode, SpanKind
|
12
|
+
from openlit.__helpers import handle_exception
|
10
13
|
from openlit.semcov import SemanticConvention
|
11
14
|
|
12
15
|
# Initialize logger for logging potential issues and operations
|
13
16
|
logger = logging.getLogger(__name__)
|
14
17
|
|
15
|
-
|
16
|
-
|
18
|
+
|
19
|
+
def set_span_attributes(
|
20
|
+
span,
|
21
|
+
version,
|
22
|
+
operation_name,
|
23
|
+
environment,
|
24
|
+
application_name,
|
25
|
+
server_address,
|
26
|
+
server_port,
|
27
|
+
request_model,
|
28
|
+
agent_name,
|
29
|
+
):
|
17
30
|
"""
|
18
31
|
Set common OpenTelemetry span attributes for Pydantic AI operations.
|
19
32
|
"""
|
20
33
|
|
21
34
|
# Set Span attributes (OTel Semconv)
|
22
|
-
span.set_attribute(TELEMETRY_SDK_NAME,
|
35
|
+
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
|
23
36
|
span.set_attribute(SemanticConvention.GEN_AI_OPERATION, operation_name)
|
24
|
-
span.set_attribute(
|
37
|
+
span.set_attribute(
|
38
|
+
SemanticConvention.GEN_AI_SYSTEM, SemanticConvention.GEN_AI_SYSTEM_PYDANTIC_AI
|
39
|
+
)
|
25
40
|
span.set_attribute(SemanticConvention.GEN_AI_AGENT_NAME, agent_name)
|
26
41
|
span.set_attribute(SemanticConvention.SERVER_ADDRESS, server_address)
|
27
42
|
span.set_attribute(SemanticConvention.SERVER_PORT, server_port)
|
@@ -32,8 +47,19 @@ def set_span_attributes(span, version, operation_name, environment,
|
|
32
47
|
span.set_attribute(SERVICE_NAME, application_name)
|
33
48
|
span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION, version)
|
34
49
|
|
35
|
-
|
36
|
-
|
50
|
+
|
51
|
+
def common_agent_run(
|
52
|
+
wrapped,
|
53
|
+
instance,
|
54
|
+
args,
|
55
|
+
kwargs,
|
56
|
+
tracer,
|
57
|
+
version,
|
58
|
+
environment,
|
59
|
+
application_name,
|
60
|
+
capture_message_content,
|
61
|
+
response,
|
62
|
+
):
|
37
63
|
"""
|
38
64
|
Handle telemetry for Pydantic AI agent run operations.
|
39
65
|
"""
|
@@ -41,13 +67,27 @@ def common_agent_run(wrapped, instance, args, kwargs, tracer, version, environme
|
|
41
67
|
server_address, server_port = instance.model.base_url, 443
|
42
68
|
agent_name = instance.name or "pydantic_agent"
|
43
69
|
request_model = str(instance.model.model_name)
|
44
|
-
span_name =
|
70
|
+
span_name = (
|
71
|
+
f"{SemanticConvention.GEN_AI_OPERATION_TYPE_EXECUTE_AGENT_TASK} {agent_name}"
|
72
|
+
)
|
45
73
|
|
46
74
|
with tracer.start_as_current_span(span_name, kind=SpanKind.CLIENT) as span:
|
47
75
|
try:
|
48
|
-
set_span_attributes(
|
49
|
-
|
50
|
-
|
76
|
+
set_span_attributes(
|
77
|
+
span,
|
78
|
+
version,
|
79
|
+
SemanticConvention.GEN_AI_OPERATION_TYPE_EXECUTE_AGENT_TASK,
|
80
|
+
environment,
|
81
|
+
application_name,
|
82
|
+
server_address,
|
83
|
+
server_port,
|
84
|
+
request_model,
|
85
|
+
agent_name,
|
86
|
+
)
|
87
|
+
span.set_attribute(
|
88
|
+
SemanticConvention.GEN_AI_AGENT_DESCRIPTION,
|
89
|
+
str(instance._system_prompts),
|
90
|
+
)
|
51
91
|
span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, request_model)
|
52
92
|
|
53
93
|
if capture_message_content:
|
@@ -64,25 +104,50 @@ def common_agent_run(wrapped, instance, args, kwargs, tracer, version, environme
|
|
64
104
|
|
65
105
|
except Exception as e:
|
66
106
|
handle_exception(span, e)
|
67
|
-
logger.error(
|
107
|
+
logger.error("Error in trace creation: %s", e)
|
68
108
|
return response
|
69
109
|
|
70
|
-
|
71
|
-
|
110
|
+
|
111
|
+
def common_agent_create(
|
112
|
+
wrapped,
|
113
|
+
instance,
|
114
|
+
args,
|
115
|
+
kwargs,
|
116
|
+
tracer,
|
117
|
+
version,
|
118
|
+
environment,
|
119
|
+
application_name,
|
120
|
+
capture_message_content,
|
121
|
+
response,
|
122
|
+
):
|
72
123
|
"""
|
73
124
|
Handle telemetry for Pydantic AI agent creation operations.
|
74
125
|
"""
|
75
126
|
|
76
|
-
server_address, server_port =
|
127
|
+
server_address, server_port = "127.0.0.1", 80
|
77
128
|
agent_name = kwargs.get("name", "pydantic_agent")
|
78
|
-
span_name = f
|
129
|
+
span_name = f"{SemanticConvention.GEN_AI_OPERATION_TYPE_CREATE_AGENT} {agent_name}"
|
79
130
|
|
80
131
|
with tracer.start_as_current_span(span_name, kind=SpanKind.CLIENT) as span:
|
81
132
|
try:
|
82
|
-
request_model = args[0] or kwargs.get(
|
83
|
-
|
84
|
-
|
85
|
-
|
133
|
+
request_model = args[0] or kwargs.get(
|
134
|
+
"model", "google-gla:gemini-1.5-flash"
|
135
|
+
)
|
136
|
+
set_span_attributes(
|
137
|
+
span,
|
138
|
+
version,
|
139
|
+
SemanticConvention.GEN_AI_OPERATION_TYPE_CREATE_AGENT,
|
140
|
+
environment,
|
141
|
+
application_name,
|
142
|
+
server_address,
|
143
|
+
server_port,
|
144
|
+
request_model,
|
145
|
+
agent_name,
|
146
|
+
)
|
147
|
+
span.set_attribute(
|
148
|
+
SemanticConvention.GEN_AI_AGENT_DESCRIPTION,
|
149
|
+
str(kwargs.get("system_prompt", "")),
|
150
|
+
)
|
86
151
|
span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, request_model)
|
87
152
|
|
88
153
|
span.set_status(Status(StatusCode.OK))
|
@@ -91,5 +156,5 @@ def common_agent_create(wrapped, instance, args, kwargs, tracer, version, enviro
|
|
91
156
|
|
92
157
|
except Exception as e:
|
93
158
|
handle_exception(span, e)
|
94
|
-
logger.error(
|
159
|
+
logger.error("Error in trace creation: %s", e)
|
95
160
|
return response
|
@@ -36,6 +36,7 @@ QDRANT_OPERATIONS = [
|
|
36
36
|
("query_points", "qdrant.query_points"),
|
37
37
|
]
|
38
38
|
|
39
|
+
|
39
40
|
class QdrantInstrumentor(BaseInstrumentor):
|
40
41
|
"""
|
41
42
|
An instrumentor for Qdrant client library.
|
@@ -60,8 +61,15 @@ class QdrantInstrumentor(BaseInstrumentor):
|
|
60
61
|
"qdrant_client",
|
61
62
|
f"QdrantClient.{method_name}",
|
62
63
|
general_wrap(
|
63
|
-
endpoint,
|
64
|
-
|
64
|
+
endpoint,
|
65
|
+
version,
|
66
|
+
environment,
|
67
|
+
application_name,
|
68
|
+
tracer,
|
69
|
+
pricing_info,
|
70
|
+
capture_message_content,
|
71
|
+
metrics,
|
72
|
+
disable_metrics,
|
65
73
|
),
|
66
74
|
)
|
67
75
|
|
@@ -71,8 +79,15 @@ class QdrantInstrumentor(BaseInstrumentor):
|
|
71
79
|
"qdrant_client",
|
72
80
|
f"AsyncQdrantClient.{method_name}",
|
73
81
|
async_general_wrap(
|
74
|
-
endpoint,
|
75
|
-
|
82
|
+
endpoint,
|
83
|
+
version,
|
84
|
+
environment,
|
85
|
+
application_name,
|
86
|
+
tracer,
|
87
|
+
pricing_info,
|
88
|
+
capture_message_content,
|
89
|
+
metrics,
|
90
|
+
disable_metrics,
|
76
91
|
),
|
77
92
|
)
|
78
93
|
|
@@ -7,10 +7,24 @@ import time
|
|
7
7
|
from opentelemetry.trace import SpanKind
|
8
8
|
from opentelemetry import context as context_api
|
9
9
|
from openlit.__helpers import handle_exception
|
10
|
-
from openlit.instrumentation.qdrant.utils import
|
10
|
+
from openlit.instrumentation.qdrant.utils import (
|
11
|
+
DB_OPERATION_MAP,
|
12
|
+
process_qdrant_response,
|
13
|
+
set_server_address_and_port,
|
14
|
+
)
|
11
15
|
|
12
|
-
|
13
|
-
|
16
|
+
|
17
|
+
def async_general_wrap(
|
18
|
+
gen_ai_endpoint,
|
19
|
+
version,
|
20
|
+
environment,
|
21
|
+
application_name,
|
22
|
+
tracer,
|
23
|
+
pricing_info,
|
24
|
+
capture_message_content,
|
25
|
+
metrics,
|
26
|
+
disable_metrics,
|
27
|
+
):
|
14
28
|
"""
|
15
29
|
Generates a telemetry wrapper for Pinecone function calls.
|
16
30
|
"""
|
@@ -41,10 +55,22 @@ def async_general_wrap(gen_ai_endpoint, version, environment, application_name,
|
|
41
55
|
try:
|
42
56
|
# Process response with endpoint information
|
43
57
|
response = process_qdrant_response(
|
44
|
-
response,
|
45
|
-
|
46
|
-
|
47
|
-
|
58
|
+
response,
|
59
|
+
db_operation,
|
60
|
+
server_address,
|
61
|
+
server_port,
|
62
|
+
environment,
|
63
|
+
application_name,
|
64
|
+
metrics,
|
65
|
+
start_time,
|
66
|
+
span,
|
67
|
+
capture_message_content,
|
68
|
+
disable_metrics,
|
69
|
+
version,
|
70
|
+
instance=instance,
|
71
|
+
args=args,
|
72
|
+
endpoint=gen_ai_endpoint,
|
73
|
+
**kwargs,
|
48
74
|
)
|
49
75
|
|
50
76
|
except Exception as e:
|
@@ -7,10 +7,24 @@ import time
|
|
7
7
|
from opentelemetry.trace import SpanKind
|
8
8
|
from opentelemetry import context as context_api
|
9
9
|
from openlit.__helpers import handle_exception
|
10
|
-
from openlit.instrumentation.qdrant.utils import
|
10
|
+
from openlit.instrumentation.qdrant.utils import (
|
11
|
+
DB_OPERATION_MAP,
|
12
|
+
process_qdrant_response,
|
13
|
+
set_server_address_and_port,
|
14
|
+
)
|
11
15
|
|
12
|
-
|
13
|
-
|
16
|
+
|
17
|
+
def general_wrap(
|
18
|
+
gen_ai_endpoint,
|
19
|
+
version,
|
20
|
+
environment,
|
21
|
+
application_name,
|
22
|
+
tracer,
|
23
|
+
pricing_info,
|
24
|
+
capture_message_content,
|
25
|
+
metrics,
|
26
|
+
disable_metrics,
|
27
|
+
):
|
14
28
|
"""
|
15
29
|
Generates a telemetry wrapper for Pinecone function calls.
|
16
30
|
"""
|
@@ -41,10 +55,22 @@ def general_wrap(gen_ai_endpoint, version, environment, application_name, tracer
|
|
41
55
|
try:
|
42
56
|
# Process response with endpoint information
|
43
57
|
response = process_qdrant_response(
|
44
|
-
response,
|
45
|
-
|
46
|
-
|
47
|
-
|
58
|
+
response,
|
59
|
+
db_operation,
|
60
|
+
server_address,
|
61
|
+
server_port,
|
62
|
+
environment,
|
63
|
+
application_name,
|
64
|
+
metrics,
|
65
|
+
start_time,
|
66
|
+
span,
|
67
|
+
capture_message_content,
|
68
|
+
disable_metrics,
|
69
|
+
version,
|
70
|
+
instance=instance,
|
71
|
+
args=args,
|
72
|
+
endpoint=gen_ai_endpoint,
|
73
|
+
**kwargs,
|
48
74
|
)
|
49
75
|
|
50
76
|
except Exception as e:
|