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.
Files changed (168) hide show
  1. {openlit-1.34.28 → openlit-1.34.29}/PKG-INFO +2 -1
  2. {openlit-1.34.28 → openlit-1.34.29}/pyproject.toml +2 -1
  3. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/openai/utils.py +56 -23
  4. openlit-1.34.29/src/openlit/instrumentation/openai_agents/__init__.py +62 -0
  5. openlit-1.34.29/src/openlit/instrumentation/openai_agents/processor.py +600 -0
  6. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/semcov/__init__.py +1 -0
  7. openlit-1.34.28/src/openlit/instrumentation/openai_agents/__init__.py +0 -42
  8. openlit-1.34.28/src/openlit/instrumentation/openai_agents/openai_agents.py +0 -65
  9. {openlit-1.34.28 → openlit-1.34.29}/LICENSE +0 -0
  10. {openlit-1.34.28 → openlit-1.34.29}/README.md +0 -0
  11. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/__helpers.py +0 -0
  12. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/__init__.py +0 -0
  13. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/_instrumentors.py +0 -0
  14. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/evals/__init__.py +0 -0
  15. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/evals/all.py +0 -0
  16. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/evals/bias_detection.py +0 -0
  17. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/evals/hallucination.py +0 -0
  18. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/evals/toxicity.py +0 -0
  19. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/evals/utils.py +0 -0
  20. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/guard/__init__.py +0 -0
  21. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/guard/all.py +0 -0
  22. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/guard/prompt_injection.py +0 -0
  23. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/guard/restrict_topic.py +0 -0
  24. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/guard/sensitive_topic.py +0 -0
  25. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/guard/utils.py +0 -0
  26. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ag2/__init__.py +0 -0
  27. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ag2/ag2.py +0 -0
  28. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ag2/async_ag2.py +0 -0
  29. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ag2/utils.py +0 -0
  30. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ai21/__init__.py +0 -0
  31. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ai21/ai21.py +0 -0
  32. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ai21/async_ai21.py +0 -0
  33. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ai21/utils.py +0 -0
  34. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/anthropic/__init__.py +0 -0
  35. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/anthropic/anthropic.py +0 -0
  36. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/anthropic/async_anthropic.py +0 -0
  37. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/anthropic/utils.py +0 -0
  38. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/assemblyai/__init__.py +0 -0
  39. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/assemblyai/assemblyai.py +0 -0
  40. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/assemblyai/utils.py +0 -0
  41. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/astra/__init__.py +0 -0
  42. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/astra/astra.py +0 -0
  43. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/astra/async_astra.py +0 -0
  44. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/astra/utils.py +0 -0
  45. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/azure_ai_inference/__init__.py +0 -0
  46. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/azure_ai_inference/async_azure_ai_inference.py +0 -0
  47. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/azure_ai_inference/azure_ai_inference.py +0 -0
  48. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/azure_ai_inference/utils.py +0 -0
  49. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/bedrock/__init__.py +0 -0
  50. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/bedrock/bedrock.py +0 -0
  51. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/bedrock/utils.py +0 -0
  52. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/chroma/__init__.py +0 -0
  53. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/chroma/chroma.py +0 -0
  54. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/chroma/utils.py +0 -0
  55. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/cohere/__init__.py +0 -0
  56. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/cohere/async_cohere.py +0 -0
  57. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/cohere/cohere.py +0 -0
  58. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/cohere/utils.py +0 -0
  59. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/controlflow/__init__.py +0 -0
  60. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/controlflow/controlflow.py +0 -0
  61. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/crawl4ai/__init__.py +0 -0
  62. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/crawl4ai/async_crawl4ai.py +0 -0
  63. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/crawl4ai/crawl4ai.py +0 -0
  64. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/crewai/__init__.py +0 -0
  65. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/crewai/crewai.py +0 -0
  66. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/dynamiq/__init__.py +0 -0
  67. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/dynamiq/dynamiq.py +0 -0
  68. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/elevenlabs/__init__.py +0 -0
  69. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/elevenlabs/async_elevenlabs.py +0 -0
  70. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/elevenlabs/elevenlabs.py +0 -0
  71. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/elevenlabs/utils.py +0 -0
  72. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/embedchain/__init__.py +0 -0
  73. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/embedchain/embedchain.py +0 -0
  74. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/firecrawl/__init__.py +0 -0
  75. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/firecrawl/firecrawl.py +0 -0
  76. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/google_ai_studio/__init__.py +0 -0
  77. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/google_ai_studio/async_google_ai_studio.py +0 -0
  78. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/google_ai_studio/google_ai_studio.py +0 -0
  79. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/google_ai_studio/utils.py +0 -0
  80. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/gpt4all/__init__.py +0 -0
  81. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/gpt4all/gpt4all.py +0 -0
  82. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/gpt4all/utils.py +0 -0
  83. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/gpu/__init__.py +0 -0
  84. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/groq/__init__.py +0 -0
  85. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/groq/async_groq.py +0 -0
  86. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/groq/groq.py +0 -0
  87. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/groq/utils.py +0 -0
  88. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/haystack/__init__.py +0 -0
  89. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/haystack/async_haystack.py +0 -0
  90. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/haystack/haystack.py +0 -0
  91. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/haystack/utils.py +0 -0
  92. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/julep/__init__.py +0 -0
  93. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/julep/async_julep.py +0 -0
  94. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/julep/julep.py +0 -0
  95. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain/__init__.py +0 -0
  96. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain/async_langchain.py +0 -0
  97. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain/langchain.py +0 -0
  98. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain/utils.py +0 -0
  99. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain_community/__init__.py +0 -0
  100. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain_community/async_langchain_community.py +0 -0
  101. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain_community/langchain_community.py +0 -0
  102. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/langchain_community/utils.py +0 -0
  103. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/letta/__init__.py +0 -0
  104. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/letta/letta.py +0 -0
  105. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/litellm/__init__.py +0 -0
  106. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/litellm/async_litellm.py +0 -0
  107. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/litellm/litellm.py +0 -0
  108. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/litellm/utils.py +0 -0
  109. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/llamaindex/__init__.py +0 -0
  110. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/llamaindex/async_llamaindex.py +0 -0
  111. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/llamaindex/llamaindex.py +0 -0
  112. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/llamaindex/utils.py +0 -0
  113. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/mem0/__init__.py +0 -0
  114. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/mem0/mem0.py +0 -0
  115. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/milvus/__init__.py +0 -0
  116. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/milvus/milvus.py +0 -0
  117. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/milvus/utils.py +0 -0
  118. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/mistral/__init__.py +0 -0
  119. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/mistral/async_mistral.py +0 -0
  120. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/mistral/mistral.py +0 -0
  121. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/mistral/utils.py +0 -0
  122. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/multion/__init__.py +0 -0
  123. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/multion/async_multion.py +0 -0
  124. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/multion/multion.py +0 -0
  125. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ollama/__init__.py +0 -0
  126. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ollama/async_ollama.py +0 -0
  127. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ollama/ollama.py +0 -0
  128. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/ollama/utils.py +0 -0
  129. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/openai/__init__.py +0 -0
  130. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/openai/async_openai.py +0 -0
  131. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/openai/openai.py +0 -0
  132. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/phidata/__init__.py +0 -0
  133. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/phidata/phidata.py +0 -0
  134. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/pinecone/__init__.py +0 -0
  135. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/pinecone/async_pinecone.py +0 -0
  136. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/pinecone/pinecone.py +0 -0
  137. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/pinecone/utils.py +0 -0
  138. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/premai/__init__.py +0 -0
  139. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/premai/premai.py +0 -0
  140. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/premai/utils.py +0 -0
  141. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/pydantic_ai/__init__.py +0 -0
  142. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/pydantic_ai/pydantic_ai.py +0 -0
  143. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/pydantic_ai/utils.py +0 -0
  144. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/qdrant/__init__.py +0 -0
  145. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/qdrant/async_qdrant.py +0 -0
  146. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/qdrant/qdrant.py +0 -0
  147. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/qdrant/utils.py +0 -0
  148. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/reka/__init__.py +0 -0
  149. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/reka/async_reka.py +0 -0
  150. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/reka/reka.py +0 -0
  151. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/reka/utils.py +0 -0
  152. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/together/__init__.py +0 -0
  153. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/together/async_together.py +0 -0
  154. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/together/together.py +0 -0
  155. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/together/utils.py +0 -0
  156. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/transformers/__init__.py +0 -0
  157. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/transformers/transformers.py +0 -0
  158. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/transformers/utils.py +0 -0
  159. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/vertexai/__init__.py +0 -0
  160. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/vertexai/async_vertexai.py +0 -0
  161. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/vertexai/utils.py +0 -0
  162. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/vertexai/vertexai.py +0 -0
  163. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/vllm/__init__.py +0 -0
  164. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/vllm/utils.py +0 -0
  165. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/instrumentation/vllm/vllm.py +0 -0
  166. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/otel/events.py +0 -0
  167. {openlit-1.34.28 → openlit-1.34.29}/src/openlit/otel/metrics.py +0 -0
  168. {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.28
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.28"
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(SemanticConvention.GEN_AI_REQUEST_TOP_P, scope._kwargs.get("top_p", 1.0))
253
- scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS, scope._kwargs.get("max_output_tokens", -1))
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(scope,
431
- SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT, SemanticConvention.GEN_AI_SYSTEM_OPENAI,
432
- scope._server_address, scope._server_port, request_model, scope._response_model,
433
- environment, application_name, is_stream, scope._tbt, scope._ttft, version)
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(SemanticConvention.GEN_AI_REQUEST_FREQUENCY_PENALTY, scope._kwargs.get("frequency_penalty", 0.0))
438
- scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MAX_TOKENS, scope._kwargs.get("max_tokens", -1))
439
- scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_PRESENCE_PENALTY, scope._kwargs.get("presence_penalty", 0.0))
440
- scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_STOP_SEQUENCES, scope._kwargs.get("stop", []))
441
- scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TEMPERATURE, scope._kwargs.get("temperature", 1.0))
442
- scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_TOP_P, scope._kwargs.get("top_p", 1.0))
443
- scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_USER, scope._kwargs.get("user", ""))
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(SemanticConvention.GEN_AI_REQUEST_ENCODING_FORMATS, [scope._kwargs.get("encoding_format", "float")])
575
- scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_USER, scope._kwargs.get("user", ""))
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(SemanticConvention.GEN_AI_REQUEST_IMAGE_QUALITY, scope._kwargs.get("quality", "standard"))
616
- scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_USER, scope._kwargs.get("user", ""))
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(SemanticConvention.GEN_AI_REQUEST_AUDIO_RESPONSE_FORMAT, scope._kwargs.get("response_format", "mp3"))
714
- scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_AUDIO_SPEED, scope._kwargs.get("speed", 1.0))
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