langtrace-python-sdk 2.3.0__tar.gz → 2.3.2__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.3.0 → langtrace_python_sdk-2.3.2}/PKG-INFO +1 -1
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/crewai_example/simple_agent/main.py +4 -4
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/extensions/langtrace_exporter.py +47 -9
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/crewai/instrumentation.py +18 -2
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/crewai/patch.py +58 -83
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/embedchain/patch.py +5 -0
- langtrace_python_sdk-2.3.2/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +109 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/langchain/patch.py +6 -1
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +2 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/langtrace.py +10 -2
- langtrace_python_sdk-2.3.2/src/langtrace_python_sdk/utils/misc.py +62 -0
- langtrace_python_sdk-2.3.2/src/langtrace_python_sdk/version.py +1 -0
- langtrace_python_sdk-2.3.0/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +0 -96
- langtrace_python_sdk-2.3.0/src/langtrace_python_sdk/utils/misc.py +0 -30
- langtrace_python_sdk-2.3.0/src/langtrace_python_sdk/version.py +0 -1
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/.gitignore +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/LICENSE +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/README.md +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/pyproject.toml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/anthropic_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/anthropic_example/completion.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/chroma_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/chroma_example/basic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/cohere_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/cohere_example/chat.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/cohere_example/chat_stream.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/cohere_example/embed.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/cohere_example/rerank.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/cohere_example/tools.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/crewai_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/crewai_example/basic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/crewai_example/simple_agent/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/crewai_example/simple_agent/agents.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/crewai_example/simple_agent/tasks.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/crewai_example/trip_planner/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/crewai_example/trip_planner/agents.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/crewai_example/trip_planner/main.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/crewai_example/trip_planner/tasks.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/crewai_example/trip_planner/tools/calculator.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/crewai_example/trip_planner/tools/search_tools.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/dspy_example/math_problems_cot.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/dspy_example/math_problems_cot_parallel.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/dspy_example/program_of_thought_basic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/dspy_example/quiz_gen.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/dspy_example/react.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/embedchain_example/simple.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/fastapi_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/fastapi_example/basic_route.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/gemini_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/gemini_example/function_tools.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/gemini_example/main.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/hiveagent_example/basic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/inspect_ai_example/basic_eval.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/langchain_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/langchain_example/basic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/langchain_example/groq_example.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/langchain_example/langgraph_example.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/langchain_example/sagemaker.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/langchain_example/tool.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/litellm_example/basic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/llamaindex_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/llamaindex_example/agent.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/llamaindex_example/basic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/llamaindex_example/data/abramov.txt +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/mistral_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/mistral_example/complete.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/mistral_example/complete_async.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/mistral_example/embeddings.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/ollama_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/ollama_example/basic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/async_tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/async_tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/chat_completion.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/chat_completion_tool_choice.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/embeddings_create.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/function_calling.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/images_edit.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/images_generate.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/resources/lounge_flamingo.png +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/resources/mask.png +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/send_user_feedback.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/tool_calling.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/openai_example/tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/otlp_example/otlp_basic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/otlp_example/otlp_with_langtrace.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/perplexity_example/basic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/pinecone_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/pinecone_example/basic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/qdrant_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/qdrant_example/basic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/routellm_example/basic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/vertexai_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/vertexai_example/main.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/weaviate_example/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/examples/weaviate_example/query_text.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/exporter/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/anthropic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/chroma.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/cohere.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/common.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/embedchain.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/gemini.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/groq.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/mistral.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/ollama.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/openai.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/pinecone.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/qdrant.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/vertexai.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/constants/instrumentation/weaviate.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/extensions/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/extensions/langtrace_filesystem.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/chroma/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/chroma/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/cohere/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/cohere/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/cohere/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/crewai/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/dspy/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/dspy/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/dspy/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/embedchain/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/embedchain/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/gemini/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/gemini/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/gemini/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/groq/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/groq/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/groq/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/langchain_community/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/langchain_core/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/langgraph/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/langgraph/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/langgraph/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/llamaindex/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/mistral/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/mistral/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/mistral/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/ollama/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/ollama/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/ollama/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/openai/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/openai/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/openai/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/pinecone/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/qdrant/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/qdrant/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/qdrant/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/vertexai/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/vertexai/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/vertexai/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/weaviate/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/weaviate/instrumentation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/instrumentation/weaviate/patch.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/types/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/utils/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/utils/langtrace_sampler.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/utils/llm.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/utils/prompt_registry.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/utils/sdk_version_checker.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/utils/silently_fail.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/utils/types.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/utils/with_root_span.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/run_example.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/__init__.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/anthropic/cassettes/test_anthropic.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/anthropic/cassettes/test_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/anthropic/cassettes/test_async_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/anthropic/conftest.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/anthropic/test_anthropic.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/chroma/conftest.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/chroma/test_chroma.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/cohere/cassettes/test_cohere_chat.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/cohere/cassettes/test_cohere_chat_streaming.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/cohere/cassettes/test_cohere_embed.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/cohere/cassettes/test_cohere_rerank.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/cohere/conftest.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/cohere/test_cohere_chat.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/cohere/test_cohere_embed.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/cohere/test_cohere_rerank.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/conftest.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/groq/cassettes/test_async_chat_completion.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/groq/cassettes/test_async_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/groq/cassettes/test_chat_completion.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/groq/cassettes/test_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/groq/conftest.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/groq/test_groq.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/langchain/cassettes/test_langchain.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/langchain/conftest.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/langchain/test_langchain.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/openai/cassettes/test_async_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/openai/cassettes/test_async_image_generation.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/openai/cassettes/test_chat_completion.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/openai/cassettes/test_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/openai/cassettes/test_image_generation.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/openai/conftest.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/openai/test_chat_completion.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/openai/test_embeddings.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/openai/test_image_generation.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/pinecone/cassettes/test_query.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/pinecone/cassettes/test_upsert.yaml +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/pinecone/conftest.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/pinecone/test_pinecone.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/qdrant/conftest.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/qdrant/test_qdrant.py +0 -0
- {langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/tests/utils.py +0 -0
|
@@ -18,12 +18,12 @@ class PoetryCrew:
|
|
|
18
18
|
tasks = PoetryTasks()
|
|
19
19
|
|
|
20
20
|
poetry_agent = agents.create_poet_agent()
|
|
21
|
-
poetry_agent_2 = agents.poet_agent_2()
|
|
22
|
-
poetry_agent_3 = agents.poet_agent_3()
|
|
21
|
+
# poetry_agent_2 = agents.poet_agent_2()
|
|
22
|
+
# poetry_agent_3 = agents.poet_agent_3()
|
|
23
23
|
|
|
24
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)
|
|
25
|
+
# create_poem_2 = tasks.create_poem(poetry_agent_2, self.topic)
|
|
26
|
+
# create_poem_3 = tasks.create_poem(poetry_agent_3, self.topic)
|
|
27
27
|
|
|
28
28
|
crew = Crew(agents=[poetry_agent], tasks=[create_poem], verbose=True, memory=True)
|
|
29
29
|
res = crew.kickoff()
|
|
@@ -76,7 +76,29 @@ class LangTraceExporter(SpanExporter):
|
|
|
76
76
|
Returns:
|
|
77
77
|
The result of the export SUCCESS or FAILURE
|
|
78
78
|
"""
|
|
79
|
-
|
|
79
|
+
headers = {
|
|
80
|
+
"Content-Type": "application/json",
|
|
81
|
+
"x-api-key": self.api_key,
|
|
82
|
+
"User-Agent": "LangtraceExporter",
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
# Check if the OTEL_EXPORTER_OTLP_HEADERS environment variable is set
|
|
86
|
+
otel_headers = os.getenv("OTEL_EXPORTER_OTLP_HEADERS", None)
|
|
87
|
+
if otel_headers:
|
|
88
|
+
# Parse and add to headers
|
|
89
|
+
for header in otel_headers.split(","):
|
|
90
|
+
key, value = header.split("=")
|
|
91
|
+
headers[key.strip()] = value.strip()
|
|
92
|
+
|
|
93
|
+
# Check if the OTEL_EXPORTER_OTLP_TRACES_HEADERS environment variable is set
|
|
94
|
+
otel_traces_headers = os.getenv("OTEL_EXPORTER_OTLP_TRACES_HEADERS", None)
|
|
95
|
+
if otel_traces_headers:
|
|
96
|
+
# Parse and add to headers
|
|
97
|
+
for header in otel_traces_headers.split(","):
|
|
98
|
+
key, value = header.split("=")
|
|
99
|
+
headers[key.strip()] = value.strip()
|
|
100
|
+
|
|
101
|
+
if not headers["x-api-key"] and not self.disable_logging:
|
|
80
102
|
print(Fore.RED)
|
|
81
103
|
print(
|
|
82
104
|
"Missing Langtrace API key, proceed to https://langtrace.ai to create one"
|
|
@@ -101,11 +123,7 @@ class LangTraceExporter(SpanExporter):
|
|
|
101
123
|
response = requests.post(
|
|
102
124
|
url=f"{self.api_host}",
|
|
103
125
|
data=json.dumps(data),
|
|
104
|
-
headers=
|
|
105
|
-
"Content-Type": "application/json",
|
|
106
|
-
"x-api-key": self.api_key,
|
|
107
|
-
"User-Agent": "LangtraceExporter",
|
|
108
|
-
},
|
|
126
|
+
headers=headers,
|
|
109
127
|
timeout=20,
|
|
110
128
|
)
|
|
111
129
|
|
|
@@ -113,14 +131,34 @@ class LangTraceExporter(SpanExporter):
|
|
|
113
131
|
raise RequestException(response.text)
|
|
114
132
|
if not self.disable_logging:
|
|
115
133
|
print(
|
|
116
|
-
Fore.GREEN
|
|
134
|
+
Fore.GREEN
|
|
135
|
+
+ f"Exported {len(spans)} spans successfully."
|
|
136
|
+
+ Fore.RESET
|
|
117
137
|
)
|
|
118
138
|
return SpanExportResult.SUCCESS
|
|
119
139
|
except RequestException as err:
|
|
120
140
|
if not self.disable_logging:
|
|
121
141
|
print(Fore.RED + "Failed to export spans.")
|
|
122
|
-
print(Fore.RED + f"Error: {err}" + Fore.RESET)
|
|
142
|
+
print(Fore.RED + f"Error: {err}\r\n" + Fore.RESET)
|
|
143
|
+
if (
|
|
144
|
+
"invalid api key" in str(err).lower()
|
|
145
|
+
and self.api_host == f"{LANGTRACE_REMOTE_URL}/api/trace"
|
|
146
|
+
):
|
|
147
|
+
print(
|
|
148
|
+
Fore.YELLOW
|
|
149
|
+
+ "If you're self-hosting Langtrace, make sure to do one of the following to configure your trace endpoint (e.g., http://localhost:3000/api/trace):"
|
|
150
|
+
+ Fore.YELLOW
|
|
151
|
+
)
|
|
152
|
+
print(
|
|
153
|
+
Fore.YELLOW
|
|
154
|
+
+ "1. Set the `LANGTRACE_API_HOST` environment variable, or\r\n2. Pass the `api_host` parameter to the `langtrace.init()` method.\r\n"
|
|
155
|
+
+ Fore.YELLOW
|
|
156
|
+
)
|
|
123
157
|
return SpanExportResult.FAILURE
|
|
124
158
|
|
|
125
159
|
def shutdown(self) -> None:
|
|
126
|
-
print(
|
|
160
|
+
print(
|
|
161
|
+
Fore.WHITE
|
|
162
|
+
+ "⭐ Leave our github a star to stay on top of our updates - https://github.com/Scale3-Labs/langtrace"
|
|
163
|
+
+ Fore.RESET
|
|
164
|
+
)
|
|
@@ -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):
|
|
@@ -161,25 +135,26 @@ class CrewAISpanAttributes:
|
|
|
161
135
|
instance_name = self.instance.__class__.__name__
|
|
162
136
|
if instance_name == "Crew":
|
|
163
137
|
self.set_crew_attributes()
|
|
164
|
-
|
|
138
|
+
for key, value in self.crew.items():
|
|
139
|
+
key = f"crewai.crew.{key}"
|
|
140
|
+
set_span_attribute(self.span, key, value)
|
|
165
141
|
|
|
166
142
|
elif instance_name == "Agent":
|
|
167
143
|
agent = self.set_agent_attributes()
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
144
|
+
for key, value in agent.items():
|
|
145
|
+
key = f"crewai.agent.{key}"
|
|
146
|
+
set_span_attribute(self.span, key, value)
|
|
147
|
+
|
|
171
148
|
elif instance_name == "Task":
|
|
172
149
|
task = self.set_task_attributes()
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
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)
|
|
177
153
|
|
|
178
154
|
def set_crew_attributes(self):
|
|
179
155
|
for key, value in self.instance.__dict__.items():
|
|
180
156
|
if key == "tasks":
|
|
181
157
|
self._parse_tasks(value)
|
|
182
|
-
|
|
183
158
|
elif key == "agents":
|
|
184
159
|
self._parse_agents(value)
|
|
185
160
|
else:
|
|
@@ -52,6 +52,11 @@ def generic_patch(method, version, tracer):
|
|
|
52
52
|
**(extra_attributes if extra_attributes is not None else {}),
|
|
53
53
|
}
|
|
54
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
|
+
|
|
55
60
|
if len(args) > 0:
|
|
56
61
|
span_attributes["embedchain.inputs"] = json.dumps(args)
|
|
57
62
|
|
langtrace_python_sdk-2.3.2/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
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.langchain.patch import generic_patch
|
|
26
|
+
|
|
27
|
+
logging.basicConfig(level=logging.FATAL)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# def patch_module_classes(
|
|
31
|
+
# module_name, tracer, version, task, trace_output=True, trace_input=True
|
|
32
|
+
# ):
|
|
33
|
+
# """
|
|
34
|
+
# Generic function to patch all public methods of all classes in a given module.
|
|
35
|
+
|
|
36
|
+
# Parameters:
|
|
37
|
+
# - module: The module object containing the classes to patch.
|
|
38
|
+
# - module_name: The name of the module, used in the prefix for `wrap_function_wrapper`.
|
|
39
|
+
# - tracer: The tracer object used in `generic_patch`.
|
|
40
|
+
# - version: The version parameter used in `generic_patch`.
|
|
41
|
+
# - task: The name used to identify the type of task in `generic_patch`.
|
|
42
|
+
# - exclude_private: Whether to exclude private methods (those starting with '_').
|
|
43
|
+
# - trace_output: Whether to trace the output of the patched methods.
|
|
44
|
+
# - trace_input: Whether to trace the input of the patched methods.
|
|
45
|
+
# """
|
|
46
|
+
# # import the module
|
|
47
|
+
# module = importlib.import_module(module_name)
|
|
48
|
+
# # loop through all public classes in the module
|
|
49
|
+
# for name, obj in inspect.getmembers(
|
|
50
|
+
# module,
|
|
51
|
+
# lambda member: inspect.isclass(member) and member.__module__ == module.__name__,
|
|
52
|
+
# ):
|
|
53
|
+
# # loop through all public methods of the class
|
|
54
|
+
# for method_name, _ in inspect.getmembers(obj, predicate=inspect.isfunction):
|
|
55
|
+
# # Skip private methods
|
|
56
|
+
# if method_name.startswith("_"):
|
|
57
|
+
# continue
|
|
58
|
+
# try:
|
|
59
|
+
# method_path = f"{name}.{method_name}"
|
|
60
|
+
# wrap_function_wrapper(
|
|
61
|
+
# module_name,
|
|
62
|
+
# method_path,
|
|
63
|
+
# generic_patch(
|
|
64
|
+
# method_path, task, tracer, version, trace_output, trace_input
|
|
65
|
+
# ),
|
|
66
|
+
# )
|
|
67
|
+
# # pylint: disable=broad-except
|
|
68
|
+
# except Exception:
|
|
69
|
+
# pass
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class LangchainInstrumentation(BaseInstrumentor):
|
|
73
|
+
"""
|
|
74
|
+
Instrumentor for langchain.
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
def instrumentation_dependencies(self) -> Collection[str]:
|
|
78
|
+
return ["langchain >= 0.1.9"]
|
|
79
|
+
|
|
80
|
+
def _instrument(self, **kwargs):
|
|
81
|
+
tracer_provider = kwargs.get("tracer_provider")
|
|
82
|
+
tracer = get_tracer(__name__, "", tracer_provider)
|
|
83
|
+
version = importlib.metadata.version("langchain")
|
|
84
|
+
|
|
85
|
+
wrap_function_wrapper(
|
|
86
|
+
"langchain.agents.agent",
|
|
87
|
+
"RunnableAgent.plan",
|
|
88
|
+
generic_patch(
|
|
89
|
+
"RunnableAgent.plan", "plan", tracer, version, True, True
|
|
90
|
+
),
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
wrap_function_wrapper(
|
|
94
|
+
"langchain.agents.agent",
|
|
95
|
+
"RunnableAgent.aplan",
|
|
96
|
+
generic_patch(
|
|
97
|
+
"RunnableAgent.aplan", "plan", tracer, version, True, True
|
|
98
|
+
),
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# modules_to_patch = []
|
|
102
|
+
|
|
103
|
+
# for module_name, task, trace_output, trace_input in modules_to_patch:
|
|
104
|
+
# patch_module_classes(
|
|
105
|
+
# module_name, tracer, version, task, trace_output, trace_input
|
|
106
|
+
# )
|
|
107
|
+
|
|
108
|
+
def _uninstrument(self, **kwargs):
|
|
109
|
+
pass
|
|
@@ -29,6 +29,7 @@ from langtrace_python_sdk.constants.instrumentation.common import (
|
|
|
29
29
|
SERVICE_PROVIDERS,
|
|
30
30
|
)
|
|
31
31
|
from importlib_metadata import version as v
|
|
32
|
+
from langtrace_python_sdk.utils.misc import serialize_args, serialize_kwargs
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
def generic_patch(
|
|
@@ -52,8 +53,12 @@ def generic_patch(
|
|
|
52
53
|
**(extra_attributes if extra_attributes is not None else {}),
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
inputs = {}
|
|
55
57
|
if len(args) > 0 and trace_input:
|
|
56
|
-
|
|
58
|
+
inputs["args"] = serialize_args(*args)
|
|
59
|
+
if len(kwargs) > 0 and trace_input:
|
|
60
|
+
inputs["kwargs"] = serialize_kwargs(**kwargs)
|
|
61
|
+
span_attributes["langchain.inputs"] = json.dumps(inputs)
|
|
57
62
|
|
|
58
63
|
attributes = FrameworkSpanAttributes(**span_attributes)
|
|
59
64
|
|
{langtrace_python_sdk-2.3.0 → langtrace_python_sdk-2.3.2}/src/langtrace_python_sdk/langtrace.py
RENAMED
|
@@ -80,11 +80,19 @@ def init(
|
|
|
80
80
|
sys.stdout = open(os.devnull, "w")
|
|
81
81
|
|
|
82
82
|
host = (
|
|
83
|
-
os.environ.get("LANGTRACE_API_HOST", None)
|
|
83
|
+
os.environ.get("LANGTRACE_API_HOST", None)
|
|
84
|
+
or os.environ.get("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", None)
|
|
85
|
+
or os.environ.get("OTEL_EXPORTER_OTLP_ENDPOINT", None)
|
|
86
|
+
or api_host
|
|
87
|
+
or LANGTRACE_REMOTE_URL
|
|
84
88
|
)
|
|
85
89
|
check_if_sdk_is_outdated()
|
|
86
90
|
print(Fore.GREEN + "Initializing Langtrace SDK.." + Fore.RESET)
|
|
87
|
-
print(
|
|
91
|
+
print(
|
|
92
|
+
Fore.WHITE
|
|
93
|
+
+ "⭐ Leave our github a star to stay on top of our updates - https://github.com/Scale3-Labs/langtrace"
|
|
94
|
+
+ Fore.RESET
|
|
95
|
+
)
|
|
88
96
|
sampler = LangtraceSampler(disabled_methods=disable_tracing_for_functions)
|
|
89
97
|
resource = Resource.create(
|
|
90
98
|
attributes={
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
import json
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def extract_input_params(args, kwargs):
|
|
6
|
+
extracted_params = {}
|
|
7
|
+
for key, value in kwargs.items():
|
|
8
|
+
if hasattr(value, "__dict__"):
|
|
9
|
+
extracted_params[key] = json.dumps(vars(value))
|
|
10
|
+
else:
|
|
11
|
+
extracted_params[key] = value
|
|
12
|
+
for i, value in enumerate(args):
|
|
13
|
+
if hasattr(value, "__dict__"):
|
|
14
|
+
extracted_params[f"arg{i}"] = json.dumps(vars(value))
|
|
15
|
+
else:
|
|
16
|
+
extracted_params[f"arg{i}"] = value
|
|
17
|
+
# Remove None values
|
|
18
|
+
return {k: v for k, v in extracted_params.items() if v is not None}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def to_iso_format(value):
|
|
22
|
+
return (
|
|
23
|
+
None
|
|
24
|
+
if value is None
|
|
25
|
+
else (
|
|
26
|
+
value.isoformat(timespec="microseconds") + "Z"
|
|
27
|
+
if isinstance(value, datetime)
|
|
28
|
+
else None
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def serialize_kwargs(**kwargs):
|
|
34
|
+
# Function to check if a value is serializable
|
|
35
|
+
def is_serializable(value):
|
|
36
|
+
try:
|
|
37
|
+
json.dumps(value)
|
|
38
|
+
return True
|
|
39
|
+
except (TypeError, ValueError):
|
|
40
|
+
return False
|
|
41
|
+
|
|
42
|
+
# Filter out non-serializable items
|
|
43
|
+
serializable_kwargs = {k: v for k, v in kwargs.items() if is_serializable(v)}
|
|
44
|
+
|
|
45
|
+
# Convert to string representation
|
|
46
|
+
return json.dumps(serializable_kwargs)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def serialize_args(*args):
|
|
50
|
+
# Function to check if a value is serializable
|
|
51
|
+
def is_serializable(value):
|
|
52
|
+
try:
|
|
53
|
+
json.dumps(value)
|
|
54
|
+
return True
|
|
55
|
+
except (TypeError, ValueError):
|
|
56
|
+
return False
|
|
57
|
+
|
|
58
|
+
# Filter out non-serializable items
|
|
59
|
+
serializable_args = [arg for arg in args if is_serializable(arg)]
|
|
60
|
+
|
|
61
|
+
# Convert to string representation
|
|
62
|
+
return json.dumps(serializable_args)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.3.2"
|
langtrace_python_sdk-2.3.0/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
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 inspect
|
|
19
|
-
import logging
|
|
20
|
-
from typing import Collection
|
|
21
|
-
|
|
22
|
-
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
|
23
|
-
from opentelemetry.trace import get_tracer
|
|
24
|
-
from wrapt import wrap_function_wrapper
|
|
25
|
-
|
|
26
|
-
from langtrace_python_sdk.instrumentation.langchain.patch import generic_patch
|
|
27
|
-
|
|
28
|
-
logging.basicConfig(level=logging.FATAL)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def patch_module_classes(
|
|
32
|
-
module_name, tracer, version, task, trace_output=True, trace_input=True
|
|
33
|
-
):
|
|
34
|
-
"""
|
|
35
|
-
Generic function to patch all public methods of all classes in a given module.
|
|
36
|
-
|
|
37
|
-
Parameters:
|
|
38
|
-
- module: The module object containing the classes to patch.
|
|
39
|
-
- module_name: The name of the module, used in the prefix for `wrap_function_wrapper`.
|
|
40
|
-
- tracer: The tracer object used in `generic_patch`.
|
|
41
|
-
- version: The version parameter used in `generic_patch`.
|
|
42
|
-
- task: The name used to identify the type of task in `generic_patch`.
|
|
43
|
-
- exclude_private: Whether to exclude private methods (those starting with '_').
|
|
44
|
-
- trace_output: Whether to trace the output of the patched methods.
|
|
45
|
-
- trace_input: Whether to trace the input of the patched methods.
|
|
46
|
-
"""
|
|
47
|
-
# import the module
|
|
48
|
-
module = importlib.import_module(module_name)
|
|
49
|
-
# loop through all public classes in the module
|
|
50
|
-
for name, obj in inspect.getmembers(
|
|
51
|
-
module,
|
|
52
|
-
lambda member: inspect.isclass(member) and member.__module__ == module.__name__,
|
|
53
|
-
):
|
|
54
|
-
# loop through all public methods of the class
|
|
55
|
-
for method_name, _ in inspect.getmembers(obj, predicate=inspect.isfunction):
|
|
56
|
-
# Skip private methods
|
|
57
|
-
if method_name.startswith("_"):
|
|
58
|
-
continue
|
|
59
|
-
try:
|
|
60
|
-
method_path = f"{name}.{method_name}"
|
|
61
|
-
wrap_function_wrapper(
|
|
62
|
-
module_name,
|
|
63
|
-
method_path,
|
|
64
|
-
generic_patch(
|
|
65
|
-
method_path, task, tracer, version, trace_output, trace_input
|
|
66
|
-
),
|
|
67
|
-
)
|
|
68
|
-
# pylint: disable=broad-except
|
|
69
|
-
except Exception:
|
|
70
|
-
pass
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
class LangchainInstrumentation(BaseInstrumentor):
|
|
74
|
-
"""
|
|
75
|
-
Instrumentor for langchain.
|
|
76
|
-
"""
|
|
77
|
-
|
|
78
|
-
def instrumentation_dependencies(self) -> Collection[str]:
|
|
79
|
-
return ["langchain >= 0.1.9"]
|
|
80
|
-
|
|
81
|
-
def _instrument(self, **kwargs):
|
|
82
|
-
tracer_provider = kwargs.get("tracer_provider")
|
|
83
|
-
tracer = get_tracer(__name__, "", tracer_provider)
|
|
84
|
-
version = importlib.metadata.version("langchain")
|
|
85
|
-
|
|
86
|
-
modules_to_patch = [
|
|
87
|
-
("langchain.text_splitter", "split_text", True, True),
|
|
88
|
-
]
|
|
89
|
-
|
|
90
|
-
for module_name, task, trace_output, trace_input in modules_to_patch:
|
|
91
|
-
patch_module_classes(
|
|
92
|
-
module_name, tracer, version, task, trace_output, trace_input
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
def _uninstrument(self, **kwargs):
|
|
96
|
-
pass
|