langtrace-python-sdk 2.2.1__tar.gz → 2.2.3__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 (194) hide show
  1. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/PKG-INFO +1 -1
  2. langtrace_python_sdk-2.2.3/src/examples/dspy_example/math_problems_cot_parallel.py +51 -0
  3. langtrace_python_sdk-2.2.3/src/examples/openai_example/chat_completion_tool_choice.py +73 -0
  4. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +3 -1
  5. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/dspy/instrumentation.py +2 -2
  6. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/dspy/patch.py +57 -39
  7. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/gemini/patch.py +4 -1
  8. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/utils/llm.py +1 -0
  9. langtrace_python_sdk-2.2.3/src/langtrace_python_sdk/version.py +1 -0
  10. langtrace_python_sdk-2.2.1/src/langtrace_python_sdk/version.py +0 -1
  11. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/.gitignore +0 -0
  12. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/LICENSE +0 -0
  13. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/README.md +0 -0
  14. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/pyproject.toml +0 -0
  15. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/__init__.py +0 -0
  16. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/__init__.py +0 -0
  17. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/anthropic_example/__init__.py +0 -0
  18. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/anthropic_example/completion.py +0 -0
  19. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/chroma_example/__init__.py +0 -0
  20. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/chroma_example/basic.py +0 -0
  21. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/cohere_example/__init__.py +0 -0
  22. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/cohere_example/chat.py +0 -0
  23. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/cohere_example/chat_stream.py +0 -0
  24. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/cohere_example/embed.py +0 -0
  25. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/cohere_example/rerank.py +0 -0
  26. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/cohere_example/tools.py +0 -0
  27. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/crewai_example/basic.py +0 -0
  28. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/dspy_example/math_problems_cot.py +0 -0
  29. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/dspy_example/program_of_thought_basic.py +0 -0
  30. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/dspy_example/quiz_gen.py +0 -0
  31. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/dspy_example/react.py +0 -0
  32. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/fastapi_example/__init__.py +0 -0
  33. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/fastapi_example/basic_route.py +0 -0
  34. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/gemini_example/__init__.py +0 -0
  35. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/gemini_example/function_tools.py +0 -0
  36. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/gemini_example/main.py +0 -0
  37. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/hiveagent_example/basic.py +0 -0
  38. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/inspect_ai_example/basic_eval.py +0 -0
  39. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/langchain_example/__init__.py +0 -0
  40. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/langchain_example/basic.py +0 -0
  41. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/langchain_example/groq_example.py +0 -0
  42. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/langchain_example/langgraph_example.py +0 -0
  43. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/langchain_example/tool.py +0 -0
  44. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/llamaindex_example/__init__.py +0 -0
  45. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/llamaindex_example/agent.py +0 -0
  46. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/llamaindex_example/basic.py +0 -0
  47. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/llamaindex_example/data/abramov.txt +0 -0
  48. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/ollama_example/__init__.py +0 -0
  49. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/ollama_example/basic.py +0 -0
  50. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/openai_example/__init__.py +0 -0
  51. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/openai_example/async_tool_calling_nonstreaming.py +0 -0
  52. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/openai_example/async_tool_calling_streaming.py +0 -0
  53. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/openai_example/chat_completion.py +0 -0
  54. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/openai_example/embeddings_create.py +0 -0
  55. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/openai_example/function_calling.py +0 -0
  56. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/openai_example/images_edit.py +0 -0
  57. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/openai_example/images_generate.py +0 -0
  58. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/openai_example/resources/lounge_flamingo.png +0 -0
  59. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/openai_example/resources/mask.png +0 -0
  60. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/openai_example/tool_calling.py +0 -0
  61. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/openai_example/tool_calling_nonstreaming.py +0 -0
  62. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/openai_example/tool_calling_streaming.py +0 -0
  63. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/perplexity_example/basic.py +0 -0
  64. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/pinecone_example/__init__.py +0 -0
  65. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/pinecone_example/basic.py +0 -0
  66. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/qdrant_example/__init__.py +0 -0
  67. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/qdrant_example/basic.py +0 -0
  68. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/vertexai_example/__init__.py +0 -0
  69. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/vertexai_example/main.py +0 -0
  70. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/weaviate_example/__init__.py +0 -0
  71. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/examples/weaviate_example/query_text.py +0 -0
  72. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/__init__.py +0 -0
  73. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/__init__.py +0 -0
  74. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/exporter/langtrace_exporter.py +0 -0
  75. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/instrumentation/__init__.py +0 -0
  76. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/instrumentation/anthropic.py +0 -0
  77. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/instrumentation/chroma.py +0 -0
  78. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/instrumentation/cohere.py +0 -0
  79. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/instrumentation/common.py +0 -0
  80. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/instrumentation/gemini.py +0 -0
  81. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/instrumentation/groq.py +0 -0
  82. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/instrumentation/ollama.py +0 -0
  83. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/instrumentation/openai.py +0 -0
  84. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/instrumentation/pinecone.py +0 -0
  85. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/instrumentation/qdrant.py +0 -0
  86. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/instrumentation/vertexai.py +0 -0
  87. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/constants/instrumentation/weaviate.py +0 -0
  88. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/extensions/__init__.py +0 -0
  89. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/extensions/langtrace_exporter.py +0 -0
  90. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/extensions/langtrace_filesystem.py +0 -0
  91. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/__init__.py +0 -0
  92. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +0 -0
  93. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +0 -0
  94. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +0 -0
  95. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/chroma/instrumentation.py +0 -0
  96. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/chroma/patch.py +0 -0
  97. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/cohere/__init__.py +0 -0
  98. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/cohere/instrumentation.py +0 -0
  99. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/cohere/patch.py +0 -0
  100. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/crewai/__init__.py +0 -0
  101. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/crewai/instrumentation.py +0 -0
  102. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/crewai/patch.py +0 -0
  103. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/dspy/__init__.py +0 -0
  104. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/gemini/__init__.py +0 -0
  105. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/gemini/instrumentation.py +0 -0
  106. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/groq/__init__.py +0 -0
  107. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/groq/instrumentation.py +0 -0
  108. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/groq/patch.py +0 -0
  109. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +0 -0
  110. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +0 -0
  111. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/langchain/patch.py +0 -0
  112. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +0 -0
  113. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +0 -0
  114. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/langchain_community/patch.py +0 -0
  115. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +0 -0
  116. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +0 -0
  117. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/langchain_core/patch.py +0 -0
  118. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/langgraph/__init__.py +0 -0
  119. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/langgraph/instrumentation.py +0 -0
  120. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/langgraph/patch.py +0 -0
  121. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +0 -0
  122. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +0 -0
  123. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/llamaindex/patch.py +0 -0
  124. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/ollama/__init__.py +0 -0
  125. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/ollama/instrumentation.py +0 -0
  126. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/ollama/patch.py +0 -0
  127. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/openai/__init__.py +0 -0
  128. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/openai/instrumentation.py +0 -0
  129. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/openai/patch.py +0 -0
  130. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +0 -0
  131. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +0 -0
  132. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/pinecone/patch.py +0 -0
  133. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/qdrant/__init__.py +0 -0
  134. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/qdrant/instrumentation.py +0 -0
  135. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/qdrant/patch.py +0 -0
  136. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/vertexai/__init__.py +0 -0
  137. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/vertexai/instrumentation.py +0 -0
  138. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/vertexai/patch.py +0 -0
  139. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/weaviate/__init__.py +0 -0
  140. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/weaviate/instrumentation.py +0 -0
  141. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/instrumentation/weaviate/patch.py +0 -0
  142. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/langtrace.py +0 -0
  143. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/types/__init__.py +0 -0
  144. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/utils/__init__.py +0 -0
  145. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/utils/langtrace_sampler.py +0 -0
  146. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/utils/misc.py +0 -0
  147. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/utils/prompt_registry.py +0 -0
  148. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/utils/sdk_version_checker.py +0 -0
  149. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/utils/silently_fail.py +0 -0
  150. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/utils/types.py +0 -0
  151. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/langtrace_python_sdk/utils/with_root_span.py +0 -0
  152. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/run_example.py +0 -0
  153. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/__init__.py +0 -0
  154. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/anthropic/cassettes/test_anthropic.yaml +0 -0
  155. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/anthropic/cassettes/test_anthropic_streaming.yaml +0 -0
  156. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/anthropic/cassettes/test_async_anthropic_streaming.yaml +0 -0
  157. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/anthropic/conftest.py +0 -0
  158. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/anthropic/test_anthropic.py +0 -0
  159. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/chroma/conftest.py +0 -0
  160. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/chroma/test_chroma.py +0 -0
  161. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/cohere/cassettes/test_cohere_chat.yaml +0 -0
  162. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/cohere/cassettes/test_cohere_chat_streaming.yaml +0 -0
  163. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/cohere/cassettes/test_cohere_embed.yaml +0 -0
  164. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/cohere/cassettes/test_cohere_rerank.yaml +0 -0
  165. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/cohere/conftest.py +0 -0
  166. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/cohere/test_cohere_chat.py +0 -0
  167. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/cohere/test_cohere_embed.py +0 -0
  168. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/cohere/test_cohere_rerank.py +0 -0
  169. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/conftest.py +0 -0
  170. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/groq/cassettes/test_async_chat_completion.yaml +0 -0
  171. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/groq/cassettes/test_async_chat_completion_streaming.yaml +0 -0
  172. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/groq/cassettes/test_chat_completion.yaml +0 -0
  173. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/groq/cassettes/test_chat_completion_streaming.yaml +0 -0
  174. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/groq/conftest.py +0 -0
  175. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/groq/test_groq.py +0 -0
  176. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/langchain/cassettes/test_langchain.yaml +0 -0
  177. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/langchain/conftest.py +0 -0
  178. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/langchain/test_langchain.py +0 -0
  179. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/openai/cassettes/test_async_chat_completion_streaming.yaml +0 -0
  180. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/openai/cassettes/test_async_image_generation.yaml +0 -0
  181. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/openai/cassettes/test_chat_completion.yaml +0 -0
  182. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/openai/cassettes/test_chat_completion_streaming.yaml +0 -0
  183. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/openai/cassettes/test_image_generation.yaml +0 -0
  184. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/openai/conftest.py +0 -0
  185. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/openai/test_chat_completion.py +0 -0
  186. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/openai/test_embeddings.py +0 -0
  187. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/openai/test_image_generation.py +0 -0
  188. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/pinecone/cassettes/test_query.yaml +0 -0
  189. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/pinecone/cassettes/test_upsert.yaml +0 -0
  190. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/pinecone/conftest.py +0 -0
  191. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/pinecone/test_pinecone.py +0 -0
  192. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/qdrant/conftest.py +0 -0
  193. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/src/tests/qdrant/test_qdrant.py +0 -0
  194. {langtrace_python_sdk-2.2.1 → langtrace_python_sdk-2.2.3}/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.2.1
