langtrace-python-sdk 2.1.22__tar.gz → 2.1.24__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 (174) hide show
  1. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/PKG-INFO +3 -1
  2. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/README.md +2 -0
  3. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/openai/patch.py +72 -42
  4. langtrace_python_sdk-2.1.24/src/langtrace_python_sdk/version.py +1 -0
  5. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/openai/cassettes/test_async_chat_completion_streaming.yaml +29 -35
  6. langtrace_python_sdk-2.1.24/src/tests/openai/cassettes/test_chat_completion_streaming.yaml +152 -0
  7. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/openai/test_chat_completion.py +4 -4
  8. langtrace_python_sdk-2.1.22/src/langtrace_python_sdk/version.py +0 -1
  9. langtrace_python_sdk-2.1.22/src/tests/openai/cassettes/test_chat_completion_streaming.yaml +0 -200860
  10. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/.gitignore +0 -0
  11. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/LICENSE +0 -0
  12. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/pyproject.toml +0 -0
  13. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/__init__.py +0 -0
  14. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/__init__.py +0 -0
  15. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/anthropic_example/__init__.py +0 -0
  16. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/anthropic_example/completion.py +0 -0
  17. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/chroma_example/__init__.py +0 -0
  18. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/chroma_example/basic.py +0 -0
  19. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/cohere_example/__init__.py +0 -0
  20. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/cohere_example/chat.py +0 -0
  21. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/cohere_example/chat_stream.py +0 -0
  22. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/cohere_example/embed.py +0 -0
  23. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/cohere_example/rerank.py +0 -0
  24. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/cohere_example/tools.py +0 -0
  25. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/crewai_example/basic.py +0 -0
  26. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/dspy_example/math_problems_cot.py +0 -0
  27. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/dspy_example/program_of_thought_basic.py +0 -0
  28. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/dspy_example/quiz_gen.py +0 -0
  29. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/dspy_example/react.py +0 -0
  30. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/fastapi_example/__init__.py +0 -0
  31. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/fastapi_example/basic_route.py +0 -0
  32. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/hiveagent_example/basic.py +0 -0
  33. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/inspect_ai_example/basic_eval.py +0 -0
  34. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/langchain_example/__init__.py +0 -0
  35. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/langchain_example/basic.py +0 -0
  36. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/langchain_example/groq_example.py +0 -0
  37. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/langchain_example/langgraph_example.py +0 -0
  38. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/langchain_example/tool.py +0 -0
  39. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/llamaindex_example/__init__.py +0 -0
  40. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/llamaindex_example/agent.py +0 -0
  41. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/llamaindex_example/basic.py +0 -0
  42. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/llamaindex_example/data/abramov.txt +0 -0
  43. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/ollama_example/__init__.py +0 -0
  44. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/ollama_example/basic.py +0 -0
  45. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/openai_example/__init__.py +0 -0
  46. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/openai_example/async_tool_calling_nonstreaming.py +0 -0
  47. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/openai_example/async_tool_calling_streaming.py +0 -0
  48. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/openai_example/chat_completion.py +0 -0
  49. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/openai_example/embeddings_create.py +0 -0
  50. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/openai_example/function_calling.py +0 -0
  51. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/openai_example/images_edit.py +0 -0
  52. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/openai_example/images_generate.py +0 -0
  53. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/openai_example/resources/lounge_flamingo.png +0 -0
  54. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/openai_example/resources/mask.png +0 -0
  55. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/openai_example/tool_calling.py +0 -0
  56. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/openai_example/tool_calling_nonstreaming.py +0 -0
  57. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/openai_example/tool_calling_streaming.py +0 -0
  58. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/perplexity_example/basic.py +0 -0
  59. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/pinecone_example/__init__.py +0 -0
  60. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/pinecone_example/basic.py +0 -0
  61. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/qdrant_example/__init__.py +0 -0
  62. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/qdrant_example/basic.py +0 -0
  63. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/weaviate_example/__init__.py +0 -0
  64. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/examples/weaviate_example/query_text.py +0 -0
  65. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/__init__.py +0 -0
  66. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/constants/__init__.py +0 -0
  67. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/constants/exporter/langtrace_exporter.py +0 -0
  68. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/constants/instrumentation/__init__.py +0 -0
  69. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/constants/instrumentation/anthropic.py +0 -0
  70. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/constants/instrumentation/chroma.py +0 -0
  71. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/constants/instrumentation/cohere.py +0 -0
  72. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/constants/instrumentation/common.py +0 -0
  73. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/constants/instrumentation/groq.py +0 -0
  74. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/constants/instrumentation/ollama.py +0 -0
  75. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/constants/instrumentation/openai.py +0 -0
  76. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/constants/instrumentation/pinecone.py +0 -0
  77. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/constants/instrumentation/qdrant.py +0 -0
  78. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/constants/instrumentation/weaviate.py +0 -0
  79. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/extensions/__init__.py +0 -0
  80. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/extensions/langtrace_exporter.py +0 -0
  81. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/extensions/langtrace_filesystem.py +0 -0
  82. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/__init__.py +0 -0
  83. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +0 -0
  84. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +0 -0
  85. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +0 -0
  86. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +0 -0
  87. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/chroma/instrumentation.py +0 -0
  88. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/chroma/patch.py +0 -0
  89. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/cohere/__init__.py +0 -0
  90. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/cohere/instrumentation.py +0 -0
  91. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/cohere/patch.py +0 -0
  92. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/crewai/__init__.py +0 -0
  93. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/crewai/instrumentation.py +0 -0
  94. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/crewai/patch.py +0 -0
  95. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/dspy/__init__.py +0 -0
  96. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/dspy/instrumentation.py +0 -0
  97. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/dspy/patch.py +0 -0
  98. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/groq/__init__.py +0 -0
  99. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/groq/instrumentation.py +0 -0
  100. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/groq/patch.py +0 -0
  101. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +0 -0
  102. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +0 -0
  103. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/langchain/patch.py +0 -0
  104. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +0 -0
  105. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +0 -0
  106. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/langchain_community/patch.py +0 -0
  107. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +0 -0
  108. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +0 -0
  109. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/langchain_core/patch.py +0 -0
  110. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/langgraph/__init__.py +0 -0
  111. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/langgraph/instrumentation.py +0 -0
  112. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/langgraph/patch.py +0 -0
  113. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +0 -0
  114. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +0 -0
  115. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/llamaindex/patch.py +0 -0
  116. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/ollama/__init__.py +0 -0
  117. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/ollama/instrumentation.py +0 -0
  118. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/ollama/patch.py +0 -0
  119. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/openai/__init__.py +0 -0
  120. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/openai/instrumentation.py +0 -0
  121. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +0 -0
  122. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +0 -0
  123. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/pinecone/patch.py +0 -0
  124. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/qdrant/__init__.py +0 -0
  125. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/qdrant/instrumentation.py +0 -0
  126. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/qdrant/patch.py +0 -0
  127. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/weaviate/__init__.py +0 -0
  128. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/weaviate/instrumentation.py +0 -0
  129. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/instrumentation/weaviate/patch.py +0 -0
  130. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/langtrace.py +0 -0
  131. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/types/__init__.py +0 -0
  132. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/utils/__init__.py +0 -0
  133. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/utils/langtrace_sampler.py +0 -0
  134. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/utils/llm.py +0 -0
  135. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/utils/misc.py +0 -0
  136. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/utils/prompt_registry.py +0 -0
  137. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/utils/sdk_version_checker.py +0 -0
  138. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/utils/silently_fail.py +0 -0
  139. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/utils/types.py +0 -0
  140. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/langtrace_python_sdk/utils/with_root_span.py +0 -0
  141. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/run_example.py +0 -0
  142. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/__init__.py +0 -0
  143. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/anthropic/cassettes/test_anthropic.yaml +0 -0
  144. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/anthropic/cassettes/test_anthropic_streaming.yaml +0 -0
  145. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/anthropic/cassettes/test_async_anthropic_streaming.yaml +0 -0
  146. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/anthropic/conftest.py +0 -0
  147. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/anthropic/test_anthropic.py +0 -0
  148. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/chroma/conftest.py +0 -0
  149. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/chroma/test_chroma.py +0 -0
  150. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/cohere/cassettes/test_cohere_chat.yaml +0 -0
  151. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/cohere/cassettes/test_cohere_chat_streaming.yaml +0 -0
  152. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/cohere/cassettes/test_cohere_embed.yaml +0 -0
  153. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/cohere/cassettes/test_cohere_rerank.yaml +0 -0
  154. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/cohere/conftest.py +0 -0
  155. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/cohere/test_cohere_chat.py +0 -0
  156. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/cohere/test_cohere_embed.py +0 -0
  157. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/cohere/test_cohere_rerank.py +0 -0
  158. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/conftest.py +0 -0
  159. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/langchain/cassettes/test_langchain.yaml +0 -0
  160. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/langchain/conftest.py +0 -0
  161. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/langchain/test_langchain.py +0 -0
  162. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/openai/cassettes/test_async_image_generation.yaml +0 -0
  163. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/openai/cassettes/test_chat_completion.yaml +0 -0
  164. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/openai/cassettes/test_image_generation.yaml +0 -0
  165. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/openai/conftest.py +0 -0
  166. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/openai/test_embeddings.py +0 -0
  167. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/openai/test_image_generation.py +0 -0
  168. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/pinecone/cassettes/test_query.yaml +0 -0
  169. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/pinecone/cassettes/test_upsert.yaml +0 -0
  170. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/pinecone/conftest.py +0 -0
  171. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/pinecone/test_pinecone.py +0 -0
  172. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/qdrant/conftest.py +0 -0
  173. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/qdrant/test_qdrant.py +0 -0
  174. {langtrace_python_sdk-2.1.22 → langtrace_python_sdk-2.1.24}/src/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: langtrace-python-sdk
