langtrace-python-sdk 2.1.29__tar.gz → 2.2.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.1.29 → langtrace_python_sdk-2.2.2}/PKG-INFO +26 -19
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/README.md +21 -17
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/pyproject.toml +5 -2
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/cohere_example/chat.py +1 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/cohere_example/chat_stream.py +3 -0
- langtrace_python_sdk-2.2.2/src/examples/dspy_example/math_problems_cot_parallel.py +59 -0
- langtrace_python_sdk-2.2.2/src/examples/gemini_example/__init__.py +6 -0
- langtrace_python_sdk-2.2.2/src/examples/gemini_example/function_tools.py +62 -0
- langtrace_python_sdk-2.2.2/src/examples/gemini_example/main.py +91 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/langchain_example/__init__.py +8 -0
- langtrace_python_sdk-2.2.2/src/examples/langchain_example/groq_example.py +45 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/ollama_example/basic.py +1 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/openai_example/__init__.py +1 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/openai_example/async_tool_calling_nonstreaming.py +1 -1
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/openai_example/chat_completion.py +1 -1
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/openai_example/embeddings_create.py +1 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/openai_example/images_edit.py +2 -2
- langtrace_python_sdk-2.2.2/src/examples/vertexai_example/__init__.py +6 -0
- langtrace_python_sdk-2.2.2/src/examples/vertexai_example/main.py +214 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/constants/instrumentation/common.py +2 -0
- langtrace_python_sdk-2.2.2/src/langtrace_python_sdk/constants/instrumentation/gemini.py +12 -0
- langtrace_python_sdk-2.2.2/src/langtrace_python_sdk/constants/instrumentation/vertexai.py +42 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/__init__.py +4 -0
- langtrace_python_sdk-2.2.2/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +179 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/chroma/patch.py +29 -29
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/cohere/patch.py +143 -242
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/dspy/instrumentation.py +2 -2
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/dspy/patch.py +36 -36
- langtrace_python_sdk-2.2.2/src/langtrace_python_sdk/instrumentation/gemini/__init__.py +3 -0
- langtrace_python_sdk-2.2.2/src/langtrace_python_sdk/instrumentation/gemini/instrumentation.py +36 -0
- langtrace_python_sdk-2.2.2/src/langtrace_python_sdk/instrumentation/gemini/patch.py +186 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/groq/patch.py +82 -125
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/ollama/patch.py +62 -65
- langtrace_python_sdk-2.2.2/src/langtrace_python_sdk/instrumentation/openai/patch.py +651 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/qdrant/patch.py +6 -6
- langtrace_python_sdk-2.2.2/src/langtrace_python_sdk/instrumentation/vertexai/__init__.py +3 -0
- langtrace_python_sdk-2.2.2/src/langtrace_python_sdk/instrumentation/vertexai/instrumentation.py +33 -0
- langtrace_python_sdk-2.2.2/src/langtrace_python_sdk/instrumentation/vertexai/patch.py +131 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/langtrace.py +5 -0
- langtrace_python_sdk-2.2.2/src/langtrace_python_sdk/utils/__init__.py +24 -0
- langtrace_python_sdk-2.2.2/src/langtrace_python_sdk/utils/llm.py +384 -0
- langtrace_python_sdk-2.2.2/src/langtrace_python_sdk/version.py +1 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/run_example.py +22 -1
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/anthropic/test_anthropic.py +28 -27
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/cohere/test_cohere_chat.py +36 -36
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/cohere/test_cohere_embed.py +12 -9
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/cohere/test_cohere_rerank.py +18 -11
- langtrace_python_sdk-2.2.2/src/tests/groq/cassettes/test_async_chat_completion.yaml +113 -0
- langtrace_python_sdk-2.2.2/src/tests/groq/cassettes/test_async_chat_completion_streaming.yaml +2232 -0
- langtrace_python_sdk-2.2.2/src/tests/groq/cassettes/test_chat_completion.yaml +114 -0
- langtrace_python_sdk-2.2.2/src/tests/groq/cassettes/test_chat_completion_streaming.yaml +2512 -0
- langtrace_python_sdk-2.2.2/src/tests/groq/conftest.py +33 -0
- langtrace_python_sdk-2.2.2/src/tests/groq/test_groq.py +142 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/openai/cassettes/test_async_chat_completion_streaming.yaml +28 -28
- langtrace_python_sdk-2.2.2/src/tests/openai/test_chat_completion.py +132 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/openai/test_image_generation.py +47 -24
- langtrace_python_sdk-2.2.2/src/tests/utils.py +79 -0
- langtrace_python_sdk-2.1.29/src/examples/langchain_example/groq_example.py +0 -32
- langtrace_python_sdk-2.1.29/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +0 -207
- langtrace_python_sdk-2.1.29/src/langtrace_python_sdk/instrumentation/openai/patch.py +0 -955
- langtrace_python_sdk-2.1.29/src/langtrace_python_sdk/utils/__init__.py +0 -13
- langtrace_python_sdk-2.1.29/src/langtrace_python_sdk/utils/llm.py +0 -79
- langtrace_python_sdk-2.1.29/src/langtrace_python_sdk/version.py +0 -1
- langtrace_python_sdk-2.1.29/src/tests/openai/test_chat_completion.py +0 -146
- langtrace_python_sdk-2.1.29/src/tests/utils.py +0 -44
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/.gitignore +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/LICENSE +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/anthropic_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/anthropic_example/completion.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/chroma_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/chroma_example/basic.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/cohere_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/cohere_example/embed.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/cohere_example/rerank.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/cohere_example/tools.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/crewai_example/basic.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/dspy_example/math_problems_cot.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/dspy_example/program_of_thought_basic.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/dspy_example/quiz_gen.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/dspy_example/react.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/fastapi_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/fastapi_example/basic_route.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/hiveagent_example/basic.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/inspect_ai_example/basic_eval.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/langchain_example/basic.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/langchain_example/langgraph_example.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/langchain_example/tool.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/llamaindex_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/llamaindex_example/agent.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/llamaindex_example/basic.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/llamaindex_example/data/abramov.txt +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/ollama_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/openai_example/async_tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/openai_example/function_calling.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/openai_example/images_generate.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/openai_example/resources/lounge_flamingo.png +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/openai_example/resources/mask.png +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/openai_example/tool_calling.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/openai_example/tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/openai_example/tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/perplexity_example/basic.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/pinecone_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/pinecone_example/basic.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/qdrant_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/qdrant_example/basic.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/weaviate_example/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/weaviate_example/query_text.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/constants/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/constants/exporter/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/constants/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/constants/instrumentation/anthropic.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/constants/instrumentation/chroma.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/constants/instrumentation/cohere.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/constants/instrumentation/groq.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/constants/instrumentation/ollama.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/constants/instrumentation/openai.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/constants/instrumentation/pinecone.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/constants/instrumentation/qdrant.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/constants/instrumentation/weaviate.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/extensions/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/extensions/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/extensions/langtrace_filesystem.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/chroma/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/cohere/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/cohere/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/crewai/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/crewai/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/crewai/patch.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/dspy/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/groq/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/groq/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/langchain/patch.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/langchain_community/patch.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/langchain_core/patch.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/langgraph/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/langgraph/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/langgraph/patch.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/llamaindex/patch.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/ollama/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/ollama/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/openai/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/openai/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/pinecone/patch.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/qdrant/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/qdrant/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/weaviate/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/weaviate/instrumentation.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/instrumentation/weaviate/patch.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/types/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/utils/langtrace_sampler.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/utils/misc.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/utils/prompt_registry.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/utils/sdk_version_checker.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/utils/silently_fail.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/utils/types.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/langtrace_python_sdk/utils/with_root_span.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/__init__.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/anthropic/cassettes/test_anthropic.yaml +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/anthropic/cassettes/test_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/anthropic/cassettes/test_async_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/anthropic/conftest.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/chroma/conftest.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/chroma/test_chroma.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/cohere/cassettes/test_cohere_chat.yaml +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/cohere/cassettes/test_cohere_chat_streaming.yaml +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/cohere/cassettes/test_cohere_embed.yaml +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/cohere/cassettes/test_cohere_rerank.yaml +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/cohere/conftest.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/conftest.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/langchain/cassettes/test_langchain.yaml +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/langchain/conftest.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/langchain/test_langchain.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/openai/cassettes/test_async_image_generation.yaml +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/openai/cassettes/test_chat_completion.yaml +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/openai/cassettes/test_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/openai/cassettes/test_image_generation.yaml +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/openai/conftest.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/openai/test_embeddings.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/pinecone/cassettes/test_query.yaml +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/pinecone/cassettes/test_upsert.yaml +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/pinecone/conftest.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/pinecone/test_pinecone.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/qdrant/conftest.py +0 -0
- {langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/tests/qdrant/test_qdrant.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: langtrace-python-sdk
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.2
|
|
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>
|
|
@@ -20,11 +20,14 @@ Requires-Dist: opentelemetry-instrumentation>=0.46b0
|
|
|
20
20
|
Requires-Dist: opentelemetry-sdk>=1.25.0
|
|
21
21
|
Requires-Dist: sqlalchemy
|
|
22
22
|
Requires-Dist: tiktoken>=0.1.1
|
|
23
|
-
Requires-Dist: trace-attributes<
|
|
23
|
+
Requires-Dist: trace-attributes<7.0.0,>=6.0.0
|
|
24
24
|
Provides-Extra: dev
|
|
25
25
|
Requires-Dist: anthropic; extra == 'dev'
|
|
26
26
|
Requires-Dist: chromadb; extra == 'dev'
|
|
27
27
|
Requires-Dist: cohere; extra == 'dev'
|
|
28
|
+
Requires-Dist: google-cloud-aiplatform; extra == 'dev'
|
|
29
|
+
Requires-Dist: google-generativeai; extra == 'dev'
|
|
30
|
+
Requires-Dist: groq; extra == 'dev'
|
|
28
31
|
Requires-Dist: langchain; extra == 'dev'
|
|
29
32
|
Requires-Dist: langchain-community; extra == 'dev'
|
|
30
33
|
Requires-Dist: langchain-openai; extra == 'dev'
|
|
@@ -274,23 +277,27 @@ prompt = get_prompt_from_registry(<Registry ID>, options={"prompt_version": 1, "
|
|
|
274
277
|
|
|
275
278
|
Langtrace automatically captures traces from the following vendors:
|
|
276
279
|
|
|
277
|
-
| Vendor | Type | Typescript SDK | Python SDK
|
|
278
|
-
| ------------ | --------------- | ------------------ |
|
|
279
|
-
| OpenAI | LLM | :white_check_mark: | :white_check_mark:
|
|
280
|
-
| Anthropic | LLM | :white_check_mark: | :white_check_mark:
|
|
281
|
-
| Azure OpenAI | LLM | :white_check_mark: | :white_check_mark:
|
|
282
|
-
| Cohere | LLM | :white_check_mark: | :white_check_mark:
|
|
283
|
-
| Groq | LLM | :x: | :white_check_mark:
|
|
284
|
-
|
|
|
285
|
-
|
|
|
286
|
-
|
|
|
287
|
-
|
|
|
288
|
-
|
|
|
289
|
-
|
|
|
290
|
-
|
|
|
291
|
-
|
|
|
292
|
-
|
|
|
293
|
-
|
|
|
280
|
+
| Vendor | Type | Typescript SDK | Python SDK |
|
|
281
|
+
| ------------ | --------------- | ------------------ | ------------------------------- |
|
|
282
|
+
| OpenAI | LLM | :white_check_mark: | :white_check_mark: |
|
|
283
|
+
| Anthropic | LLM | :white_check_mark: | :white_check_mark: |
|
|
284
|
+
| Azure OpenAI | LLM | :white_check_mark: | :white_check_mark: |
|
|
285
|
+
| Cohere | LLM | :white_check_mark: | :white_check_mark: |
|
|
286
|
+
| Groq | LLM | :x: | :white_check_mark: |
|
|
287
|
+
| Perplexity | LLM | :white_check_mark: | :white_check_mark: |
|
|
288
|
+
| Gemini | LLM | :x: | :white_check_mark: |
|
|
289
|
+
| Langchain | Framework | :x: | :white_check_mark: |
|
|
290
|
+
| LlamaIndex | Framework | :white_check_mark: | :white_check_mark: |
|
|
291
|
+
| Langgraph | Framework | :x: | :white_check_mark: |
|
|
292
|
+
| DSPy | Framework | :x: | :white_check_mark: |
|
|
293
|
+
| CrewAI | Framework | :x: | :white_check_mark: |
|
|
294
|
+
| Ollama | Framework | :x: | :white_check_mark: |
|
|
295
|
+
| VertexAI | Framework | :x: | :white_check_mark: |
|
|
296
|
+
| Pinecone | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
297
|
+
| ChromaDB | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
298
|
+
| QDrant | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
299
|
+
| Weaviate | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
300
|
+
| PGVector | Vector Database | :white_check_mark: | :white_check_mark: (SQLAlchemy) |
|
|
294
301
|
|
|
295
302
|
---
|
|
296
303
|
|
|
@@ -232,23 +232,27 @@ prompt = get_prompt_from_registry(<Registry ID>, options={"prompt_version": 1, "
|
|
|
232
232
|
|
|
233
233
|
Langtrace automatically captures traces from the following vendors:
|
|
234
234
|
|
|
235
|
-
| Vendor | Type | Typescript SDK | Python SDK
|
|
236
|
-
| ------------ | --------------- | ------------------ |
|
|
237
|
-
| OpenAI | LLM | :white_check_mark: | :white_check_mark:
|
|
238
|
-
| Anthropic | LLM | :white_check_mark: | :white_check_mark:
|
|
239
|
-
| Azure OpenAI | LLM | :white_check_mark: | :white_check_mark:
|
|
240
|
-
| Cohere | LLM | :white_check_mark: | :white_check_mark:
|
|
241
|
-
| Groq | LLM | :x: | :white_check_mark:
|
|
242
|
-
|
|
|
243
|
-
|
|
|
244
|
-
|
|
|
245
|
-
|
|
|
246
|
-
|
|
|
247
|
-
|
|
|
248
|
-
|
|
|
249
|
-
|
|
|
250
|
-
|
|
|
251
|
-
|
|
|
235
|
+
| Vendor | Type | Typescript SDK | Python SDK |
|
|
236
|
+
| ------------ | --------------- | ------------------ | ------------------------------- |
|
|
237
|
+
| OpenAI | LLM | :white_check_mark: | :white_check_mark: |
|
|
238
|
+
| Anthropic | LLM | :white_check_mark: | :white_check_mark: |
|
|
239
|
+
| Azure OpenAI | LLM | :white_check_mark: | :white_check_mark: |
|
|
240
|
+
| Cohere | LLM | :white_check_mark: | :white_check_mark: |
|
|
241
|
+
| Groq | LLM | :x: | :white_check_mark: |
|
|
242
|
+
| Perplexity | LLM | :white_check_mark: | :white_check_mark: |
|
|
243
|
+
| Gemini | LLM | :x: | :white_check_mark: |
|
|
244
|
+
| Langchain | Framework | :x: | :white_check_mark: |
|
|
245
|
+
| LlamaIndex | Framework | :white_check_mark: | :white_check_mark: |
|
|
246
|
+
| Langgraph | Framework | :x: | :white_check_mark: |
|
|
247
|
+
| DSPy | Framework | :x: | :white_check_mark: |
|
|
248
|
+
| CrewAI | Framework | :x: | :white_check_mark: |
|
|
249
|
+
| Ollama | Framework | :x: | :white_check_mark: |
|
|
250
|
+
| VertexAI | Framework | :x: | :white_check_mark: |
|
|
251
|
+
| Pinecone | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
252
|
+
| ChromaDB | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
253
|
+
| QDrant | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
254
|
+
| Weaviate | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
255
|
+
| PGVector | Vector Database | :white_check_mark: | :white_check_mark: (SQLAlchemy) |
|
|
252
256
|
|
|
253
257
|
---
|
|
254
258
|
|
|
@@ -18,7 +18,7 @@ classifiers=[
|
|
|
18
18
|
"Operating System :: OS Independent",
|
|
19
19
|
]
|
|
20
20
|
dependencies = [
|
|
21
|
-
'trace-attributes>=
|
|
21
|
+
'trace-attributes>=6.0.0,<7.0.0',
|
|
22
22
|
'opentelemetry-api>=1.25.0',
|
|
23
23
|
'opentelemetry-sdk>=1.25.0',
|
|
24
24
|
'opentelemetry-instrumentation>=0.46b0',
|
|
@@ -49,7 +49,10 @@ dev = [
|
|
|
49
49
|
"cohere",
|
|
50
50
|
"qdrant_client",
|
|
51
51
|
"weaviate-client",
|
|
52
|
-
"ollama"
|
|
52
|
+
"ollama",
|
|
53
|
+
"groq",
|
|
54
|
+
"google-generativeai",
|
|
55
|
+
"google-cloud-aiplatform"
|
|
53
56
|
]
|
|
54
57
|
|
|
55
58
|
test = [
|
{langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/cohere_example/chat.py
RENAMED
|
@@ -23,6 +23,7 @@ def chat_comp():
|
|
|
23
23
|
"message": "The man who is widely credited with discovering gravity is Sir Isaac Newton",
|
|
24
24
|
},
|
|
25
25
|
],
|
|
26
|
+
k=3,
|
|
26
27
|
message="Tell me a story in 3 sentences or less?",
|
|
27
28
|
preamble="answer like a pirate",
|
|
28
29
|
# perform web search before answering the question. You can also use your own custom connector.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import dspy
|
|
2
|
+
from dspy.datasets.gsm8k import GSM8K, gsm8k_metric
|
|
3
|
+
from dspy.teleprompt import BootstrapFewShot
|
|
4
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
5
|
+
from opentelemetry.context import get_current, attach, detach
|
|
6
|
+
|
|
7
|
+
# flake8: noqa
|
|
8
|
+
from langtrace_python_sdk import langtrace, with_langtrace_root_span
|
|
9
|
+
|
|
10
|
+
langtrace.init()
|
|
11
|
+
|
|
12
|
+
turbo = dspy.OpenAI(model="gpt-3.5-turbo", max_tokens=250)
|
|
13
|
+
dspy.settings.configure(lm=turbo)
|
|
14
|
+
|
|
15
|
+
# Load math questions from the GSM8K dataset
|
|
16
|
+
gsm8k = GSM8K()
|
|
17
|
+
gsm8k_trainset, gsm8k_devset = gsm8k.train[:10], gsm8k.dev[:10]
|
|
18
|
+
|
|
19
|
+
class CoT(dspy.Module):
|
|
20
|
+
def __init__(self):
|
|
21
|
+
super().__init__()
|
|
22
|
+
self.prog = dspy.ChainOfThought("question -> answer")
|
|
23
|
+
|
|
24
|
+
def forward(self, question):
|
|
25
|
+
return self.prog(question=question)
|
|
26
|
+
|
|
27
|
+
@with_langtrace_root_span(name="parallel_example")
|
|
28
|
+
def example():
|
|
29
|
+
# Set up the optimizer: we want to "bootstrap" (i.e., self-generate) 4-shot examples of our CoT program.
|
|
30
|
+
config = dict(max_bootstrapped_demos=4, max_labeled_demos=4)
|
|
31
|
+
|
|
32
|
+
# Optimize! Use the `gsm8k_metric` here. In general, the metric is going to tell the optimizer how well it's doing.
|
|
33
|
+
teleprompter = BootstrapFewShot(metric=gsm8k_metric, **config)
|
|
34
|
+
optimized_cot = teleprompter.compile(CoT(), trainset=gsm8k_trainset)
|
|
35
|
+
|
|
36
|
+
questions = [
|
|
37
|
+
"What is the cosine of 0?",
|
|
38
|
+
"What is the tangent of 0?",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
current_context = get_current()
|
|
42
|
+
|
|
43
|
+
def run_with_context(context, func, *args, **kwargs):
|
|
44
|
+
token = attach(context)
|
|
45
|
+
try:
|
|
46
|
+
return func(*args, **kwargs)
|
|
47
|
+
finally:
|
|
48
|
+
detach(token)
|
|
49
|
+
|
|
50
|
+
with ThreadPoolExecutor(max_workers=2) as executor:
|
|
51
|
+
futures = [executor.submit(run_with_context, current_context, optimized_cot, question=q) for q in questions]
|
|
52
|
+
|
|
53
|
+
for future in futures:
|
|
54
|
+
ans = future.result()
|
|
55
|
+
print(ans)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
if __name__ == "__main__":
|
|
59
|
+
example()
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
tools = [
|
|
2
|
+
{
|
|
3
|
+
"function_declarations": [
|
|
4
|
+
{
|
|
5
|
+
"name": "find_movies",
|
|
6
|
+
"description": "find movie titles currently playing in theaters based on any description, genre, title words, etc.",
|
|
7
|
+
"parameters": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"location": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "The city and state, e.g. San Francisco, CA or a zip code e.g. 95616",
|
|
13
|
+
},
|
|
14
|
+
"description": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "Any kind of description including category or genre, title words, attributes, etc.",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
"required": ["description"],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "find_theaters",
|
|
24
|
+
"description": "find theaters based on location and optionally movie title which is currently playing in theaters",
|
|
25
|
+
"parameters": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"properties": {
|
|
28
|
+
"location": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "The city and state, e.g. San Francisco, CA or a zip code e.g. 95616",
|
|
31
|
+
},
|
|
32
|
+
"movie": {"type": "string", "description": "Any movie title"},
|
|
33
|
+
},
|
|
34
|
+
"required": ["location"],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "get_showtimes",
|
|
39
|
+
"description": "Find the start times for movies playing in a specific theater",
|
|
40
|
+
"parameters": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"properties": {
|
|
43
|
+
"location": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"description": "The city and state, e.g. San Francisco, CA or a zip code e.g. 95616",
|
|
46
|
+
},
|
|
47
|
+
"movie": {"type": "string", "description": "Any movie title"},
|
|
48
|
+
"theater": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"description": "Name of the theater",
|
|
51
|
+
},
|
|
52
|
+
"date": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"description": "Date for requested showtime",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
"required": ["location", "movie", "theater", "date"],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
]
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
from langtrace_python_sdk import langtrace
|
|
2
|
+
import google.generativeai as genai
|
|
3
|
+
from dotenv import load_dotenv
|
|
4
|
+
import os
|
|
5
|
+
import asyncio
|
|
6
|
+
import pathlib
|
|
7
|
+
from .function_tools import tools
|
|
8
|
+
|
|
9
|
+
load_dotenv()
|
|
10
|
+
|
|
11
|
+
langtrace.init(write_spans_to_console=False, batch=False)
|
|
12
|
+
genai.configure(api_key=os.environ["GEMINI_API_KEY"])
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
async def async_demo():
|
|
16
|
+
task1 = asyncio.create_task(async_generate())
|
|
17
|
+
task2 = asyncio.create_task(async_generate(stream=True))
|
|
18
|
+
return await asyncio.gather(task1, task2)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def basic():
|
|
22
|
+
generate()
|
|
23
|
+
generate(stream=True, with_tools=True)
|
|
24
|
+
|
|
25
|
+
# image_to_text()
|
|
26
|
+
# audio_to_text()
|
|
27
|
+
asyncio.run(async_demo())
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def generate(stream=False, with_tools=False):
|
|
31
|
+
model = genai.GenerativeModel(
|
|
32
|
+
"gemini-1.5-pro", system_instruction="You are a cat. Your name is Neko."
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
response = model.generate_content(
|
|
36
|
+
"Write a story about a AI and magic",
|
|
37
|
+
stream=stream,
|
|
38
|
+
tools=tools if with_tools else None,
|
|
39
|
+
)
|
|
40
|
+
if stream:
|
|
41
|
+
for res in response:
|
|
42
|
+
if res.text:
|
|
43
|
+
print(res.text)
|
|
44
|
+
else:
|
|
45
|
+
print(response.text)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
async def async_generate(stream=False):
|
|
49
|
+
model = genai.GenerativeModel(
|
|
50
|
+
"gemini-1.5-pro", system_instruction="You are a cat. Your name is Neko."
|
|
51
|
+
)
|
|
52
|
+
response = await model.generate_content_async(
|
|
53
|
+
"Write a story about a AI and magic", stream=stream
|
|
54
|
+
)
|
|
55
|
+
if stream:
|
|
56
|
+
async for chunk in response:
|
|
57
|
+
if chunk.text:
|
|
58
|
+
print(chunk.text)
|
|
59
|
+
else:
|
|
60
|
+
print(response.text)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def image_to_text(stream=False):
|
|
64
|
+
model = genai.GenerativeModel("gemini-1.5-flash")
|
|
65
|
+
image1 = {
|
|
66
|
+
"mime_type": "image/jpeg",
|
|
67
|
+
"data": pathlib.Path("src/examples/gemini_example/jetpack.jpg").read_bytes(),
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
prompt = "Describe me this picture. What do you see in it."
|
|
71
|
+
response = model.generate_content([prompt, image1], stream=stream)
|
|
72
|
+
if stream:
|
|
73
|
+
for res in response:
|
|
74
|
+
print(res.text)
|
|
75
|
+
else:
|
|
76
|
+
print(response.text)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# def audio_to_text(stream=False):
|
|
80
|
+
# model = genai.GenerativeModel("gemini-1.5-flash")
|
|
81
|
+
# audio = genai.upload_file(
|
|
82
|
+
# pathlib.Path("src/examples/gemini_example/voice_note.mp3")
|
|
83
|
+
# )
|
|
84
|
+
|
|
85
|
+
# prompt = "Summarize this voice recording."
|
|
86
|
+
# response = model.generate_content([prompt, audio], stream=stream)
|
|
87
|
+
# if stream:
|
|
88
|
+
# for res in response:
|
|
89
|
+
# print(res.text)
|
|
90
|
+
# else:
|
|
91
|
+
# print(response.text)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from .basic import basic_app, rag, load_and_split
|
|
2
2
|
from langtrace_python_sdk import with_langtrace_root_span
|
|
3
3
|
|
|
4
|
+
from .groq_example import groq_basic, groq_streaming
|
|
5
|
+
|
|
4
6
|
|
|
5
7
|
class LangChainRunner:
|
|
6
8
|
@with_langtrace_root_span("LangChain")
|
|
@@ -8,3 +10,9 @@ class LangChainRunner:
|
|
|
8
10
|
basic_app()
|
|
9
11
|
rag()
|
|
10
12
|
load_and_split()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class GroqRunner:
|
|
16
|
+
@with_langtrace_root_span("Groq")
|
|
17
|
+
def run(self):
|
|
18
|
+
groq_streaming()
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from dotenv import find_dotenv, load_dotenv
|
|
2
|
+
from langchain_core.prompts import ChatPromptTemplate
|
|
3
|
+
from langchain_groq import ChatGroq
|
|
4
|
+
from groq import Groq
|
|
5
|
+
|
|
6
|
+
_ = load_dotenv(find_dotenv())
|
|
7
|
+
|
|
8
|
+
from langtrace_python_sdk import langtrace
|
|
9
|
+
|
|
10
|
+
# from langtrace_python_sdk.utils.with_root_span import with_langtrace_root_span
|
|
11
|
+
|
|
12
|
+
_ = load_dotenv(find_dotenv())
|
|
13
|
+
|
|
14
|
+
langtrace.init()
|
|
15
|
+
|
|
16
|
+
client = Groq()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def groq_basic():
|
|
20
|
+
chat_completion = client.chat.completions.create(
|
|
21
|
+
messages=[
|
|
22
|
+
{
|
|
23
|
+
"role": "user",
|
|
24
|
+
"content": "Explain the importance of low latency LLMs",
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
stream=False,
|
|
28
|
+
model="llama3-8b-8192",
|
|
29
|
+
)
|
|
30
|
+
return chat_completion
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def groq_streaming():
|
|
34
|
+
chat_completion = client.chat.completions.create(
|
|
35
|
+
messages=[
|
|
36
|
+
{
|
|
37
|
+
"role": "user",
|
|
38
|
+
"content": "Explain the importance of low latency LLMs",
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
stream=True,
|
|
42
|
+
model="llama3-8b-8192",
|
|
43
|
+
)
|
|
44
|
+
for chunk in chat_completion:
|
|
45
|
+
print(chunk)
|
{langtrace_python_sdk-2.1.29 → langtrace_python_sdk-2.2.2}/src/examples/openai_example/__init__.py
RENAMED
|
@@ -10,6 +10,7 @@ class OpenAIRunner:
|
|
|
10
10
|
run_conversation as run_conversation_streaming,
|
|
11
11
|
)
|
|
12
12
|
from .chat_completion import chat_completion as chat_completion_example
|
|
13
|
+
|
|
13
14
|
from .embeddings_create import embeddings_create as embeddings_create_example
|
|
14
15
|
from .function_calling import function_calling as function_example
|
|
15
16
|
from .images_edit import image_edit
|
|
@@ -23,8 +23,8 @@ def image_edit():
|
|
|
23
23
|
|
|
24
24
|
response = client.images.edit(
|
|
25
25
|
model="dall-e-2",
|
|
26
|
-
image=open("
|
|
27
|
-
mask=open("
|
|
26
|
+
image=open("src/examples/openai_example/resources/lounge_flamingo.png", "rb"),
|
|
27
|
+
mask=open("src/examples/openai_example/resources/mask.png", "rb"),
|
|
28
28
|
prompt="A sunlit indoor lounge area with a pool and duck standing in side with flamingo.",
|
|
29
29
|
n=1,
|
|
30
30
|
size="1024x1024",
|