langtrace-python-sdk 2.2.25__tar.gz → 2.2.27__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.
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/PKG-INFO +4 -2
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/README.md +1 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/pyproject.toml +3 -2
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/crewai_example/trip_planner/agents.py +5 -5
- langtrace_python_sdk-2.2.27/src/examples/litellm_example/basic.py +98 -0
- langtrace_python_sdk-2.2.27/src/examples/mistral_example/__init__.py +14 -0
- langtrace_python_sdk-2.2.27/src/examples/mistral_example/complete.py +18 -0
- langtrace_python_sdk-2.2.27/src/examples/mistral_example/complete_async.py +16 -0
- langtrace_python_sdk-2.2.27/src/examples/mistral_example/embeddings.py +17 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/instrumentation/common.py +1 -0
- langtrace_python_sdk-2.2.27/src/langtrace_python_sdk/constants/instrumentation/mistral.py +24 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/__init__.py +2 -0
- langtrace_python_sdk-2.2.27/src/langtrace_python_sdk/instrumentation/mistral/__init__.py +3 -0
- langtrace_python_sdk-2.2.27/src/langtrace_python_sdk/instrumentation/mistral/instrumentation.py +73 -0
- langtrace_python_sdk-2.2.27/src/langtrace_python_sdk/instrumentation/mistral/patch.py +192 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/langtrace.py +6 -2
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/types/__init__.py +7 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/utils/llm.py +13 -0
- langtrace_python_sdk-2.2.27/src/langtrace_python_sdk/version.py +1 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/run_example.py +8 -1
- langtrace_python_sdk-2.2.25/src/langtrace_python_sdk/version.py +0 -1
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/.gitignore +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/LICENSE +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/anthropic_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/anthropic_example/completion.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/chroma_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/chroma_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/cohere_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/cohere_example/chat.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/cohere_example/chat_stream.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/cohere_example/embed.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/cohere_example/rerank.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/cohere_example/tools.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/crewai_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/crewai_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/crewai_example/simple_agent/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/crewai_example/simple_agent/agents.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/crewai_example/simple_agent/main.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/crewai_example/simple_agent/tasks.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/crewai_example/trip_planner/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/crewai_example/trip_planner/main.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/crewai_example/trip_planner/tasks.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/crewai_example/trip_planner/tools/calculator.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/crewai_example/trip_planner/tools/search_tools.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/dspy_example/math_problems_cot.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/dspy_example/math_problems_cot_parallel.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/dspy_example/program_of_thought_basic.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/dspy_example/quiz_gen.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/dspy_example/react.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/fastapi_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/fastapi_example/basic_route.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/gemini_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/gemini_example/function_tools.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/gemini_example/main.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/hiveagent_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/inspect_ai_example/basic_eval.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/langchain_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/langchain_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/langchain_example/groq_example.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/langchain_example/langgraph_example.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/langchain_example/sagemaker.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/langchain_example/tool.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/llamaindex_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/llamaindex_example/agent.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/llamaindex_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/llamaindex_example/data/abramov.txt +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/ollama_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/ollama_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/async_tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/async_tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/chat_completion.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/chat_completion_tool_choice.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/embeddings_create.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/function_calling.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/images_edit.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/images_generate.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/resources/lounge_flamingo.png +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/resources/mask.png +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/send_user_feedback.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/tool_calling.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/openai_example/tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/otlp_example/otlp_basic.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/otlp_example/otlp_with_langtrace.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/perplexity_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/pinecone_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/pinecone_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/qdrant_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/qdrant_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/routellm_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/vertexai_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/vertexai_example/main.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/weaviate_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/examples/weaviate_example/query_text.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/exporter/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/instrumentation/anthropic.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/instrumentation/chroma.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/instrumentation/cohere.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/instrumentation/gemini.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/instrumentation/groq.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/instrumentation/ollama.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/instrumentation/openai.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/instrumentation/pinecone.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/instrumentation/qdrant.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/instrumentation/vertexai.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/constants/instrumentation/weaviate.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/extensions/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/extensions/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/extensions/langtrace_filesystem.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/chroma/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/chroma/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/cohere/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/cohere/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/cohere/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/crewai/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/crewai/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/crewai/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/dspy/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/dspy/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/dspy/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/gemini/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/gemini/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/gemini/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/groq/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/groq/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/groq/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/langchain/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/langchain_community/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/langchain_core/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/langgraph/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/langgraph/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/langgraph/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/llamaindex/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/ollama/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/ollama/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/ollama/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/openai/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/openai/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/openai/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/pinecone/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/qdrant/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/qdrant/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/qdrant/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/vertexai/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/vertexai/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/vertexai/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/weaviate/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/weaviate/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/instrumentation/weaviate/patch.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/utils/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/utils/langtrace_sampler.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/utils/misc.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/utils/prompt_registry.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/utils/sdk_version_checker.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/utils/silently_fail.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/utils/types.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/utils/with_root_span.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/__init__.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/anthropic/cassettes/test_anthropic.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/anthropic/cassettes/test_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/anthropic/cassettes/test_async_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/anthropic/conftest.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/anthropic/test_anthropic.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/chroma/conftest.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/chroma/test_chroma.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/cohere/cassettes/test_cohere_chat.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/cohere/cassettes/test_cohere_chat_streaming.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/cohere/cassettes/test_cohere_embed.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/cohere/cassettes/test_cohere_rerank.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/cohere/conftest.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/cohere/test_cohere_chat.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/cohere/test_cohere_embed.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/cohere/test_cohere_rerank.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/conftest.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/groq/cassettes/test_async_chat_completion.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/groq/cassettes/test_async_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/groq/cassettes/test_chat_completion.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/groq/cassettes/test_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/groq/conftest.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/groq/test_groq.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/langchain/cassettes/test_langchain.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/langchain/conftest.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/langchain/test_langchain.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/openai/cassettes/test_async_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/openai/cassettes/test_async_image_generation.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/openai/cassettes/test_chat_completion.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/openai/cassettes/test_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/openai/cassettes/test_image_generation.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/openai/conftest.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/openai/test_chat_completion.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/openai/test_embeddings.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/openai/test_image_generation.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/pinecone/cassettes/test_query.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/pinecone/cassettes/test_upsert.yaml +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/pinecone/conftest.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/pinecone/test_pinecone.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/qdrant/conftest.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/tests/qdrant/test_qdrant.py +0 -0
- {langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/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.
|
|
3
|
+
Version: 2.2.27
|
|
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.47b0
|
|
|
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.
|
|
23
|
+
Requires-Dist: trace-attributes==7.0.4
|
|
24
24
|
Provides-Extra: dev
|
|
25
25
|
Requires-Dist: anthropic; extra == 'dev'
|
|
26
26
|
Requires-Dist: chromadb; extra == 'dev'
|
|
@@ -31,6 +31,7 @@ Requires-Dist: groq; extra == 'dev'
|
|
|
31
31
|
Requires-Dist: langchain; extra == 'dev'
|
|
32
32
|
Requires-Dist: langchain-community; extra == 'dev'
|
|
33
33
|
Requires-Dist: langchain-openai; extra == 'dev'
|
|
34
|
+
Requires-Dist: mistralai; extra == 'dev'
|
|
34
35
|
Requires-Dist: ollama; extra == 'dev'
|
|
35
36
|
Requires-Dist: openai; extra == 'dev'
|
|
36
37
|
Requires-Dist: pinecone-client; extra == 'dev'
|
|
@@ -291,6 +292,7 @@ Langtrace automatically captures traces from the following vendors:
|
|
|
291
292
|
| Groq | LLM | :x: | :white_check_mark: |
|
|
292
293
|
| Perplexity | LLM | :white_check_mark: | :white_check_mark: |
|
|
293
294
|
| Gemini | LLM | :x: | :white_check_mark: |
|
|
295
|
+
| Mistral | LLM | :x: | :white_check_mark: |
|
|
294
296
|
| Langchain | Framework | :x: | :white_check_mark: |
|
|
295
297
|
| LlamaIndex | Framework | :white_check_mark: | :white_check_mark: |
|
|
296
298
|
| Langgraph | Framework | :x: | :white_check_mark: |
|
|
@@ -246,6 +246,7 @@ Langtrace automatically captures traces from the following vendors:
|
|
|
246
246
|
| Groq | LLM | :x: | :white_check_mark: |
|
|
247
247
|
| Perplexity | LLM | :white_check_mark: | :white_check_mark: |
|
|
248
248
|
| Gemini | LLM | :x: | :white_check_mark: |
|
|
249
|
+
| Mistral | LLM | :x: | :white_check_mark: |
|
|
249
250
|
| Langchain | Framework | :x: | :white_check_mark: |
|
|
250
251
|
| LlamaIndex | Framework | :white_check_mark: | :white_check_mark: |
|
|
251
252
|
| Langgraph | Framework | :x: | :white_check_mark: |
|
|
@@ -18,7 +18,7 @@ classifiers=[
|
|
|
18
18
|
"Operating System :: OS Independent",
|
|
19
19
|
]
|
|
20
20
|
dependencies = [
|
|
21
|
-
'trace-attributes==7.0.
|
|
21
|
+
'trace-attributes==7.0.4',
|
|
22
22
|
'opentelemetry-api>=1.25.0',
|
|
23
23
|
'opentelemetry-sdk>=1.25.0',
|
|
24
24
|
'opentelemetry-instrumentation>=0.47b0',
|
|
@@ -52,7 +52,8 @@ dev = [
|
|
|
52
52
|
"ollama",
|
|
53
53
|
"groq",
|
|
54
54
|
"google-generativeai",
|
|
55
|
-
"google-cloud-aiplatform"
|
|
55
|
+
"google-cloud-aiplatform",
|
|
56
|
+
"mistralai"
|
|
56
57
|
]
|
|
57
58
|
|
|
58
59
|
test = [
|
|
@@ -12,9 +12,9 @@ class TravelAgents:
|
|
|
12
12
|
def __init__(self):
|
|
13
13
|
self.OpenAIGPT35 = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0.7)
|
|
14
14
|
self.OpenAIGPT4 = ChatOpenAI(model_name="gpt-4", temperature=0.7)
|
|
15
|
-
self.Ollama = ChatOllama(model="
|
|
15
|
+
self.Ollama = ChatOllama(model="llama3")
|
|
16
16
|
self.Cohere = ChatCohere(model="command-r")
|
|
17
|
-
self.Anthropic = ChatAnthropic(model="claude-3-5-sonnet")
|
|
17
|
+
self.Anthropic = ChatAnthropic(model="claude-3-5-sonnet-20240620")
|
|
18
18
|
|
|
19
19
|
def expert_travel_agent(self):
|
|
20
20
|
return Agent(
|
|
@@ -28,7 +28,7 @@ class TravelAgents:
|
|
|
28
28
|
# tools=[tool_1, tool_2],
|
|
29
29
|
allow_delegation=False,
|
|
30
30
|
verbose=True,
|
|
31
|
-
llm=self.
|
|
31
|
+
llm=self.Cohere,
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
def city_selection_expert(self):
|
|
@@ -39,7 +39,7 @@ class TravelAgents:
|
|
|
39
39
|
# tools=[tool_1, tool_2],
|
|
40
40
|
allow_delegation=False,
|
|
41
41
|
verbose=True,
|
|
42
|
-
llm=self.
|
|
42
|
+
llm=self.Cohere,
|
|
43
43
|
)
|
|
44
44
|
|
|
45
45
|
def local_tour_guide(self):
|
|
@@ -50,5 +50,5 @@ class TravelAgents:
|
|
|
50
50
|
# tools=[tool_1, tool_2],
|
|
51
51
|
allow_delegation=False,
|
|
52
52
|
verbose=True,
|
|
53
|
-
llm=self.
|
|
53
|
+
llm=self.Cohere,
|
|
54
54
|
)
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
from langtrace_python_sdk import with_langtrace_root_span, langtrace
|
|
2
|
+
from dotenv import load_dotenv
|
|
3
|
+
from litellm import completion, acompletion
|
|
4
|
+
import litellm
|
|
5
|
+
import asyncio
|
|
6
|
+
|
|
7
|
+
load_dotenv()
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
litellm.success_callback = ["langtrace"]
|
|
11
|
+
langtrace.init()
|
|
12
|
+
litellm.set_verbose = False
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@with_langtrace_root_span("Litellm Example OpenAI")
|
|
16
|
+
def openAI(streaming=False):
|
|
17
|
+
response = completion(
|
|
18
|
+
model="gpt-3.5-turbo",
|
|
19
|
+
messages=[
|
|
20
|
+
{"content": "respond only in Yoda speak.", "role": "system"},
|
|
21
|
+
{"content": "Hello, how are you?", "role": "user"},
|
|
22
|
+
],
|
|
23
|
+
stream=streaming,
|
|
24
|
+
stream_options={"include_usage": True},
|
|
25
|
+
)
|
|
26
|
+
if streaming:
|
|
27
|
+
for _ in response:
|
|
28
|
+
pass
|
|
29
|
+
else:
|
|
30
|
+
return response
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# @with_langtrace_root_span("Litellm Example Anthropic Completion")
|
|
34
|
+
def anthropic(streaming=False):
|
|
35
|
+
try:
|
|
36
|
+
|
|
37
|
+
response = completion(
|
|
38
|
+
model="claude-2.1",
|
|
39
|
+
messages=[
|
|
40
|
+
{"content": "respond only in Yoda speak.", "role": "system"},
|
|
41
|
+
{"content": "what is 2 + 2?", "role": "user"},
|
|
42
|
+
],
|
|
43
|
+
temperature=0.5,
|
|
44
|
+
top_p=0.5,
|
|
45
|
+
n=1,
|
|
46
|
+
stream=streaming,
|
|
47
|
+
stream_options={"include_usage": True},
|
|
48
|
+
)
|
|
49
|
+
# print(response)
|
|
50
|
+
if streaming:
|
|
51
|
+
for _ in response:
|
|
52
|
+
pass
|
|
53
|
+
else:
|
|
54
|
+
return response
|
|
55
|
+
except Exception as e:
|
|
56
|
+
print("ERORRRR", e)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# @with_langtrace_root_span("Litellm Example OpenAI Async Streaming")
|
|
60
|
+
async def async_anthropic(streaming=False):
|
|
61
|
+
response = await acompletion(
|
|
62
|
+
model="claude-2.1",
|
|
63
|
+
messages=[{"content": "Hello, how are you?", "role": "user"}],
|
|
64
|
+
stream=streaming,
|
|
65
|
+
stream_options={"include_usage": True},
|
|
66
|
+
temperature=0.5,
|
|
67
|
+
top_p=0.5,
|
|
68
|
+
n=1,
|
|
69
|
+
)
|
|
70
|
+
if streaming:
|
|
71
|
+
async for _ in response:
|
|
72
|
+
pass
|
|
73
|
+
else:
|
|
74
|
+
return response
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def cohere(streaming=False):
|
|
78
|
+
response = completion(
|
|
79
|
+
model="command-r",
|
|
80
|
+
messages=[
|
|
81
|
+
{"content": "respond only in Yoda speak.", "role": "system"},
|
|
82
|
+
{"content": "Hello, how are you?", "role": "user"},
|
|
83
|
+
],
|
|
84
|
+
stream=streaming,
|
|
85
|
+
stream_options={"include_usage": True},
|
|
86
|
+
)
|
|
87
|
+
if streaming:
|
|
88
|
+
for _ in response:
|
|
89
|
+
pass
|
|
90
|
+
else:
|
|
91
|
+
return response
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
if __name__ == "__main__":
|
|
95
|
+
# openAI()
|
|
96
|
+
anthropic(streaming=False)
|
|
97
|
+
cohere(streaming=True)
|
|
98
|
+
# asyncio.run(async_anthropic(streaming=True))
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
from examples.mistral_example.complete import chat_complete
|
|
3
|
+
from examples.mistral_example.complete_async import complete_async
|
|
4
|
+
from examples.mistral_example.embeddings import embeddings_create
|
|
5
|
+
from langtrace_python_sdk import langtrace, with_langtrace_root_span
|
|
6
|
+
|
|
7
|
+
langtrace.init()
|
|
8
|
+
|
|
9
|
+
class MistralRunner:
|
|
10
|
+
@with_langtrace_root_span("Mistral")
|
|
11
|
+
def run(self):
|
|
12
|
+
chat_complete()
|
|
13
|
+
asyncio.run(complete_async())
|
|
14
|
+
embeddings_create()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from langtrace_python_sdk import with_langtrace_root_span
|
|
3
|
+
from mistralai import Mistral
|
|
4
|
+
|
|
5
|
+
@with_langtrace_root_span("chat_complete")
|
|
6
|
+
def chat_complete():
|
|
7
|
+
model = "mistral-large-latest"
|
|
8
|
+
client = Mistral(api_key=os.environ["MISTRAL_API_KEY"])
|
|
9
|
+
chat_response = client.chat.complete(
|
|
10
|
+
model= model,
|
|
11
|
+
messages = [
|
|
12
|
+
{
|
|
13
|
+
"role": "user",
|
|
14
|
+
"content": "I need 10 cocktail recipes with tequila other than the classics like margarita, tequila"
|
|
15
|
+
},
|
|
16
|
+
]
|
|
17
|
+
)
|
|
18
|
+
print(chat_response.choices[0].message.content)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from langtrace_python_sdk import with_langtrace_root_span
|
|
3
|
+
from mistralai import Mistral
|
|
4
|
+
|
|
5
|
+
@with_langtrace_root_span("chat_complete_async")
|
|
6
|
+
async def complete_async():
|
|
7
|
+
client = Mistral(api_key=os.environ["MISTRAL_API_KEY"])
|
|
8
|
+
res = await client.chat.complete_async(model="mistral-small-latest", messages=[
|
|
9
|
+
{
|
|
10
|
+
"content": "Which locations should I visit when I travel to New york? Answer in one short sentence.",
|
|
11
|
+
"role": "user",
|
|
12
|
+
},
|
|
13
|
+
])
|
|
14
|
+
if res is not None:
|
|
15
|
+
# handle response
|
|
16
|
+
print(res.choices[0].message.content)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from langtrace_python_sdk import with_langtrace_root_span
|
|
3
|
+
from mistralai import Mistral
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@with_langtrace_root_span("create_embeddings")
|
|
7
|
+
def embeddings_create():
|
|
8
|
+
model = "mistral-embed"
|
|
9
|
+
|
|
10
|
+
client = Mistral(api_key=os.environ["MISTRAL_API_KEY"])
|
|
11
|
+
|
|
12
|
+
embeddings_batch_response = client.embeddings.create(
|
|
13
|
+
model=model,
|
|
14
|
+
inputs=["Embed this sentence.", "As well as this one."],
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
print(embeddings_batch_response.data[0].embedding)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from langtrace.trace_attributes import MistralMethods
|
|
2
|
+
|
|
3
|
+
APIS = {
|
|
4
|
+
"CHAT_COMPLETE": {
|
|
5
|
+
"METHOD": MistralMethods.CHAT_COMPLETE.value,
|
|
6
|
+
"ENDPOINT": "/v1/chat/completions",
|
|
7
|
+
},
|
|
8
|
+
"ASYNC_CHAT_COMPLETE": {
|
|
9
|
+
"METHOD": MistralMethods.ASYNC_CHAT_COMPLETE.value,
|
|
10
|
+
"ENDPOINT": "/v1/chat/completions",
|
|
11
|
+
},
|
|
12
|
+
"CHAT_STREAM": {
|
|
13
|
+
"METHOD": MistralMethods.CHAT_STREAM.value,
|
|
14
|
+
"ENDPOINT": "/v1/chat/completions",
|
|
15
|
+
},
|
|
16
|
+
"EMBEDDINGS_CREATE": {
|
|
17
|
+
"METHOD": MistralMethods.EMBEDDINGS_CREATE.value,
|
|
18
|
+
"ENDPOINT": "/v1/embeddings",
|
|
19
|
+
},
|
|
20
|
+
"ASYNC_EMBEDDINGS_CREATE": {
|
|
21
|
+
"METHOD": MistralMethods.ASYNC_EMBEDDINGS_CREATE.value,
|
|
22
|
+
"ENDPOINT": "/v1/embeddings",
|
|
23
|
+
},
|
|
24
|
+
}
|
|
@@ -16,6 +16,7 @@ from .ollama import OllamaInstrumentor
|
|
|
16
16
|
from .dspy import DspyInstrumentation
|
|
17
17
|
from .vertexai import VertexAIInstrumentation
|
|
18
18
|
from .gemini import GeminiInstrumentation
|
|
19
|
+
from .mistral import MistralInstrumentation
|
|
19
20
|
|
|
20
21
|
__all__ = [
|
|
21
22
|
"AnthropicInstrumentation",
|
|
@@ -36,4 +37,5 @@ __all__ = [
|
|
|
36
37
|
"DspyInstrumentation",
|
|
37
38
|
"VertexAIInstrumentation",
|
|
38
39
|
"GeminiInstrumentation",
|
|
40
|
+
"MistralInstrumentation",
|
|
39
41
|
]
|
langtrace_python_sdk-2.2.27/src/langtrace_python_sdk/instrumentation/mistral/instrumentation.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (c) 2024 Scale3 Labs
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import importlib.metadata
|
|
18
|
+
import logging
|
|
19
|
+
from typing import Collection
|
|
20
|
+
|
|
21
|
+
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
|
22
|
+
from opentelemetry.trace import get_tracer
|
|
23
|
+
from wrapt import wrap_function_wrapper as _W
|
|
24
|
+
|
|
25
|
+
from langtrace_python_sdk.instrumentation.mistral.patch import (
|
|
26
|
+
chat_complete,
|
|
27
|
+
embeddings_create,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
logging.basicConfig(level=logging.FATAL)
|
|
31
|
+
|
|
32
|
+
class MistralInstrumentation(BaseInstrumentor):
|
|
33
|
+
|
|
34
|
+
def instrumentation_dependencies(self) -> Collection[str]:
|
|
35
|
+
return ["mistralai >= 1.0.1"]
|
|
36
|
+
|
|
37
|
+
def _instrument(self, **kwargs):
|
|
38
|
+
tracer_provider = kwargs.get("tracer_provider")
|
|
39
|
+
tracer = get_tracer(__name__, "", tracer_provider)
|
|
40
|
+
version = importlib.metadata.version("mistralai")
|
|
41
|
+
|
|
42
|
+
_W(
|
|
43
|
+
module="mistralai.chat",
|
|
44
|
+
name="Chat.complete",
|
|
45
|
+
wrapper=chat_complete("mistral.chat.complete", version, tracer),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
_W(
|
|
49
|
+
module="mistralai.chat",
|
|
50
|
+
name="Chat.stream",
|
|
51
|
+
wrapper=chat_complete("mistral.chat.stream", version, tracer, is_streaming=True),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
_W(
|
|
55
|
+
module="mistralai.chat",
|
|
56
|
+
name="Chat.complete_async",
|
|
57
|
+
wrapper=chat_complete("mistral.chat.complete_async", version, tracer, is_async=True),
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
_W(
|
|
61
|
+
module="mistralai.embeddings",
|
|
62
|
+
name="Embeddings.create",
|
|
63
|
+
wrapper=embeddings_create("mistral.embeddings.create", version, tracer),
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
_W(
|
|
67
|
+
module="mistralai.embeddings",
|
|
68
|
+
name="Embeddings.create_async",
|
|
69
|
+
wrapper=embeddings_create("mistral.embeddings.create_async", version, tracer, is_async=True),
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
def _uninstrument(self, **kwargs):
|
|
73
|
+
pass
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (c) 2024 Scale3 Labs
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
|
|
19
|
+
from langtrace.trace_attributes import (
|
|
20
|
+
LLMSpanAttributes,
|
|
21
|
+
SpanAttributes,
|
|
22
|
+
)
|
|
23
|
+
from langtrace_python_sdk.utils import set_span_attribute
|
|
24
|
+
from langtrace_python_sdk.utils.silently_fail import silently_fail
|
|
25
|
+
from opentelemetry import trace
|
|
26
|
+
from opentelemetry.trace import SpanKind
|
|
27
|
+
from opentelemetry.trace.status import Status, StatusCode
|
|
28
|
+
from opentelemetry.trace.propagation import set_span_in_context
|
|
29
|
+
from langtrace_python_sdk.constants.instrumentation.common import (
|
|
30
|
+
SERVICE_PROVIDERS,
|
|
31
|
+
)
|
|
32
|
+
from langtrace_python_sdk.constants.instrumentation.mistral import APIS
|
|
33
|
+
from langtrace_python_sdk.utils.llm import (
|
|
34
|
+
get_extra_attributes,
|
|
35
|
+
get_langtrace_attributes,
|
|
36
|
+
get_llm_request_attributes,
|
|
37
|
+
get_llm_url,
|
|
38
|
+
get_span_name,
|
|
39
|
+
set_event_completion,
|
|
40
|
+
StreamWrapper,
|
|
41
|
+
set_span_attributes,
|
|
42
|
+
set_usage_attributes,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
from langtrace_python_sdk.instrumentation.openai.patch import extract_content
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def chat_complete(original_method, version, tracer, is_async=False, is_streaming=False):
|
|
49
|
+
|
|
50
|
+
def traced_method(wrapped, instance, args, kwargs):
|
|
51
|
+
service_provider = SERVICE_PROVIDERS["MISTRAL"]
|
|
52
|
+
llm_prompts = []
|
|
53
|
+
for item in kwargs.get("messages", []):
|
|
54
|
+
llm_prompts.append(item)
|
|
55
|
+
|
|
56
|
+
api = "ASYNC_CHAT_COMPLETE" if is_async else "CHAT_COMPLETE"
|
|
57
|
+
|
|
58
|
+
span_attributes = {
|
|
59
|
+
**get_langtrace_attributes(version, service_provider, vendor_type="llm"),
|
|
60
|
+
**get_llm_request_attributes(kwargs, prompts=llm_prompts),
|
|
61
|
+
**get_llm_url(instance),
|
|
62
|
+
SpanAttributes.LLM_PATH: APIS[api]["ENDPOINT"],
|
|
63
|
+
**get_extra_attributes(),
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
attributes = LLMSpanAttributes(**span_attributes)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
span = tracer.start_span(
|
|
70
|
+
name=get_span_name(APIS[api]["METHOD"]),
|
|
71
|
+
kind=SpanKind.CLIENT,
|
|
72
|
+
context=set_span_in_context(trace.get_current_span()),
|
|
73
|
+
)
|
|
74
|
+
_set_input_attributes(span, kwargs, attributes)
|
|
75
|
+
|
|
76
|
+
try:
|
|
77
|
+
result = wrapped(*args, **kwargs)
|
|
78
|
+
if is_streaming:
|
|
79
|
+
return StreamWrapper(
|
|
80
|
+
result,
|
|
81
|
+
span,
|
|
82
|
+
function_call=kwargs.get("functions") is not None,
|
|
83
|
+
tool_calls=kwargs.get("tools") is not None,
|
|
84
|
+
)
|
|
85
|
+
else:
|
|
86
|
+
_set_response_attributes(span, kwargs, result)
|
|
87
|
+
span.set_status(StatusCode.OK)
|
|
88
|
+
span.end()
|
|
89
|
+
return result
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
except Exception as error:
|
|
93
|
+
span.record_exception(error)
|
|
94
|
+
span.set_status(Status(StatusCode.ERROR, str(error)))
|
|
95
|
+
span.end()
|
|
96
|
+
raise
|
|
97
|
+
|
|
98
|
+
return traced_method
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def embeddings_create(original_method, version, tracer, is_async=False):
|
|
102
|
+
"""
|
|
103
|
+
Wrap the `create` method of the `Embeddings` class to trace it.
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
def traced_method(wrapped, instance, args, kwargs):
|
|
107
|
+
service_provider = SERVICE_PROVIDERS["MISTRAL"]
|
|
108
|
+
|
|
109
|
+
api = "ASYNC_EMBEDDINGS_CREATE" if is_async else "EMBEDDINGS_CREATE"
|
|
110
|
+
|
|
111
|
+
span_attributes = {
|
|
112
|
+
**get_langtrace_attributes(version, service_provider, vendor_type="llm"),
|
|
113
|
+
**get_llm_request_attributes(kwargs, operation_name="embed"),
|
|
114
|
+
**get_llm_url(instance),
|
|
115
|
+
SpanAttributes.LLM_PATH: APIS[api]["ENDPOINT"],
|
|
116
|
+
SpanAttributes.LLM_REQUEST_DIMENSIONS: kwargs.get("dimensions"),
|
|
117
|
+
**get_extra_attributes(),
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
encoding_format = kwargs.get("encoding_format")
|
|
121
|
+
if encoding_format is not None:
|
|
122
|
+
if not isinstance(encoding_format, list):
|
|
123
|
+
encoding_format = [encoding_format]
|
|
124
|
+
span_attributes[SpanAttributes.LLM_REQUEST_ENCODING_FORMATS] = (
|
|
125
|
+
encoding_format
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
if kwargs.get("inputs") is not None:
|
|
129
|
+
span_attributes[SpanAttributes.LLM_REQUEST_EMBEDDING_INPUTS] = json.dumps(
|
|
130
|
+
[kwargs.get("inputs", [])]
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
attributes = LLMSpanAttributes(**span_attributes)
|
|
134
|
+
|
|
135
|
+
with tracer.start_as_current_span(
|
|
136
|
+
name=get_span_name(APIS[api]["METHOD"]),
|
|
137
|
+
kind=SpanKind.CLIENT,
|
|
138
|
+
context=set_span_in_context(trace.get_current_span()),
|
|
139
|
+
) as span:
|
|
140
|
+
|
|
141
|
+
set_span_attributes(span, attributes)
|
|
142
|
+
try:
|
|
143
|
+
# Attempt to call the original method
|
|
144
|
+
result = wrapped(*args, **kwargs)
|
|
145
|
+
span.set_status(StatusCode.OK)
|
|
146
|
+
return result
|
|
147
|
+
except Exception as err:
|
|
148
|
+
# Record the exception in the span
|
|
149
|
+
span.record_exception(err)
|
|
150
|
+
|
|
151
|
+
# Set the span status to indicate an error
|
|
152
|
+
span.set_status(Status(StatusCode.ERROR, str(err)))
|
|
153
|
+
|
|
154
|
+
# Reraise the exception to ensure it's not swallowed
|
|
155
|
+
raise err
|
|
156
|
+
|
|
157
|
+
return traced_method
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
@silently_fail
|
|
161
|
+
def _set_input_attributes(span, kwargs, attributes):
|
|
162
|
+
tools = []
|
|
163
|
+
for field, value in attributes.model_dump(by_alias=True).items():
|
|
164
|
+
set_span_attribute(span, field, value)
|
|
165
|
+
|
|
166
|
+
if kwargs.get("tools") is not None:
|
|
167
|
+
tools.append(json.dumps(kwargs.get("tools")))
|
|
168
|
+
|
|
169
|
+
if tools:
|
|
170
|
+
set_span_attribute(span, SpanAttributes.LLM_TOOLS, json.dumps(tools))
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
@silently_fail
|
|
174
|
+
def _set_response_attributes(span, kwargs, result):
|
|
175
|
+
set_span_attribute(span, SpanAttributes.LLM_RESPONSE_MODEL, result.model)
|
|
176
|
+
if hasattr(result, "choices") and result.choices is not None:
|
|
177
|
+
responses = [
|
|
178
|
+
{
|
|
179
|
+
"role": (
|
|
180
|
+
choice.message.role
|
|
181
|
+
if choice.message and choice.message.role
|
|
182
|
+
else "assistant"
|
|
183
|
+
),
|
|
184
|
+
"content": extract_content(choice),
|
|
185
|
+
}
|
|
186
|
+
for choice in result.choices
|
|
187
|
+
]
|
|
188
|
+
set_event_completion(span, responses)
|
|
189
|
+
|
|
190
|
+
# Get the usage
|
|
191
|
+
if hasattr(result, "usage") and result.usage is not None:
|
|
192
|
+
set_usage_attributes(span, result.usage)
|
{langtrace_python_sdk-2.2.25 → langtrace_python_sdk-2.2.27}/src/langtrace_python_sdk/langtrace.py
RENAMED
|
@@ -56,6 +56,7 @@ from langtrace_python_sdk.instrumentation import (
|
|
|
56
56
|
DspyInstrumentation,
|
|
57
57
|
VertexAIInstrumentation,
|
|
58
58
|
GeminiInstrumentation,
|
|
59
|
+
MistralInstrumentation,
|
|
59
60
|
)
|
|
60
61
|
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
|
|
61
62
|
from colorama import Fore
|
|
@@ -72,7 +73,7 @@ def init(
|
|
|
72
73
|
disable_instrumentations: Optional[DisableInstrumentations] = None,
|
|
73
74
|
disable_tracing_for_functions: Optional[InstrumentationMethods] = None,
|
|
74
75
|
service_name: Optional[str] = None,
|
|
75
|
-
disable_logging
|
|
76
|
+
disable_logging=False,
|
|
76
77
|
):
|
|
77
78
|
if disable_logging:
|
|
78
79
|
sys.stdout = open(os.devnull, "w")
|
|
@@ -93,7 +94,9 @@ def init(
|
|
|
93
94
|
provider = TracerProvider(resource=resource, sampler=sampler)
|
|
94
95
|
|
|
95
96
|
remote_write_exporter = (
|
|
96
|
-
LangTraceExporter(
|
|
97
|
+
LangTraceExporter(
|
|
98
|
+
api_key=api_key, api_host=host, disable_logging=disable_logging
|
|
99
|
+
)
|
|
97
100
|
if custom_remote_exporter is None
|
|
98
101
|
else custom_remote_exporter
|
|
99
102
|
)
|
|
@@ -125,6 +128,7 @@ def init(
|
|
|
125
128
|
"crewai": CrewAIInstrumentation(),
|
|
126
129
|
"vertexai": VertexAIInstrumentation(),
|
|
127
130
|
"gemini": GeminiInstrumentation(),
|
|
131
|
+
"mistral": MistralInstrumentation(),
|
|
128
132
|
}
|
|
129
133
|
|
|
130
134
|
init_instrumentations(disable_instrumentations, all_instrumentations)
|
|
@@ -7,6 +7,7 @@ class InstrumentationType(Enum):
|
|
|
7
7
|
COHERE = "cohere"
|
|
8
8
|
ANTHROPIC = "anthropic"
|
|
9
9
|
GROQ = "groq"
|
|
10
|
+
MISTRAL = "mistral"
|
|
10
11
|
PINECONE = "pinecone"
|
|
11
12
|
LLAMAINDEX = "llamaindex"
|
|
12
13
|
CHROMADB = "chromadb"
|
|
@@ -43,6 +44,11 @@ class VendorMethods(TypedDict):
|
|
|
43
44
|
"openai.images.generate",
|
|
44
45
|
"openai.images.edit",
|
|
45
46
|
]
|
|
47
|
+
MistralMethods = Literal[
|
|
48
|
+
"mistral.chat.complete",
|
|
49
|
+
"mistral.chat.stream",
|
|
50
|
+
"mistral.embeddings.create",
|
|
51
|
+
]
|
|
46
52
|
|
|
47
53
|
ChromadbMethods = Literal[
|
|
48
54
|
"chromadb.collection.add",
|
|
@@ -93,6 +99,7 @@ class VendorMethods(TypedDict):
|
|
|
93
99
|
class InstrumentationMethods(TypedDict):
|
|
94
100
|
open_ai: List[VendorMethods.OpenaiMethods]
|
|
95
101
|
groq: List[VendorMethods.GroqMethods]
|
|
102
|
+
mistral: List[VendorMethods.MistralMethods]
|
|
96
103
|
pinecone: List[VendorMethods.PineconeMethods]
|
|
97
104
|
llamaindex: List[VendorMethods.LlamaIndexMethods]
|
|
98
105
|
chromadb: List[VendorMethods.ChromadbMethods]
|