langtrace-python-sdk 3.1.3__tar.gz → 3.2.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/PKG-INFO +3 -2
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/pyproject.toml +3 -2
- langtrace_python_sdk-3.2.0/src/examples/awsbedrock_examples/__init__.py +10 -0
- langtrace_python_sdk-3.2.0/src/examples/awsbedrock_examples/converse.py +34 -0
- langtrace_python_sdk-3.2.0/src/langtrace_python_sdk/constants/instrumentation/aws_bedrock.py +12 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/common.py +2 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/__init__.py +2 -0
- langtrace_python_sdk-3.2.0/src/langtrace_python_sdk/instrumentation/aws_bedrock/__init__.py +3 -0
- langtrace_python_sdk-3.2.0/src/langtrace_python_sdk/instrumentation/aws_bedrock/instrumentation.py +58 -0
- langtrace_python_sdk-3.2.0/src/langtrace_python_sdk/instrumentation/aws_bedrock/patch.py +157 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/groq/patch.py +4 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/litellm/patch.py +4 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/openai/patch.py +4 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/langtrace.py +2 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/types/__init__.py +7 -0
- langtrace_python_sdk-3.2.0/src/langtrace_python_sdk/version.py +1 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/run_example.py +8 -1
- langtrace_python_sdk-3.1.3/src/langtrace_python_sdk/version.py +0 -1
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/.gitignore +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/LICENSE +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/README.md +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/anthropic_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/anthropic_example/completion.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/autogen_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/autogen_example/main.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/azureopenai_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/azureopenai_example/completion.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/chroma_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/chroma_example/basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/cohere_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/cohere_example/chat.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/cohere_example/chat_stream.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/cohere_example/embed.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/cohere_example/rerank.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/cohere_example/tools.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/instagram_post/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/instagram_post/agents.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/instagram_post/main.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/instagram_post/tasks.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/instagram_post/tools/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/instagram_post/tools/browser_tools.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/simple_agent/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/simple_agent/agents.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/simple_agent/main.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/simple_agent/tasks.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/trip_planner/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/trip_planner/agents.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/trip_planner/main.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/trip_planner/tasks.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/trip_planner/tools/calculator.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/trip_planner/tools/search_tools.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/dspy_example/QA_basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/dspy_example/QA_basic_with_chain_of_thought.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/dspy_example/QA_basic_with_signature.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/dspy_example/QA_multi_step_with_chain_of_thought.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/dspy_example/math_problems_cot.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/dspy_example/math_problems_cot_parallel.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/dspy_example/optimizers/bootstrap_fewshot.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/dspy_example/program_of_thought_basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/dspy_example/quiz_gen.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/dspy_example/react.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/embedchain_example/simple.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/fastapi_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/fastapi_example/basic_route.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/gemini_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/gemini_example/function_tools.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/gemini_example/main.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/hiveagent_example/basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/inspect_ai_example/basic_eval.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/langchain_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/langchain_example/basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/langchain_example/groq_example.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/langchain_example/langchain_google_example.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/langchain_example/langgraph_example.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/langchain_example/langgraph_example_tools.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/langchain_example/sagemaker.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/langchain_example/tool.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/litellm_example/basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/litellm_example/config.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/litellm_example/proxy_basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/llamaindex_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/llamaindex_example/agent.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/llamaindex_example/basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/llamaindex_example/data/abramov.txt +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/mistral_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/mistral_example/complete.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/mistral_example/complete_async.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/mistral_example/embeddings.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/ollama_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/ollama_example/basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/async_tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/async_tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/chat_completion.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/chat_completion_tool_choice.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/embeddings_create.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/function_calling.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/images_edit.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/images_generate.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/resources/lounge_flamingo.png +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/resources/mask.png +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/send_user_feedback.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/tool_calling.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/openai_example/tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/otlp_example/otlp_basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/otlp_example/otlp_with_langtrace.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/perplexity_example/basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/pinecone_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/pinecone_example/basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/qdrant_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/qdrant_example/basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/routellm_example/basic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/vertexai_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/vertexai_example/main.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/weaviate_example/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/weaviate_example/query_text.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/exporter/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/anthropic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/chroma.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/cohere.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/embedchain.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/gemini.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/groq.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/litellm.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/mistral.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/ollama.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/openai.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/pinecone.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/qdrant.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/vertexai.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/constants/instrumentation/weaviate.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/extensions/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/extensions/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/extensions/langtrace_filesystem.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/anthropic/types.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/autogen/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/autogen/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/autogen/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/chroma/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/chroma/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/cohere/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/cohere/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/cohere/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/crewai/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/crewai/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/crewai/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/dspy/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/dspy/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/dspy/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/embedchain/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/embedchain/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/embedchain/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/gemini/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/gemini/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/gemini/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/groq/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/groq/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/langchain/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/langchain_community/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/langchain_core/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/langgraph/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/langgraph/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/langgraph/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/litellm/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/litellm/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/litellm/types.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/llamaindex/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/mistral/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/mistral/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/mistral/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/ollama/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/ollama/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/ollama/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/openai/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/openai/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/openai/types.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/pinecone/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/qdrant/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/qdrant/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/qdrant/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/vertexai/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/vertexai/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/vertexai/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/weaviate/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/weaviate/instrumentation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/instrumentation/weaviate/patch.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/utils/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/utils/langtrace_sampler.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/utils/llm.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/utils/misc.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/utils/prompt_registry.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/utils/sdk_version_checker.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/utils/silently_fail.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/utils/types.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/utils/with_root_span.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/__init__.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/anthropic/cassettes/test_anthropic.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/anthropic/cassettes/test_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/anthropic/cassettes/test_async_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/anthropic/conftest.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/anthropic/test_anthropic.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/chroma/conftest.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/chroma/test_chroma.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/cohere/cassettes/test_cohere_chat.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/cohere/cassettes/test_cohere_chat_streaming.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/cohere/cassettes/test_cohere_embed.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/cohere/cassettes/test_cohere_rerank.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/cohere/conftest.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/cohere/test_cohere_chat.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/cohere/test_cohere_embed.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/cohere/test_cohere_rerank.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/conftest.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/groq/cassettes/test_async_chat_completion.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/groq/cassettes/test_async_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/groq/cassettes/test_chat_completion.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/groq/cassettes/test_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/groq/conftest.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/groq/test_groq.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/langchain/cassettes/test_langchain.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/langchain/conftest.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/langchain/test_langchain.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/openai/cassettes/test_async_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/openai/cassettes/test_async_image_generation.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/openai/cassettes/test_chat_completion.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/openai/cassettes/test_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/openai/cassettes/test_image_generation.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/openai/conftest.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/openai/test_chat_completion.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/openai/test_embeddings.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/openai/test_image_generation.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/pinecone/cassettes/test_query.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/pinecone/cassettes/test_upsert.yaml +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/pinecone/conftest.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/pinecone/test_pinecone.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/qdrant/conftest.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/qdrant/test_qdrant.py +0 -0
- {langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: langtrace-python-sdk
|
3
|
-
Version: 3.
|
3
|
+
Version: 3.2.0
|
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>
|
@@ -21,11 +21,12 @@ Requires-Dist: opentelemetry-sdk>=1.25.0
|
|
21
21
|
Requires-Dist: sentry-sdk>=2.14.0
|
22
22
|
Requires-Dist: sqlalchemy
|
23
23
|
Requires-Dist: tiktoken>=0.1.1
|
24
|
-
Requires-Dist: trace-attributes==7.0
|
24
|
+
Requires-Dist: trace-attributes==7.1.0
|
25
25
|
Requires-Dist: transformers>=4.11.3
|
26
26
|
Requires-Dist: ujson>=5.10.0
|
27
27
|
Provides-Extra: dev
|
28
28
|
Requires-Dist: anthropic; extra == 'dev'
|
29
|
+
Requires-Dist: boto3; extra == 'dev'
|
29
30
|
Requires-Dist: chromadb; extra == 'dev'
|
30
31
|
Requires-Dist: cohere; extra == 'dev'
|
31
32
|
Requires-Dist: embedchain; extra == 'dev'
|
@@ -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.1.0',
|
22
22
|
'opentelemetry-api>=1.25.0',
|
23
23
|
'opentelemetry-sdk>=1.25.0',
|
24
24
|
'opentelemetry-instrumentation>=0.47b0',
|
@@ -57,7 +57,8 @@ dev = [
|
|
57
57
|
"google-generativeai",
|
58
58
|
"google-cloud-aiplatform",
|
59
59
|
"mistralai",
|
60
|
-
"
|
60
|
+
"boto3",
|
61
|
+
"embedchain",
|
61
62
|
]
|
62
63
|
|
63
64
|
test = ["pytest", "pytest-vcr", "pytest-asyncio"]
|
@@ -0,0 +1,10 @@
|
|
1
|
+
from examples.awsbedrock_examples.converse import use_converse
|
2
|
+
from langtrace_python_sdk import langtrace, with_langtrace_root_span
|
3
|
+
|
4
|
+
langtrace.init()
|
5
|
+
|
6
|
+
|
7
|
+
class AWSBedrockRunner:
|
8
|
+
@with_langtrace_root_span("AWS_Bedrock")
|
9
|
+
def run(self):
|
10
|
+
use_converse()
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import os
|
2
|
+
import boto3
|
3
|
+
from langtrace_python_sdk import langtrace
|
4
|
+
|
5
|
+
langtrace.init(api_key=os.environ["LANGTRACE_API_KEY"])
|
6
|
+
|
7
|
+
def use_converse():
|
8
|
+
model_id = "anthropic.claude-3-haiku-20240307-v1:0"
|
9
|
+
client = boto3.client(
|
10
|
+
"bedrock-runtime",
|
11
|
+
region_name="us-east-1",
|
12
|
+
aws_access_key_id=os.environ["AWS_ACCESS_KEY_ID"],
|
13
|
+
aws_secret_access_key=os.environ["AWS_SECRET_ACCESS_KEY"],
|
14
|
+
)
|
15
|
+
conversation = [
|
16
|
+
{
|
17
|
+
"role": "user",
|
18
|
+
"content": [{"text": "Write a story about a magic backpack."}],
|
19
|
+
}
|
20
|
+
]
|
21
|
+
|
22
|
+
try:
|
23
|
+
response = client.converse(
|
24
|
+
modelId=model_id,
|
25
|
+
messages=conversation,
|
26
|
+
inferenceConfig={"maxTokens":4096,"temperature":0},
|
27
|
+
additionalModelRequestFields={"top_k":250}
|
28
|
+
)
|
29
|
+
response_text = response["output"]["message"]["content"][0]["text"]
|
30
|
+
print(response_text)
|
31
|
+
|
32
|
+
except (Exception) as e:
|
33
|
+
print(f"ERROR: Can't invoke '{model_id}'. Reason: {e}")
|
34
|
+
exit(1)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
from langtrace.trace_attributes import AWSBedrockMethods
|
2
|
+
|
3
|
+
APIS = {
|
4
|
+
"CONVERSE": {
|
5
|
+
"METHOD": AWSBedrockMethods.CONVERSE.value,
|
6
|
+
"ENDPOINT": "/converse",
|
7
|
+
},
|
8
|
+
"CONVERSE_STREAM": {
|
9
|
+
"METHOD": AWSBedrockMethods.CONVERSE_STREAM.value,
|
10
|
+
"ENDPOINT": "/converse-stream",
|
11
|
+
},
|
12
|
+
}
|
@@ -18,6 +18,7 @@ from .autogen import AutogenInstrumentation
|
|
18
18
|
from .vertexai import VertexAIInstrumentation
|
19
19
|
from .gemini import GeminiInstrumentation
|
20
20
|
from .mistral import MistralInstrumentation
|
21
|
+
from .aws_bedrock import AWSBedrockInstrumentation
|
21
22
|
from .embedchain import EmbedchainInstrumentation
|
22
23
|
from .litellm import LiteLLMInstrumentation
|
23
24
|
|
@@ -44,4 +45,5 @@ __all__ = [
|
|
44
45
|
"VertexAIInstrumentation",
|
45
46
|
"GeminiInstrumentation",
|
46
47
|
"MistralInstrumentation",
|
48
|
+
"AWSBedrockInstrumentation",
|
47
49
|
]
|
langtrace_python_sdk-3.2.0/src/langtrace_python_sdk/instrumentation/aws_bedrock/instrumentation.py
ADDED
@@ -0,0 +1,58 @@
|
|
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.aws_bedrock.patch import (
|
26
|
+
converse, converse_stream
|
27
|
+
)
|
28
|
+
|
29
|
+
logging.basicConfig(level=logging.FATAL)
|
30
|
+
|
31
|
+
def _patch_client(client, version: str, tracer) -> None:
|
32
|
+
|
33
|
+
# Store original methods
|
34
|
+
original_converse = client.converse
|
35
|
+
|
36
|
+
# Replace with wrapped versions
|
37
|
+
client.converse = converse("aws_bedrock.converse", version, tracer)(original_converse)
|
38
|
+
|
39
|
+
class AWSBedrockInstrumentation(BaseInstrumentor):
|
40
|
+
|
41
|
+
def instrumentation_dependencies(self) -> Collection[str]:
|
42
|
+
return ["boto3 >= 1.35.31"]
|
43
|
+
|
44
|
+
def _instrument(self, **kwargs):
|
45
|
+
tracer_provider = kwargs.get("tracer_provider")
|
46
|
+
tracer = get_tracer(__name__, "", tracer_provider)
|
47
|
+
version = importlib.metadata.version("boto3")
|
48
|
+
|
49
|
+
def wrap_create_client(wrapped, instance, args, kwargs):
|
50
|
+
result = wrapped(*args, **kwargs)
|
51
|
+
if args and args[0] == 'bedrock-runtime':
|
52
|
+
_patch_client(result, version, tracer)
|
53
|
+
return result
|
54
|
+
|
55
|
+
_W("boto3", "client", wrap_create_client)
|
56
|
+
|
57
|
+
def _uninstrument(self, **kwargs):
|
58
|
+
pass
|
@@ -0,0 +1,157 @@
|
|
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
|
+
from functools import wraps
|
19
|
+
|
20
|
+
from langtrace.trace_attributes import (
|
21
|
+
LLMSpanAttributes,
|
22
|
+
SpanAttributes,
|
23
|
+
)
|
24
|
+
from langtrace_python_sdk.utils import set_span_attribute
|
25
|
+
from langtrace_python_sdk.utils.silently_fail import silently_fail
|
26
|
+
from opentelemetry import trace
|
27
|
+
from opentelemetry.trace import SpanKind
|
28
|
+
from opentelemetry.trace.status import Status, StatusCode
|
29
|
+
from opentelemetry.trace.propagation import set_span_in_context
|
30
|
+
from langtrace_python_sdk.constants.instrumentation.common import (
|
31
|
+
SERVICE_PROVIDERS,
|
32
|
+
)
|
33
|
+
from langtrace_python_sdk.constants.instrumentation.aws_bedrock import APIS
|
34
|
+
from langtrace_python_sdk.utils.llm import (
|
35
|
+
get_extra_attributes,
|
36
|
+
get_langtrace_attributes,
|
37
|
+
get_llm_request_attributes,
|
38
|
+
get_llm_url,
|
39
|
+
get_span_name,
|
40
|
+
set_event_completion,
|
41
|
+
set_span_attributes,
|
42
|
+
)
|
43
|
+
|
44
|
+
|
45
|
+
def traced_aws_bedrock_call(api_name: str, operation_name: str):
|
46
|
+
def decorator(method_name: str, version: str, tracer):
|
47
|
+
def wrapper(original_method):
|
48
|
+
@wraps(original_method)
|
49
|
+
def wrapped_method(*args, **kwargs):
|
50
|
+
service_provider = SERVICE_PROVIDERS["AWS_BEDROCK"]
|
51
|
+
|
52
|
+
input_content = [
|
53
|
+
{
|
54
|
+
'role': message.get('role', 'user'),
|
55
|
+
'content': message.get('content', [])[0].get('text', "")
|
56
|
+
}
|
57
|
+
for message in kwargs.get('messages', [])
|
58
|
+
]
|
59
|
+
|
60
|
+
span_attributes = {
|
61
|
+
**get_langtrace_attributes(version, service_provider, vendor_type="framework"),
|
62
|
+
**get_llm_request_attributes(kwargs, operation_name=operation_name, prompts=input_content),
|
63
|
+
**get_llm_url(args[0] if args else None),
|
64
|
+
SpanAttributes.LLM_PATH: APIS[api_name]["ENDPOINT"],
|
65
|
+
**get_extra_attributes(),
|
66
|
+
}
|
67
|
+
|
68
|
+
if api_name == "CONVERSE":
|
69
|
+
span_attributes.update({
|
70
|
+
SpanAttributes.LLM_REQUEST_MODEL: kwargs.get('modelId'),
|
71
|
+
SpanAttributes.LLM_REQUEST_MAX_TOKENS: kwargs.get('inferenceConfig', {}).get('maxTokens'),
|
72
|
+
SpanAttributes.LLM_REQUEST_TEMPERATURE: kwargs.get('inferenceConfig', {}).get('temperature'),
|
73
|
+
SpanAttributes.LLM_REQUEST_TOP_P: kwargs.get('inferenceConfig', {}).get('top_p'),
|
74
|
+
})
|
75
|
+
|
76
|
+
attributes = LLMSpanAttributes(**span_attributes)
|
77
|
+
|
78
|
+
with tracer.start_as_current_span(
|
79
|
+
name=get_span_name(APIS[api_name]["METHOD"]),
|
80
|
+
kind=SpanKind.CLIENT,
|
81
|
+
context=set_span_in_context(trace.get_current_span()),
|
82
|
+
) as span:
|
83
|
+
set_span_attributes(span, attributes)
|
84
|
+
try:
|
85
|
+
result = original_method(*args, **kwargs)
|
86
|
+
_set_response_attributes(span, kwargs, result)
|
87
|
+
span.set_status(StatusCode.OK)
|
88
|
+
return result
|
89
|
+
except Exception as err:
|
90
|
+
span.record_exception(err)
|
91
|
+
span.set_status(Status(StatusCode.ERROR, str(err)))
|
92
|
+
raise err
|
93
|
+
|
94
|
+
return wrapped_method
|
95
|
+
return wrapper
|
96
|
+
return decorator
|
97
|
+
|
98
|
+
|
99
|
+
converse = traced_aws_bedrock_call("CONVERSE", "converse")
|
100
|
+
|
101
|
+
|
102
|
+
def converse_stream(original_method, version, tracer):
|
103
|
+
def traced_method(wrapped, instance, args, kwargs):
|
104
|
+
service_provider = SERVICE_PROVIDERS["AWS_BEDROCK"]
|
105
|
+
|
106
|
+
span_attributes = {
|
107
|
+
**get_langtrace_attributes
|
108
|
+
(version, service_provider, vendor_type="llm"),
|
109
|
+
**get_llm_request_attributes(kwargs),
|
110
|
+
**get_llm_url(instance),
|
111
|
+
SpanAttributes.LLM_PATH: APIS["CONVERSE_STREAM"]["ENDPOINT"],
|
112
|
+
**get_extra_attributes(),
|
113
|
+
}
|
114
|
+
|
115
|
+
attributes = LLMSpanAttributes(**span_attributes)
|
116
|
+
|
117
|
+
with tracer.start_as_current_span(
|
118
|
+
name=get_span_name(APIS["CONVERSE_STREAM"]["METHOD"]),
|
119
|
+
kind=SpanKind.CLIENT,
|
120
|
+
context=set_span_in_context(trace.get_current_span()),
|
121
|
+
) as span:
|
122
|
+
set_span_attributes(span, attributes)
|
123
|
+
try:
|
124
|
+
result = wrapped(*args, **kwargs)
|
125
|
+
_set_response_attributes(span, kwargs, result)
|
126
|
+
span.set_status(StatusCode.OK)
|
127
|
+
return result
|
128
|
+
except Exception as err:
|
129
|
+
span.record_exception(err)
|
130
|
+
span.set_status(Status(StatusCode.ERROR, str(err)))
|
131
|
+
raise err
|
132
|
+
|
133
|
+
return traced_method
|
134
|
+
|
135
|
+
|
136
|
+
@silently_fail
|
137
|
+
def _set_response_attributes(span, kwargs, result):
|
138
|
+
set_span_attribute(span, SpanAttributes.LLM_RESPONSE_MODEL, kwargs.get('modelId'))
|
139
|
+
set_span_attribute(span, SpanAttributes.LLM_TOP_K, kwargs.get('additionalModelRequestFields', {}).get('top_k'))
|
140
|
+
content = result.get('output', {}).get('message', {}).get('content', [])
|
141
|
+
if len(content) > 0:
|
142
|
+
role = result.get('output', {}).get('message', {}).get('role', "assistant")
|
143
|
+
responses = [
|
144
|
+
{"role": role, "content": c.get('text', "")}
|
145
|
+
for c in content
|
146
|
+
]
|
147
|
+
set_event_completion(span, responses)
|
148
|
+
|
149
|
+
if 'usage' in result:
|
150
|
+
set_span_attributes(
|
151
|
+
span,
|
152
|
+
{
|
153
|
+
SpanAttributes.LLM_USAGE_COMPLETION_TOKENS: result['usage'].get('outputTokens'),
|
154
|
+
SpanAttributes.LLM_USAGE_PROMPT_TOKENS: result['usage'].get('inputTokens'),
|
155
|
+
SpanAttributes.LLM_USAGE_TOTAL_TOKENS: result['usage'].get('totalTokens'),
|
156
|
+
}
|
157
|
+
)
|
@@ -55,6 +55,8 @@ def chat_completions_create(original_method, version, tracer):
|
|
55
55
|
service_provider = SERVICE_PROVIDERS["PPLX"]
|
56
56
|
elif "azure" in get_base_url(instance):
|
57
57
|
service_provider = SERVICE_PROVIDERS["AZURE"]
|
58
|
+
elif "x.ai" in get_base_url(instance):
|
59
|
+
service_provider = SERVICE_PROVIDERS["XAI"]
|
58
60
|
|
59
61
|
# handle tool calls in the kwargs
|
60
62
|
llm_prompts = []
|
@@ -274,6 +276,8 @@ def async_chat_completions_create(original_method, version, tracer):
|
|
274
276
|
service_provider = SERVICE_PROVIDERS["PPLX"]
|
275
277
|
elif "azure" in get_base_url(instance):
|
276
278
|
service_provider = SERVICE_PROVIDERS["AZURE"]
|
279
|
+
elif "x.ai" in get_base_url(instance):
|
280
|
+
service_provider = SERVICE_PROVIDERS["XAI"]
|
277
281
|
|
278
282
|
# handle tool calls in the kwargs
|
279
283
|
llm_prompts = []
|
@@ -248,6 +248,8 @@ def chat_completions_create(version: str, tracer: Tracer) -> Callable:
|
|
248
248
|
service_provider = SERVICE_PROVIDERS["AZURE"]
|
249
249
|
elif "groq" in get_base_url(instance):
|
250
250
|
service_provider = SERVICE_PROVIDERS["GROQ"]
|
251
|
+
elif "x.ai" in get_base_url(instance):
|
252
|
+
service_provider = SERVICE_PROVIDERS["XAI"]
|
251
253
|
llm_prompts = []
|
252
254
|
for item in kwargs.get("messages", []):
|
253
255
|
tools = get_tool_calls(item)
|
@@ -336,6 +338,8 @@ def async_chat_completions_create(version: str, tracer: Tracer) -> Callable:
|
|
336
338
|
service_provider = SERVICE_PROVIDERS["PPLX"]
|
337
339
|
elif "azure" in get_base_url(instance):
|
338
340
|
service_provider = SERVICE_PROVIDERS["AZURE"]
|
341
|
+
elif "x.ai" in get_base_url(instance):
|
342
|
+
service_provider = SERVICE_PROVIDERS["XAI"]
|
339
343
|
llm_prompts = []
|
340
344
|
for item in kwargs.get("messages", []):
|
341
345
|
tools = get_tool_calls(item)
|
@@ -249,6 +249,8 @@ def chat_completions_create(version: str, tracer: Tracer) -> Callable:
|
|
249
249
|
service_provider = SERVICE_PROVIDERS["AZURE"]
|
250
250
|
elif "groq" in get_base_url(instance):
|
251
251
|
service_provider = SERVICE_PROVIDERS["GROQ"]
|
252
|
+
elif "x.ai" in get_base_url(instance):
|
253
|
+
service_provider = SERVICE_PROVIDERS["XAI"]
|
252
254
|
llm_prompts = []
|
253
255
|
for item in kwargs.get("messages", []):
|
254
256
|
tools = get_tool_calls(item)
|
@@ -337,6 +339,8 @@ def async_chat_completions_create(version: str, tracer: Tracer) -> Callable:
|
|
337
339
|
service_provider = SERVICE_PROVIDERS["PPLX"]
|
338
340
|
elif "azure" in get_base_url(instance):
|
339
341
|
service_provider = SERVICE_PROVIDERS["AZURE"]
|
342
|
+
elif "x.ai" in get_base_url(instance):
|
343
|
+
service_provider = SERVICE_PROVIDERS["XAI"]
|
340
344
|
llm_prompts = []
|
341
345
|
for item in kwargs.get("messages", []):
|
342
346
|
tools = get_tool_calls(item)
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/langtrace.py
RENAMED
@@ -56,6 +56,7 @@ from langtrace_python_sdk.instrumentation import (
|
|
56
56
|
LiteLLMInstrumentation,
|
57
57
|
LlamaindexInstrumentation,
|
58
58
|
MistralInstrumentation,
|
59
|
+
AWSBedrockInstrumentation,
|
59
60
|
OllamaInstrumentor,
|
60
61
|
OpenAIInstrumentation,
|
61
62
|
PineconeInstrumentation,
|
@@ -278,6 +279,7 @@ def init(
|
|
278
279
|
"google-cloud-aiplatform": VertexAIInstrumentation(),
|
279
280
|
"google-generativeai": GeminiInstrumentation(),
|
280
281
|
"mistralai": MistralInstrumentation(),
|
282
|
+
"boto3": AWSBedrockInstrumentation(),
|
281
283
|
"autogen": AutogenInstrumentation(),
|
282
284
|
}
|
283
285
|
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/langtrace_python_sdk/types/__init__.py
RENAMED
@@ -30,6 +30,7 @@ class InstrumentationType(Enum):
|
|
30
30
|
SQLALCHEMY = "sqlalchemy"
|
31
31
|
VERTEXAI = "vertexai"
|
32
32
|
WEAVIATE = "weaviate"
|
33
|
+
AWS_BEDROCK = "boto3"
|
33
34
|
|
34
35
|
@staticmethod
|
35
36
|
def from_string(value: str):
|
@@ -62,6 +63,11 @@ class VendorMethods(TypedDict):
|
|
62
63
|
"mistral.embeddings.create",
|
63
64
|
]
|
64
65
|
|
66
|
+
AwsBedrockMethods = Literal[
|
67
|
+
"aws_bedrock.converse",
|
68
|
+
"aws_bedrock.converse_stream",
|
69
|
+
]
|
70
|
+
|
65
71
|
ChromadbMethods = Literal[
|
66
72
|
"chromadb.collection.add",
|
67
73
|
"chromadb.collection.query",
|
@@ -112,6 +118,7 @@ class InstrumentationMethods(TypedDict):
|
|
112
118
|
open_ai: List[VendorMethods.OpenaiMethods]
|
113
119
|
groq: List[VendorMethods.GroqMethods]
|
114
120
|
mistral: List[VendorMethods.MistralMethods]
|
121
|
+
aws_bedrock: List[VendorMethods.AwsBedrockMethods]
|
115
122
|
pinecone: List[VendorMethods.PineconeMethods]
|
116
123
|
llamaindex: List[VendorMethods.LlamaIndexMethods]
|
117
124
|
chromadb: List[VendorMethods.ChromadbMethods]
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "3.2.0"
|
@@ -16,10 +16,11 @@ ENABLED_EXAMPLES = {
|
|
16
16
|
"weaviate": False,
|
17
17
|
"ollama": False,
|
18
18
|
"groq": False,
|
19
|
-
"autogen":
|
19
|
+
"autogen": False,
|
20
20
|
"vertexai": False,
|
21
21
|
"gemini": False,
|
22
22
|
"mistral": False,
|
23
|
+
"awsbedrock": True,
|
23
24
|
}
|
24
25
|
|
25
26
|
if ENABLED_EXAMPLES["anthropic"]:
|
@@ -123,3 +124,9 @@ if ENABLED_EXAMPLES["azureopenai"]:
|
|
123
124
|
|
124
125
|
print(Fore.BLUE + "Running Azure OpenAI example" + Fore.RESET)
|
125
126
|
AzureOpenAIRunner().run()
|
127
|
+
|
128
|
+
if ENABLED_EXAMPLES["awsbedrock"]:
|
129
|
+
from examples.awsbedrock_examples import AWSBedrockRunner
|
130
|
+
|
131
|
+
print(Fore.BLUE + "Running AWS Bedrock example" + Fore.RESET)
|
132
|
+
AWSBedrockRunner().run()
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = "3.1.3"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/anthropic_example/__init__.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/autogen_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/autogen_example/main.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/chroma_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/chroma_example/basic.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/cohere_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/cohere_example/chat.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/cohere_example/chat_stream.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/cohere_example/embed.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/cohere_example/rerank.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/cohere_example/tools.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/crewai_example/basic.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/dspy_example/QA_basic.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/dspy_example/quiz_gen.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/dspy_example/react.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/embedchain_example/simple.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/fastapi_example/__init__.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/gemini_example/__init__.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/gemini_example/main.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/hiveagent_example/basic.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/langchain_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.1.3 → langtrace_python_sdk-3.2.0}/src/examples/langchain_example/basic.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|