3
- Version: 2.1.22
3
+ Version: 2.1.24
4
4
  Summary: Python SDK for LangTrace
5
5
  Project-URL: Homepage, https://github.com/Scale3-Labs/langtrace-python-sdk
6
6
  Author-email: Scale3 Labs <engineering@scale3labs.com>
@@ -283,6 +283,8 @@ Langtrace automatically captures traces from the following vendors:
283
283
  | Groq | LLM | :x: | :white_check_mark: |
284
284
  | Langchain | Framework | :x: | :white_check_mark: |
285
285
  | LlamaIndex | Framework | :white_check_mark: | :white_check_mark: |
286
+ | DSPy | Framework | :x: | :white_check_mark: |
287
+ | CrewAI | Framework | :x: | :white_check_mark: |
286
288
  | Pinecone | Vector Database | :white_check_mark: | :white_check_mark: |
287
289
  | ChromaDB | Vector Database | :white_check_mark: | :white_check_mark: |
288
290
  | QDrant | Vector Database | :x: | :white_check_mark: |
@@ -241,6 +241,8 @@ Langtrace automatically captures traces from the following vendors:
241
241
  | Groq | LLM | :x: | :white_check_mark: |
242
242
  | Langchain | Framework | :x: | :white_check_mark: |
243
243
  | LlamaIndex | Framework | :white_check_mark: | :white_check_mark: |
