-
Notifications
You must be signed in to change notification settings - Fork 19
Description
When using the Langtrace Python SDK with AWS Bedrock and providing a cross-region model ID or an ARN (e.g., arn:aws:bedrock:us-east-1:<account_id>:inference-profile/us.anthropic.claude-3-haiku-20240307-v1:0, us.anthropic.claude-sonnet-4-20250514-v1:0) as the modelId, the SDK fails with an error:
Traceback (most recent call last):
File "/opt/langtrace-app/call_bedrock.py", line 26, in <module>
response = client.converse(
^^^^^^^^^^^^^^^^
File "/opt/langtrace-app/langtrace-env/lib/python3.11/site-packages/langtrace_python_sdk/instrumentation/aws_bedrock/patch.py", line 140, in traced_method
(vendor, _) = modelId.split(".")
^^^^^^^^^^^
The issue originates from the assumption in the SDK code that modelId can always be split into two parts using vendor, model = modelId.split('.'), which breaks when the modelId is an ARN or contains multiple . (dots), as is the case for Bedrock inference profiles.
Steps to Reproduce:
Use the Langtrace Python SDK with boto3 to invoke Bedrock model using modelId as an ARN or a region-prefixed ID like us.anthropic.claude-3-haiku-20240307-v1:0.
Observe the crash due to unpacking error in the SDK.
Also cost calculation for AWS bedrock seems to be not supported.
Exception occured in cost calculation: type object 'SpanAttributes' has no attribute 'LLM_USAGE_COST'