langtrace-python-sdk 2.2.6__tar.gz → 2.2.8__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 (199) hide show
  1. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/PKG-INFO +5 -4
  2. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/README.md +3 -2
  3. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/pyproject.toml +1 -1
  4. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/inspect_ai_example/basic_eval.py +4 -2
  5. langtrace_python_sdk-2.2.8/src/examples/openai_example/send_user_feedback.py +40 -0
  6. langtrace_python_sdk-2.2.8/src/examples/otlp_example/otlp_with_langtrace.py +59 -0
  7. langtrace_python_sdk-2.2.8/src/examples/routellm_example/basic.py +41 -0
  8. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/extensions/langtrace_filesystem.py +28 -4
  9. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/cohere/patch.py +2 -2
  10. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/openai/patch.py +5 -5
  11. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/utils/llm.py +2 -1
  12. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/utils/with_root_span.py +17 -1
  13. langtrace_python_sdk-2.2.8/src/langtrace_python_sdk/version.py +1 -0
  14. langtrace_python_sdk-2.2.6/src/examples/ollama_example/basic_example_2.py +0 -34
  15. langtrace_python_sdk-2.2.6/src/langtrace_python_sdk/version.py +0 -1
  16. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/.gitignore +0 -0
  17. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/LICENSE +0 -0
  18. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/__init__.py +0 -0
  19. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/__init__.py +0 -0
  20. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/anthropic_example/__init__.py +0 -0
  21. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/anthropic_example/completion.py +0 -0
  22. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/chroma_example/__init__.py +0 -0
  23. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/chroma_example/basic.py +0 -0
  24. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/cohere_example/__init__.py +0 -0
  25. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/cohere_example/chat.py +0 -0
  26. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/cohere_example/chat_stream.py +0 -0
  27. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/cohere_example/embed.py +0 -0
  28. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/cohere_example/rerank.py +0 -0
  29. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/cohere_example/tools.py +0 -0
  30. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/crewai_example/basic.py +0 -0
  31. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/dspy_example/math_problems_cot.py +0 -0
  32. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/dspy_example/math_problems_cot_parallel.py +0 -0
  33. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/dspy_example/program_of_thought_basic.py +0 -0
  34. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/dspy_example/quiz_gen.py +0 -0
  35. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/dspy_example/react.py +0 -0
  36. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/fastapi_example/__init__.py +0 -0
  37. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/fastapi_example/basic_route.py +0 -0
  38. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/gemini_example/__init__.py +0 -0
  39. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/gemini_example/function_tools.py +0 -0
  40. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/gemini_example/main.py +0 -0
  41. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/hiveagent_example/basic.py +0 -0
  42. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/langchain_example/__init__.py +0 -0
  43. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/langchain_example/basic.py +0 -0
  44. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/langchain_example/groq_example.py +0 -0
  45. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/langchain_example/langgraph_example.py +0 -0
  46. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/langchain_example/tool.py +0 -0
  47. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/llamaindex_example/__init__.py +0 -0
  48. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/llamaindex_example/agent.py +0 -0
  49. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/llamaindex_example/basic.py +0 -0
  50. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/llamaindex_example/data/abramov.txt +0 -0
  51. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/ollama_example/__init__.py +0 -0
  52. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/ollama_example/basic.py +0 -0
  53. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/openai_example/__init__.py +0 -0
  54. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/openai_example/async_tool_calling_nonstreaming.py +0 -0
  55. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/openai_example/async_tool_calling_streaming.py +0 -0
  56. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/openai_example/chat_completion.py +0 -0
  57. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/openai_example/chat_completion_tool_choice.py +0 -0
  58. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/openai_example/embeddings_create.py +0 -0
  59. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/openai_example/function_calling.py +0 -0
  60. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/openai_example/images_edit.py +0 -0
  61. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/openai_example/images_generate.py +0 -0
  62. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/openai_example/resources/lounge_flamingo.png +0 -0
  63. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/openai_example/resources/mask.png +0 -0
  64. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/openai_example/tool_calling.py +0 -0
  65. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/openai_example/tool_calling_nonstreaming.py +0 -0
  66. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/openai_example/tool_calling_streaming.py +0 -0
  67. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/otlp_example/otlp_basic.py +0 -0
  68. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/perplexity_example/basic.py +0 -0
  69. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/pinecone_example/__init__.py +0 -0
  70. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/pinecone_example/basic.py +0 -0
  71. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/qdrant_example/__init__.py +0 -0
  72. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/qdrant_example/basic.py +0 -0
  73. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/vertexai_example/__init__.py +0 -0
  74. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/vertexai_example/main.py +0 -0
  75. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/weaviate_example/__init__.py +0 -0
  76. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/examples/weaviate_example/query_text.py +0 -0
  77. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/__init__.py +0 -0
  78. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/__init__.py +0 -0
  79. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/exporter/langtrace_exporter.py +0 -0
  80. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/instrumentation/__init__.py +0 -0
  81. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/instrumentation/anthropic.py +0 -0
  82. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/instrumentation/chroma.py +0 -0
  83. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/instrumentation/cohere.py +0 -0
  84. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/instrumentation/common.py +0 -0
  85. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/instrumentation/gemini.py +0 -0
  86. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/instrumentation/groq.py +0 -0
  87. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/instrumentation/ollama.py +0 -0
  88. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/instrumentation/openai.py +0 -0
  89. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/instrumentation/pinecone.py +0 -0
  90. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/instrumentation/qdrant.py +0 -0
  91. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/instrumentation/vertexai.py +0 -0
  92. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/constants/instrumentation/weaviate.py +0 -0
  93. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/extensions/__init__.py +0 -0
  94. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/extensions/langtrace_exporter.py +0 -0
  95. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/__init__.py +0 -0
  96. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +0 -0
  97. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +0 -0
  98. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +0 -0
  99. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +0 -0
  100. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/chroma/instrumentation.py +0 -0
  101. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/chroma/patch.py +0 -0
  102. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/cohere/__init__.py +0 -0
  103. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/cohere/instrumentation.py +0 -0
  104. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/crewai/__init__.py +0 -0
  105. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/crewai/instrumentation.py +0 -0
  106. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/crewai/patch.py +0 -0
  107. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/dspy/__init__.py +0 -0
  108. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/dspy/instrumentation.py +0 -0
  109. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/dspy/patch.py +0 -0
  110. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/gemini/__init__.py +0 -0
  111. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/gemini/instrumentation.py +0 -0
  112. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/gemini/patch.py +0 -0
  113. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/groq/__init__.py +0 -0
  114. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/groq/instrumentation.py +0 -0
  115. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/groq/patch.py +0 -0
  116. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +0 -0
  117. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +0 -0
  118. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/langchain/patch.py +0 -0
  119. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +0 -0
  120. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +0 -0
  121. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/langchain_community/patch.py +0 -0
  122. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +0 -0
  123. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +0 -0
  124. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/langchain_core/patch.py +0 -0
  125. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/langgraph/__init__.py +0 -0
  126. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/langgraph/instrumentation.py +0 -0
  127. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/langgraph/patch.py +0 -0
  128. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +0 -0
  129. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +0 -0
  130. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/llamaindex/patch.py +0 -0
  131. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/ollama/__init__.py +0 -0
  132. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/ollama/instrumentation.py +0 -0
  133. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/ollama/patch.py +0 -0
  134. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/openai/__init__.py +0 -0
  135. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/openai/instrumentation.py +0 -0
  136. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +0 -0
  137. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +0 -0
  138. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/pinecone/patch.py +0 -0
  139. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/qdrant/__init__.py +0 -0
  140. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/qdrant/instrumentation.py +0 -0
  141. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/qdrant/patch.py +0 -0
  142. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/vertexai/__init__.py +0 -0
  143. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/vertexai/instrumentation.py +0 -0
  144. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/vertexai/patch.py +0 -0
  145. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/weaviate/__init__.py +0 -0
  146. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/weaviate/instrumentation.py +0 -0
  147. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/instrumentation/weaviate/patch.py +0 -0
  148. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/langtrace.py +0 -0
  149. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/types/__init__.py +0 -0
  150. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/utils/__init__.py +0 -0
  151. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/utils/langtrace_sampler.py +0 -0
  152. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/utils/misc.py +0 -0
  153. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/utils/prompt_registry.py +0 -0
  154. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/utils/sdk_version_checker.py +0 -0
  155. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/utils/silently_fail.py +0 -0
  156. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/langtrace_python_sdk/utils/types.py +0 -0
  157. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/run_example.py +0 -0
  158. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/__init__.py +0 -0
  159. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/anthropic/cassettes/test_anthropic.yaml +0 -0
  160. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/anthropic/cassettes/test_anthropic_streaming.yaml +0 -0
  161. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/anthropic/cassettes/test_async_anthropic_streaming.yaml +0 -0
  162. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/anthropic/conftest.py +0 -0
  163. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/anthropic/test_anthropic.py +0 -0
  164. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/chroma/conftest.py +0 -0
  165. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/chroma/test_chroma.py +0 -0
  166. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/cohere/cassettes/test_cohere_chat.yaml +0 -0
  167. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/cohere/cassettes/test_cohere_chat_streaming.yaml +0 -0
  168. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/cohere/cassettes/test_cohere_embed.yaml +0 -0
  169. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/cohere/cassettes/test_cohere_rerank.yaml +0 -0
  170. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/cohere/conftest.py +0 -0
  171. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/cohere/test_cohere_chat.py +0 -0
  172. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/cohere/test_cohere_embed.py +0 -0
  173. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/cohere/test_cohere_rerank.py +0 -0
  174. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/conftest.py +0 -0
  175. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/groq/cassettes/test_async_chat_completion.yaml +0 -0
  176. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/groq/cassettes/test_async_chat_completion_streaming.yaml +0 -0
  177. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/groq/cassettes/test_chat_completion.yaml +0 -0
  178. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/groq/cassettes/test_chat_completion_streaming.yaml +0 -0
  179. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/groq/conftest.py +0 -0
  180. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/groq/test_groq.py +0 -0
  181. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/langchain/cassettes/test_langchain.yaml +0 -0
  182. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/langchain/conftest.py +0 -0
  183. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/langchain/test_langchain.py +0 -0
  184. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/openai/cassettes/test_async_chat_completion_streaming.yaml +0 -0
  185. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/openai/cassettes/test_async_image_generation.yaml +0 -0
  186. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/openai/cassettes/test_chat_completion.yaml +0 -0
  187. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/openai/cassettes/test_chat_completion_streaming.yaml +0 -0
  188. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/openai/cassettes/test_image_generation.yaml +0 -0
  189. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/openai/conftest.py +0 -0
  190. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/openai/test_chat_completion.py +0 -0
  191. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/openai/test_embeddings.py +0 -0
  192. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/openai/test_image_generation.py +0 -0
  193. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/pinecone/cassettes/test_query.yaml +0 -0
  194. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/pinecone/cassettes/test_upsert.yaml +0 -0
  195. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/pinecone/conftest.py +0 -0
  196. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/pinecone/test_pinecone.py +0 -0
  197. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/qdrant/conftest.py +0 -0
  198. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/src/tests/qdrant/test_qdrant.py +0 -0
  199. {langtrace_python_sdk-2.2.6 → langtrace_python_sdk-2.2.8}/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.6
