fix(bedrock): detect global cross-region inference profile prefix#4235
fix(bedrock): detect global cross-region inference profile prefix#4235kimnamu wants to merge 1 commit into
Conversation
The global. cross-region inference profile prefix (currently Claude Sonnet 4) was not recognized in _cross_region_check, so model IDs like global.anthropic.claude-sonnet-4-... fell to the else branch and resolved to model_vendor="global". span_utils branches on the vendor with no else clause, so prompt, completion, and finish-reason attributes were silently dropped and the model name kept its anthropic. prefix. Add "global" to the regional prefix list alongside us / us-gov / eu / apac. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR adds support for AWS's new ChangesBedrock Global Inference Profile Support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Thanks for OpenLLMetry. This fills in one missing entry in the cross-region prefix list added in #2785.
Fixes #4234
Problem
AWS's
global.cross-region inference profile prefix (currently Claude Sonnet 4 — AWS docs) isn't recognized by_cross_region_check, which knowsus/us-gov/eu/apac. Soglobal.anthropic.claude-sonnet-4-...falls to theelsebranch.Cause
The
elsepath doesvalue.split(".", 1)→model_vendor="global", model keeps theanthropic.prefix.span_utils(set_model_message_span_attributes,set_model_choice_span_attributes,_set_finish_reasons_unconditionally) branches on the vendor with noelse, so an unrecognized vendor drops all prompt/completion/finish-reason attributes.Change
Add
"global"to the prefix list — symmetric to the regional prefixes already handled.global.anthropic.claude-sonnet-4-...)model_vendor"global""anthropic"gen_ai.request.modelanthropic.claude-sonnet-4-...claude-sonnet-4-...anthropic.claude-...)Tests
New
tests/test_cross_region_inference_profile.py(5 tests). Revert-the-fix check: with the one-line change reverted the new test fails (assert 'global' == 'anthropic'); restored, all pass. Full bedrock unit suite: 64 passed.ruff checkclean.This contribution was prepared with the help of an AI agent (Claude Code); a human reviewed the change, the AWS-doc rationale, and the test results before submission.
Summary by CodeRabbit
New Features
globalprefix alongside existing region identifiers.Tests