244
+ | DSPy | Framework | :x: | :white_check_mark: |
245
+ | CrewAI | Framework | :x: | :white_check_mark: |
244
246
  | Pinecone | Vector Database | :white_check_mark: | :white_check_mark: |
245
247
  | ChromaDB | Vector Database | :white_check_mark: | :white_check_mark: |
246
248
  | QDrant | Vector Database | :x: | :white_check_mark: |
@@ -29,6 +29,7 @@ from langtrace_python_sdk.constants.instrumentation.common import (
29
29
  )
30
30
  from langtrace_python_sdk.constants.instrumentation.openai import APIS
31
31
  from langtrace_python_sdk.utils.llm import calculate_prompt_tokens, estimate_tokens
32
+ from openai._types import NOT_GIVEN
32
33
 
33
34
 
34
35
  def images_generate(original_method, version, tracer):
@@ -276,7 +277,9 @@ def images_edit(original_method, version, tracer):
276
277
 
277
278
 
278
279
  class StreamWrapper:
279
- def __init__(self, stream, span, prompt_tokens, function_call=False, tool_calls=False):
280
+ def __init__(
281
+ self, stream, span, prompt_tokens, function_call=False, tool_calls=False
282
+ ):
280
283
  self.stream = stream
281
284
  self.span = span
282
285
  self.prompt_tokens = prompt_tokens
@@ -284,46 +287,73 @@ class StreamWrapper:
284
287
  self.tool_calls = tool_calls
285
288
  self.result_content = []
286
289
  self.completion_tokens = 0
