langtrace-python-sdk 2.1.2__tar.gz → 2.1.5__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.1.2 → langtrace_python_sdk-2.1.5}/PKG-INFO +3 -1
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/pyproject.toml +4 -1
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/pinecone_example/basic.py +2 -4
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/weaviate_example/query_text.py +3 -3
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/extensions/langtrace_exporter.py +22 -7
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/instrumentation/__init__.py +29 -0
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +5 -0
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +5 -0
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/instrumentation/cohere/__init__.py +5 -0
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/instrumentation/groq/__init__.py +5 -0
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +5 -0
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +5 -0
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +6 -0
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/instrumentation/langgraph/__init__.py +5 -0
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +5 -0
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/instrumentation/openai/__init__.py +5 -0
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +5 -0
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/instrumentation/qdrant/__init__.py +5 -0
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/instrumentation/weaviate/__init__.py +5 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/weaviate/instrumentation.py +14 -12
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/langtrace.py +9 -25
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/utils/with_root_span.py +0 -2
- langtrace_python_sdk-2.1.5/src/langtrace_python_sdk/version.py +1 -0
- langtrace_python_sdk-2.1.5/src/tests/langchain/cassettes/test_langchain.yaml +106 -0
- langtrace_python_sdk-2.1.5/src/tests/langchain/conftest.py +42 -0
- langtrace_python_sdk-2.1.5/src/tests/langchain/test_langchain.py +28 -0
- langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +0 -0
- langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +0 -0
- langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/cohere/__init__.py +0 -0
- langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/groq/__init__.py +0 -0
- langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +0 -0
- langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +0 -0
- langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +0 -0
- langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/langgraph/__init__.py +0 -0
- langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +0 -0
- langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/openai/__init__.py +0 -0
- langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +0 -0
- langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/qdrant/__init__.py +0 -0
- langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/weaviate/__init__.py +0 -0
- langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/version.py +0 -1
- langtrace_python_sdk-2.1.2/src/tests/__init__.py +0 -0
- langtrace_python_sdk-2.1.2/src/tests/langchain/test_langchain.py +0 -82
- langtrace_python_sdk-2.1.2/src/tests/langchain/test_langchain_community.py +0 -82
- langtrace_python_sdk-2.1.2/src/tests/langchain/test_langchain_core.py +0 -141
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/.gitignore +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/LICENSE +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/README.md +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/anthropic_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/anthropic_example/completion.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/chroma_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/chroma_example/basic.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/cohere_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/cohere_example/chat.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/cohere_example/chat_stream.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/cohere_example/embed.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/cohere_example/rerank.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/cohere_example/tools.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/fastapi_example/basic_route.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/hiveagent_example/basic.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/langchain_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/langchain_example/basic.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/langchain_example/groq_example.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/langchain_example/langgraph_example.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/langchain_example/tool.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/llamaindex_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/llamaindex_example/agent.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/llamaindex_example/basic.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/llamaindex_example/data/abramov.txt +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/openai_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/openai_example/async_tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/openai_example/async_tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/openai_example/chat_completion.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/openai_example/embeddings_create.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/openai_example/function_calling.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/openai_example/images_generate.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/openai_example/tool_calling.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/openai_example/tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/openai_example/tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/perplexity_example/basic.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/pinecone_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/qdrant_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/qdrant_example/basic.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/constants/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/constants/exporter/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/constants/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/constants/instrumentation/anthropic.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/constants/instrumentation/chroma.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/constants/instrumentation/cohere.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/constants/instrumentation/common.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/constants/instrumentation/groq.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/constants/instrumentation/openai.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/constants/instrumentation/pinecone.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/constants/instrumentation/qdrant.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/constants/instrumentation/weaviate.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/extensions/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/chroma/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/chroma/patch.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/cohere/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/cohere/patch.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/groq/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/groq/patch.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/langchain/patch.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/langchain_community/patch.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/langchain_core/patch.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/langgraph/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/langgraph/patch.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/llamaindex/patch.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/openai/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/openai/patch.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/pinecone/patch.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/qdrant/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/qdrant/patch.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/instrumentation/weaviate/patch.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/types/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/utils/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/utils/llm.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/utils/misc.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/utils/prompt_registry.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/utils/silently_fail.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/utils/types.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/run_example.py +0 -0
- {langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation → langtrace_python_sdk-2.1.5/src/tests}/__init__.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/anthropic/cassettes/test_anthropic.yaml +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/anthropic/cassettes/test_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/anthropic/cassettes/test_async_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/anthropic/conftest.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/anthropic/test_anthropic.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/chroma/conftest.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/chroma/test_chroma.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/cohere/cassettes/test_cohere_chat.yaml +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/cohere/cassettes/test_cohere_chat_streaming.yaml +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/cohere/cassettes/test_cohere_embed.yaml +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/cohere/cassettes/test_cohere_rerank.yaml +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/cohere/conftest.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/cohere/test_cohere_chat.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/cohere/test_cohere_embed.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/cohere/test_cohere_rerank.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/conftest.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/openai/cassettes/test_async_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/openai/cassettes/test_async_image_generation.yaml +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/openai/cassettes/test_chat_completion.yaml +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/openai/cassettes/test_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/openai/cassettes/test_image_generation.yaml +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/openai/conftest.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/openai/test_chat_completion.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/openai/test_embeddings.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/openai/test_image_generation.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/pinecone/cassettes/test_query.yaml +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/pinecone/cassettes/test_upsert.yaml +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/pinecone/conftest.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/pinecone/test_pinecone.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/qdrant/conftest.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/qdrant/test_qdrant.py +0 -0
- {langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/tests/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: langtrace-python-sdk
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.5
|
|
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>
|
|
@@ -10,9 +10,11 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Requires-Python: >=3.9
|
|
13
|
+
Requires-Dist: colorama>=0.4.6
|
|
13
14
|
Requires-Dist: opentelemetry-api>=1.24.0
|
|
14
15
|
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.24.0
|
|
15
16
|
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.24.0
|
|
17
|
+
Requires-Dist: opentelemetry-instrumentation-sqlalchemy>=0.45b0
|
|
16
18
|
Requires-Dist: opentelemetry-instrumentation>=0.45b0
|
|
17
19
|
Requires-Dist: opentelemetry-sdk>=1.24.0
|
|
18
20
|
Requires-Dist: tiktoken>=0.1.1
|
|
@@ -22,9 +22,12 @@ dependencies = [
|
|
|
22
22
|
'opentelemetry-api>=1.24.0',
|
|
23
23
|
'opentelemetry-sdk>=1.24.0',
|
|
24
24
|
'opentelemetry-instrumentation>=0.45b0',
|
|
25
|
-
'
|
|
25
|
+
'opentelemetry-instrumentation-sqlalchemy>=0.45b0',
|
|
26
26
|
'opentelemetry-exporter-otlp-proto-http>=1.24.0',
|
|
27
27
|
'opentelemetry-exporter-otlp-proto-grpc>=1.24.0',
|
|
28
|
+
'tiktoken>=0.1.1',
|
|
29
|
+
'colorama>=0.4.6'
|
|
30
|
+
|
|
28
31
|
]
|
|
29
32
|
|
|
30
33
|
requires-python = ">=3.9"
|
{langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/examples/pinecone_example/basic.py
RENAMED
|
@@ -29,7 +29,7 @@ def create_index():
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
@with_langtrace_root_span()
|
|
32
|
-
def basic(span_id, trace_id):
|
|
32
|
+
def basic(span_id=None, trace_id=None):
|
|
33
33
|
|
|
34
34
|
result = client.embeddings.create(
|
|
35
35
|
model="text-embedding-ada-002",
|
|
@@ -44,7 +44,6 @@ def basic(span_id, trace_id):
|
|
|
44
44
|
|
|
45
45
|
index = pinecone.Index(PINECONE_INDEX_NAME)
|
|
46
46
|
res = index.upsert(vectors=[data_to_upsert], namespace="test-namespace")
|
|
47
|
-
print("res", res)
|
|
48
47
|
|
|
49
48
|
resp = index.query(
|
|
50
49
|
vector=embedding, top_k=1, include_values=False, namespace="test-namespace"
|
|
@@ -52,8 +51,7 @@ def basic(span_id, trace_id):
|
|
|
52
51
|
send_user_feedback(
|
|
53
52
|
{"spanId": span_id, "traceId": trace_id, "userScore": 1, "userId": "123"}
|
|
54
53
|
)
|
|
55
|
-
|
|
54
|
+
return [res, resp]
|
|
56
55
|
|
|
57
56
|
|
|
58
57
|
# create_index()
|
|
59
|
-
basic("span_id", "trace_id")
|
|
@@ -19,8 +19,8 @@ import langtrace_python_sdk.langtrace as langtrace
|
|
|
19
19
|
from langtrace_python_sdk import with_langtrace_root_span
|
|
20
20
|
|
|
21
21
|
# Set these environment variables
|
|
22
|
-
WCS_DEMO_URL = "
|
|
23
|
-
WCS_DEMO_RO_KEY = "
|
|
22
|
+
WCS_DEMO_URL = os.environ["WCS_DEMO_URL"]
|
|
23
|
+
WCS_DEMO_RO_KEY = os.environ["WCS_DEMO_RO_KEY"]
|
|
24
24
|
|
|
25
25
|
# Connect to a WCS instance
|
|
26
26
|
client = weaviate.connect_to_wcs(
|
|
@@ -30,7 +30,7 @@ client = weaviate.connect_to_wcs(
|
|
|
30
30
|
headers={"X-OpenAI-Api-Key": os.environ["OPENAI_APIKEY"]},
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
-
langtrace.init(
|
|
33
|
+
langtrace.init()
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
@with_langtrace_root_span()
|
|
@@ -9,6 +9,8 @@ from opentelemetry.trace.span import format_trace_id
|
|
|
9
9
|
from langtrace_python_sdk.constants.exporter.langtrace_exporter import (
|
|
10
10
|
LANGTRACE_REMOTE_URL,
|
|
11
11
|
)
|
|
12
|
+
from colorama import Fore
|
|
13
|
+
from requests.exceptions import RequestException
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
class LangTraceExporter(SpanExporter):
|
|
@@ -55,9 +57,6 @@ class LangTraceExporter(SpanExporter):
|
|
|
55
57
|
self.api_key = api_key or os.environ.get("LANGTRACE_API_KEY")
|
|
56
58
|
self.api_host: str = api_host or LANGTRACE_REMOTE_URL
|
|
57
59
|
|
|
58
|
-
if not self.api_key:
|
|
59
|
-
raise ValueError("No API key provided")
|
|
60
|
-
|
|
61
60
|
def export(self, spans: typing.Sequence[ReadableSpan]) -> SpanExportResult:
|
|
62
61
|
"""
|
|
63
62
|
Exports a batch of telemetry data.
|
|
@@ -68,10 +67,17 @@ class LangTraceExporter(SpanExporter):
|
|
|
68
67
|
Returns:
|
|
69
68
|
The result of the export SUCCESS or FAILURE
|
|
70
69
|
"""
|
|
70
|
+
if not self.api_key:
|
|
71
|
+
print(Fore.RED)
|
|
72
|
+
print(
|
|
73
|
+
"Missing Langtrace API key, proceed to https://langtrace.ai to create one"
|
|
74
|
+
)
|
|
75
|
+
print("Set the API key as an environment variable LANGTRACE_API_KEY")
|
|
76
|
+
print(Fore.RESET)
|
|
77
|
+
return
|
|
71
78
|
data = [
|
|
72
79
|
{
|
|
73
80
|
"traceId": format_trace_id(span.get_span_context().trace_id),
|
|
74
|
-
"instrumentationLibrary": span.instrumentation_info.__repr__(),
|
|
75
81
|
"droppedEventsCount": span.dropped_events,
|
|
76
82
|
"droppedAttributesCount": span.dropped_attributes,
|
|
77
83
|
"droppedLinksCount": span.dropped_links,
|
|
@@ -83,14 +89,23 @@ class LangTraceExporter(SpanExporter):
|
|
|
83
89
|
|
|
84
90
|
# Send data to remote URL
|
|
85
91
|
try:
|
|
86
|
-
requests.post(
|
|
92
|
+
response = requests.post(
|
|
87
93
|
url=f"{self.api_host}/api/trace",
|
|
88
94
|
data=json.dumps(data),
|
|
89
95
|
headers={"Content-Type": "application/json", "x-api-key": self.api_key},
|
|
96
|
+
timeout=20,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
if not response.ok:
|
|
100
|
+
raise RequestException(response.text)
|
|
101
|
+
|
|
102
|
+
print(
|
|
103
|
+
Fore.GREEN + f"Exported {len(spans)} spans successfully." + Fore.RESET
|
|
90
104
|
)
|
|
91
|
-
print(f"sent to {self.api_host}/api/trace with {len(data)} spans")
|
|
92
105
|
return SpanExportResult.SUCCESS
|
|
93
|
-
except
|
|
106
|
+
except RequestException as err:
|
|
107
|
+
print(Fore.RED + "Failed to export spans.")
|
|
108
|
+
print(Fore.RED + f"Error: {err}" + Fore.RESET)
|
|
94
109
|
return SpanExportResult.FAILURE
|
|
95
110
|
|
|
96
111
|
def shutdown(self) -> None:
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from .anthropic import AnthropicInstrumentation
|
|
2
|
+
from .chroma import ChromaInstrumentation
|
|
3
|
+
from .cohere import CohereInstrumentation
|
|
4
|
+
from .groq import GroqInstrumentation
|
|
5
|
+
from .langchain import LangchainInstrumentation
|
|
6
|
+
from .langchain_community import LangchainCommunityInstrumentation
|
|
7
|
+
from .langchain_core import LangchainCoreInstrumentation
|
|
8
|
+
from .langgraph import LanggraphInstrumentation
|
|
9
|
+
from .llamaindex import LlamaindexInstrumentation
|
|
10
|
+
from .openai import OpenAIInstrumentation
|
|
11
|
+
from .pinecone import PineconeInstrumentation
|
|
12
|
+
from .qdrant import QdrantInstrumentation
|
|
13
|
+
from .weaviate import WeaviateInstrumentation
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"AnthropicInstrumentation",
|
|
17
|
+
"ChromaInstrumentation",
|
|
18
|
+
"CohereInstrumentation",
|
|
19
|
+
"GroqInstrumentation",
|
|
20
|
+
"LangchainInstrumentation",
|
|
21
|
+
"LangchainCommunityInstrumentation",
|
|
22
|
+
"LangchainCoreInstrumentation",
|
|
23
|
+
"LanggraphInstrumentation",
|
|
24
|
+
"LlamaindexInstrumentation",
|
|
25
|
+
"OpenAIInstrumentation",
|
|
26
|
+
"PineconeInstrumentation",
|
|
27
|
+
"QdrantInstrumentation",
|
|
28
|
+
"WeaviateInstrumentation",
|
|
29
|
+
]
|
|
@@ -17,7 +17,7 @@ limitations under the License.
|
|
|
17
17
|
import importlib.metadata
|
|
18
18
|
import logging
|
|
19
19
|
from typing import Collection
|
|
20
|
-
|
|
20
|
+
from opentelemetry.instrumentation.utils import unwrap
|
|
21
21
|
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
|
22
22
|
from opentelemetry.trace import get_tracer
|
|
23
23
|
from wrapt import wrap_function_wrapper
|
|
@@ -28,7 +28,7 @@ from langtrace_python_sdk.instrumentation.weaviate.patch import (
|
|
|
28
28
|
)
|
|
29
29
|
from langtrace_python_sdk.constants.instrumentation.weaviate import APIS
|
|
30
30
|
|
|
31
|
-
logging.basicConfig(level=logging.
|
|
31
|
+
logging.basicConfig(level=logging.DEBUG) # Set to DEBUG for detailed logging
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
class WeaviateInstrumentation(BaseInstrumentor):
|
|
@@ -47,17 +47,19 @@ class WeaviateInstrumentation(BaseInstrumentor):
|
|
|
47
47
|
for api_name, api_config in APIS.items():
|
|
48
48
|
module_path, function_name = api_name.rsplit(".", 1)
|
|
49
49
|
if api_config.get("OPERATION") == "query":
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
if getattr(api_config["MODULE"], api_config["METHOD"], None):
|
|
51
|
+
wrap_function_wrapper(
|
|
52
|
+
api_config["MODULE"],
|
|
53
|
+
api_config["METHOD"],
|
|
54
|
+
generic_query_patch(api_name, version, tracer),
|
|
55
|
+
)
|
|
55
56
|
elif api_config.get("OPERATION") == "create":
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
if getattr(api_config["MODULE"], api_config["METHOD"], None):
|
|
58
|
+
wrap_function_wrapper(
|
|
59
|
+
api_config["MODULE"],
|
|
60
|
+
api_config["METHOD"],
|
|
61
|
+
generic_collection_patch(api_name, version, tracer),
|
|
62
|
+
)
|
|
61
63
|
|
|
62
64
|
def _instrument_module(self, module_name):
|
|
63
65
|
pass
|
{langtrace_python_sdk-2.1.2 → langtrace_python_sdk-2.1.5}/src/langtrace_python_sdk/langtrace.py
RENAMED
|
@@ -28,45 +28,23 @@ import sys
|
|
|
28
28
|
from opentelemetry.sdk.resources import Resource
|
|
29
29
|
|
|
30
30
|
from langtrace_python_sdk.extensions.langtrace_exporter import LangTraceExporter
|
|
31
|
-
from langtrace_python_sdk.instrumentation
|
|
31
|
+
from langtrace_python_sdk.instrumentation import (
|
|
32
32
|
AnthropicInstrumentation,
|
|
33
|
-
)
|
|
34
|
-
from langtrace_python_sdk.instrumentation.chroma.instrumentation import (
|
|
35
33
|
ChromaInstrumentation,
|
|
36
|
-
)
|
|
37
|
-
from langtrace_python_sdk.instrumentation.cohere.instrumentation import (
|
|
38
34
|
CohereInstrumentation,
|
|
39
|
-
)
|
|
40
|
-
from langtrace_python_sdk.instrumentation.groq.instrumentation import (
|
|
41
35
|
GroqInstrumentation,
|
|
42
|
-
)
|
|
43
|
-
from langtrace_python_sdk.instrumentation.langchain.instrumentation import (
|
|
44
36
|
LangchainInstrumentation,
|
|
45
|
-
)
|
|
46
|
-
from langtrace_python_sdk.instrumentation.langchain_community.instrumentation import (
|
|
47
37
|
LangchainCommunityInstrumentation,
|
|
48
|
-
)
|
|
49
|
-
from langtrace_python_sdk.instrumentation.langchain_core.instrumentation import (
|
|
50
38
|
LangchainCoreInstrumentation,
|
|
51
|
-
)
|
|
52
|
-
from langtrace_python_sdk.instrumentation.langgraph.instrumentation import (
|
|
53
39
|
LanggraphInstrumentation,
|
|
54
|
-
)
|
|
55
|
-
from langtrace_python_sdk.instrumentation.llamaindex.instrumentation import (
|
|
56
40
|
LlamaindexInstrumentation,
|
|
57
|
-
)
|
|
58
|
-
from langtrace_python_sdk.instrumentation.openai.instrumentation import (
|
|
59
41
|
OpenAIInstrumentation,
|
|
60
|
-
)
|
|
61
|
-
from langtrace_python_sdk.instrumentation.pinecone.instrumentation import (
|
|
62
42
|
PineconeInstrumentation,
|
|
63
|
-
)
|
|
64
|
-
from langtrace_python_sdk.instrumentation.qdrant.instrumentation import (
|
|
65
43
|
QdrantInstrumentation,
|
|
66
|
-
)
|
|
67
|
-
from langtrace_python_sdk.instrumentation.weaviate.instrumentation import (
|
|
68
44
|
WeaviateInstrumentation,
|
|
69
45
|
)
|
|
46
|
+
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
|
|
47
|
+
from colorama import Fore
|
|
70
48
|
|
|
71
49
|
|
|
72
50
|
def init(
|
|
@@ -77,6 +55,7 @@ def init(
|
|
|
77
55
|
api_host: Optional[str] = None,
|
|
78
56
|
disable_instrumentations: Optional[DisableInstrumentations] = None,
|
|
79
57
|
):
|
|
58
|
+
print(Fore.GREEN + "Initializing Langtrace SDK.." + Fore.RESET)
|
|
80
59
|
provider = TracerProvider(resource=Resource.create({"service.name": sys.argv[0]}))
|
|
81
60
|
|
|
82
61
|
remote_write_exporter = (
|
|
@@ -90,20 +69,24 @@ def init(
|
|
|
90
69
|
simple_processor_console = SimpleSpanProcessor(console_exporter)
|
|
91
70
|
|
|
92
71
|
if write_spans_to_console:
|
|
72
|
+
print(Fore.BLUE + "Writing spans to console" + Fore.RESET)
|
|
93
73
|
provider.add_span_processor(simple_processor_console)
|
|
94
74
|
|
|
95
75
|
elif custom_remote_exporter is not None:
|
|
76
|
+
print(Fore.BLUE + "Exporting spans to custom remote exporter.." + Fore.RESET)
|
|
96
77
|
if batch:
|
|
97
78
|
provider.add_span_processor(batch_processor_remote)
|
|
98
79
|
else:
|
|
99
80
|
provider.add_span_processor(simple_processor_remote)
|
|
100
81
|
|
|
101
82
|
elif api_host is not None:
|
|
83
|
+
print(Fore.BLUE + f"Exporting spans to custom host: {api_host}.." + Fore.RESET)
|
|
102
84
|
if batch:
|
|
103
85
|
provider.add_span_processor(batch_processor_remote)
|
|
104
86
|
else:
|
|
105
87
|
provider.add_span_processor(simple_processor_remote)
|
|
106
88
|
else:
|
|
89
|
+
print(Fore.BLUE + "Exporting spans to Langtrace cloud.." + Fore.RESET)
|
|
107
90
|
provider.add_span_processor(batch_processor_remote)
|
|
108
91
|
|
|
109
92
|
# Initialize tracer
|
|
@@ -123,6 +106,7 @@ def init(
|
|
|
123
106
|
"anthropic": AnthropicInstrumentation(),
|
|
124
107
|
"cohere": CohereInstrumentation(),
|
|
125
108
|
"weaviate": WeaviateInstrumentation(),
|
|
109
|
+
"sqlalchemy": SQLAlchemyInstrumentor(),
|
|
126
110
|
}
|
|
127
111
|
|
|
128
112
|
init_instrumentations(disable_instrumentations, all_instrumentations)
|
|
@@ -126,7 +126,6 @@ def send_user_feedback(data: EvaluationAPIData) -> None:
|
|
|
126
126
|
timeout=None,
|
|
127
127
|
)
|
|
128
128
|
response.raise_for_status()
|
|
129
|
-
print("SENDING FEEDBACK PUT", response.status_code, response.text)
|
|
130
129
|
|
|
131
130
|
else:
|
|
132
131
|
# Make a POST request to create a new evaluation
|
|
@@ -137,7 +136,6 @@ def send_user_feedback(data: EvaluationAPIData) -> None:
|
|
|
137
136
|
headers=headers,
|
|
138
137
|
timeout=None,
|
|
139
138
|
)
|
|
140
|
-
print("Response", response.status_code, response.text)
|
|
141
139
|
response.raise_for_status()
|
|
142
140
|
|
|
143
141
|
except requests.RequestException as err:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.1.5"
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
interactions:
|
|
2
|
+
- request:
|
|
3
|
+
body: '{"messages": [{"content": "You are world class technical documentation
|
|
4
|
+
writer.", "role": "system"}, {"content": "how can langsmith help with testing?",
|
|
5
|
+
"role": "user"}], "model": "gpt-3.5-turbo", "n": 1, "stream": false, "temperature":
|
|
6
|
+
0.7}'
|
|
7
|
+
headers:
|
|
8
|
+
accept:
|
|
9
|
+
- application/json
|
|
10
|
+
accept-encoding:
|
|
11
|
+
- gzip, deflate
|
|
12
|
+
connection:
|
|
13
|
+
- keep-alive
|
|
14
|
+
content-length:
|
|
15
|
+
- '240'
|
|
16
|
+
content-type:
|
|
17
|
+
- application/json
|
|
18
|
+
host:
|
|
19
|
+
- api.openai.com
|
|
20
|
+
user-agent:
|
|
21
|
+
- OpenAI/Python 1.30.5
|
|
22
|
+
x-stainless-arch:
|
|
23
|
+
- arm64
|
|
24
|
+
x-stainless-async:
|
|
25
|
+
- 'false'
|
|
26
|
+
x-stainless-lang:
|
|
27
|
+
- python
|
|
28
|
+
x-stainless-os:
|
|
29
|
+
- MacOS
|
|
30
|
+
x-stainless-package-version:
|
|
31
|
+
- 1.30.5
|
|
32
|
+
x-stainless-runtime:
|
|
33
|
+
- CPython
|
|
34
|
+
x-stainless-runtime-version:
|
|
35
|
+
- 3.12.3
|
|
36
|
+
method: POST
|
|
37
|
+
uri: https://api.openai.com/v1/chat/completions
|
|
38
|
+
response:
|
|
39
|
+
body:
|
|
40
|
+
string: !!binary |
|
|
41
|
+
H4sIAAAAAAAAA3xVTW8bOQy9+1cQc7aNfLR16tv2A4tFt9hL9rRdBLSGnlGikVSSsuMt8t8X1Iwd
|
|
42
|
+
pwh6MWxRfHp8fKR/zAAa3zZraFyP6oYcFu//br/s3+271XUeVvfb+0f6cvv4x8MHyjf4tZlbRtrc
|
|
43
|
+
k9Nj1tKlIQdSn+IYdkyoZKiXq8vVxc3NxeqmBobUUrC0Luvievl2oYU3aXFxefV2yuyTdyTNGv6Z
|
|
44
|
+
AQD8qJ/GMbb02KzhYn48GUgEO2rWp0sADadgJw2KeFGM2syfgy5FpVhp/4mxk8FrD14AIac98bYE
|
|
45
|
+
0JQCaI8KDiP0FDLs7ZaSqI8d+Ag7ZJ+KwB4Psv4Wv8XLJfxWNA1WMtyOF9fw/IIhbQiKUAuaYM9e
|
|
46
|
+
CfCUYdAgjn1WgW1iOKTCIGmre2QCzDl4hyauLOHDAQLtiLGrbFQgohbGAAFjV7AjyJwciVjcYcaN
|
|
47
|
+
D149ydxwK5eRQH3WoZBYUTmgj/A5dsFLP4cBH0Z8IBRPXHnFFBdKro/eYQAlHGCgYUMsVpaJy35T
|
|
48
|
+
DDqB9nTSbCK0NK2ullUh+ISK8DtF4lrZz3J1Y2Ri2drlDZp+KUJmamnrI7XAJZAAxhYyqhJHmdee
|
|
49
|
+
2atW7ffi3UM4wOjHZzChc6lfKnzbezm2LCOrdyUgh4P1zxxiacfKxFE0N8hoGabvxVvLICB3BDik
|
|
50
|
+
EhXSFlq/Ixaqj1cdricdPqIQfMWIHQ0U9Re2Sdxh9P9RLXeoGWc9fKVl1gVG91B7kTl1TCJG5sge
|
|
51
|
+
nfpd9UbFpCiFCWyWmXqK4nf2q5qNLO8XvrSS3izhU3LFyni1pxgknU1UO901Jud11O9MUoLKvBJL
|
|
52
|
+
2tNJ8wVTqGPj4zbxUF+qYzENlHkzHI4GMvD2nJR5HUGUi9PC1MII8jwcJxWiLRCK7lA5uIDs9WDp
|
|
53
|
+
VYajhi/Aqwx/mWAhzH+qXpQJh+AjvTYbc/BD5rQ7tnRSfT41psfojFMIuEnjxJi5qnJnU+jjLoVd
|
|
54
|
+
1eaVJi+baRM+nVZoSF3mtLF1G0sIp/Otj176OyaUFG1diqY8pj/NAP6tq7q82L5N5jRkvdP0QNEA
|
|
55
|
+
r1YjXPP853AWvHw/RTUphrPAm3eziWEjB1Ea7rY+dsSZfd3cxnP2NPsfAAD//wMAt4ZeGbgGAAA=
|
|
56
|
+
headers:
|
|
57
|
+
CF-Cache-Status:
|
|
58
|
+
- DYNAMIC
|
|
59
|
+
CF-RAY:
|
|
60
|
+
- 88c03f46bf3b23c5-LHR
|
|
61
|
+
Connection:
|
|
62
|
+
- keep-alive
|
|
63
|
+
Content-Encoding:
|
|
64
|
+
- gzip
|
|
65
|
+
Content-Type:
|
|
66
|
+
- application/json
|
|
67
|
+
Date:
|
|
68
|
+
- Thu, 30 May 2024 16:54:42 GMT
|
|
69
|
+
Server:
|
|
70
|
+
- cloudflare
|
|
71
|
+
Set-Cookie:
|
|
72
|
+
- __cf_bm=9en.DN2CPQUgM8CubXIqqiVZkm43q.oBCL4n7bXxViw-1717088082-1.0.1.1-nl9dbPbwwGsUORjX1Y8Ta7S2v.MBG3o1JWUgYQU98tFUNcY9hFcmfcXWFu_bcohUX1nun6S55Wg2rg3MX7PHPQ;
|
|
73
|
+
path=/; expires=Thu, 30-May-24 17:24:42 GMT; domain=.api.openai.com; HttpOnly;
|
|
74
|
+
Secure; SameSite=None
|
|
75
|
+
- _cfuvid=bJ_po6.pyb_9JWu27O8yfh1AX1atGjC5_sFN497eMI8-1717088082420-0.0.1.1-604800000;
|
|
76
|
+
path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
|
|
77
|
+
Transfer-Encoding:
|
|
78
|
+
- chunked
|
|
79
|
+
alt-svc:
|
|
80
|
+
- h3=":443"; ma=86400
|
|
81
|
+
openai-organization:
|
|
82
|
+
- scale3-1
|
|
83
|
+
openai-processing-ms:
|
|
84
|
+
- '4295'
|
|
85
|
+
openai-version:
|
|
86
|
+
- '2020-10-01'
|
|
87
|
+
strict-transport-security:
|
|
88
|
+
- max-age=15724800; includeSubDomains
|
|
89
|
+
x-ratelimit-limit-requests:
|
|
90
|
+
- '10000'
|
|
91
|
+
x-ratelimit-limit-tokens:
|
|
92
|
+
- '2000000'
|
|
93
|
+
x-ratelimit-remaining-requests:
|
|
94
|
+
- '9999'
|
|
95
|
+
x-ratelimit-remaining-tokens:
|
|
96
|
+
- '1999960'
|
|
97
|
+
x-ratelimit-reset-requests:
|
|
98
|
+
- 6ms
|
|
99
|
+
x-ratelimit-reset-tokens:
|
|
100
|
+
- 1ms
|
|
101
|
+
x-request-id:
|
|
102
|
+
- req_4b43c2d3cf0dc839647c8b775b75d6f5
|
|
103
|
+
status:
|
|
104
|
+
code: 200
|
|
105
|
+
message: OK
|
|
106
|
+
version: 1
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Unit tests configuration module."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
from langtrace_python_sdk.instrumentation.openai.instrumentation import (
|
|
7
|
+
OpenAIInstrumentation,
|
|
8
|
+
)
|
|
9
|
+
from langtrace_python_sdk.instrumentation.langchain.instrumentation import (
|
|
10
|
+
LangchainInstrumentation,
|
|
11
|
+
)
|
|
12
|
+
from langtrace_python_sdk.instrumentation.langchain_core.instrumentation import (
|
|
13
|
+
LangchainCoreInstrumentation,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
from langtrace_python_sdk.instrumentation.langchain_community.instrumentation import (
|
|
17
|
+
LangchainCommunityInstrumentation,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@pytest.fixture(autouse=True)
|
|
22
|
+
def clear_exporter(exporter):
|
|
23
|
+
exporter.clear()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@pytest.fixture(autouse=True)
|
|
27
|
+
def environment():
|
|
28
|
+
if not os.environ.get("OPENAI_API_KEY"):
|
|
29
|
+
os.environ["OPENAI_API_KEY"] = "test"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@pytest.fixture(scope="module")
|
|
33
|
+
def vcr_config():
|
|
34
|
+
return {"filter_headers": ["authorization", "x-api-key"]}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@pytest.fixture(scope="session", autouse=True)
|
|
38
|
+
def instrument():
|
|
39
|
+
OpenAIInstrumentation().instrument()
|
|
40
|
+
LangchainInstrumentation().instrument()
|
|
41
|
+
LangchainCoreInstrumentation().instrument()
|
|
42
|
+
LangchainCommunityInstrumentation().instrument()
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from langchain_openai import ChatOpenAI
|
|
3
|
+
from langchain_core.prompts.chat import ChatPromptTemplate
|
|
4
|
+
from langchain_core.output_parsers import StrOutputParser
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@pytest.mark.vcr()
|
|
8
|
+
def test_langchain(exporter):
|
|
9
|
+
llm = ChatOpenAI()
|
|
10
|
+
prompt = ChatPromptTemplate.from_messages(
|
|
11
|
+
[
|
|
12
|
+
("system", "You are world class technical documentation writer."),
|
|
13
|
+
("user", "{input}"),
|
|
14
|
+
]
|
|
15
|
+
)
|
|
16
|
+
output_parser = StrOutputParser()
|
|
17
|
+
chain = prompt | llm | output_parser
|
|
18
|
+
chain.invoke({"input": "how can langsmith help with testing?"})
|
|
19
|
+
spans = exporter.get_finished_spans()
|
|
20
|
+
|
|
21
|
+
assert [
|
|
22
|
+
"ChatPromptTemplate.invoke",
|
|
23
|
+
"openai.chat.completions.create",
|
|
24
|
+
"StrOutputParser.parse",
|
|
25
|
+
"StrOutputParser.parse_result",
|
|
26
|
+
"StrOutputParser.invoke",
|
|
27
|
+
"RunnableSequence.invoke",
|
|
28
|
+
] == [span.name for span in spans]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py
DELETED
|
File without changes
|
langtrace_python_sdk-2.1.2/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.1.2"
|
|
File without changes
|