3
+ Version: 2.2.3
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>
@@ -0,0 +1,51 @@
1
+ import contextvars
2
+ import dspy
3
+ from dspy.datasets.gsm8k import GSM8K, gsm8k_metric
4
+ from dspy.teleprompt import BootstrapFewShot
5
+ from concurrent.futures import ThreadPoolExecutor
6
+
7
+ # flake8: noqa
8
+ from langtrace_python_sdk import langtrace, with_langtrace_root_span
9
+
10
+ langtrace.init()
11
+
12
+ turbo = dspy.OpenAI(model="gpt-3.5-turbo", max_tokens=250)
13
+ dspy.settings.configure(lm=turbo)
14
+
15
+ # Load math questions from the GSM8K dataset
16
+ gsm8k = GSM8K()
17
+ gsm8k_trainset, gsm8k_devset = gsm8k.train[:10], gsm8k.dev[:10]
18
+
19
+ class CoT(dspy.Module):
20
+ def __init__(self):
21
+ super().__init__()
22
+ self.prog = dspy.ChainOfThought("question -> answer")
23
+
24
+ def forward(self, question):
25
+ result = inject_additional_attributes(lambda: self.prog(question=question), {'langtrace.span.name': 'MathProblemsCotParallel'})
26
+ return result
27
+
28
+ @with_langtrace_root_span(name="parallel_example")
29
+ def example():
30
+ # Set up the optimizer: we want to "bootstrap" (i.e., self-generate) 4-shot examples of our CoT program.
31
+ config = dict(max_bootstrapped_demos=4, max_labeled_demos=4)
32
+
33
+ # Optimize! Use the `gsm8k_metric` here. In general, the metric is going to tell the optimizer how well it's doing.
34
+ teleprompter = BootstrapFewShot(metric=gsm8k_metric, **config)
35
+ optimized_cot = teleprompter.compile(CoT(), trainset=gsm8k_trainset)
36
+
37
+ questions = [
38
+ "What is the sine of 0?",
39
+ "What is the tangent of 100?",
40
+ ]
41
+
42
+ with ThreadPoolExecutor(max_workers=2) as executor:
43
+ futures = [executor.submit(contextvars.copy_context().run, optimized_cot, question=q) for q in questions]
44
+
45
+ for future in futures:
46
+ ans = future.result()
47
+ print(ans)
48
+
49
+
50
+ if __name__ == "__main__":
51
+ example()
@@ -0,0 +1,73 @@
1
+ # Example taken from https://platform.openai.com/docs/guides/function-calling
2
+ import json
3
+
4
+ from dotenv import find_dotenv, load_dotenv
5
+ from openai import OpenAI
6
+
7
+ from langtrace_python_sdk import langtrace
8
+
9
+ client = OpenAI()
10
+
11
+ _ = load_dotenv(find_dotenv())
12
+
13
+ langtrace.init(
14
+ write_spans_to_console=True,
15
+ )
16
+
17
+
18
+ # Example dummy function hard coded to return the same weather
19
+ # In production, this could be your backend API or an external API
20
+ def get_current_weather(location, unit="fahrenheit"):
21
+ """Get the current weather in a given location"""
22
+ if "tokyo" in location.lower():
23
+ return json.dumps({"location": "Tokyo", "temperature": "10", "unit": unit})
24
+ elif "san francisco" in location.lower():
25
+ return json.dumps(
26
+ {"location": "San Francisco", "temperature": "72", "unit": unit}
27
+ )
28
+ elif "paris" in location.lower():
29
+ return json.dumps({"location": "Paris", "temperature": "22", "unit": unit})
30
+ else:
31
+ return json.dumps({"location": location, "temperature": "unknown"})
32
+
33
+
34
+ def run_conversation():
35
+ # Step 1: send the conversation and available functions to the model
36
+ messages = [
37
+ {
38
+ "role": "user",
39
+ "content": "What's the weather like in San Francisco, Tokyo, and Paris?",
40
+ }
41
+ ]
42
+ tools = [
43
+ {
44
+ "type": "function",
45
+ "function": {
46
+ "name": "get_current_weather",
47
+ "description": "Get the current weather in a given location",
48
+ "parameters": {
49
+ "type": "object",
50
+ "properties": {
51
+ "location": {
52
+ "type": "string",
53
+ "description": "The city and state, e.g. San Francisco, CA",
54
+ },
55
+ "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
56
+ },
57
+ "required": ["location"],
58
+ },
59
+ },
60
+ }
61
+ ]
62
+ response = client.chat.completions.create(
63
+ model="gpt-4o",
64
+ messages=messages,
65
+ tools=tools,
66
+ tool_choice="required", # auto is default, but we'll be explicit
67
+ )
68
+ response_message = response.choices[0].message
69
+ tool_calls = response_message.tool_calls
70
+ print(tool_calls)
71
+
72
+
73
+ print(run_conversation())
@@ -48,7 +48,9 @@ def messages_create(original_method, version, tracer):
48
48
  prompts = kwargs.get("messages", [])