290
+ self._span_started = False
291
+ self._start_span()
292
+
293
+ def _start_span(self):
294
+ if not self._span_started:
295
+ self.span.add_event(Event.STREAM_START.value)
296
+ self._span_started = True
297
+
298
+ def _end_span(self):
299
+ if self._span_started:
300
+ self.span.add_event(Event.STREAM_END.value)
301
+ self.span.set_attribute(
302
+ "llm.token.counts",
303
+ json.dumps(
304
+ {
305
+ "input_tokens": self.prompt_tokens,
306
+ "output_tokens": self.completion_tokens,
307
+ "total_tokens": self.prompt_tokens + self.completion_tokens,
308
+ }
309
+ ),
310
+ )
311
+ self.span.set_attribute(
312
+ "llm.responses",
313
+ json.dumps(
314
+ [
315
+ {
316
+ "role": "assistant",
317
+ "content": "".join(self.result_content),
318
+ }
319
+ ]
320
+ ),
321
+ )
322
+ self.span.set_status(StatusCode.OK)
323
+ self.span.end()
324
+ self._span_started = False
287
325
 
288
326
  def __enter__(self):
289
- self.span.add_event(Event.STREAM_START.value)
327
+ self._start_span()
290
328
  return self
291
329
 
292
330
  def __exit__(self, exc_type, exc_val, exc_tb):
293
- self.span.add_event(Event.STREAM_END.value)
294
- self.span.set_attribute(
295
- "llm.token.counts",
296
- json.dumps(
297
- {
298
- "input_tokens": self.prompt_tokens,
299
- "output_tokens": self.completion_tokens,
300
- "total_tokens": self.prompt_tokens + self.completion_tokens,
301
- }
302
- ),
303
- )
304
- self.span.set_attribute(
305
- "llm.responses",
306
- json.dumps(
307
- [
308
- {
309
- "role": "assistant",
310
- "content": "".join(self.result_content),
311
- }
312
- ]
313
- ),
314
- )
315
- self.span.set_status(StatusCode.OK)
316
- self.span.end()
331
+ self._end_span()
317
332
 
318
333
  def __iter__(self):
334
+ self._start_span()
319
335
  return self
320
336
 
337
+ def __aiter__(self):
338
+ self._start_span()
339
+ return self
340
+
341
+ async def __anext__(self):
342
+ try:
343
+ chunk = await self.stream.__anext__()
344
+ self.process_chunk(chunk)
345
+ return chunk
346
+ except StopIteration:
347
+ self._end_span()
348
+ raise
349
+
321
350
  def __next__(self):
322
351
  try:
323
352
  chunk = next(self.stream)
324
353
  self.process_chunk(chunk)
325
354
  return chunk
326
355
  except StopIteration:
356
+ self._end_span()
327
357
  raise
328
358
 
329
359
  def process_chunk(self, chunk):
@@ -441,16 +471,16 @@ def chat_completions_create(original_method, version, tracer):
441
471
  attributes = LLMSpanAttributes(**span_attributes)
442
472
 
443
473
  tools = []
444
- if kwargs.get("temperature") is not None:
474
+ if kwargs.get("temperature") is not None and kwargs.get("temperature") != NOT_GIVEN:
445
475
  attributes.llm_temperature = kwargs.get("temperature")
446
- if kwargs.get("top_p") is not None:
476
+ if kwargs.get("top_p") is not None and kwargs.get("top_p") != NOT_GIVEN:
447
477
  attributes.llm_top_p = kwargs.get("top_p")
448
- if kwargs.get("user") is not None:
478
+ if kwargs.get("user") is not None and kwargs.get("user") != NOT_GIVEN:
449
479
  attributes.llm_user = kwargs.get("user")
450
- if kwargs.get("functions") is not None:
480
+ if kwargs.get("functions") is not None and kwargs.get("functions") != NOT_GIVEN:
451
481
  for function in kwargs.get("functions"):
452
482
  tools.append(json.dumps({"type": "function", "function": function}))
453
- if kwargs.get("tools") is not None:
483
+ if kwargs.get("tools") is not None and kwargs.get("tools") != NOT_GIVEN:
454
484
  tools.append(json.dumps(kwargs.get("tools")))
455
485
  if len(tools) > 0:
456
486
  attributes.llm_tools = json.dumps(tools)
