openlit 1.34.28__tar.gz → 1.34.29__tar.gz
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-1.34.28 → openlit-1.34.29}/PKG-INFO +2 -1
- {openlit-1.34.28 → openlit-1.34.29}/pyproject.toml +2 -1
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/openai/utils.py +56 -23
- openlit-1.34.29/src/openlit/instrumentation/openai_agents/__init__.py +62 -0
- openlit-1.34.29/src/openlit/instrumentation/openai_agents/processor.py +600 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/semcov/__init__.py +1 -0
- openlit-1.34.28/src/openlit/instrumentation/openai_agents/__init__.py +0 -42
- openlit-1.34.28/src/openlit/instrumentation/openai_agents/openai_agents.py +0 -65
- {openlit-1.34.28 → openlit-1.34.29}/LICENSE +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/README.md +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/__helpers.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/_instrumentors.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/evals/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/evals/all.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/evals/bias_detection.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/evals/hallucination.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/evals/toxicity.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/evals/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/guard/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/guard/all.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/guard/prompt_injection.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/guard/restrict_topic.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/guard/sensitive_topic.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/guard/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ag2/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ag2/ag2.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ag2/async_ag2.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ag2/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ai21/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ai21/ai21.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ai21/async_ai21.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ai21/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/anthropic/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/anthropic/anthropic.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/anthropic/async_anthropic.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/anthropic/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/assemblyai/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/assemblyai/assemblyai.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/assemblyai/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/astra/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/astra/astra.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/astra/async_astra.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/astra/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/azure_ai_inference/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/azure_ai_inference/async_azure_ai_inference.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/azure_ai_inference/azure_ai_inference.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/azure_ai_inference/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/bedrock/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/bedrock/bedrock.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/bedrock/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/chroma/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/chroma/chroma.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/chroma/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/cohere/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/cohere/async_cohere.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/cohere/cohere.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/cohere/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/controlflow/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/controlflow/controlflow.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/crawl4ai/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/crawl4ai/async_crawl4ai.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/crawl4ai/crawl4ai.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/crewai/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/crewai/crewai.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/dynamiq/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/dynamiq/dynamiq.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/elevenlabs/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/elevenlabs/async_elevenlabs.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/elevenlabs/elevenlabs.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/elevenlabs/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/embedchain/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/embedchain/embedchain.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/firecrawl/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/firecrawl/firecrawl.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/google_ai_studio/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/google_ai_studio/async_google_ai_studio.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/google_ai_studio/google_ai_studio.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/google_ai_studio/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/gpt4all/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/gpt4all/gpt4all.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/gpt4all/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/gpu/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/groq/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/groq/async_groq.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/groq/groq.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/groq/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/haystack/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/haystack/async_haystack.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/haystack/haystack.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/haystack/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/julep/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/julep/async_julep.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/julep/julep.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain/async_langchain.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain/langchain.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain_community/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain_community/async_langchain_community.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain_community/langchain_community.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain_community/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/letta/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/letta/letta.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/litellm/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/litellm/async_litellm.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/litellm/litellm.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/litellm/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/llamaindex/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/llamaindex/async_llamaindex.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/llamaindex/llamaindex.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/llamaindex/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/mem0/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/mem0/mem0.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/milvus/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/milvus/milvus.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/milvus/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/mistral/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/mistral/async_mistral.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/mistral/mistral.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/mistral/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/multion/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/multion/async_multion.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/multion/multion.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ollama/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ollama/async_ollama.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ollama/ollama.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ollama/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/openai/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/openai/async_openai.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/openai/openai.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/phidata/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/phidata/phidata.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/pinecone/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/pinecone/async_pinecone.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/pinecone/pinecone.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/pinecone/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/premai/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/premai/premai.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/premai/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/pydantic_ai/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/pydantic_ai/pydantic_ai.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/pydantic_ai/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/qdrant/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/qdrant/async_qdrant.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/qdrant/qdrant.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/qdrant/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/reka/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/reka/async_reka.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/reka/reka.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/reka/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/together/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/together/async_together.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/together/together.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/together/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/transformers/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/transformers/transformers.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/transformers/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/vertexai/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/vertexai/async_vertexai.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/vertexai/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/vertexai/vertexai.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/vllm/__init__.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/vllm/utils.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/vllm/vllm.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/otel/events.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/otel/metrics.py +0 -0
- {openlit-1.34.28 → openlit-1.34.29}/src/openlit/otel/tracing.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: openlit
|
3
|
-
Version: 1.34.
|
3
|
+
Version: 1.34.29
|
4
4
|
Summary: OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications and GPUs, facilitating the integration of observability into your GenAI-driven projects
|
5
5
|
License: Apache-2.0
|
6
6
|
Keywords: OpenTelemetry,otel,otlp,llm,tracing,openai,anthropic,claude,cohere,llm monitoring,observability,monitoring,gpt,Generative AI,chatGPT,gpu
|
@@ -18,6 +18,7 @@ Requires-Dist: anthropic (>=0.42.0,<1.0.0)
|
|
18
18
|
Requires-Dist: boto3 (>=1.34.0,<2.0.0)
|
19
19
|
Requires-Dist: botocore (>=1.34.0,<2.0.0)
|
20
20
|
Requires-Dist: openai (>=1.1.1,<2.0.0)
|
21
|
+
Requires-Dist: openai-agents (>=0.0.3)
|
21
22
|
Requires-Dist: opentelemetry-api (>=1.30.0,<2.0.0)
|
22
23
|
Requires-Dist: opentelemetry-exporter-otlp (>=1.30.0,<2.0.0)
|
23
24
|
Requires-Dist: opentelemetry-instrumentation (>=0.52b0,<1.0.0)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "openlit"
|
3
|
-
version = "1.34.
|
3
|
+
version = "1.34.29"
|
4
4
|
description = "OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications and GPUs, facilitating the integration of observability into your GenAI-driven projects"
|
5
5
|
authors = ["OpenLIT"]
|
6
6
|
license = "Apache-2.0"
|
@@ -23,6 +23,7 @@ opentelemetry-exporter-otlp = "^1.30.0"
|
|
23
23
|
opentelemetry-instrumentation = ">=0.52b0,<1.0.0"
|
24
24
|
openai = "^1.1.1"
|
25
25
|
anthropic = ">=0.42.0,<1.0.0"
|
26
|
+
openai-agents = ">=0.0.3"
|
26
27
|
|
27
28
|
[build-system]
|
28
29
|
requires = ["poetry-core>=1.1.0"]
|
@@ -22,6 +22,14 @@ from openlit.__helpers import (
|
|
22
22
|
)
|
23
23
|
from openlit.semcov import SemanticConvention
|
24
24
|
|
25
|
+
def handle_not_given(value, default=None):
|
26
|
+
"""
|
27
|
+
Handle OpenAI's NotGiven values by converting them to appropriate defaults.
|
28
|
+
"""
|
29
|
+
if hasattr(value, '__class__') and value.__class__.__name__ == 'NotGiven':
|
30
|
+
return default
|
31
|
+
return value
|
32
|
+
|
25
33
|
def format_content(messages):
|
26
34
|
"""
|
27
35
|
Format the messages into a string for span events.
|
@@ -248,9 +256,15 @@ def common_response_logic(scope, pricing_info, environment, application_name, me
|
|
248
256
|
environment, application_name, is_stream, scope._tbt, scope._ttft, version)
|
249
257
|
|
250
258
|
# Span Attributes for Request parameters specific to responses API
|
251
|
-
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE, scope._kwargs.get("temperature", 1.0))
|
252
|
-
scope._span.set_attribute(
|
253
|
-
|
259
|
+
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE, handle_not_given(scope._kwargs.get("temperature"), 1.0))
|
260
|
+
scope._span.set_attribute(
|
261
|
+
SemanticConvention.GEN_AI_REQUEST_TOP_P,
|
262
|
+
handle_not_given(scope._kwargs.get("top_p"), 1.0)
|
263
|
+
)
|
264
|
+
scope._span.set_attribute(
|
265
|
+
SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS,
|
266
|
+
handle_not_given(scope._kwargs.get("max_output_tokens"), -1)
|
267
|
+
)
|
254
268
|
|
255
269
|
# Reasoning parameters
|
256
270
|
reasoning = scope._kwargs.get("reasoning", {})
|
@@ -427,20 +441,30 @@ def common_chat_logic(scope, pricing_info, environment, application_name, metric
|
|
427
441
|
cost = get_chat_model_cost(request_model, pricing_info, input_tokens, output_tokens)
|
428
442
|
|
429
443
|
# Common Span Attributes
|
430
|
-
common_span_attributes(
|
431
|
-
|
432
|
-
|
433
|
-
|
444
|
+
common_span_attributes(
|
445
|
+
scope,
|
446
|
+
SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT,
|
447
|
+
SemanticConvention.GEN_AI_SYSTEM_OPENAI,
|
448
|
+
scope._server_address, scope._server_port, request_model,
|
449
|
+
scope._response_model, environment, application_name,
|
450
|
+
is_stream, scope._tbt, scope._ttft, version
|
451
|
+
)
|
434
452
|
|
435
453
|
# Span Attributes for Request parameters
|
436
|
-
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_SEED, str(scope._kwargs.get("seed", "")))
|
437
|
-
scope._span.set_attribute(
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
scope._span.set_attribute(SemanticConvention.
|
442
|
-
scope._span.set_attribute(
|
443
|
-
|
454
|
+
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_SEED, str(handle_not_given(scope._kwargs.get("seed"), "")))
|
455
|
+
scope._span.set_attribute(
|
456
|
+
SemanticConvention.GEN_AI_REQUEST_FREQUENCY_PENALTY,
|
457
|
+
handle_not_given(scope._kwargs.get("frequency_penalty"), 0.0)
|
458
|
+
)
|
459
|
+
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS, handle_not_given(scope._kwargs.get("max_tokens"), -1))
|
460
|
+
scope._span.set_attribute(
|
461
|
+
SemanticConvention.GEN_AI_REQUEST_PRESENCE_PENALTY,
|
462
|
+
handle_not_given(scope._kwargs.get("presence_penalty"), 0.0)
|
463
|
+
)
|
464
|
+
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_STOP_SEQUENCES, handle_not_given(scope._kwargs.get("stop"), []))
|
465
|
+
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE, handle_not_given(scope._kwargs.get("temperature"), 1.0))
|
466
|
+
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TOP_P, handle_not_given(scope._kwargs.get("top_p"), 1.0))
|
467
|
+
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_USER, handle_not_given(scope._kwargs.get("user"), ""))
|
444
468
|
|
445
469
|
# Span Attributes for Response parameters
|
446
470
|
scope._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_ID, scope._response_id)
|
@@ -571,8 +595,11 @@ def common_embedding_logic(scope, request_model, pricing_info, environment, appl
|
|
571
595
|
environment, application_name, False, scope._tbt, scope._ttft, version)
|
572
596
|
|
573
597
|
# Span Attributes for Request parameters
|
574
|
-
scope._span.set_attribute(
|
575
|
-
|
598
|
+
scope._span.set_attribute(
|
599
|
+
SemanticConvention.GEN_AI_REQUEST_ENCODING_FORMATS,
|
600
|
+
[handle_not_given(scope._kwargs.get("encoding_format"), "float")]
|
601
|
+
)
|
602
|
+
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_USER, handle_not_given(scope._kwargs.get("user"), ""))
|
576
603
|
|
577
604
|
# Span Attributes for Cost and Tokens
|
578
605
|
scope._span.set_attribute(SemanticConvention.GEN_AI_USAGE_INPUT_TOKENS, scope._input_tokens)
|
@@ -611,9 +638,12 @@ def common_image_logic(scope, request_model, pricing_info, environment, applicat
|
|
611
638
|
environment, application_name, False, scope._tbt, scope._ttft, version)
|
612
639
|
|
613
640
|
# Span Attributes for Request parameters
|
614
|
-
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_IMAGE_SIZE, scope._kwargs.get("size", "1024x1024"))
|
615
|
-
scope._span.set_attribute(
|
616
|
-
|
641
|
+
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_IMAGE_SIZE, handle_not_given(scope._kwargs.get("size"), "1024x1024"))
|
642
|
+
scope._span.set_attribute(
|
643
|
+
SemanticConvention.GEN_AI_REQUEST_IMAGE_QUALITY,
|
644
|
+
handle_not_given(scope._kwargs.get("quality"), "standard")
|
645
|
+
)
|
646
|
+
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_USER, handle_not_given(scope._kwargs.get("user"), ""))
|
617
647
|
|
618
648
|
# Extract response data
|
619
649
|
response_dict = scope._response_dict
|
@@ -709,9 +739,12 @@ def common_audio_logic(scope, request_model, pricing_info, environment, applicat
|
|
709
739
|
environment, application_name, False, scope._tbt, scope._ttft, version)
|
710
740
|
|
711
741
|
# Span Attributes for Request parameters
|
712
|
-
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_AUDIO_VOICE, scope._kwargs.get("voice", "alloy"))
|
713
|
-
scope._span.set_attribute(
|
714
|
-
|
742
|
+
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_AUDIO_VOICE, handle_not_given(scope._kwargs.get("voice"), "alloy"))
|
743
|
+
scope._span.set_attribute(
|
744
|
+
SemanticConvention.GEN_AI_REQUEST_AUDIO_RESPONSE_FORMAT,
|
745
|
+
handle_not_given(scope._kwargs.get("response_format"), "mp3")
|
746
|
+
)
|
747
|
+
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_AUDIO_SPEED, handle_not_given(scope._kwargs.get("speed"), 1.0))
|
715
748
|
|
716
749
|
# Span Attributes for Cost
|
717
750
|
scope._span.set_attribute(SemanticConvention.GEN_AI_USAGE_COST, cost)
|
@@ -0,0 +1,62 @@
|
|
1
|
+
"""
|
2
|
+
OpenLIT OpenAI Agents Instrumentation - Native Tracing Integration
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import Collection
|
6
|
+
import importlib.metadata
|
7
|
+
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
8
|
+
|
9
|
+
from openlit.instrumentation.openai_agents.processor import OpenLITTracingProcessor
|
10
|
+
|
11
|
+
_instruments = ("openai-agents >= 0.0.3",)
|
12
|
+
|
13
|
+
class OpenAIAgentsInstrumentor(BaseInstrumentor):
|
14
|
+
"""OpenLIT instrumentor for OpenAI Agents using native tracing system"""
|
15
|
+
|
16
|
+
def instrumentation_dependencies(self) -> Collection[str]:
|
17
|
+
return _instruments
|
18
|
+
|
19
|
+
def _instrument(self, **kwargs):
|
20
|
+
version = importlib.metadata.version("openai-agents")
|
21
|
+
environment = kwargs.get("environment", "default")
|
22
|
+
application_name = kwargs.get("application_name", "default")
|
23
|
+
tracer = kwargs.get("tracer")
|
24
|
+
pricing_info = kwargs.get("pricing_info", {})
|
25
|
+
capture_message_content = kwargs.get("capture_message_content", False)
|
26
|
+
metrics = kwargs.get("metrics_dict")
|
27
|
+
disable_metrics = kwargs.get("disable_metrics")
|
28
|
+
detailed_tracing = kwargs.get("detailed_tracing", False)
|
29
|
+
|
30
|
+
# Create our processor with OpenLIT enhancements
|
31
|
+
processor = OpenLITTracingProcessor(
|
32
|
+
tracer=tracer,
|
33
|
+
version=version,
|
34
|
+
environment=environment,
|
35
|
+
application_name=application_name,
|
36
|
+
pricing_info=pricing_info,
|
37
|
+
capture_message_content=capture_message_content,
|
38
|
+
metrics=metrics,
|
39
|
+
disable_metrics=disable_metrics,
|
40
|
+
detailed_tracing=detailed_tracing
|
41
|
+
)
|
42
|
+
|
43
|
+
# Integrate with OpenAI Agents' native tracing system
|
44
|
+
try:
|
45
|
+
from agents import set_trace_processors
|
46
|
+
# Replace existing processors with our enhanced processor
|
47
|
+
set_trace_processors([processor])
|
48
|
+
except ImportError:
|
49
|
+
# Fallback: Add our processor to existing ones
|
50
|
+
try:
|
51
|
+
from agents import add_trace_processor
|
52
|
+
add_trace_processor(processor)
|
53
|
+
except ImportError:
|
54
|
+
pass # Agents package may not have tracing
|
55
|
+
|
56
|
+
def _uninstrument(self, **kwargs):
|
57
|
+
# Clear our processors
|
58
|
+
try:
|
59
|
+
from agents import set_trace_processors
|
60
|
+
set_trace_processors([])
|
61
|
+
except ImportError:
|
62
|
+
pass
|