49
49
  system = kwargs.get("system")
50
50
  if system:
51
- prompts = [{"role": "system", "content": system}] + kwargs.get("messages", [])
51
+ prompts = [{"role": "system", "content": system}] + kwargs.get(
52
+ "messages", []
53
+ )
52
54
 
53
55
  span_attributes = {
54
56
  **get_langtrace_attributes(version, service_provider),
@@ -27,12 +27,12 @@ class DspyInstrumentation(BaseInstrumentor):
27
27
  The DspyInstrumentor class represents the DSPy instrumentation"""
28
28
 
29
29
  def instrumentation_dependencies(self) -> Collection[str]:
30
- return ["dspy >= 0.1.5"]
30
+ return ["dspy-ai >= 2.0.0"]
31
31
 
32
32
  def _instrument(self, **kwargs):
33
33
  tracer_provider = kwargs.get("tracer_provider")
34
34
  tracer = get_tracer(__name__, "", tracer_provider)
35
- version = v("dspy")
35
+ version = v("dspy-ai")
36
36
  _W(
37
37
  "dspy.teleprompt.bootstrap",
38
38
  "BootstrapFewShot.compile",
@@ -39,30 +39,36 @@ def patch_bootstrapfewshot_optimizer(operation_name, version, tracer):
39
39
  ),
40
40
  }
41
41
  span_attributes["dspy.optimizer.module.prog"] = json.dumps(prog)
42
- if "metric" in instance and instance.metric:
43
- span_attributes["dspy.optimizer.metric"] = instance.metric.__name__
42
+ if hasattr(instance, 'metric'):
43
+ span_attributes["dspy.optimizer.metric"] = getattr(instance, 'metric').__name__
44
44
  if kwargs.get("trainset") and len(kwargs.get("trainset")) > 0:
45
45
  span_attributes["dspy.optimizer.trainset"] = str(kwargs.get("trainset"))
46
46
  config = {}
47
- if "metric_threshold" in instance and instance.metric_threshold:
48
- config["metric_threshold"] = instance.metric_threshold
49
- if "teacher_settings" in instance and instance.teacher_settings:
50
- config["teacher_settings"] = instance.teacher_settings
51
- if "max_bootstrapped_demos" in instance and instance.max_bootstrapped_demos:
52
- config["max_bootstrapped_demos"] = instance.max_bootstrapped_demos
53
- if "max_labeled_demos" in instance and instance.max_labeled_demos:
54
- config["max_labeled_demos"] = instance.max_labeled_demos
55
- if "max_rounds" in instance and instance.max_rounds:
56
- config["max_rounds"] = instance.max_rounds
57
- if "max_errors" in instance and instance.max_errors:
58
- config["max_errors"] = instance.max_errors
59
- if "error_count" in instance and instance.error_count:
60
- config["error_count"] = instance.error_count
47
+ if hasattr(instance, 'metric_threshold'):
48
+ config["metric_threshold"] = getattr(instance, 'metric_threshold')
49
+ if hasattr(instance, 'teacher_settings'):
50
+ config["teacher_settings"] = getattr(instance, 'teacher_settings')
51
+ if hasattr(instance, 'max_bootstrapped_demos'):
52
+ config["max_bootstrapped_demos"] = getattr(instance, 'max_bootstrapped_demos')
53
+ if hasattr(instance, 'max_labeled_demos'):
54
+ config["max_labeled_demos"] = getattr(instance, 'max_labeled_demos')
55
+ if hasattr(instance, 'max_rounds'):
56
+ config["max_rounds"] = getattr(instance, 'max_rounds')
57
+ if hasattr(instance, 'max_steps'):
58
+ config["max_errors"] = getattr(instance, 'max_errors')
59
+ if hasattr(instance, 'error_count'):
60
+ config["error_count"] = getattr(instance, 'error_count')
61
61
  if config and len(config) > 0:
62
62
  span_attributes["dspy.optimizer.config"] = json.dumps(config)
63
63
 
64
+ # passed operation name
65
+ opname = operation_name
66
+ if extra_attributes is not None and "langtrace.span.name" in extra_attributes:
67
+ # append the operation name to the span name
68
+ opname = f"{operation_name}-{extra_attributes['langtrace.span.name']}"
69
+
64
70
  attributes = FrameworkSpanAttributes(**span_attributes)
65
- with tracer.start_as_current_span(operation_name, kind=SpanKind.CLIENT) as span:
71
+ with tracer.start_as_current_span(opname, kind=SpanKind.CLIENT) as span:
66
72
  _set_input_attributes(span, kwargs, attributes)
67
73
 
68
74
  try:
@@ -100,6 +106,12 @@ def patch_signature(operation_name, version, tracer):
100
106
  **(extra_attributes if extra_attributes is not None else {}),
101
107
  }
102
108
 
109
+ # passed operation name
110
+ opname = operation_name
111
+ if extra_attributes is not None and "langtrace.span.name" in extra_attributes:
112
+ # append the operation name to the span name
113
+ opname = f"{operation_name}-{extra_attributes['langtrace.span.name']}"
114
+
103
115
  if instance.__class__.__name__:
104
116
  span_attributes["dspy.signature.name"] = instance.__class__.__name__
105
117
  span_attributes["dspy.signature"] = str(instance)
@@ -108,7 +120,7 @@ def patch_signature(operation_name, version, tracer):
108
120
  span_attributes["dspy.signature.args"] = str(kwargs)
109
121
 
110
122
  attributes = FrameworkSpanAttributes(**span_attributes)
111
- with tracer.start_as_current_span(operation_name, kind=SpanKind.CLIENT) as span:
123
+ with tracer.start_as_current_span(opname, kind=SpanKind.CLIENT) as span:
112
124
  _set_input_attributes(span, kwargs, attributes)
113
125
 
114
126
  try:
@@ -147,35 +159,41 @@ def patch_evaluate(operation_name, version, tracer):
147
159
  **(extra_attributes if extra_attributes is not None else {}),
148
160
  }
149
161
 
150
- if "devset" in instance and instance.devset is not None:
151
- span_attributes["dspy.evaluate.devset"] = str(instance.devset)
152
- if "display" in instance and instance.display is not None:
153
- span_attributes["dspy.evaluate.display"] = str(instance.display)
154
- if "num_threads" in instance and instance.num_threads is not None:
155
- span_attributes["dspy.evaluate.num_threads"] = str(instance.num_threads)
156
- if "return_outputs" in instance and instance.return_outputs is not None:
162
+ # passed operation name
163
+ opname = operation_name
164
+ if extra_attributes is not None and "langtrace.span.name" in extra_attributes:
165
+ # append the operation name to the span name
166
+ opname = f"{operation_name}-{extra_attributes['langtrace.span.name']}"
167
+
168
+ if hasattr(instance, "devset"):
169
+ span_attributes["dspy.evaluate.devset"] = str(getattr(instance, "devset"))
170
+ if hasattr(instance, "trainset"):
171
+ span_attributes["dspy.evaluate.display"] = str(getattr(instance, "trainset"))
172
+ if hasattr(instance, "num_threads"):
173
+ span_attributes["dspy.evaluate.num_threads"] = str(getattr(instance, "num_threads"))
174
+ if hasattr(instance, "return_outputs"):
157
175
  span_attributes["dspy.evaluate.return_outputs"] = str(
158
- instance.return_outputs
176
+ getattr(instance, "return_outputs")
159
177
  )
160
- if "display_table" in instance and instance.display_table is not None:
161
- span_attributes["dspy.evaluate.display_table"] = str(instance.display_table)
162
- if "display_progress" in instance and instance.display_progress is not None:
178
+ if hasattr(instance, "display_table"):
179
+ span_attributes["dspy.evaluate.display_table"] = str(getattr(instance, "display_table"))
180
+ if hasattr(instance, "display_progress"):
163
181
  span_attributes["dspy.evaluate.display_progress"] = str(
164
- instance.display_progress
182
+ getattr(instance, "display_progress")
165
183
  )
166
- if "metric" in instance and instance.metric is not None:
167
- span_attributes["dspy.evaluate.metric"] = instance.metric.__name__
168
- if "error_count" in instance and instance.error_count is not None:
169
- span_attributes["dspy.evaluate.error_count"] = str(instance.error_count)
170
- if "error_lock" in instance and instance.error_lock is not None:
171
- span_attributes["dspy.evaluate.error_lock"] = str(instance.error_lock)
172
- if "max_errors" in instance and instance.max_errors is not None:
173
- span_attributes["dspy.evaluate.max_errors"] = str(instance.max_errors)
184
+ if hasattr(instance, "metric"):
185
+ span_attributes["dspy.evaluate.metric"] = getattr(instance, "metric").__name__
186
+ if hasattr(instance, "error_count"):
187
+ span_attributes["dspy.evaluate.error_count"] = str(getattr(instance, "error_count"))
188
+ if hasattr(instance, "error_lock"):
189
+ span_attributes["dspy.evaluate.error_lock"] = str(getattr(instance, "error_lock"))
190
+ if hasattr(instance, "max_errors"):
191
+ span_attributes["dspy.evaluate.max_errors"] = str(getattr(instance, "max_errors"))
174
192
  if args and len(args) > 0:
175
193
  span_attributes["dspy.evaluate.args"] = str(args)
176
194
 
177
195
  attributes = FrameworkSpanAttributes(**span_attributes)
178
- with tracer.start_as_current_span(operation_name, kind=SpanKind.CLIENT) as span:
196
+ with tracer.start_as_current_span(opname, kind=SpanKind.CLIENT) as span:
179
197
  _set_input_attributes(span, kwargs, attributes)
180
198
 
181
199
  try:
@@ -110,7 +110,10 @@ def get_llm_model(instance):
110
110
 
111
111
  def serialize_prompts(args, kwargs, instance):
112
112
  prompts = []
113
- if hasattr(instance, "_system_instruction") and instance._system_instruction is not None:
113
+ if (
114
+ hasattr(instance, "_system_instruction")
115
+ and instance._system_instruction is not None
116
+ ):
114
117
  system_prompt = {
115
118
  "role": "system",
116
119
  "content": instance._system_instruction.__dict__["_pb"].parts[0].text,
@@ -123,6 +123,7 @@ def get_llm_request_attributes(kwargs, prompts=None, model=None):
123
123
  SpanAttributes.LLM_FREQUENCY_PENALTY: kwargs.get("frequency_penalty"),
124
124
  SpanAttributes.LLM_REQUEST_SEED: kwargs.get("seed"),
125
125
  SpanAttributes.LLM_TOOLS: json.dumps(tools) if tools else None,
126
+ SpanAttributes.LLM_TOOL_CHOICE: kwargs.get("tool_choice"),
126
127
  SpanAttributes.LLM_REQUEST_LOGPROPS: kwargs.get("logprobs"),
127
128
  SpanAttributes.LLM_REQUEST_LOGITBIAS: kwargs.get("logit_bias"),
128
129
  SpanAttributes.LLM_REQUEST_TOP_LOGPROPS: kwargs.get("top_logprobs"),
@@ -0,0 +1 @@
1
+ __version__ = "2.2.3"
@@ -1 +0,0 @@
1
- __version__ = "2.2.1"