@@ -469,7 +499,7 @@ def chat_completions_create(original_method, version, tracer):
469
499
  try:
470
500
  # Attempt to call the original method
471
501
  result = wrapped(*args, **kwargs)
472
- if kwargs.get("stream") is False or kwargs.get("stream") is None:
502
+ if kwargs.get("stream") is False or kwargs.get("stream") is None or kwargs.get("stream") == NOT_GIVEN:
473
503
  span.set_attribute("llm.model", result.model)
474
504
  if hasattr(result, "choices") and result.choices is not None:
475
505
  responses = [
@@ -498,7 +528,7 @@ def chat_completions_create(original_method, version, tracer):
498
528
  span.set_attribute("llm.responses", json.dumps(responses))
499
529
  if (
500
530
  hasattr(result, "system_fingerprint")
501
- and result.system_fingerprint is not None
531
+ and result.system_fingerprint is not None and result.system_fingerprint != NOT_GIVEN
502
532
  ):
503
533
  span.set_attribute(
504
534
  "llm.system.fingerprint", result.system_fingerprint
@@ -525,7 +555,7 @@ def chat_completions_create(original_method, version, tracer):
525
555
  )
526
556
 
527
557
  # iterate over kwargs.get("functions") and calculate the prompt tokens
528
- if kwargs.get("functions") is not None:
558
+ if kwargs.get("functions") is not None and kwargs.get("functions") != NOT_GIVEN:
529
559
  for function in kwargs.get("functions"):
530
560
  prompt_tokens += calculate_prompt_tokens(
531
561
  json.dumps(function), kwargs.get("model")
@@ -611,16 +641,16 @@ def async_chat_completions_create(original_method, version, tracer):
611
641
  attributes = LLMSpanAttributes(**span_attributes)
612
642
 
613
643
  tools = []
614
- if kwargs.get("temperature") is not None:
644
+ if kwargs.get("temperature") is not None and kwargs.get("temperature") != NOT_GIVEN:
615
645
  attributes.llm_temperature = kwargs.get("temperature")
616
- if kwargs.get("top_p") is not None:
646
+ if kwargs.get("top_p") is not None and kwargs.get("top_p") != NOT_GIVEN:
617
647
  attributes.llm_top_p = kwargs.get("top_p")
618
- if kwargs.get("user") is not None:
648
+ if kwargs.get("user") is not None and kwargs.get("user") != NOT_GIVEN:
619
649
  attributes.llm_user = kwargs.get("user")
620
- if kwargs.get("functions") is not None:
650
+ if kwargs.get("functions") is not None and kwargs.get("functions") != NOT_GIVEN:
621
651
  for function in kwargs.get("functions"):
622
652
  tools.append(json.dumps({"type": "function", "function": function}))
623
- if kwargs.get("tools") is not None:
653
+ if kwargs.get("tools") is not None and kwargs.get("tools") != NOT_GIVEN:
624
654
  tools.append(json.dumps(kwargs.get("tools")))
625
655
  if len(tools) > 0:
626
656
  attributes.llm_tools = json.dumps(tools)
@@ -637,7 +667,7 @@ def async_chat_completions_create(original_method, version, tracer):
637
667
  try:
638
668
  # Attempt to call the original method
639
669
  result = await wrapped(*args, **kwargs)
640
- if kwargs.get("stream") is False or kwargs.get("stream") is None:
670
+ if kwargs.get("stream") is False or kwargs.get("stream") is None or kwargs.get("stream") == NOT_GIVEN:
641
671
  span.set_attribute("llm.model", result.model)
642
672
  if hasattr(result, "choices") and result.choices is not None:
643
673
  responses = [
@@ -666,7 +696,7 @@ def async_chat_completions_create(original_method, version, tracer):
666
696
  span.set_attribute("llm.responses", json.dumps(responses))
667
697
  if (
668
698
  hasattr(result, "system_fingerprint")
669
- and result.system_fingerprint is not None
699
+ and result.system_fingerprint is not None and result.system_fingerprint != NOT_GIVEN
670
700
  ):
671
701
  span.set_attribute(
672
702
  "llm.system.fingerprint", result.system_fingerprint
@@ -693,7 +723,7 @@ def async_chat_completions_create(original_method, version, tracer):
693
723
  )
694
724
 
695
725
  # iterate over kwargs.get("functions") and calculate the prompt tokens
696
- if kwargs.get("functions") is not None:
726
+ if kwargs.get("functions") is not None and kwargs.get("functions") != NOT_GIVEN:
697
727
  for function in kwargs.get("functions"):
698
728
  prompt_tokens += calculate_prompt_tokens(
699
729
  json.dumps(function), kwargs.get("model")
@@ -0,0 +1 @@
1
+ __version__ = "2.1.24"
@@ -16,7 +16,7 @@ interactions:
16
16
  host:
17
17
  - api.openai.com
18
18
  user-agent:
19
- - AsyncOpenAI/Python 1.23.2
19
+ - AsyncOpenAI/Python 1.34.0
20
20
  x-stainless-arch:
21
21
  - arm64
22
22
  x-stainless-async:
@@ -26,75 +26,75 @@ interactions:
26
26
  x-stainless-os:
27
27
  - MacOS
28
28
  x-stainless-package-version:
29
- - 1.23.2
29
+ - 1.34.0
30
30
  x-stainless-runtime:
31
31
  - CPython
32
32
  x-stainless-runtime-version:
33
- - 3.11.5
33
+ - 3.12.3
34
34
  method: POST
35
35
  uri: https://api.openai.com/v1/chat/completions
36
36
  response:
37
37
  body:
38
- string: 'data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]}
38
+ string: 'data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]}
39
39
 
40
40
 
41
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"This"},"logprobs":null,"finish_reason":null}]}
41
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"This"},"logprobs":null,"finish_reason":null}]}
42
42
 