3
+ Version: 2.2.8
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>
@@ -20,7 +20,7 @@ Requires-Dist: opentelemetry-instrumentation>=0.46b0
20
20
  Requires-Dist: opentelemetry-sdk>=1.25.0
21
21
  Requires-Dist: sqlalchemy
22
22
  Requires-Dist: tiktoken>=0.1.1
23
- Requires-Dist: trace-attributes<7.0.0,>=6.0.3
23
+ Requires-Dist: trace-attributes==7.0.0
24
24
  Provides-Extra: dev
25
25
  Requires-Dist: anthropic; extra == 'dev'
26
26
  Requires-Dist: chromadb; extra == 'dev'
@@ -239,7 +239,7 @@ def main():
239
239
  from langtrace_python_sdk import with_langtrace_root_span, with_additional_attributes
240
240
 
241
241
 
242
- @with_additional_attributes({"user.id": "1234", "user.feedback.rating": 1})
242
+ @with_additional_attributes({"user.id": "1234"})
243
243
  def api_call1():
244
244
  response = client.chat.completions.create(
245
245
  model="gpt-4",
@@ -249,7 +249,7 @@ def api_call1():
249
249
  return response
250
250
 
251
251
 
252
- @with_additional_attributes({"user.id": "5678", "user.feedback.rating": -1})
252
+ @with_additional_attributes({"user.id": "5678"})
253
253
  def api_call2():
254
254
  response = client.chat.completions.create(
255
255
  model="gpt-4",
@@ -293,6 +293,7 @@ Langtrace automatically captures traces from the following vendors:
293
293
  | CrewAI | Framework | :x: | :white_check_mark: |
294
294
  | Ollama | Framework | :x: | :white_check_mark: |
295
295
  | VertexAI | Framework | :x: | :white_check_mark: |
296
+ | Vercel AI SDK| Framework | :white_check_mark: | :x: |
296
297
  | Pinecone | Vector Database | :white_check_mark: | :white_check_mark: |
297
298
  | ChromaDB | Vector Database | :white_check_mark: | :white_check_mark: |
298
299
  | QDrant | Vector Database | :white_check_mark: | :white_check_mark: |
@@ -194,7 +194,7 @@ def main():
194
194
  from langtrace_python_sdk import with_langtrace_root_span, with_additional_attributes
195
195
 
196
196
 
197
- @with_additional_attributes({"user.id": "1234", "user.feedback.rating": 1})
197
+ @with_additional_attributes({"user.id": "1234"})
198
198
  def api_call1():
199
199
  response = client.chat.completions.create(
200
200
  model="gpt-4",
@@ -204,7 +204,7 @@ def api_call1():
204
204
  return response
205
205
 
206
206
 
207
- @with_additional_attributes({"user.id": "5678", "user.feedback.rating": -1})
207
+ @with_additional_attributes({"user.id": "5678"})
208
208
  def api_call2():
209
209
  response = client.chat.completions.create(
210
210
  model="gpt-4",
@@ -248,6 +248,7 @@ Langtrace automatically captures traces from the following vendors:
248
248
  | CrewAI | Framework | :x: | :white_check_mark: |
249
249
  | Ollama | Framework | :x: | :white_check_mark: |
250
250
  | VertexAI | Framework | :x: | :white_check_mark: |
251
+ | Vercel AI SDK| Framework | :white_check_mark: | :x: |
251
252
  | Pinecone | Vector Database | :white_check_mark: | :white_check_mark: |
252
253
  | ChromaDB | Vector Database | :white_check_mark: | :white_check_mark: |
253
254
  | QDrant | Vector Database | :white_check_mark: | :white_check_mark: |
@@ -18,7 +18,7 @@ classifiers=[
18
18
  "Operating System :: OS Independent",
19
19
  ]
20
20
  dependencies = [
21
- 'trace-attributes>=6.0.3,<7.0.0',
21
+ 'trace-attributes==7.0.0',
22
22
  'opentelemetry-api>=1.25.0',
23
23
  'opentelemetry-sdk>=1.25.0',
24
24
  'opentelemetry-instrumentation>=0.46b0',
@@ -1,10 +1,12 @@
1
1
  import fsspec
2
+ from dotenv import find_dotenv, load_dotenv
2
3
  from inspect_ai import Task, task
3
4
  from inspect_ai.dataset import csv_dataset, Sample
4
5
  from inspect_ai.scorer import model_graded_qa
5
6
  from inspect_ai.solver import chain_of_thought, self_critique
6
7
  from langtrace_python_sdk.extensions.langtrace_filesystem import LangTraceFileSystem
7
8
 
9
+ _ = load_dotenv(find_dotenv())
8
10
 
9
11
  # Manually register the filesystem with fsspec
10
12
  # Note: This is only necessary because the filesystem is not registered.
@@ -24,9 +26,9 @@ def hydrate_with_question(record):
24
26
 
25
27
 
26
28
  @task
27
- def pricing_question():
29
+ def basic_eval():
28
30
  return Task(
29
- dataset=csv_dataset("langtracefs://clyythmcs0001145cuvi426zi", hydrate_with_question),
31
+ dataset=csv_dataset("langtracefs://clz0p4i1t000fwv0xjtlvkxyx"),
30
32
  plan=[chain_of_thought(), self_critique()],
31
33
  scorer=model_graded_qa(),
32
34
  )
@@ -0,0 +1,40 @@
1
+ from dotenv import find_dotenv, load_dotenv
2
+ from openai import OpenAI
3
+ from langtrace_python_sdk import langtrace, with_langtrace_root_span, SendUserFeedback
4
+
5
+ _ = load_dotenv(find_dotenv())
6
+
7
+ # Initialize Langtrace SDK
8
+ langtrace.init()
9
+ client = OpenAI()
10
+
11
+
12
+ def api(span_id, trace_id):
13
+ response = client.chat.completions.create(
14
+ model="gpt-4o-mini",
15
+ messages=[
16
+ {"role": "user", "content": "What is the best place to live in the US?"},
17
+ ],
18
+ stream=False,
19
+ )
20
+
21
+ # Collect user feedback and send it to Langtrace
22
+ user_score = 1 # Example user score
23
+ user_id = 'user_1234' # Example user ID
24
+ data = {
25
+ "userScore": user_score,
26
+ "userId": user_id,
27
+ "spanId": span_id,
28
+ "traceId": trace_id
29
+ }
30
+ SendUserFeedback().evaluate(data=data)
31
+
32
+ # Return the response
33
+ return response.choices[0].message.content
34
+
35
+
36
+ # wrap the API call with the Langtrace root span
37
+ wrapped_api = with_langtrace_root_span()(api)
38
+
39
+ # Call the wrapped API
40
+ wrapped_api()
@@ -0,0 +1,59 @@
1
+ # Instructions
2
+ # 1. Run the OpenTelemetry Collector with the OTLP receiver enabled
3
+ # Create otel-config.yaml with the following content:
4
+ # receivers:
5
+ # otlp:
6
+ # protocols:
7
+ # grpc:
8
+ # endpoint: "0.0.0.0:4317"
9
+ # http:
10
+ # endpoint: "0.0.0.0:4318"
11
+
12
+ # exporters:
13
+ # logging:
14
+ # loglevel: debug
15
+
16
+ # service:
17
+ # pipelines:
18
+ # traces:
19
+ # receivers: [otlp]
20
+ # exporters: [logging]
21
+ # docker pull otel/opentelemetry-collector:latest
22
+ # docker run --rm -p 4317:4317 -p 4318:4318 -v $(pwd)/otel-config.yaml:/otel-config.yaml otel/opentelemetry-collector --config otel-config.yaml
23
+ # 2. Run the following code
24
+
25
+ from langtrace_python_sdk import langtrace
26
+ from openai import OpenAI
27
+ from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
28
+
29
+
30
+ # Configure the OTLP exporter to use the correct endpoint and API key
31
+ otlp_endpoint = "http://localhost:4318/v1/traces"
32
+ otlp_exporter = OTLPSpanExporter(
33
+ endpoint=otlp_endpoint,
34
+ headers=(("Content-Type", "application/json"),))
35
+ langtrace.init(custom_remote_exporter=otlp_exporter, batch=False)
36
+
37
+
38
+ def chat_with_openai():
39
+ client = OpenAI()
40
+ messages = [
41
+ {
42
+ "role": "user",
43
+ "content": "Hello, I'm a human.",
44
+ },
45
+ ]
46
+ chat_completion = client.chat.completions.create(
47
+ messages=messages,
48
+ stream=False,
49
+ model="gpt-3.5-turbo",
50
+ )
51
+ print(chat_completion.choices[0].message.content)
52
+
53
+
54
+ def main():
55
+ chat_with_openai()
56
+
57
+
58
+ if __name__ == "__main__":
59
+ main()
@@ -0,0 +1,41 @@
1
+ import sys
2
+
3
+ sys.path.insert(0, "/Users/karthikkalyanaraman/work/langtrace/langtrace-python-sdk/src")
4
+
5
+ from langtrace_python_sdk import langtrace
6
+ from langtrace_python_sdk.utils.with_root_span import with_langtrace_root_span
7
+ from routellm.controller import Controller
8
+ from dotenv import load_dotenv
9
+
10
+ load_dotenv()
11
+
12
+ langtrace.init()
13
+
14
+ # litellm.set_verbose=True
15
+ client = Controller(
16
+ routers=["mf"],
17
+ strong_model="claude-3-opus-20240229",
18
+ weak_model="claude-3-opus-20240229",
19
+ )
20
+
21
+
22
+ @with_langtrace_root_span("Routellm")
23
+ def Routellm(prompt):
24
+ try:
25
+
26
+ response = client.chat.completions.create(
27
+ model="router-mf-0.11593", messages=[{"role": "user", "content": prompt}]
28
+ )
29
+
30
+ for chunk in response:
31
+ if hasattr(chunk, "choices"):
32
+ print(chunk.choices[0].delta.content or "", end="")
33
+ else:
34
+ print(chunk)
35
+
36
+ except Exception as e:
37
+ print(f"An error occurred: {e}")
38
+
39
+
40
+ Routellm("what is the square root of 12182382932.99")
41
+ Routellm("Write me a short story")
@@ -27,13 +27,25 @@ class OpenMode(str):
27
27
 
28
28
 
29
29
  class LangTraceFile(io.BytesIO):
30
- _host: str = os.environ.get("LANGTRACE_API_HOST", None) or LANGTRACE_REMOTE_URL
31
30
 
32
31
  def __init__(self, fs: "LangTraceFileSystem", path: str, mode: OpenMode):
33
32
  super().__init__()
34
33
  self.fs = fs
35
34
  self.path = path
36
35
  self.mode = mode
36
+ self._host: str = os.environ.get("LANGTRACE_API_HOST", LANGTRACE_REMOTE_URL)
37
+ self._api_key: str = os.environ.get("LANGTRACE_API_KEY", None)
38
+ if self._host.endswith("/api/trace"):
39
+ self._host = self._host.replace("/api/trace", "")
40
+
41
+ if self._api_key is None:
42
+ print(Fore.RED)
43
+ print(
44
+ f"Missing Langtrace API key, proceed to {self._host} to create one"
45
+ )
46
+ print("Set the API key as an environment variable LANGTRACE_API_KEY")
47
+ print(Fore.RESET)
48
+ return
37
49
 
38
50
  def close(self) -> None:
39
51
  if not self.closed:
@@ -71,7 +83,7 @@ class LangTraceFile(io.BytesIO):
71
83
  data=json.dumps(data),
72
84
  headers={
73
85
  "Content-Type": "application/json",
74
- "x-api-key": os.environ.get("LANGTRACE_API_KEY"),
86
+ "x-api-key": self._api_key,
75
87
  },
76
88
  timeout=20,
77
89
  )
@@ -82,7 +94,6 @@ class LangTraceFile(io.BytesIO):
82
94
 
83
95
 
84
96
  class LangTraceFileSystem(AbstractFileSystem):
85
- _host: str = os.environ.get("LANGTRACE_API_HOST", None) or LANGTRACE_REMOTE_URL
86
97
  protocol = "langtracefs"
87
98
  sep = "/"
88
99
 
@@ -90,6 +101,19 @@ class LangTraceFileSystem(AbstractFileSystem):
90
101
  super().__init__(*args, **kwargs)
91
102
  self.files = {}
92
103
  self.dirs = set()
104
+ self._host: str = os.environ.get("LANGTRACE_API_HOST", LANGTRACE_REMOTE_URL)
105
+ self._api_key: str = os.environ.get("LANGTRACE_API_KEY", None)
106
+ if self._host.endswith("/api/trace"):
107
+ self._host = self._host.replace("/api/trace", "")
108
+
109
+ if self._api_key is None:
110
+ print(Fore.RED)
111
+ print(
112
+ f"Missing Langtrace API key, proceed to {self._host} to create one"
113
+ )
114
+ print("Set the API key as an environment variable LANGTRACE_API_KEY")
115
+ print(Fore.RESET)
116
+ return
93
117
 
94
118
  def open(
95
119
  self,
@@ -118,7 +142,7 @@ class LangTraceFileSystem(AbstractFileSystem):
118
142
  url=f"{self._host}/api/dataset/download?id={dataset_id}",
119
143
  headers={
120
144
  "Content-Type": "application/json",
121
- "x-api-key": os.environ.get("LANGTRACE_API_KEY"),
145
+ "x-api-key": self._api_key,
122
146
  },
123
147
  timeout=20,
124
148
  )
@@ -44,7 +44,7 @@ def rerank(original_method, version, tracer):
44
44
 
45
45
  span_attributes = {
46
46
  **get_langtrace_attributes(version, service_provider),
47
- **get_llm_request_attributes(kwargs),
47
+ **get_llm_request_attributes(kwargs, operation_name="rerank"),
48
48
  **get_llm_url(instance),
49
49
  SpanAttributes.LLM_REQUEST_MODEL: kwargs.get("model") or "command-r-plus",
50
50
  SpanAttributes.LLM_URL: APIS["RERANK"]["URL"],
@@ -121,7 +121,7 @@ def embed(original_method, version, tracer):
121
121
 
122
122
  span_attributes = {
123
123
  **get_langtrace_attributes(version, service_provider),
124
- **get_llm_request_attributes(kwargs),
124
+ **get_llm_request_attributes(kwargs, operation_name="embed"),
125
125
  **get_llm_url(instance),
126
126
  SpanAttributes.LLM_URL: APIS["EMBED"]["URL"],
127
127
  SpanAttributes.LLM_PATH: APIS["EMBED"]["ENDPOINT"],
@@ -55,7 +55,7 @@ def images_generate(original_method, version, tracer):
55
55
  service_provider = SERVICE_PROVIDERS["OPENAI"]
56
56
  span_attributes = {
57
57
  **get_langtrace_attributes(version, service_provider, vendor_type="llm"),
58
- **get_llm_request_attributes(kwargs),
58
+ **get_llm_request_attributes(kwargs, operation_name="images_generate"),
59
59
  **get_llm_url(instance),
60
60
  SpanAttributes.LLM_PATH: APIS["IMAGES_GENERATION"]["ENDPOINT"],
61
61
  **get_extra_attributes(),
@@ -118,7 +118,7 @@ def async_images_generate(original_method, version, tracer):
118
118
 
119
119
  span_attributes = {
120
120
  **get_langtrace_attributes(version, service_provider, vendor_type="llm"),
121
- **get_llm_request_attributes(kwargs),
121
+ **get_llm_request_attributes(kwargs, operation_name="images_generate"),
122
122
  **get_llm_url(instance),
123
123
  SpanAttributes.LLM_PATH: APIS["IMAGES_GENERATION"]["ENDPOINT"],
124
124
  **get_extra_attributes(),
@@ -181,7 +181,7 @@ def images_edit(original_method, version, tracer):
181
181
 
182
182
  span_attributes = {
183
183
  **get_langtrace_attributes(version, service_provider, vendor_type="llm"),
184
- **get_llm_request_attributes(kwargs),
184
+ **get_llm_request_attributes(kwargs, operation_name="images_edit"),
185
185
  **get_llm_url(instance),
186
186
  SpanAttributes.LLM_PATH: APIS["IMAGES_EDIT"]["ENDPOINT"],
187
187
  SpanAttributes.LLM_RESPONSE_FORMAT: kwargs.get("response_format"),
@@ -432,7 +432,7 @@ def embeddings_create(original_method, version, tracer):
432
432
 
433
433
  span_attributes = {
434
434
  **get_langtrace_attributes(version, service_provider, vendor_type="llm"),
435
- **get_llm_request_attributes(kwargs),
435
+ **get_llm_request_attributes(kwargs, operation_name="embed"),
436
436
  **get_llm_url(instance),
437
437
  SpanAttributes.LLM_PATH: APIS["EMBEDDINGS_CREATE"]["ENDPOINT"],
438
438
  SpanAttributes.LLM_REQUEST_DIMENSIONS: kwargs.get("dimensions"),
@@ -490,7 +490,7 @@ def async_embeddings_create(original_method, version, tracer):
490
490
 
491
491
  span_attributes = {
492
492
  **get_langtrace_attributes(version, service_provider, vendor_type="llm"),
493
- **get_llm_request_attributes(kwargs),
493
+ **get_llm_request_attributes(kwargs, operation_name="embed"),
494
494
  SpanAttributes.LLM_PATH: APIS["EMBEDDINGS_CREATE"]["ENDPOINT"],
495
495
  SpanAttributes.LLM_REQUEST_DIMENSIONS: kwargs.get("dimensions"),
496
496
  **get_extra_attributes(),
@@ -92,7 +92,7 @@ def get_langtrace_attributes(version, service_provider, vendor_type="llm"):
92
92
  }
93
93
 
94
94
 
95
- def get_llm_request_attributes(kwargs, prompts=None, model=None):
95
+ def get_llm_request_attributes(kwargs, prompts=None, model=None, operation_name="chat"):
96
96
 
97
97
  user = kwargs.get("user", None)
98
98
  if prompts is None:
@@ -111,6 +111,7 @@ def get_llm_request_attributes(kwargs, prompts=None, model=None):
111
111
  top_p = kwargs.get("p", None) or kwargs.get("top_p", None)
112
112
  tools = kwargs.get("tools", None)
113
113
  return {
114
+ SpanAttributes.LLM_OPERATION_NAME: operation_name,
114
115
  SpanAttributes.LLM_REQUEST_MODEL: model or kwargs.get("model"),
115
116
  SpanAttributes.LLM_IS_STREAMING: kwargs.get("stream"),
116
117
  SpanAttributes.LLM_REQUEST_TEMPERATURE: kwargs.get("temperature"),
@@ -25,6 +25,9 @@ from opentelemetry import baggage, context, trace
25
25
  from opentelemetry.trace import SpanKind
26
26
  from opentelemetry.trace.propagation import set_span_in_context
27
27
 
28
+ from langtrace_python_sdk.constants.exporter.langtrace_exporter import (
29
+ LANGTRACE_REMOTE_URL,
30
+ )
28
31
  from langtrace_python_sdk.constants.instrumentation.common import (
29
32
  LANGTRACE_ADDITIONAL_SPAN_ATTRIBUTES_KEY,
30
33
  )
@@ -142,7 +145,10 @@ class SendUserFeedback:
142
145
  _langtrace_api_key: str
143
146
 
144
147
  def __init__(self):
145
- self._langtrace_host = os.environ["LANGTRACE_API_HOST"]
148
+ self._langtrace_host = os.environ.get("LANGTRACE_API_HOST", LANGTRACE_REMOTE_URL)
149
+ # When the host is set to /api/trace, remove the /api/trace
150
+ if self._langtrace_host.endswith("/api/trace"):
151
+ self._langtrace_host = self._langtrace_host.replace("/api/trace", "")
146
152
  self._langtrace_api_key = os.environ.get("LANGTRACE_API_KEY", None)
147
153
 
148
154
  def evaluate(self, data: EvaluationAPIData) -> None:
@@ -155,6 +161,16 @@ class SendUserFeedback:
155
161
  print("Set the API key as an environment variable LANGTRACE_API_KEY")
156
162
  print(Fore.RESET)
157
163
  return
164
+
165
+ # convert spanId and traceId to hexadecimals
166
+ span_hex_number = hex(int(data["spanId"], 10))[2:] # Convert to hex and remove the '0x' prefix
167
+ formatted_span_hex_number = span_hex_number.zfill(16) # Pad with zeros to 16 characters
168
+ data["spanId"] = f"0x{formatted_span_hex_number}"
169
+
170
+ trace_hex_number = hex(int(data["traceId"], 10))[2:] # Convert to hex and remove the '0x' prefix
171
+ formatted_trace_hex_number = trace_hex_number.zfill(32) # Pad with zeros to 32 characters
172
+ data["traceId"] = f"0x{formatted_trace_hex_number}"
173
+
158
174
  evaluation = self.get_evaluation(data["spanId"])
159
175
  headers = {"x-api-key": self._langtrace_api_key}
160
176
  if evaluation is not None:
@@ -0,0 +1 @@
1
+ __version__ = "2.2.8"
@@ -1,34 +0,0 @@
1
- from langtrace_python_sdk import langtrace
2
- from openai import OpenAI
3
- from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
4
-
5
- service_name = "langtrace-python-ollama"
6
- otlp_endpoint = "http://localhost:4318/v1/traces"
7
- otlp_exporter = OTLPSpanExporter(
8
- endpoint=otlp_endpoint,
9
- headers=(("Content-Type", "application/json"),))
10
- langtrace.init(custom_remote_exporter=otlp_exporter, batch=False)
11
-
12
-
13
- def chat_with_ollama():
14
- # Use the OpenAI endpoint, not the Ollama API.
15
- base_url = "http://localhost:11434/v1"
16
- client = OpenAI(base_url=base_url, api_key="unused")
17
- messages = [
18
- {
19
- "role": "user",
20
- "content": "Hello, I'm a human.",
21
- },
22
- ]
23
- chat_completion = client.chat.completions.create(
24
- model="llama3", messages=messages
25
- )
26
- print(chat_completion.choices[0].message.content)
27
-
28
-
29
- def main():
30
- chat_with_ollama()
31
-
32
-
33
- if __name__ == "__main__":
34
- main()
@@ -1 +0,0 @@
1
- __version__ = "2.2.6"