langtrace-python-sdk 3.3.0__tar.gz → 3.3.1__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/PKG-INFO +1 -1
- langtrace_python_sdk-3.3.1/src/examples/cerebras_example/__init__.py +11 -0
- langtrace_python_sdk-3.3.1/src/examples/cerebras_example/main.py +195 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/common.py +1 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/__init__.py +2 -0
- langtrace_python_sdk-3.3.1/src/langtrace_python_sdk/instrumentation/cerebras/__init__.py +3 -0
- langtrace_python_sdk-3.3.1/src/langtrace_python_sdk/instrumentation/cerebras/instrumentation.py +54 -0
- langtrace_python_sdk-3.3.1/src/langtrace_python_sdk/instrumentation/cerebras/patch.py +138 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/langtrace.py +2 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/utils/__init__.py +12 -0
- langtrace_python_sdk-3.3.1/src/langtrace_python_sdk/version.py +1 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/run_example.py +8 -1
- langtrace_python_sdk-3.3.0/src/langtrace_python_sdk/version.py +0 -1
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/.gitignore +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/LICENSE +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/README.md +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/pyproject.toml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/anthropic_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/anthropic_example/completion.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/autogen_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/autogen_example/main.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/awsbedrock_examples/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/awsbedrock_examples/converse.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/azureopenai_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/azureopenai_example/completion.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/chroma_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/chroma_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/cohere_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/cohere_example/chat.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/cohere_example/chat_stream.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/cohere_example/embed.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/cohere_example/rerank.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/cohere_example/tools.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/instagram_post/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/instagram_post/agents.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/instagram_post/main.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/instagram_post/tasks.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/instagram_post/tools/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/instagram_post/tools/browser_tools.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/simple_agent/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/simple_agent/agents.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/simple_agent/main.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/simple_agent/tasks.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/trip_planner/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/trip_planner/agents.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/trip_planner/main.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/trip_planner/tasks.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/trip_planner/tools/calculator.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/trip_planner/tools/search_tools.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/dspy_example/QA_basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/dspy_example/QA_basic_with_chain_of_thought.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/dspy_example/QA_basic_with_signature.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/dspy_example/QA_multi_step_with_chain_of_thought.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/dspy_example/math_problems_cot.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/dspy_example/math_problems_cot_parallel.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/dspy_example/optimizers/bootstrap_fewshot.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/dspy_example/program_of_thought_basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/dspy_example/quiz_gen.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/dspy_example/react.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/embedchain_example/simple.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/fastapi_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/fastapi_example/basic_route.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/gemini_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/gemini_example/function_tools.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/gemini_example/main.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/hiveagent_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/inspect_ai_example/basic_eval.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/langchain_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/langchain_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/langchain_example/groq_example.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/langchain_example/langchain_google_example.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/langchain_example/langgraph_example.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/langchain_example/langgraph_example_tools.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/langchain_example/sagemaker.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/langchain_example/tool.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/litellm_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/litellm_example/config.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/litellm_example/proxy_basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/llamaindex_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/llamaindex_example/agent.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/llamaindex_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/llamaindex_example/data/abramov.txt +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/mistral_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/mistral_example/complete.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/mistral_example/complete_async.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/mistral_example/embeddings.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/ollama_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/ollama_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/async_tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/async_tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/chat_completion.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/chat_completion_tool_choice.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/embeddings_create.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/function_calling.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/images_edit.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/images_generate.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/resources/lounge_flamingo.png +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/resources/mask.png +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/send_user_feedback.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/tool_calling.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/tool_calling_nonstreaming.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/openai_example/tool_calling_streaming.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/otlp_example/otlp_basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/otlp_example/otlp_with_langtrace.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/perplexity_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/pinecone_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/pinecone_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/qdrant_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/qdrant_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/routellm_example/basic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/vertexai_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/vertexai_example/main.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/weaviate_example/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/weaviate_example/query_text.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/exporter/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/anthropic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/aws_bedrock.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/chroma.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/cohere.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/embedchain.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/gemini.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/groq.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/litellm.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/mistral.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/ollama.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/openai.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/pinecone.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/qdrant.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/vertexai.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/constants/instrumentation/weaviate.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/extensions/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/extensions/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/extensions/langtrace_filesystem.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/anthropic/types.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/autogen/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/autogen/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/autogen/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/aws_bedrock/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/aws_bedrock/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/aws_bedrock/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/chroma/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/chroma/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/cohere/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/cohere/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/cohere/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/crewai/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/crewai/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/crewai/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/dspy/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/dspy/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/dspy/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/embedchain/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/embedchain/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/embedchain/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/gemini/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/gemini/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/gemini/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/groq/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/groq/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/groq/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/langchain/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/langchain_community/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/langchain_core/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/langgraph/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/langgraph/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/langgraph/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/litellm/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/litellm/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/litellm/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/litellm/types.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/llamaindex/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/mistral/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/mistral/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/mistral/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/ollama/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/ollama/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/ollama/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/openai/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/openai/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/openai/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/openai/types.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/pinecone/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/qdrant/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/qdrant/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/qdrant/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/vertexai/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/vertexai/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/vertexai/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/weaviate/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/weaviate/instrumentation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/instrumentation/weaviate/patch.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/types/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/utils/langtrace_sampler.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/utils/llm.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/utils/misc.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/utils/prompt_registry.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/utils/sdk_version_checker.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/utils/silently_fail.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/utils/types.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/utils/with_root_span.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/__init__.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/anthropic/cassettes/test_anthropic.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/anthropic/cassettes/test_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/anthropic/cassettes/test_async_anthropic_streaming.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/anthropic/conftest.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/anthropic/test_anthropic.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/chroma/conftest.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/chroma/test_chroma.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/cohere/cassettes/test_cohere_chat.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/cohere/cassettes/test_cohere_chat_streaming.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/cohere/cassettes/test_cohere_embed.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/cohere/cassettes/test_cohere_rerank.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/cohere/conftest.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/cohere/test_cohere_chat.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/cohere/test_cohere_embed.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/cohere/test_cohere_rerank.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/conftest.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/groq/cassettes/test_async_chat_completion.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/groq/cassettes/test_async_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/groq/cassettes/test_chat_completion.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/groq/cassettes/test_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/groq/conftest.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/groq/test_groq.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/langchain/cassettes/test_langchain.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/langchain/conftest.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/langchain/test_langchain.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/openai/cassettes/test_async_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/openai/cassettes/test_async_image_generation.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/openai/cassettes/test_chat_completion.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/openai/cassettes/test_chat_completion_streaming.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/openai/cassettes/test_image_generation.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/openai/conftest.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/openai/test_chat_completion.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/openai/test_embeddings.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/openai/test_image_generation.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/pinecone/cassettes/test_query.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/pinecone/cassettes/test_upsert.yaml +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/pinecone/conftest.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/pinecone/test_pinecone.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/qdrant/conftest.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/qdrant/test_qdrant.py +0 -0
- {langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/tests/utils.py +0 -0
@@ -0,0 +1,195 @@
|
|
1
|
+
from langtrace_python_sdk import langtrace
|
2
|
+
from cerebras.cloud.sdk import Cerebras
|
3
|
+
from dotenv import load_dotenv
|
4
|
+
import re
|
5
|
+
import json
|
6
|
+
from openai import OpenAI
|
7
|
+
import os
|
8
|
+
|
9
|
+
load_dotenv()
|
10
|
+
|
11
|
+
langtrace.init()
|
12
|
+
openai_client = OpenAI(
|
13
|
+
base_url="https://api.cerebras.ai/v1",
|
14
|
+
api_key=os.getenv("CEREBRAS_API_KEY"),
|
15
|
+
)
|
16
|
+
client = Cerebras()
|
17
|
+
|
18
|
+
|
19
|
+
def openai_cerebras_example(stream=False):
|
20
|
+
completion = openai_client.chat.completions.create(
|
21
|
+
messages=[
|
22
|
+
{
|
23
|
+
"role": "user",
|
24
|
+
"content": "Why is fast inference important?",
|
25
|
+
}
|
26
|
+
],
|
27
|
+
model="llama3.1-8b",
|
28
|
+
stream=stream,
|
29
|
+
)
|
30
|
+
|
31
|
+
if stream:
|
32
|
+
for chunk in completion:
|
33
|
+
print(chunk)
|
34
|
+
else:
|
35
|
+
return completion
|
36
|
+
|
37
|
+
|
38
|
+
def completion_example(stream=False):
|
39
|
+
completion = client.chat.completions.create(
|
40
|
+
messages=[
|
41
|
+
{
|
42
|
+
"role": "user",
|
43
|
+
"content": "Why is fast inference important?",
|
44
|
+
}
|
45
|
+
],
|
46
|
+
model="llama3.1-8b",
|
47
|
+
stream=stream,
|
48
|
+
)
|
49
|
+
|
50
|
+
if stream:
|
51
|
+
for chunk in completion:
|
52
|
+
print(chunk)
|
53
|
+
else:
|
54
|
+
return completion
|
55
|
+
|
56
|
+
|
57
|
+
def completion_with_tools_example(stream=False):
|
58
|
+
messages = [
|
59
|
+
{
|
60
|
+
"role": "system",
|
61
|
+
"content": "You are a helpful assistant with access to a calculator. Use the calculator tool to compute mathematical expressions when needed.",
|
62
|
+
},
|
63
|
+
{"role": "user", "content": "What's the result of 15 multiplied by 7?"},
|
64
|
+
]
|
65
|
+
|
66
|
+
response = client.chat.completions.create(
|
67
|
+
model="llama3.1-8b",
|
68
|
+
messages=messages,
|
69
|
+
tools=tools,
|
70
|
+
stream=stream,
|
71
|
+
)
|
72
|
+
|
73
|
+
if stream:
|
74
|
+
# Handle streaming response
|
75
|
+
full_content = ""
|
76
|
+
for chunk in response:
|
77
|
+
if chunk.choices[0].delta.tool_calls:
|
78
|
+
tool_call = chunk.choices[0].delta.tool_calls[0]
|
79
|
+
if hasattr(tool_call, "function"):
|
80
|
+
if tool_call.function.name == "calculate":
|
81
|
+
arguments = json.loads(tool_call.function.arguments)
|
82
|
+
result = calculate(arguments["expression"])
|
83
|
+
print(f"Calculation result: {result}")
|
84
|
+
|
85
|
+
# Get final response with calculation result
|
86
|
+
messages.append(
|
87
|
+
{
|
88
|
+
"role": "assistant",
|
89
|
+
"content": None,
|
90
|
+
"tool_calls": [
|
91
|
+
{
|
92
|
+
"function": {
|
93
|
+
"name": "calculate",
|
94
|
+
"arguments": tool_call.function.arguments,
|
95
|
+
},
|
96
|
+
"id": tool_call.id,
|
97
|
+
"type": "function",
|
98
|
+
}
|
99
|
+
],
|
100
|
+
}
|
101
|
+
)
|
102
|
+
messages.append(
|
103
|
+
{
|
104
|
+
"role": "tool",
|
105
|
+
"content": str(result),
|
106
|
+
"tool_call_id": tool_call.id,
|
107
|
+
}
|
108
|
+
)
|
109
|
+
|
110
|
+
final_response = client.chat.completions.create(
|
111
|
+
model="llama3.1-70b", messages=messages, stream=True
|
112
|
+
)
|
113
|
+
|
114
|
+
for final_chunk in final_response:
|
115
|
+
if final_chunk.choices[0].delta.content:
|
116
|
+
print(final_chunk.choices[0].delta.content, end="")
|
117
|
+
elif chunk.choices[0].delta.content:
|
118
|
+
print(chunk.choices[0].delta.content, end="")
|
119
|
+
full_content += chunk.choices[0].delta.content
|
120
|
+
else:
|
121
|
+
# Handle non-streaming response
|
122
|
+
choice = response.choices[0].message
|
123
|
+
if choice.tool_calls:
|
124
|
+
function_call = choice.tool_calls[0].function
|
125
|
+
if function_call.name == "calculate":
|
126
|
+
arguments = json.loads(function_call.arguments)
|
127
|
+
result = calculate(arguments["expression"])
|
128
|
+
print(f"Calculation result: {result}")
|
129
|
+
|
130
|
+
messages.append(
|
131
|
+
{
|
132
|
+
"role": "assistant",
|
133
|
+
"content": None,
|
134
|
+
"tool_calls": [
|
135
|
+
{
|
136
|
+
"function": {
|
137
|
+
"name": "calculate",
|
138
|
+
"arguments": function_call.arguments,
|
139
|
+
},
|
140
|
+
"id": choice.tool_calls[0].id,
|
141
|
+
"type": "function",
|
142
|
+
}
|
143
|
+
],
|
144
|
+
}
|
145
|
+
)
|
146
|
+
messages.append(
|
147
|
+
{
|
148
|
+
"role": "tool",
|
149
|
+
"content": str(result),
|
150
|
+
"tool_call_id": choice.tool_calls[0].id,
|
151
|
+
}
|
152
|
+
)
|
153
|
+
|
154
|
+
final_response = client.chat.completions.create(
|
155
|
+
model="llama3.1-70b",
|
156
|
+
messages=messages,
|
157
|
+
)
|
158
|
+
|
159
|
+
if final_response:
|
160
|
+
print(final_response.choices[0].message.content)
|
161
|
+
else:
|
162
|
+
print("No final response received")
|
163
|
+
else:
|
164
|
+
print("Unexpected response from the model")
|
165
|
+
|
166
|
+
|
167
|
+
def calculate(expression):
|
168
|
+
expression = re.sub(r"[^0-9+\-*/().]", "", expression)
|
169
|
+
|
170
|
+
try:
|
171
|
+
result = eval(expression)
|
172
|
+
return str(result)
|
173
|
+
except (SyntaxError, ZeroDivisionError, NameError, TypeError, OverflowError):
|
174
|
+
return "Error: Invalid expression"
|
175
|
+
|
176
|
+
|
177
|
+
tools = [
|
178
|
+
{
|
179
|
+
"type": "function",
|
180
|
+
"function": {
|
181
|
+
"name": "calculate",
|
182
|
+
"description": "A calculator tool that can perform basic arithmetic operations. Use this when you need to compute mathematical expressions or solve numerical problems.",
|
183
|
+
"parameters": {
|
184
|
+
"type": "object",
|
185
|
+
"properties": {
|
186
|
+
"expression": {
|
187
|
+
"type": "string",
|
188
|
+
"description": "The mathematical expression to evaluate",
|
189
|
+
}
|
190
|
+
},
|
191
|
+
"required": ["expression"],
|
192
|
+
},
|
193
|
+
},
|
194
|
+
}
|
195
|
+
]
|
@@ -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 .cerebras import CerebrasInstrumentation
|
24
25
|
|
25
26
|
__all__ = [
|
26
27
|
"AnthropicInstrumentation",
|
@@ -46,4 +47,5 @@ __all__ = [
|
|
46
47
|
"GeminiInstrumentation",
|
47
48
|
"MistralInstrumentation",
|
48
49
|
"AWSBedrockInstrumentation",
|
50
|
+
"CerebrasInstrumentation",
|
49
51
|
]
|
langtrace_python_sdk-3.3.1/src/langtrace_python_sdk/instrumentation/cerebras/instrumentation.py
ADDED
@@ -0,0 +1,54 @@
|
|
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 typing import Collection
|
18
|
+
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
19
|
+
from opentelemetry.trace import get_tracer
|
20
|
+
from opentelemetry.semconv.schemas import Schemas
|
21
|
+
from wrapt import wrap_function_wrapper
|
22
|
+
from importlib_metadata import version as v
|
23
|
+
from .patch import chat_completions_create, async_chat_completions_create
|
24
|
+
|
25
|
+
|
26
|
+
class CerebrasInstrumentation(BaseInstrumentor):
|
27
|
+
"""
|
28
|
+
The CerebrasInstrumentation class represents the Cerebras instrumentation
|
29
|
+
"""
|
30
|
+
|
31
|
+
def instrumentation_dependencies(self) -> Collection[str]:
|
32
|
+
return ["cerebras-cloud-sdk >= 1.0.0"]
|
33
|
+
|
34
|
+
def _instrument(self, **kwargs):
|
35
|
+
tracer_provider = kwargs.get("tracer_provider")
|
36
|
+
tracer = get_tracer(
|
37
|
+
__name__, "", tracer_provider, schema_url=Schemas.V1_27_0.value
|
38
|
+
)
|
39
|
+
version = v("cerebras-cloud-sdk")
|
40
|
+
|
41
|
+
wrap_function_wrapper(
|
42
|
+
module="cerebras.cloud.sdk",
|
43
|
+
name="resources.chat.completions.CompletionsResource.create",
|
44
|
+
wrapper=chat_completions_create(version, tracer),
|
45
|
+
)
|
46
|
+
|
47
|
+
wrap_function_wrapper(
|
48
|
+
module="cerebras.cloud.sdk",
|
49
|
+
name="resources.chat.completions.AsyncCompletionsResource.create",
|
50
|
+
wrapper=async_chat_completions_create(version, tracer),
|
51
|
+
)
|
52
|
+
|
53
|
+
def _uninstrument(self, **kwargs):
|
54
|
+
pass
|
@@ -0,0 +1,138 @@
|
|
1
|
+
from langtrace_python_sdk.instrumentation.groq.patch import extract_content
|
2
|
+
from opentelemetry.trace import SpanKind
|
3
|
+
from langtrace_python_sdk.utils.llm import (
|
4
|
+
get_llm_request_attributes,
|
5
|
+
get_langtrace_attributes,
|
6
|
+
get_extra_attributes,
|
7
|
+
get_llm_url,
|
8
|
+
is_streaming,
|
9
|
+
set_event_completion,
|
10
|
+
set_span_attributes,
|
11
|
+
StreamWrapper,
|
12
|
+
)
|
13
|
+
from langtrace_python_sdk.utils.silently_fail import silently_fail
|
14
|
+
from langtrace_python_sdk.constants.instrumentation.common import SERVICE_PROVIDERS
|
15
|
+
from langtrace.trace_attributes import SpanAttributes
|
16
|
+
from langtrace_python_sdk.utils import handle_span_error, set_span_attribute
|
17
|
+
|
18
|
+
|
19
|
+
def chat_completions_create(version: str, tracer):
|
20
|
+
def traced_method(wrapped, instance, args, kwargs):
|
21
|
+
llm_prompts = []
|
22
|
+
for message in kwargs.get("messages", []):
|
23
|
+
llm_prompts.append(message)
|
24
|
+
|
25
|
+
span_attributes = {
|
26
|
+
**get_langtrace_attributes(version, SERVICE_PROVIDERS["CEREBRAS"]),
|
27
|
+
**get_llm_request_attributes(kwargs, prompts=llm_prompts),
|
28
|
+
**get_llm_url(instance),
|
29
|
+
**get_extra_attributes(),
|
30
|
+
}
|
31
|
+
|
32
|
+
span_name = f"{span_attributes[SpanAttributes.LLM_OPERATION_NAME]} {span_attributes[SpanAttributes.LLM_REQUEST_MODEL]}"
|
33
|
+
with tracer.start_as_current_span(
|
34
|
+
name=span_name,
|
35
|
+
kind=SpanKind.CLIENT,
|
36
|
+
attributes=span_attributes,
|
37
|
+
end_on_exit=False,
|
38
|
+
) as span:
|
39
|
+
|
40
|
+
try:
|
41
|
+
_set_input_attributes(span, kwargs, span_attributes)
|
42
|
+
result = wrapped(*args, **kwargs)
|
43
|
+
if is_streaming(kwargs):
|
44
|
+
return StreamWrapper(result, span)
|
45
|
+
|
46
|
+
if span.is_recording():
|
47
|
+
_set_response_attributes(span, result)
|
48
|
+
span.end()
|
49
|
+
return result
|
50
|
+
|
51
|
+
except Exception as error:
|
52
|
+
handle_span_error(span, error)
|
53
|
+
raise
|
54
|
+
|
55
|
+
return traced_method
|
56
|
+
|
57
|
+
|
58
|
+
def async_chat_completions_create(version: str, tracer):
|
59
|
+
async def traced_method(wrapped, instance, args, kwargs):
|
60
|
+
llm_prompts = []
|
61
|
+
for message in kwargs.get("messages", []):
|
62
|
+
llm_prompts.append(message)
|
63
|
+
|
64
|
+
span_attributes = {
|
65
|
+
**get_langtrace_attributes(version, SERVICE_PROVIDERS["CEREBRAS"]),
|
66
|
+
**get_llm_request_attributes(kwargs, prompts=llm_prompts),
|
67
|
+
**get_llm_url(instance),
|
68
|
+
**get_extra_attributes(),
|
69
|
+
}
|
70
|
+
|
71
|
+
span_name = f"{span_attributes[SpanAttributes.LLM_OPERATION_NAME]} {span_attributes[SpanAttributes.LLM_REQUEST_MODEL]}"
|
72
|
+
with tracer.start_as_current_span(
|
73
|
+
name=span_name,
|
74
|
+
kind=SpanKind.CLIENT,
|
75
|
+
attributes=span_attributes,
|
76
|
+
end_on_exit=False,
|
77
|
+
) as span:
|
78
|
+
|
79
|
+
try:
|
80
|
+
_set_input_attributes(span, kwargs, span_attributes)
|
81
|
+
result = await wrapped(*args, **kwargs)
|
82
|
+
if is_streaming(kwargs):
|
83
|
+
return StreamWrapper(result, span)
|
84
|
+
|
85
|
+
if span.is_recording():
|
86
|
+
_set_response_attributes(span, result)
|
87
|
+
span.end()
|
88
|
+
return result
|
89
|
+
|
90
|
+
except Exception as error:
|
91
|
+
handle_span_error(span, error)
|
92
|
+
raise
|
93
|
+
|
94
|
+
return traced_method
|
95
|
+
|
96
|
+
|
97
|
+
@silently_fail
|
98
|
+
def _set_response_attributes(span, result):
|
99
|
+
set_span_attribute(span, SpanAttributes.LLM_RESPONSE_MODEL, result.model)
|
100
|
+
|
101
|
+
if getattr(result, "id", None):
|
102
|
+
set_span_attribute(span, SpanAttributes.LLM_RESPONSE_ID, result.id)
|
103
|
+
|
104
|
+
if getattr(result, "choices", None):
|
105
|
+
responses = [
|
106
|
+
{
|
107
|
+
"role": (
|
108
|
+
choice.message.role
|
109
|
+
if choice.message and choice.message.role
|
110
|
+
else "assistant"
|
111
|
+
),
|
112
|
+
"content": extract_content(choice),
|
113
|
+
**(
|
114
|
+
{"content_filter_results": choice.content_filter_results}
|
115
|
+
if hasattr(choice, "content_filter_results")
|
116
|
+
else {}
|
117
|
+
),
|
118
|
+
}
|
119
|
+
for choice in result.choices
|
120
|
+
]
|
121
|
+
set_event_completion(span, responses)
|
122
|
+
# Get the usage
|
123
|
+
if getattr(result, "usage", None):
|
124
|
+
set_span_attribute(
|
125
|
+
span,
|
126
|
+
SpanAttributes.LLM_USAGE_PROMPT_TOKENS,
|
127
|
+
result.usage.prompt_tokens,
|
128
|
+
)
|
129
|
+
set_span_attribute(
|
130
|
+
span,
|
131
|
+
SpanAttributes.LLM_USAGE_COMPLETION_TOKENS,
|
132
|
+
result.usage.completion_tokens,
|
133
|
+
)
|
134
|
+
|
135
|
+
|
136
|
+
@silently_fail
|
137
|
+
def _set_input_attributes(span, kwargs, attributes):
|
138
|
+
set_span_attributes(span, attributes)
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/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
|
+
CerebrasInstrumentation,
|
67
68
|
)
|
68
69
|
from opentelemetry.util.re import parse_env_headers
|
69
70
|
|
@@ -281,6 +282,7 @@ def init(
|
|
281
282
|
"mistralai": MistralInstrumentation(),
|
282
283
|
"boto3": AWSBedrockInstrumentation(),
|
283
284
|
"autogen": AutogenInstrumentation(),
|
285
|
+
"cerebras-cloud-sdk": CerebrasInstrumentation(),
|
284
286
|
}
|
285
287
|
|
286
288
|
init_instrumentations(config.disable_instrumentations, all_instrumentations)
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/langtrace_python_sdk/utils/__init__.py
RENAMED
@@ -1,6 +1,11 @@
|
|
1
1
|
from langtrace_python_sdk.types import NOT_GIVEN, InstrumentationType
|
2
2
|
from .sdk_version_checker import SDKVersionChecker
|
3
3
|
from opentelemetry.trace import Span
|
4
|
+
from opentelemetry.semconv.attributes import (
|
5
|
+
error_attributes as ErrorAttributes,
|
6
|
+
)
|
7
|
+
from opentelemetry.trace.status import Status, StatusCode
|
8
|
+
|
4
9
|
from langtrace.trace_attributes import SpanAttributes
|
5
10
|
import inspect
|
6
11
|
import os
|
@@ -90,3 +95,10 @@ def is_package_installed(package_name):
|
|
90
95
|
|
91
96
|
installed_packages = {p.key for p in pkg_resources.working_set}
|
92
97
|
return package_name in installed_packages
|
98
|
+
|
99
|
+
|
100
|
+
def handle_span_error(span: Span, error):
|
101
|
+
span.set_status(Status(StatusCode.ERROR, str(error)))
|
102
|
+
if span.is_recording():
|
103
|
+
span.set_attribute(ErrorAttributes.ERROR_TYPE, type(error).__qualname__)
|
104
|
+
span.end()
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "3.3.1"
|
@@ -20,7 +20,8 @@ ENABLED_EXAMPLES = {
|
|
20
20
|
"vertexai": False,
|
21
21
|
"gemini": False,
|
22
22
|
"mistral": False,
|
23
|
-
"awsbedrock":
|
23
|
+
"awsbedrock": False,
|
24
|
+
"cerebras": True,
|
24
25
|
}
|
25
26
|
|
26
27
|
if ENABLED_EXAMPLES["anthropic"]:
|
@@ -130,3 +131,9 @@ if ENABLED_EXAMPLES["awsbedrock"]:
|
|
130
131
|
|
131
132
|
print(Fore.BLUE + "Running AWS Bedrock example" + Fore.RESET)
|
132
133
|
AWSBedrockRunner().run()
|
134
|
+
|
135
|
+
if ENABLED_EXAMPLES["cerebras"]:
|
136
|
+
from examples.cerebras_example import CerebrasRunner
|
137
|
+
|
138
|
+
print(Fore.BLUE + "Running Cerebras example" + Fore.RESET)
|
139
|
+
CerebrasRunner().run()
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = "3.3.0"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/anthropic_example/__init__.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/autogen_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/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.0 → langtrace_python_sdk-3.3.1}/src/examples/chroma_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/chroma_example/basic.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/cohere_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/cohere_example/chat.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/cohere_example/chat_stream.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/cohere_example/embed.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/cohere_example/rerank.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/cohere_example/tools.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/crewai_example/__init__.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/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.0 → langtrace_python_sdk-3.3.1}/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.0 → langtrace_python_sdk-3.3.1}/src/examples/dspy_example/quiz_gen.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/dspy_example/react.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/embedchain_example/simple.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/fastapi_example/__init__.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/gemini_example/__init__.py
RENAMED
File without changes
|
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/gemini_example/main.py
RENAMED
File without changes
|
{langtrace_python_sdk-3.3.0 → langtrace_python_sdk-3.3.1}/src/examples/hiveagent_example/basic.py
RENAMED
File without changes
|
File without changes
|