43
43
 
44
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
44
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
45
45
  is"},"logprobs":null,"finish_reason":null}]}
46
46
 
47
47
 
48
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
48
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
49
49
  a"},"logprobs":null,"finish_reason":null}]}
50
50
 
51
51
 
52
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
52
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
53
53
  test"},"logprobs":null,"finish_reason":null}]}
54
54
 
55
55
 
56
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]}
56
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]}
57
57
 
58
58
 
59
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
59
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
60
60
  This"},"logprobs":null,"finish_reason":null}]}
61
61
 
62
62
 
63
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
63
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
64
64
  is"},"logprobs":null,"finish_reason":null}]}
65
65
 
66
66
 
67
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
67
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
68
68
  a"},"logprobs":null,"finish_reason":null}]}
69
69
 
70
70
 
71
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
71
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
72
72
  test"},"logprobs":null,"finish_reason":null}]}
73
73
 
74
74
 
75
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]}
75
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]}
76
76
 
77
77
 
78
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
78
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
79
79
  This"},"logprobs":null,"finish_reason":null}]}
80
80
 
81
81
 
82
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
82
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
83
83
  is"},"logprobs":null,"finish_reason":null}]}
84
84
 
85
85
 
86
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
86
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
87
87
  a"},"logprobs":null,"finish_reason":null}]}
88
88
 
89
89
 
90
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
90
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
91
91
  test"},"logprobs":null,"finish_reason":null}]}
92
92
 
93
93
 
94
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]}
94
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]}
95
95
 
96
96
 
97
- data: {"id":"chatcmpl-9G7iUffCm37bRsnrZcMjcD55dwZcN","object":"chat.completion.chunk","created":1713629938,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]}
97
+ data: {"id":"chatcmpl-9deeLdQVwFn9pGfxPrHrnGhzMINed","object":"chat.completion.chunk","created":1719238077,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]}
98
98
 
99
99
 
100
100
  data: [DONE]
@@ -105,39 +105,33 @@ interactions:
105
105
  CF-Cache-Status:
106
106
  - DYNAMIC
107
107
  CF-RAY:
108
- - 8776740aaa3e73a3-MRS
109
- Cache-Control:
110
- - no-cache, must-revalidate
108
+ - 898d497cff180da3-MRS
111
109
  Connection:
112
110
  - keep-alive
113
111
  Content-Type:
114
- - text/event-stream
112
+ - text/event-stream; charset=utf-8
115
113
  Date:
116
- - Sat, 20 Apr 2024 16:18:59 GMT
114
+ - Mon, 24 Jun 2024 14:07:57 GMT
117
115
  Server:
118
116
  - cloudflare
119
117
  Set-Cookie:
