langtrace-python-sdk 3.3.2__tar.gz → 3.3.3__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/PKG-INFO +1 -3
- langtrace_python_sdk-3.3.3/src/examples/mongo_vector_search_example/main.py +61 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/common.py +1 -0
- langtrace_python_sdk-3.3.3/src/langtrace_python_sdk/constants/instrumentation/pymongo.py +8 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/__init__.py +2 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/openai/patch.py +14 -0
- langtrace_python_sdk-3.3.3/src/langtrace_python_sdk/instrumentation/pymongo/__init__.py +5 -0
- langtrace_python_sdk-3.3.3/src/langtrace_python_sdk/instrumentation/pymongo/instrumentation.py +47 -0
- langtrace_python_sdk-3.3.3/src/langtrace_python_sdk/instrumentation/pymongo/patch.py +66 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/langtrace.py +2 -0
- langtrace_python_sdk-3.3.3/src/langtrace_python_sdk/version.py +1 -0
- langtrace_python_sdk-3.3.2/src/langtrace_python_sdk/version.py +0 -1
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/.gitignore +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/LICENSE +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/README.md +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/pyproject.toml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/anthropic_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/anthropic_example/completion.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/autogen_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/autogen_example/main.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/awsbedrock_examples/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/awsbedrock_examples/converse.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/azureopenai_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/azureopenai_example/completion.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cerebras_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cerebras_example/main.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/chroma_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/chroma_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cohere_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cohere_example/chat.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cohere_example/chat_stream.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cohere_example/embed.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cohere_example/rerank.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cohere_example/tools.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/instagram_post/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/instagram_post/agents.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/instagram_post/main.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/instagram_post/tasks.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/instagram_post/tools/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/instagram_post/tools/browser_tools.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/simple_agent/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/simple_agent/agents.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/simple_agent/main.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/simple_agent/tasks.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/trip_planner/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/trip_planner/agents.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/trip_planner/main.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/trip_planner/tasks.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/trip_planner/tools/calculator.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/trip_planner/tools/search_tools.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/dspy_example/QA_basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/dspy_example/QA_basic_with_chain_of_thought.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/dspy_example/QA_basic_with_signature.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/dspy_example/QA_multi_step_with_chain_of_thought.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/dspy_example/math_problems_cot.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/dspy_example/math_problems_cot_parallel.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/dspy_example/optimizers/bootstrap_fewshot.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/dspy_example/program_of_thought_basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/dspy_example/quiz_gen.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/dspy_example/react.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/embedchain_example/simple.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/fastapi_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/fastapi_example/basic_route.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/gemini_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/gemini_example/function_tools.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/gemini_example/main.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/hiveagent_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/inspect_ai_example/basic_eval.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/langchain_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/langchain_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/langchain_example/groq_example.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/langchain_example/langchain_google_example.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/langchain_example/langgraph_example.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/langchain_example/langgraph_example_tools.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/langchain_example/sagemaker.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/langchain_example/tool.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/litellm_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/litellm_example/config.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/litellm_example/proxy_basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/llamaindex_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/llamaindex_example/agent.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/llamaindex_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/llamaindex_example/data/abramov.txt +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/mistral_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/mistral_example/complete.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/mistral_example/complete_async.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/mistral_example/embeddings.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/ollama_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/ollama_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/async_tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/async_tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/chat_completion.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/chat_completion_tool_choice.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/embeddings_create.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/function_calling.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/images_edit.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/images_generate.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/resources/lounge_flamingo.png +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/resources/mask.png +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/send_user_feedback.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/tool_calling.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/otlp_example/otlp_basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/otlp_example/otlp_with_langtrace.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/perplexity_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/pinecone_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/pinecone_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/qdrant_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/qdrant_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/routellm_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/vertexai_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/vertexai_example/main.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/weaviate_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/weaviate_example/query_text.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/exporter/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/anthropic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/aws_bedrock.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/chroma.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/cohere.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/embedchain.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/gemini.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/groq.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/litellm.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/mistral.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/ollama.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/openai.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/pinecone.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/qdrant.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/vertexai.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/constants/instrumentation/weaviate.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/extensions/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/extensions/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/extensions/langtrace_filesystem.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/anthropic/types.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/autogen/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/autogen/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/autogen/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/aws_bedrock/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/aws_bedrock/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/aws_bedrock/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/cerebras/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/cerebras/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/cerebras/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/chroma/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/chroma/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/cohere/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/cohere/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/cohere/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/crewai/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/crewai/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/crewai/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/dspy/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/dspy/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/dspy/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/embedchain/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/embedchain/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/embedchain/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/gemini/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/gemini/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/gemini/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/groq/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/groq/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/groq/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/langchain/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/langchain_community/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/langchain_core/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/langgraph/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/langgraph/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/langgraph/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/litellm/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/litellm/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/litellm/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/litellm/types.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/llamaindex/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/mistral/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/mistral/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/mistral/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/ollama/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/ollama/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/ollama/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/openai/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/openai/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/openai/types.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/pinecone/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/qdrant/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/qdrant/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/qdrant/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/vertexai/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/vertexai/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/vertexai/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/weaviate/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/weaviate/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/instrumentation/weaviate/patch.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/types/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/utils/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/utils/langtrace_sampler.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/utils/llm.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/utils/misc.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/utils/prompt_registry.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/utils/sdk_version_checker.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/utils/silently_fail.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/utils/types.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/utils/with_root_span.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/run_example.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/__init__.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/anthropic/cassettes/test_anthropic.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/anthropic/cassettes/test_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/anthropic/cassettes/test_async_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/anthropic/conftest.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/anthropic/test_anthropic.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/chroma/conftest.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/chroma/test_chroma.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/cohere/cassettes/test_cohere_chat.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/cohere/cassettes/test_cohere_chat_streaming.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/cohere/cassettes/test_cohere_embed.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/cohere/cassettes/test_cohere_rerank.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/cohere/conftest.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/cohere/test_cohere_chat.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/cohere/test_cohere_embed.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/cohere/test_cohere_rerank.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/conftest.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/groq/cassettes/test_async_chat_completion.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/groq/cassettes/test_async_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/groq/cassettes/test_chat_completion.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/groq/cassettes/test_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/groq/conftest.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/groq/test_groq.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/langchain/cassettes/test_langchain.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/langchain/conftest.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/langchain/test_langchain.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/openai/cassettes/test_async_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/openai/cassettes/test_async_image_generation.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/openai/cassettes/test_chat_completion.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/openai/cassettes/test_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/openai/cassettes/test_image_generation.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/openai/conftest.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/openai/test_chat_completion.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/openai/test_embeddings.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/openai/test_image_generation.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/pinecone/cassettes/test_query.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/pinecone/cassettes/test_upsert.yaml +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/pinecone/conftest.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/pinecone/test_pinecone.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/qdrant/conftest.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/qdrant/test_qdrant.py +0 -0
- {langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/tests/utils.py +0 -0
@@ -1,11 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: langtrace-python-sdk
|
3
|
-
Version: 3.3.
|
3
|
+
Version: 3.3.3
|
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>
|
7
|
-
License-Expression: Apache-2.0
|
8
|
-
License-File: LICENSE
|
9
7
|
Classifier: License :: OSI Approved :: Apache Software License
|
10
8
|
Classifier: Operating System :: OS Independent
|
11
9
|
Classifier: Programming Language :: Python :: 3
|
@@ -0,0 +1,61 @@
|
|
1
|
+
from langtrace_python_sdk import langtrace, with_langtrace_root_span
|
2
|
+
import pymongo
|
3
|
+
import os
|
4
|
+
from dotenv import load_dotenv
|
5
|
+
from openai import OpenAI
|
6
|
+
|
7
|
+
load_dotenv()
|
8
|
+
langtrace.init(write_spans_to_console=False, batch=False)
|
9
|
+
MODEL = "text-embedding-ada-002"
|
10
|
+
openai_client = OpenAI()
|
11
|
+
client = pymongo.MongoClient(os.environ["MONGO_URI"])
|
12
|
+
|
13
|
+
|
14
|
+
# Define a function to generate embeddings
|
15
|
+
def get_embedding(text):
|
16
|
+
"""Generates vector embeddings for the given text."""
|
17
|
+
embedding = (
|
18
|
+
openai_client.embeddings.create(input=[text], model=MODEL).data[0].embedding
|
19
|
+
)
|
20
|
+
return embedding
|
21
|
+
|
22
|
+
|
23
|
+
@with_langtrace_root_span("mongo-vector-search")
|
24
|
+
def vector_query():
|
25
|
+
db = client["sample_mflix"]
|
26
|
+
|
27
|
+
embedded_movies_collection = db["embedded_movies"]
|
28
|
+
# define pipeline
|
29
|
+
pipeline = [
|
30
|
+
{
|
31
|
+
"$vectorSearch": {
|
32
|
+
"index": "vector_index",
|
33
|
+
"path": "plot_embedding",
|
34
|
+
"queryVector": get_embedding("time travel"),
|
35
|
+
"numCandidates": 150,
|
36
|
+
"limit": 10,
|
37
|
+
}
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"$project": {
|
41
|
+
"_id": 0,
|
42
|
+
"plot": 1,
|
43
|
+
"title": 1,
|
44
|
+
"score": {"$meta": "vectorSearchScore"},
|
45
|
+
}
|
46
|
+
},
|
47
|
+
]
|
48
|
+
|
49
|
+
result = embedded_movies_collection.aggregate(pipeline)
|
50
|
+
for doc in result:
|
51
|
+
# print(doc)
|
52
|
+
pass
|
53
|
+
|
54
|
+
|
55
|
+
if __name__ == "__main__":
|
56
|
+
try:
|
57
|
+
vector_query()
|
58
|
+
except Exception as e:
|
59
|
+
print("error", e)
|
60
|
+
finally:
|
61
|
+
client.close()
|
@@ -21,6 +21,7 @@ from .mistral import MistralInstrumentation
|
|
21
21
|
from .aws_bedrock import AWSBedrockInstrumentation
|
22
22
|
from .embedchain import EmbedchainInstrumentation
|
23
23
|
from .litellm import LiteLLMInstrumentation
|
24
|
+
from .pymongo import PyMongoInstrumentation
|
24
25
|
from .cerebras import CerebrasInstrumentation
|
25
26
|
|
26
27
|
__all__ = [
|
@@ -46,6 +47,7 @@ __all__ = [
|
|
46
47
|
"VertexAIInstrumentation",
|
47
48
|
"GeminiInstrumentation",
|
48
49
|
"MistralInstrumentation",
|
50
|
+
"PyMongoInstrumentation",
|
49
51
|
"AWSBedrockInstrumentation",
|
50
52
|
"CerebrasInstrumentation",
|
51
53
|
]
|
@@ -27,6 +27,7 @@ from langtrace_python_sdk.utils.llm import (
|
|
27
27
|
set_event_completion,
|
28
28
|
StreamWrapper,
|
29
29
|
set_span_attributes,
|
30
|
+
set_usage_attributes,
|
30
31
|
)
|
31
32
|
from langtrace_python_sdk.types import NOT_GIVEN
|
32
33
|
|
@@ -450,6 +451,14 @@ def embeddings_create(version: str, tracer: Tracer) -> Callable:
|
|
450
451
|
span_attributes[SpanAttributes.LLM_REQUEST_EMBEDDING_INPUTS] = json.dumps(
|
451
452
|
[kwargs.get("input", "")]
|
452
453
|
)
|
454
|
+
span_attributes[SpanAttributes.LLM_PROMPTS] = json.dumps(
|
455
|
+
[
|
456
|
+
{
|
457
|
+
"role": "user",
|
458
|
+
"content": kwargs.get("input"),
|
459
|
+
}
|
460
|
+
]
|
461
|
+
)
|
453
462
|
|
454
463
|
attributes = LLMSpanAttributes(**filter_valid_attributes(span_attributes))
|
455
464
|
|
@@ -463,6 +472,11 @@ def embeddings_create(version: str, tracer: Tracer) -> Callable:
|
|
463
472
|
try:
|
464
473
|
# Attempt to call the original method
|
465
474
|
result = wrapped(*args, **kwargs)
|
475
|
+
usage = getattr(result, "usage", None)
|
476
|
+
if usage:
|
477
|
+
set_usage_attributes(
|
478
|
+
span, {"prompt_tokens": getattr(usage, "prompt_tokens", 0)}
|
479
|
+
)
|
466
480
|
span.set_status(StatusCode.OK)
|
467
481
|
return result
|
468
482
|
except Exception as err:
|
langtrace_python_sdk-3.3.3/src/langtrace_python_sdk/instrumentation/pymongo/instrumentation.py
ADDED
@@ -0,0 +1,47 @@
|
|
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 opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
18
|
+
from opentelemetry.trace import get_tracer
|
19
|
+
|
20
|
+
from typing import Collection
|
21
|
+
from importlib_metadata import version as v
|
22
|
+
from wrapt import wrap_function_wrapper as _W
|
23
|
+
from .patch import generic_patch
|
24
|
+
from langtrace_python_sdk.constants.instrumentation.pymongo import APIS
|
25
|
+
|
26
|
+
|
27
|
+
class PyMongoInstrumentation(BaseInstrumentor):
|
28
|
+
"""
|
29
|
+
The PyMongoInstrumentation class represents the PyMongo instrumentation
|
30
|
+
"""
|
31
|
+
|
32
|
+
def instrumentation_dependencies(self) -> Collection[str]:
|
33
|
+
return ["pymongo >= 4.0.0"]
|
34
|
+
|
35
|
+
def _instrument(self, **kwargs):
|
36
|
+
tracer_provider = kwargs.get("tracer_provider")
|
37
|
+
tracer = get_tracer(__name__, "", tracer_provider)
|
38
|
+
version = v("pymongo")
|
39
|
+
for api in APIS.values():
|
40
|
+
_W(
|
41
|
+
module=api["MODULE"],
|
42
|
+
name=api["METHOD"],
|
43
|
+
wrapper=generic_patch(api["SPAN_NAME"], version, tracer),
|
44
|
+
)
|
45
|
+
|
46
|
+
def _uninstrument(self, **kwargs):
|
47
|
+
pass
|
@@ -0,0 +1,66 @@
|
|
1
|
+
from langtrace_python_sdk.utils.llm import (
|
2
|
+
get_langtrace_attributes,
|
3
|
+
get_span_name,
|
4
|
+
set_span_attributes,
|
5
|
+
set_span_attribute,
|
6
|
+
)
|
7
|
+
from langtrace_python_sdk.utils import deduce_args_and_kwargs, handle_span_error
|
8
|
+
from opentelemetry.trace import SpanKind
|
9
|
+
from langtrace_python_sdk.constants.instrumentation.common import SERVICE_PROVIDERS
|
10
|
+
from langtrace.trace_attributes import DatabaseSpanAttributes
|
11
|
+
|
12
|
+
import json
|
13
|
+
|
14
|
+
|
15
|
+
def generic_patch(name, version, tracer):
|
16
|
+
def traced_method(wrapped, instance, args, kwargs):
|
17
|
+
database = instance.database.__dict__
|
18
|
+
span_attributes = {
|
19
|
+
**get_langtrace_attributes(
|
20
|
+
version=version,
|
21
|
+
service_provider=SERVICE_PROVIDERS["MONGODB"],
|
22
|
+
vendor_type="vectordb",
|
23
|
+
),
|
24
|
+
"db.system": "mongodb",
|
25
|
+
"db.query": "aggregate",
|
26
|
+
}
|
27
|
+
|
28
|
+
attributes = DatabaseSpanAttributes(**span_attributes)
|
29
|
+
|
30
|
+
with tracer.start_as_current_span(
|
31
|
+
get_span_name(name), kind=SpanKind.CLIENT
|
32
|
+
) as span:
|
33
|
+
if span.is_recording():
|
34
|
+
set_input_attributes(
|
35
|
+
span, deduce_args_and_kwargs(wrapped, *args, **kwargs)
|
36
|
+
)
|
37
|
+
set_span_attributes(span, attributes)
|
38
|
+
|
39
|
+
try:
|
40
|
+
result = wrapped(*args, **kwargs)
|
41
|
+
print(result)
|
42
|
+
for doc in result:
|
43
|
+
if span.is_recording():
|
44
|
+
span.add_event(
|
45
|
+
name="db.query.match",
|
46
|
+
attributes={**doc},
|
47
|
+
)
|
48
|
+
return result
|
49
|
+
except Exception as err:
|
50
|
+
handle_span_error(span, err)
|
51
|
+
raise
|
52
|
+
|
53
|
+
return traced_method
|
54
|
+
|
55
|
+
|
56
|
+
def set_input_attributes(span, args):
|
57
|
+
pipeline = args.get("pipeline", None)
|
58
|
+
for stage in pipeline:
|
59
|
+
for k, v in stage.items():
|
60
|
+
if k == "$vectorSearch":
|
61
|
+
set_span_attribute(span, "db.index", v.get("index", None))
|
62
|
+
set_span_attribute(span, "db.path", v.get("path", None))
|
63
|
+
set_span_attribute(span, "db.top_k", v.get("numCandidates"))
|
64
|
+
set_span_attribute(span, "db.limit", v.get("limit"))
|
65
|
+
else:
|
66
|
+
set_span_attribute(span, k, json.dumps(v))
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/langtrace.py
RENAMED
@@ -64,6 +64,7 @@ from langtrace_python_sdk.instrumentation import (
|
|
64
64
|
AutogenInstrumentation,
|
65
65
|
VertexAIInstrumentation,
|
66
66
|
WeaviateInstrumentation,
|
67
|
+
PyMongoInstrumentation,
|
67
68
|
CerebrasInstrumentation,
|
68
69
|
)
|
69
70
|
from opentelemetry.util.re import parse_env_headers
|
@@ -281,6 +282,7 @@ def init(
|
|
281
282
|
"mistralai": MistralInstrumentation(),
|
282
283
|
"boto3": AWSBedrockInstrumentation(),
|
283
284
|
"autogen": AutogenInstrumentation(),
|
285
|
+
"pymongo": PyMongoInstrumentation(),
|
284
286
|
"cerebras-cloud-sdk": CerebrasInstrumentation(),
|
285
287
|
}
|
286
288
|
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "3.3.3"
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = "3.3.2"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/anthropic_example/__init__.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/autogen_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/autogen_example/main.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cerebras_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cerebras_example/main.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/chroma_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/chroma_example/basic.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cohere_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cohere_example/chat.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cohere_example/chat_stream.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cohere_example/embed.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cohere_example/rerank.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/cohere_example/tools.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/crewai_example/basic.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/dspy_example/QA_basic.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/dspy_example/quiz_gen.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/dspy_example/react.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/embedchain_example/simple.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/fastapi_example/__init__.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/gemini_example/__init__.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/gemini_example/main.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/hiveagent_example/basic.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/langchain_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/langchain_example/basic.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/langchain_example/tool.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/litellm_example/basic.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/litellm_example/config.yaml
RENAMED
File without changes
|
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/llamaindex_example/agent.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/llamaindex_example/basic.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/mistral_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/mistral_example/complete.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/mistral_example/embeddings.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/ollama_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/ollama_example/basic.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/openai_example/images_edit.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/otlp_example/otlp_basic.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/perplexity_example/basic.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/pinecone_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/pinecone_example/basic.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/qdrant_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/qdrant_example/basic.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/routellm_example/basic.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/vertexai_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/vertexai_example/main.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/examples/weaviate_example/__init__.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.2 → langtrace_python_sdk-3.3.3}/src/langtrace_python_sdk/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|