-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat: enable Claude 4.5 global inference profile support for AWS Bedrock #8542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add detection for Claude Sonnet 4.5 models in custom ARNs - Enable thinking tokens and 1M context options for Claude 4.5 global inference profiles - Update UI to show options for custom ARNs matching Claude 4.5 patterns - Add comprehensive tests for global inference profile support Fixes #8541
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-review engaged: like a linter arguing with a mirror, I will now pedantically critique my own reflection.
| } | ||
| }) | ||
|
|
||
| vitest.mock("../../../utils/logging") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] The logger module is mocked without a factory, but the test asserts on logger.info. To ensure logger.info is a spy, explicitly mock the module exports with a concrete logger object.
| vitest.mock("../../../utils/logging") | |
| vitest.mock("../../../utils/logging", () => ({ | |
| logger: { | |
| info: vi.fn(), | |
| error: vi.fn(), | |
| warn: vi.fn(), | |
| debug: vi.fn(), | |
| }, | |
| })) |
| const isEligibleFor1MContext = | ||
| BEDROCK_1M_CONTEXT_MODEL_IDS.includes(baseModelId as any) || this.isClaudeSonnet45Model(modelConfig.id) | ||
| const is1MContextEnabled = isEligibleFor1MContext && this.options.awsBedrock1MContext | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] 1M context is enabled via anthropic_beta for custom Claude 4.5 ARNs, but getModel() still reports a 200k contextWindow for these cases. This can desync pricing/limits and any logic relying on info.contextWindow. Consider also setting info.contextWindow to 1_000_000 when awsBedrock1MContext is true for 4.5 custom ARNs to keep behavior consistent across UI, cost model, and runtime.
| const id = apiConfiguration.apiModelId ?? bedrockDefaultModelId | ||
| const baseInfo = bedrockModels[id as keyof typeof bedrockModels] | ||
|
|
||
| // Helper function to check if a model ID or ARN represents a Claude Sonnet 4.5 model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] Claude 4.5 detection logic is duplicated here and in settings/providers/Bedrock.tsx, and again in the backend. This increases drift risk. Recommend extracting a shared helper (e.g., a small util in a shared package) and reusing it across frontend/backend so feature gating (thinking + 1M) stays consistent.
| id.includes("claude-sonnet-4-5") || | ||
| id.includes("claude-sonnet-4.5") || | ||
| // Specific check for the global inference profile ARN mentioned in the issue | ||
| id.includes("global.anthropic.claude-sonnet-4-5-20250929") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P3] The pattern check hardcodes the date suffix "20250929". Since the broader checks already match 'claude-sonnet-4-5'/'claude-sonnet-4.5', this specific fragment is brittle and redundant. Consider removing or relaxing it to avoid unexpected mismatches when AWS updates the ARN version.
|
Feature raised by mistake, please cancel |
|
Issue was closed |
Summary
This PR addresses Issue #8541 by enabling support for Claude 4.5 global inference profiles in AWS Bedrock, allowing users with limited region access to utilize thinking tokens and 1M context options.
Problem
AWS Bedrock users who have access to limited regions cannot use the foundational model ID for Claude 4.5 directly. They need to use the global inference profile ARN (e.g.,
arn:aws:bedrock:us-east-1:148761681080:inference-profile/global.anthropic.claude-sonnet-4-5-20250929-v1:0), but Roo Code was not enabling thinking tokens and 1M context options for custom ARNs.Solution
This implementation takes a flexible pattern-matching approach that:
Changes
Backend ()
isClaudeSonnet45Model()helper to detect Claude 4.5 patternsguessModelInfoFromId()to recognize Claude 4.5 models with full feature supportFrontend
webview-ui/src/components/settings/providers/Bedrock.tsx): Added pattern matching to show 1M context option for Claude 4.5 custom ARNswebview-ui/src/components/ui/hooks/useSelectedModel.ts): Enhanced custom ARN handling to properly set model capabilities for Claude 4.5 modelsTests
src/api/providers/__tests__/bedrock-global-inference.spec.ts) covering:Testing
Impact
This change enables AWS Bedrock users with limited region access to fully utilize Claude 4.5 capabilities through global inference profiles, addressing a key limitation for enterprise users with restricted AWS configurations.
Fixes #8541
Important
Adds support for Claude 4.5 global inference profiles in AWS Bedrock, enabling thinking tokens and 1M context options for users with limited region access.
bedrock.ts):isClaudeSonnet45Model()to detect Claude 4.5 patterns.guessModelInfoFromId()for Claude 4.5 model recognition.Bedrock.tsx): Adds pattern matching for Claude 4.5 ARNs.useSelectedModel.ts): Enhances custom ARN handling for Claude 4.5.bedrock-global-inference.spec.ts) for global inference profile detection, 1M context, and reasoning features.bedrock.ts.This description was created by
for a6c2c58. You can customize this summary. It will automatically update as commits are pushed.