120
- - __cf_bm=VDKSK7GoYoxisSawjMl9W0b7YZarMfekW_Y69gq5ons-1713629939-1.0.1.1-fH6Sc.9fQ0Kb4MvzvnBRlAmk_cXfYNeNbDd_K6pZeMNxnmMy3qiDlS.olHx3Y7rfDhYg7a3FffrCHr.Xu8j_Uw;
121
- path=/; expires=Sat, 20-Apr-24 16:48:59 GMT; domain=.api.openai.com; HttpOnly;
118
+ - __cf_bm=9.DjXDRH6yqveelPQR44ZtyVUYJzgnA0G.nzqFBokzU-1719238077-1.0.1.1-aMCvEWGLFuE6ItsOru0NDaEtwnP4gVQChxLODAqfb5jmClZJa8lKqg.tNgoeMSGnxhnih1YJRhw2gq02fThn1g;
119
+ path=/; expires=Mon, 24-Jun-24 14:37:57 GMT; domain=.api.openai.com; HttpOnly;
122
120
  Secure; SameSite=None
123
- - _cfuvid=GmZ5rJWGxt2nlOYm6_pDkhIo_8V.YkD6O9_B1qloO7g-1713629939085-0.0.1.1-604800000;
121
+ - _cfuvid=O9yzYcvRGvChbCerFoeKPvIqX_jwhxHPRVMMxoF4wLY-1719238077679-0.0.1.1-604800000;
124
122
  path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
125
123
  Transfer-Encoding:
126
124
  - chunked
127
- access-control-allow-origin:
128
- - '*'
129
125
  alt-svc:
130
126
  - h3=":443"; ma=86400
131
- openai-model:
132
- - gpt-4-0613
133
127
  openai-organization:
134
128
  - scale3-1
135
129
  openai-processing-ms:
136
- - '247'
130
+ - '193'
137
131
  openai-version:
138
132
  - '2020-10-01'
139
133
  strict-transport-security:
140
- - max-age=15724800; includeSubDomains
134
+ - max-age=31536000; includeSubDomains
141
135
  x-ratelimit-limit-requests:
142
136
  - '10000'
143
137
  x-ratelimit-limit-tokens:
@@ -151,7 +145,7 @@ interactions:
151
145
  x-ratelimit-reset-tokens:
152
146
  - 5ms
153
147
  x-request-id:
154
- - req_4c6f987df5c44fb9c842d54126d2608d
148
+ - ae303b10004d584d9da9cb432917ef64
155
149
  status:
156
150
  code: 200
157
151
  message: OK
