File tree Expand file tree Collapse file tree 2 files changed +541
-0
lines changed Expand file tree Collapse file tree 2 files changed +541
-0
lines changed Original file line number Diff line number Diff line change 99 "trace_groq" ,
1010 "trace_async_openai" ,
1111 "trace_async" ,
12+ "trace_bedrock" ,
1213]
1314
1415# ---------------------------------- Tracing --------------------------------- #
@@ -84,3 +85,26 @@ def trace_groq(client):
8485 if not isinstance (client , groq .Groq ):
8586 raise ValueError ("Invalid client. Please provide a Groq client." )
8687 return groq_tracer .trace_groq (client )
88+
89+
90+ def trace_bedrock (client ):
91+ """Trace AWS Bedrock model invocations."""
92+ # pylint: disable=import-outside-toplevel
93+ try :
94+ import boto3
95+ except ImportError :
96+ raise ImportError (
97+ "boto3 is required for Bedrock tracing. Install with: pip install boto3"
98+ )
99+
100+ from .integrations import bedrock_tracer
101+
102+ # Check if it's a boto3 client for bedrock-runtime service
103+ if (
104+ not hasattr (client , "_service_model" )
105+ or client ._service_model .service_name != "bedrock-runtime"
106+ ):
107+ raise ValueError (
108+ "Invalid client. Please provide a boto3 bedrock-runtime client."
109+ )
110+ return bedrock_tracer .trace_bedrock (client )
You can’t perform that action at this time.
0 commit comments