langtrace-python-sdk 2.2.31__tar.gz → 2.3.1__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.31 → langtrace_python_sdk-2.3.1}/PKG-INFO +3 -1
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/README.md +1 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/pyproject.toml +1 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/crewai_example/simple_agent/agents.py +27 -4
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/crewai_example/simple_agent/main.py +9 -4
- langtrace_python_sdk-2.3.1/src/examples/embedchain_example/simple.py +15 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/instrumentation/common.py +1 -0
- langtrace_python_sdk-2.3.1/src/langtrace_python_sdk/constants/instrumentation/embedchain.py +14 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/__init__.py +2 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/chroma/patch.py +1 -1
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/crewai/instrumentation.py +18 -2
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/crewai/patch.py +70 -84
- langtrace_python_sdk-2.3.1/src/langtrace_python_sdk/instrumentation/embedchain/__init__.py +5 -0
- langtrace_python_sdk-2.3.1/src/langtrace_python_sdk/instrumentation/embedchain/instrumentation.py +65 -0
- langtrace_python_sdk-2.3.1/src/langtrace_python_sdk/instrumentation/embedchain/patch.py +96 -0
- langtrace_python_sdk-2.3.1/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +109 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/langchain/patch.py +6 -1
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +2 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/langtrace.py +2 -0
- langtrace_python_sdk-2.3.1/src/langtrace_python_sdk/utils/misc.py +62 -0
- langtrace_python_sdk-2.3.1/src/langtrace_python_sdk/version.py +1 -0
- langtrace_python_sdk-2.2.31/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +0 -96
- langtrace_python_sdk-2.2.31/src/langtrace_python_sdk/utils/misc.py +0 -30
- langtrace_python_sdk-2.2.31/src/langtrace_python_sdk/version.py +0 -1
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/.gitignore +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/LICENSE +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/anthropic_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/anthropic_example/completion.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/chroma_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/chroma_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/cohere_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/cohere_example/chat.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/cohere_example/chat_stream.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/cohere_example/embed.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/cohere_example/rerank.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/cohere_example/tools.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/crewai_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/crewai_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/crewai_example/simple_agent/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/crewai_example/simple_agent/tasks.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/crewai_example/trip_planner/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/crewai_example/trip_planner/agents.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/crewai_example/trip_planner/main.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/crewai_example/trip_planner/tasks.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/crewai_example/trip_planner/tools/calculator.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/crewai_example/trip_planner/tools/search_tools.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/dspy_example/math_problems_cot.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/dspy_example/math_problems_cot_parallel.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/dspy_example/program_of_thought_basic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/dspy_example/quiz_gen.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/dspy_example/react.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/fastapi_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/fastapi_example/basic_route.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/gemini_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/gemini_example/function_tools.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/gemini_example/main.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/hiveagent_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/inspect_ai_example/basic_eval.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/langchain_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/langchain_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/langchain_example/groq_example.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/langchain_example/langgraph_example.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/langchain_example/sagemaker.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/langchain_example/tool.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/litellm_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/llamaindex_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/llamaindex_example/agent.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/llamaindex_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/llamaindex_example/data/abramov.txt +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/mistral_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/mistral_example/complete.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/mistral_example/complete_async.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/mistral_example/embeddings.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/ollama_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/ollama_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/async_tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/async_tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/chat_completion.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/chat_completion_tool_choice.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/embeddings_create.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/function_calling.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/images_edit.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/images_generate.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/resources/lounge_flamingo.png +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/resources/mask.png +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/send_user_feedback.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/tool_calling.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/openai_example/tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/otlp_example/otlp_basic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/otlp_example/otlp_with_langtrace.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/perplexity_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/pinecone_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/pinecone_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/qdrant_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/qdrant_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/routellm_example/basic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/vertexai_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/vertexai_example/main.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/weaviate_example/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/examples/weaviate_example/query_text.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/exporter/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/instrumentation/anthropic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/instrumentation/chroma.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/instrumentation/cohere.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/instrumentation/gemini.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/instrumentation/groq.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/instrumentation/mistral.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/instrumentation/ollama.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/instrumentation/openai.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/instrumentation/pinecone.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/instrumentation/qdrant.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/instrumentation/vertexai.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/constants/instrumentation/weaviate.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/extensions/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/extensions/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/extensions/langtrace_filesystem.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/chroma/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/cohere/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/cohere/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/cohere/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/crewai/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/dspy/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/dspy/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/dspy/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/gemini/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/gemini/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/gemini/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/groq/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/groq/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/groq/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/langchain_community/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/langchain_core/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/langgraph/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/langgraph/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/langgraph/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/llamaindex/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/mistral/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/mistral/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/mistral/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/ollama/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/ollama/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/ollama/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/openai/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/openai/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/openai/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/pinecone/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/qdrant/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/qdrant/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/qdrant/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/vertexai/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/vertexai/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/vertexai/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/weaviate/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/weaviate/instrumentation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/instrumentation/weaviate/patch.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/types/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/utils/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/utils/langtrace_sampler.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/utils/llm.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/utils/prompt_registry.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/utils/sdk_version_checker.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/utils/silently_fail.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/utils/types.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/langtrace_python_sdk/utils/with_root_span.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/run_example.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/__init__.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/anthropic/cassettes/test_anthropic.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/anthropic/cassettes/test_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/anthropic/cassettes/test_async_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/anthropic/conftest.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/anthropic/test_anthropic.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/chroma/conftest.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/chroma/test_chroma.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/cohere/cassettes/test_cohere_chat.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/cohere/cassettes/test_cohere_chat_streaming.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/cohere/cassettes/test_cohere_embed.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/cohere/cassettes/test_cohere_rerank.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/cohere/conftest.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/cohere/test_cohere_chat.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/cohere/test_cohere_embed.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/cohere/test_cohere_rerank.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/conftest.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/groq/cassettes/test_async_chat_completion.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/groq/cassettes/test_async_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/groq/cassettes/test_chat_completion.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/groq/cassettes/test_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/groq/conftest.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/groq/test_groq.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/langchain/cassettes/test_langchain.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/langchain/conftest.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/langchain/test_langchain.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/openai/cassettes/test_async_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/openai/cassettes/test_async_image_generation.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/openai/cassettes/test_chat_completion.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/openai/cassettes/test_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/openai/cassettes/test_image_generation.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/openai/conftest.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/openai/test_chat_completion.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/openai/test_embeddings.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/openai/test_image_generation.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/pinecone/cassettes/test_query.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/pinecone/cassettes/test_upsert.yaml +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/pinecone/conftest.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/pinecone/test_pinecone.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/qdrant/conftest.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/src/tests/qdrant/test_qdrant.py +0 -0
- {langtrace_python_sdk-2.2.31 → langtrace_python_sdk-2.3.1}/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.
|
|
3
|
+
Version: 2.3.1
|
|
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>
|
|
@@ -26,6 +26,7 @@ Provides-Extra: dev
|
|
|
26
26
|
Requires-Dist: anthropic; extra == 'dev'
|
|
27
27
|
Requires-Dist: chromadb; extra == 'dev'
|
|
28
28
|
Requires-Dist: cohere; extra == 'dev'
|
|
29
|
+
Requires-Dist: embedchain; extra == 'dev'
|
|
29
30
|
Requires-Dist: google-cloud-aiplatform; extra == 'dev'
|
|
30
31
|
Requires-Dist: google-generativeai; extra == 'dev'
|
|
31
32
|
Requires-Dist: groq; extra == 'dev'
|
|
@@ -302,6 +303,7 @@ Langtrace automatically captures traces from the following vendors:
|
|
|
302
303
|
| Ollama | Framework | :x: | :white_check_mark: |
|
|
303
304
|
| VertexAI | Framework | :x: | :white_check_mark: |
|
|
304
305
|
| Vercel AI SDK| Framework | :white_check_mark: | :x: |
|
|
306
|
+
| EmbedChain | Framework | :x: | :white_check_mark: |
|
|
305
307
|
| Pinecone | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
306
308
|
| ChromaDB | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
307
309
|
| QDrant | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
@@ -255,6 +255,7 @@ Langtrace automatically captures traces from the following vendors:
|
|
|
255
255
|
| Ollama | Framework | :x: | :white_check_mark: |
|
|
256
256
|
| VertexAI | Framework | :x: | :white_check_mark: |
|
|
257
257
|
| Vercel AI SDK| Framework | :white_check_mark: | :x: |
|
|
258
|
+
| EmbedChain | Framework | :x: | :white_check_mark: |
|
|
258
259
|
| Pinecone | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
259
260
|
| ChromaDB | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
260
261
|
| QDrant | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
from crewai import Agent
|
|
2
|
-
from langchain_openai import ChatOpenAI
|
|
3
2
|
from langchain_anthropic import ChatAnthropic
|
|
4
3
|
from langchain_cohere import ChatCohere
|
|
5
4
|
from langchain_ollama import ChatOllama
|
|
5
|
+
from langchain_openai import ChatOpenAI
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class PoetryAgents:
|
|
9
9
|
def __init__(self):
|
|
10
|
-
self.open_ai = ChatOpenAI(
|
|
11
|
-
model_name="gpt-4", temperature=0.7, stream_usage=True
|
|
12
|
-
)
|
|
10
|
+
self.open_ai = ChatOpenAI(model_name="gpt-4", temperature=0.7)
|
|
13
11
|
self.anthropic = ChatAnthropic(
|
|
14
12
|
model_name="claude-3-5-sonnet-20240620", temperature=0.7
|
|
15
13
|
)
|
|
@@ -30,3 +28,28 @@ class PoetryAgents:
|
|
|
30
28
|
verbose=True,
|
|
31
29
|
llm=self.open_ai,
|
|
32
30
|
)
|
|
31
|
+
|
|
32
|
+
def poet_agent_2(self):
|
|
33
|
+
return Agent(
|
|
34
|
+
role="Renaissance Poet",
|
|
35
|
+
backstory="""
|
|
36
|
+
I am a Renaissance Poet. I am well-versed in the art of poetry and have a deep appreciation for the beauty of language and expression.
|
|
37
|
+
""",
|
|
38
|
+
goal="""Create a poem that is inspired by the works of the Renaissance poets""",
|
|
39
|
+
allow_delegation=False,
|
|
40
|
+
verbose=True,
|
|
41
|
+
llm=self.open_ai,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
def poet_agent_3(self):
|
|
45
|
+
return Agent(
|
|
46
|
+
role="William Shakespeare",
|
|
47
|
+
backstory="""
|
|
48
|
+
I am william shakespeare. I am an Expert in poetry writing and creative expression.
|
|
49
|
+
I have been writing poetry for over 10 years and have published several collections.
|
|
50
|
+
""",
|
|
51
|
+
goal="""Create a poem that is inspired by the works of William Shakespeare""",
|
|
52
|
+
allow_delegation=False,
|
|
53
|
+
verbose=True,
|
|
54
|
+
llm=self.open_ai,
|
|
55
|
+
)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
from agents import PoetryAgents
|
|
1
2
|
from crewai import Crew
|
|
2
|
-
from .agents import PoetryAgents
|
|
3
|
-
from .tasks import PoetryTasks
|
|
4
|
-
from langtrace_python_sdk import langtrace
|
|
5
3
|
from dotenv import load_dotenv
|
|
4
|
+
from tasks import PoetryTasks
|
|
5
|
+
|
|
6
|
+
from langtrace_python_sdk import langtrace
|
|
6
7
|
|
|
7
8
|
load_dotenv()
|
|
8
9
|
langtrace.init()
|
|
@@ -17,10 +18,14 @@ class PoetryCrew:
|
|
|
17
18
|
tasks = PoetryTasks()
|
|
18
19
|
|
|
19
20
|
poetry_agent = agents.create_poet_agent()
|
|
21
|
+
# poetry_agent_2 = agents.poet_agent_2()
|
|
22
|
+
# poetry_agent_3 = agents.poet_agent_3()
|
|
20
23
|
|
|
21
24
|
create_poem = tasks.create_poem(poetry_agent, self.topic)
|
|
25
|
+
# create_poem_2 = tasks.create_poem(poetry_agent_2, self.topic)
|
|
26
|
+
# create_poem_3 = tasks.create_poem(poetry_agent_3, self.topic)
|
|
22
27
|
|
|
23
|
-
crew = Crew(agents=[poetry_agent], tasks=[create_poem], verbose=True)
|
|
28
|
+
crew = Crew(agents=[poetry_agent], tasks=[create_poem], verbose=True, memory=True)
|
|
24
29
|
res = crew.kickoff()
|
|
25
30
|
return res
|
|
26
31
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from dotenv import load_dotenv
|
|
2
|
+
from embedchain import App
|
|
3
|
+
from langtrace_python_sdk import langtrace
|
|
4
|
+
|
|
5
|
+
load_dotenv()
|
|
6
|
+
langtrace.init()
|
|
7
|
+
|
|
8
|
+
app = App()
|
|
9
|
+
app.reset()
|
|
10
|
+
app.add("https://www.forbes.com/profile/elon-musk")
|
|
11
|
+
app.add("https://en.wikipedia.org/wiki/Elon_Musk")
|
|
12
|
+
res = app.query("What is the net worth of Elon Musk today?")
|
|
13
|
+
print(res)
|
|
14
|
+
re2 = app.search("Elon Musk")
|
|
15
|
+
print(re2)
|
|
@@ -17,12 +17,14 @@ from .dspy import DspyInstrumentation
|
|
|
17
17
|
from .vertexai import VertexAIInstrumentation
|
|
18
18
|
from .gemini import GeminiInstrumentation
|
|
19
19
|
from .mistral import MistralInstrumentation
|
|
20
|
+
from .embedchain import EmbedchainInstrumentation
|
|
20
21
|
|
|
21
22
|
__all__ = [
|
|
22
23
|
"AnthropicInstrumentation",
|
|
23
24
|
"ChromaInstrumentation",
|
|
24
25
|
"CohereInstrumentation",
|
|
25
26
|
"CrewAIInstrumentation",
|
|
27
|
+
"EmbedchainInstrumentation",
|
|
26
28
|
"GroqInstrumentation",
|
|
27
29
|
"LangchainInstrumentation",
|
|
28
30
|
"LangchainCommunityInstrumentation",
|
|
@@ -51,7 +51,7 @@ def collection_patch(method, version, tracer):
|
|
|
51
51
|
"langtrace.version": v(LANGTRACE_SDK_NAME),
|
|
52
52
|
"db.system": "chromadb",
|
|
53
53
|
"db.operation": api["OPERATION"],
|
|
54
|
-
"db.query": json.dumps(kwargs
|
|
54
|
+
"db.query": json.dumps(kwargs),
|
|
55
55
|
**(extra_attributes if extra_attributes is not None else {}),
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -19,7 +19,7 @@ from opentelemetry.trace import get_tracer
|
|
|
19
19
|
from wrapt import wrap_function_wrapper as _W
|
|
20
20
|
from typing import Collection
|
|
21
21
|
from importlib_metadata import version as v
|
|
22
|
-
from .patch import patch_crew
|
|
22
|
+
from .patch import patch_crew, patch_memory
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class CrewAIInstrumentation(BaseInstrumentor):
|
|
@@ -49,7 +49,23 @@ class CrewAIInstrumentation(BaseInstrumentor):
|
|
|
49
49
|
"Task.execute_sync",
|
|
50
50
|
patch_crew("Task.execute", version, tracer),
|
|
51
51
|
)
|
|
52
|
-
|
|
52
|
+
_W(
|
|
53
|
+
"crewai.memory.storage.rag_storage",
|
|
54
|
+
"RAGStorage.save",
|
|
55
|
+
patch_memory("RAGStorage.save", version, tracer),
|
|
56
|
+
)
|
|
57
|
+
_W(
|
|
58
|
+
"crewai.memory.storage.rag_storage",
|
|
59
|
+
"RAGStorage.search",
|
|
60
|
+
patch_memory("RAGStorage.search", version, tracer),
|
|
61
|
+
)
|
|
62
|
+
_W(
|
|
63
|
+
"crewai.memory.storage.rag_storage",
|
|
64
|
+
"RAGStorage.reset",
|
|
65
|
+
patch_memory("RAGStorage.reset", version, tracer),
|
|
66
|
+
)
|
|
67
|
+
# pylint: disable=broad-except
|
|
68
|
+
except Exception:
|
|
53
69
|
pass
|
|
54
70
|
|
|
55
71
|
def _uninstrument(self, **kwargs):
|
|
@@ -11,82 +11,56 @@ from opentelemetry import baggage
|
|
|
11
11
|
from langtrace.trace_attributes import FrameworkSpanAttributes
|
|
12
12
|
from opentelemetry.trace import SpanKind, Span, Tracer
|
|
13
13
|
from opentelemetry.trace.status import Status, StatusCode
|
|
14
|
+
from langtrace_python_sdk.utils.misc import serialize_args, serialize_kwargs
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"formatting_errors": "int",
|
|
64
|
-
"id": "object",
|
|
65
|
-
"role": "str",
|
|
66
|
-
"goal": "str",
|
|
67
|
-
"backstory": "str",
|
|
68
|
-
"cache": "bool",
|
|
69
|
-
"config": "object",
|
|
70
|
-
"max_rpm": "int",
|
|
71
|
-
"verbose": "bool",
|
|
72
|
-
"allow_delegation": "bool",
|
|
73
|
-
"tools": "object",
|
|
74
|
-
"max_iter": "int",
|
|
75
|
-
"max_execution_time": "object",
|
|
76
|
-
"agent_executor": "object",
|
|
77
|
-
"tools_handler": "object",
|
|
78
|
-
"force_answer_max_iterations": "int",
|
|
79
|
-
"crew": "object",
|
|
80
|
-
"cache_handler": "object",
|
|
81
|
-
"step_callback": "object",
|
|
82
|
-
"i18n": "object",
|
|
83
|
-
"llm": "object",
|
|
84
|
-
"function_calling_llm": "object",
|
|
85
|
-
"callbacks": "object",
|
|
86
|
-
"system_template": "object",
|
|
87
|
-
"prompt_template": "object",
|
|
88
|
-
"response_template": "object",
|
|
89
|
-
}
|
|
17
|
+
def patch_memory(operation_name, version, tracer: Tracer):
|
|
18
|
+
def traced_method(wrapped, instance, args, kwargs):
|
|
19
|
+
service_provider = SERVICE_PROVIDERS["CREWAI"]
|
|
20
|
+
extra_attributes = baggage.get_baggage(LANGTRACE_ADDITIONAL_SPAN_ATTRIBUTES_KEY)
|
|
21
|
+
span_attributes = {
|
|
22
|
+
"langtrace.sdk.name": "langtrace-python-sdk",
|
|
23
|
+
"langtrace.service.name": service_provider,
|
|
24
|
+
"langtrace.service.type": "framework",
|
|
25
|
+
"langtrace.service.version": version,
|
|
26
|
+
"langtrace.version": v(LANGTRACE_SDK_NAME),
|
|
27
|
+
**(extra_attributes if extra_attributes is not None else {}),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
inputs = {}
|
|
31
|
+
if len(args) > 0:
|
|
32
|
+
inputs["args"] = serialize_args(*args)
|
|
33
|
+
if len(kwargs) > 0:
|
|
34
|
+
inputs["kwargs"] = serialize_kwargs(**kwargs)
|
|
35
|
+
span_attributes["crewai.memory.storage.rag_storage.inputs"] = json.dumps(inputs)
|
|
36
|
+
|
|
37
|
+
attributes = FrameworkSpanAttributes(**span_attributes)
|
|
38
|
+
|
|
39
|
+
with tracer.start_as_current_span(
|
|
40
|
+
get_span_name(operation_name), kind=SpanKind.CLIENT
|
|
41
|
+
) as span:
|
|
42
|
+
|
|
43
|
+
try:
|
|
44
|
+
set_span_attributes(span, attributes)
|
|
45
|
+
result = wrapped(*args, **kwargs)
|
|
46
|
+
if result is not None and len(result) > 0:
|
|
47
|
+
set_span_attribute(span, "crewai.memory.storage.rag_storage.outputs", str(result))
|
|
48
|
+
if result:
|
|
49
|
+
span.set_status(Status(StatusCode.OK))
|
|
50
|
+
span.end()
|
|
51
|
+
return result
|
|
52
|
+
|
|
53
|
+
except Exception as err:
|
|
54
|
+
# Record the exception in the span
|
|
55
|
+
span.record_exception(err)
|
|
56
|
+
|
|
57
|
+
# Set the span status to indicate an error
|
|
58
|
+
span.set_status(Status(StatusCode.ERROR, str(err)))
|
|
59
|
+
|
|
60
|
+
# Reraise the exception to ensure it's not swallowed
|
|
61
|
+
raise
|
|
62
|
+
|
|
63
|
+
return traced_method
|
|
90
64
|
|
|
91
65
|
|
|
92
66
|
def patch_crew(operation_name, version, tracer: Tracer):
|
|
@@ -114,12 +88,23 @@ def patch_crew(operation_name, version, tracer: Tracer):
|
|
|
114
88
|
result = wrapped(*args, **kwargs)
|
|
115
89
|
if result:
|
|
116
90
|
span.set_status(Status(StatusCode.OK))
|
|
91
|
+
if instance.__class__.__name__ == "Crew":
|
|
92
|
+
span.set_attribute("crewai.crew.result", str(result))
|
|
93
|
+
if hasattr(result, "tasks_output"):
|
|
94
|
+
span.set_attribute("crewai.crew.tasks_output", str((result.tasks_output)))
|
|
95
|
+
if hasattr(result, "token_usage"):
|
|
96
|
+
span.set_attribute("crewai.crew.token_usage", str((result.token_usage)))
|
|
97
|
+
if hasattr(result, "usage_metrics"):
|
|
98
|
+
span.set_attribute("crewai.crew.usage_metrics", str((result.usage_metrics)))
|
|
99
|
+
elif instance.__class__.__name__ == "Agent":
|
|
100
|
+
span.set_attribute("crewai.agent.result", str(result))
|
|
101
|
+
elif instance.__class__.__name__ == "Task":
|
|
102
|
+
span.set_attribute("crewai.task.result", str(result))
|
|
117
103
|
|
|
118
104
|
span.end()
|
|
119
105
|
return result
|
|
120
106
|
|
|
121
107
|
except Exception as err:
|
|
122
|
-
print("Error", err)
|
|
123
108
|
# Record the exception in the span
|
|
124
109
|
span.record_exception(err)
|
|
125
110
|
|
|
@@ -150,25 +135,26 @@ class CrewAISpanAttributes:
|
|
|
150
135
|
instance_name = self.instance.__class__.__name__
|
|
151
136
|
if instance_name == "Crew":
|
|
152
137
|
self.set_crew_attributes()
|
|
153
|
-
|
|
138
|
+
for key, value in self.crew.items():
|
|
139
|
+
key = f"crewai.crew.{key}"
|
|
140
|
+
set_span_attribute(self.span, key, value)
|
|
154
141
|
|
|
155
142
|
elif instance_name == "Agent":
|
|
156
143
|
agent = self.set_agent_attributes()
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
144
|
+
for key, value in agent.items():
|
|
145
|
+
key = f"crewai.agent.{key}"
|
|
146
|
+
set_span_attribute(self.span, key, value)
|
|
147
|
+
|
|
160
148
|
elif instance_name == "Task":
|
|
161
149
|
task = self.set_task_attributes()
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
set_span_attribute(self.span, "crewai.task.config", json.dumps(task))
|
|
150
|
+
for key, value in task.items():
|
|
151
|
+
key = f"crewai.task.{key}"
|
|
152
|
+
set_span_attribute(self.span, key, value)
|
|
166
153
|
|
|
167
154
|
def set_crew_attributes(self):
|
|
168
155
|
for key, value in self.instance.__dict__.items():
|
|
169
156
|
if key == "tasks":
|
|
170
157
|
self._parse_tasks(value)
|
|
171
|
-
|
|
172
158
|
elif key == "agents":
|
|
173
159
|
self._parse_agents(value)
|
|
174
160
|
else:
|
langtrace_python_sdk-2.3.1/src/langtrace_python_sdk/instrumentation/embedchain/instrumentation.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
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
|
|
24
|
+
|
|
25
|
+
from langtrace_python_sdk.instrumentation.embedchain.patch import generic_patch
|
|
26
|
+
|
|
27
|
+
logging.basicConfig(level=logging.FATAL)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class EmbedchainInstrumentation(BaseInstrumentor):
|
|
31
|
+
"""
|
|
32
|
+
The EmbedchainInstrumentation class represents the Embedchain instrumentation
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
def instrumentation_dependencies(self) -> Collection[str]:
|
|
36
|
+
return ["embedchain >= 0.1.113"]
|
|
37
|
+
|
|
38
|
+
def _instrument(self, **kwargs):
|
|
39
|
+
tracer_provider = kwargs.get("tracer_provider")
|
|
40
|
+
tracer = get_tracer(__name__, "", tracer_provider)
|
|
41
|
+
version = importlib.metadata.version("embedchain")
|
|
42
|
+
|
|
43
|
+
wrap_function_wrapper(
|
|
44
|
+
"embedchain.embedchain",
|
|
45
|
+
"EmbedChain.add",
|
|
46
|
+
generic_patch("ADD", version, tracer),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
wrap_function_wrapper(
|
|
50
|
+
"embedchain.embedchain",
|
|
51
|
+
"EmbedChain.query",
|
|
52
|
+
generic_patch("QUERY", version, tracer),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
wrap_function_wrapper(
|
|
56
|
+
"embedchain.embedchain",
|
|
57
|
+
"EmbedChain.search",
|
|
58
|
+
generic_patch("SEARCH", version, tracer),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
def _instrument_module(self, module_name):
|
|
62
|
+
pass
|
|
63
|
+
|
|
64
|
+
def _uninstrument(self, **kwargs):
|
|
65
|
+
pass
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
from langtrace.trace_attributes import FrameworkSpanAttributes
|
|
18
|
+
from langtrace_python_sdk.utils import set_span_attribute
|
|
19
|
+
from langtrace_python_sdk.utils.llm import get_span_name
|
|
20
|
+
from opentelemetry import baggage, trace
|
|
21
|
+
from opentelemetry.trace import SpanKind
|
|
22
|
+
from opentelemetry.trace.status import Status, StatusCode
|
|
23
|
+
from opentelemetry.trace.propagation import set_span_in_context
|
|
24
|
+
from langtrace_python_sdk.constants.instrumentation.embedchain import APIS
|
|
25
|
+
from langtrace_python_sdk.constants.instrumentation.common import (
|
|
26
|
+
LANGTRACE_ADDITIONAL_SPAN_ATTRIBUTES_KEY,
|
|
27
|
+
SERVICE_PROVIDERS,
|
|
28
|
+
)
|
|
29
|
+
import json
|
|
30
|
+
from importlib_metadata import version as v
|
|
31
|
+
|
|
32
|
+
from langtrace_python_sdk.constants import LANGTRACE_SDK_NAME
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def generic_patch(method, version, tracer):
|
|
36
|
+
"""
|
|
37
|
+
A generic patch method that wraps a function with a span
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
def traced_method(wrapped, instance, args, kwargs):
|
|
41
|
+
api = APIS[method]
|
|
42
|
+
service_provider = SERVICE_PROVIDERS["EMBEDCHAIN"]
|
|
43
|
+
extra_attributes = baggage.get_baggage(LANGTRACE_ADDITIONAL_SPAN_ATTRIBUTES_KEY)
|
|
44
|
+
|
|
45
|
+
span_attributes = {
|
|
46
|
+
"langtrace.sdk.name": "langtrace-python-sdk",
|
|
47
|
+
"langtrace.service.name": service_provider,
|
|
48
|
+
"langtrace.service.type": "framework",
|
|
49
|
+
"langtrace.service.version": version,
|
|
50
|
+
"langtrace.version": v(LANGTRACE_SDK_NAME),
|
|
51
|
+
"embedchain.api": api["OPERATION"],
|
|
52
|
+
**(extra_attributes if extra_attributes is not None else {}),
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if hasattr(instance, 'config') and isinstance(instance.config, object):
|
|
56
|
+
config_dict = instance.config.__dict__
|
|
57
|
+
if isinstance(config_dict, dict):
|
|
58
|
+
span_attributes["embedchain.config"] = json.dumps(config_dict)
|
|
59
|
+
|
|
60
|
+
if len(args) > 0:
|
|
61
|
+
span_attributes["embedchain.inputs"] = json.dumps(args)
|
|
62
|
+
|
|
63
|
+
attributes = FrameworkSpanAttributes(**span_attributes)
|
|
64
|
+
|
|
65
|
+
with tracer.start_as_current_span(
|
|
66
|
+
name=get_span_name(api["METHOD"]),
|
|
67
|
+
kind=SpanKind.CLIENT,
|
|
68
|
+
context=set_span_in_context(trace.get_current_span()),
|
|
69
|
+
) as span:
|
|
70
|
+
for field, value in attributes.model_dump(by_alias=True).items():
|
|
71
|
+
if value is not None:
|
|
72
|
+
span.set_attribute(field, value)
|
|
73
|
+
try:
|
|
74
|
+
result = wrapped(*args, **kwargs)
|
|
75
|
+
set_span_attribute(span, "embedchain.outputs", json.dumps(result))
|
|
76
|
+
span.set_status(StatusCode.OK)
|
|
77
|
+
return result
|
|
78
|
+
except Exception as err:
|
|
79
|
+
# Record the exception in the span
|
|
80
|
+
span.record_exception(err)
|
|
81
|
+
|
|
82
|
+
# Set the span status to indicate an error
|
|
83
|
+
span.set_status(Status(StatusCode.ERROR, str(err)))
|
|
84
|
+
|
|
85
|
+
# Reraise the exception to ensure it's not swallowed
|
|
86
|
+
raise
|
|
87
|
+
|
|
88
|
+
return traced_method
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def get_count_or_none(value):
|
|
92
|
+
return len(value) if value is not None else None
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def handle_null_params(param):
|
|
96
|
+
return str(param) if param else None
|