@@ -0,0 +1,152 @@
1
+ interactions:
2
+ - request:
3
+ body: '{"messages": [{"role": "user", "content": "Say this is a test three times"}],
4
+ "model": "gpt-4", "stream": true}'
5
+ headers:
6
+ accept:
7
+ - application/json
8
+ accept-encoding:
9
+ - gzip, deflate
10
+ connection:
11
+ - keep-alive
12
+ content-length:
13
+ - '111'
14
+ content-type:
15
+ - application/json
16
+ host:
17
+ - api.openai.com
18
+ user-agent:
19
+ - OpenAI/Python 1.34.0
20
+ x-stainless-arch:
21
+ - arm64
22
+ x-stainless-async:
23
+ - 'false'
24
+ x-stainless-lang:
25
+ - python
26
+ x-stainless-os:
27
+ - MacOS
28
+ x-stainless-package-version:
29
+ - 1.34.0
30
+ x-stainless-runtime:
31
+ - CPython
32
+ x-stainless-runtime-version:
33
+ - 3.12.3
34
+ method: POST
35
+ uri: https://api.openai.com/v1/chat/completions
36
+ response:
37
+ body:
38
+ string: 'data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]}
39
+
40
+
41
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"This"},"logprobs":null,"finish_reason":null}]}
42
+
43
+
44
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
45
+ is"},"logprobs":null,"finish_reason":null}]}
46
+
47
+
48
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
49
+ a"},"logprobs":null,"finish_reason":null}]}
50
+
51
+
52
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
53
+ test"},"logprobs":null,"finish_reason":null}]}
54
+
55
+
56
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]}
57
+
58
+
59
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
60
+ This"},"logprobs":null,"finish_reason":null}]}
61
+
62
+
63
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
64
+ is"},"logprobs":null,"finish_reason":null}]}
65
+
66
+
67
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
68
+ a"},"logprobs":null,"finish_reason":null}]}
69
+
70
+
71
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
72
+ test"},"logprobs":null,"finish_reason":null}]}
73
+
74
+
75
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]}
76
+
77
+
78
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
79
+ This"},"logprobs":null,"finish_reason":null}]}
80
+
81
+
82
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
83
+ is"},"logprobs":null,"finish_reason":null}]}
84
+
85
+
86
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
87
+ a"},"logprobs":null,"finish_reason":null}]}
88
+
89
+
90
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"
91
+ test"},"logprobs":null,"finish_reason":null}]}
92
+
93
+
94
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]}
95
+
96
+
97
+ data: {"id":"chatcmpl-9dedBFBF2w4e5giel1Fnb2rSV4B5f","object":"chat.completion.chunk","created":1719238005,"model":"gpt-4-0613","system_fingerprint":null,"choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]}
98
+
99
+
100
+ data: [DONE]
101
+
102
+
103
+ '
104
+ headers:
105
+ CF-Cache-Status:
106
+ - DYNAMIC
107
+ CF-RAY:
108
+ - 898d47bbe8450c4b-MRS
109
+ Connection:
110
+ - keep-alive
111
+ Content-Type:
112
+ - text/event-stream; charset=utf-8
113
+ Date:
114
+ - Mon, 24 Jun 2024 14:06:46 GMT
115
+ Server:
116
+ - cloudflare
117
+ Set-Cookie:
118
+ - __cf_bm=cC.gMyw277E72S1.rDCFU7iMDTgKHZvtDnn0TDVEPiI-1719238006-1.0.1.1-igNFmIthBWETjho1mdSBXWLZZDOS5JmZPFl965.4BS8wzPtx4S9CiFfCFKNLTRt4Cz2DLXlalgHui5kBgoGW5Q;
119
+ path=/; expires=Mon, 24-Jun-24 14:36:46 GMT; domain=.api.openai.com; HttpOnly;
120
+ Secure; SameSite=None
121
+ - _cfuvid=GkhxkfXTUar11D599h758D5rA651Axc4m85Ai.6OWfs-1719238006334-0.0.1.1-604800000;
122
+ path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
123
+ Transfer-Encoding:
124
+ - chunked
125
+ alt-svc:
126
+ - h3=":443"; ma=86400
127
+ openai-organization:
128
+ - scale3-1
129
+ openai-processing-ms:
130
+ - '173'
131
+ openai-version:
132
+ - '2020-10-01'
133
+ strict-transport-security:
134
+ - max-age=31536000; includeSubDomains
135
+ x-ratelimit-limit-requests:
136
+ - '10000'
137
+ x-ratelimit-limit-tokens:
138
+ - '300000'
139
+ x-ratelimit-remaining-requests:
140
+ - '9999'
141
+ x-ratelimit-remaining-tokens:
142
+ - '299975'
143
+ x-ratelimit-reset-requests:
144
+ - 6ms
145
+ x-ratelimit-reset-tokens:
146
+ - 5ms
147
+ x-request-id:
148
+ - 8d22580f3c292409b9695a4c9a8c3701
149
+ status:
150
+ code: 200
151
+ message: OK
152
+ version: 1
@@ -62,8 +62,8 @@ def test_chat_completion_streaming(exporter, openai_client):
62
62
  "stream": True,
63
63
  }
64
64
 
65
- response = openai_client.chat.completions.create(**kwargs)
66
65
  chunk_count = 0
66
+ response = openai_client.chat.completions.create(**kwargs)
67
67
  for _ in response:
68
68
  chunk_count += 1
69
69
 
@@ -117,10 +117,10 @@ async def test_async_chat_completion_streaming(exporter, async_openai_client):
117
117
  "stream": True,
118
118
  }
119
119
 
120
- response = await async_openai_client.chat.completions.create(**kwargs)
121
120
  chunk_count = 0
122
- async for _ in response:
123
- chunk_count += 1
121
+ with await async_openai_client.chat.completions.create(**kwargs) as response:
122
+ async for _ in response:
123
+ chunk_count += 1
124
124
 
125
125
  spans = exporter.get_finished_spans()
126
126
  streaming_span = spans[-1]
@@ -1 +0,0 @@
1
- __version__ = "2.1.22"