Context
When using AWS Bedrock models with inference profiles in LangSmith, the default built-in regex patterns may not match your specific model configuration. This can cause issues with pricing calculations and model recognition. Inference profiles use different ARN formats that require custom regex patterns to properly match and track usage.
Answer
You'll need to update the pricing match pattern to accommodate the AWS Bedrock inference profile ARN format. Here's how to modify the regex pattern:
For AWS Bedrock inference profiles, use this pattern:
^arn:aws:bedrock:[^:]+:\d+:inference-profile/us\.anthropic\.claude-haiku-4-5(-\d{8})?(-v\d+)?(:[\d.]+)?$Instead of the default built-in pattern:
^anthropic\.claude-sonnet-4-5(-\d{8})?(-v\d+)?(:[\d.]+)?$The key difference is that inference profiles use the full ARN format (arn:aws:bedrock:[region]:[account]:inference-profile/[model-name]) rather than just the model name. Make sure to adjust the model name portion of the regex to match your specific Claude model variant (haiku, sonnet, etc.) and version numbers as needed.
This custom regex pattern will properly match AWS Bedrock inference profile ARNs and ensure accurate pricing calculations in LangSmith.