diff --git a/.tmp/Roo-Code b/.tmp/Roo-Code new file mode 160000 index 0000000000..86debeef43 --- /dev/null +++ b/.tmp/Roo-Code @@ -0,0 +1 @@ +Subproject commit 86debeef43acbea9bdc1aa4b38d514541e164c91 diff --git a/packages/types/src/providers/bedrock.ts b/packages/types/src/providers/bedrock.ts index dce4e024a0..a29a5d81c2 100644 --- a/packages/types/src/providers/bedrock.ts +++ b/packages/types/src/providers/bedrock.ts @@ -458,3 +458,4 @@ export const BEDROCK_REGIONS = [ ].sort((a, b) => a.value.localeCompare(b.value)) export const BEDROCK_CLAUDE_SONNET_4_MODEL_ID = "anthropic.claude-sonnet-4-20250514-v1:0" +export const BEDROCK_CLAUDE_SONNET_4_5_MODEL_ID = "anthropic.claude-sonnet-4-5-20250929-v1:0" diff --git a/src/api/providers/bedrock.ts b/src/api/providers/bedrock.ts index c6a0b35df4..53369a4dd1 100644 --- a/src/api/providers/bedrock.ts +++ b/src/api/providers/bedrock.ts @@ -22,6 +22,7 @@ import { BEDROCK_DEFAULT_CONTEXT, AWS_INFERENCE_PROFILE_MAPPING, BEDROCK_CLAUDE_SONNET_4_MODEL_ID, + BEDROCK_CLAUDE_SONNET_4_5_MODEL_ID, } from "@roo-code/types" import { ApiStream } from "../transform/stream" @@ -381,7 +382,9 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH // Check if 1M context is enabled for Claude Sonnet 4 // Use parseBaseModelId to handle cross-region inference prefixes const baseModelId = this.parseBaseModelId(modelConfig.id) - const is1MContextEnabled = baseModelId === BEDROCK_CLAUDE_SONNET_4_MODEL_ID && this.options.awsBedrock1MContext + const is1MContextEnabled = + (baseModelId === BEDROCK_CLAUDE_SONNET_4_MODEL_ID || baseModelId === BEDROCK_CLAUDE_SONNET_4_5_MODEL_ID) && + this.options.awsBedrock1MContext // Add anthropic_beta for 1M context to additionalModelRequestFields if (is1MContextEnabled) { @@ -979,7 +982,10 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH // Check if 1M context is enabled for Claude Sonnet 4 // Use parseBaseModelId to handle cross-region inference prefixes const baseModelId = this.parseBaseModelId(modelConfig.id) - if (baseModelId === BEDROCK_CLAUDE_SONNET_4_MODEL_ID && this.options.awsBedrock1MContext) { + if ( + (baseModelId === BEDROCK_CLAUDE_SONNET_4_MODEL_ID || baseModelId === BEDROCK_CLAUDE_SONNET_4_5_MODEL_ID) && + this.options.awsBedrock1MContext + ) { // Update context window to 1M tokens when 1M context beta is enabled modelConfig.info = { ...modelConfig.info, diff --git a/webview-ui/src/components/settings/providers/Bedrock.tsx b/webview-ui/src/components/settings/providers/Bedrock.tsx index 6c871e570a..3fca8c92ed 100644 --- a/webview-ui/src/components/settings/providers/Bedrock.tsx +++ b/webview-ui/src/components/settings/providers/Bedrock.tsx @@ -7,6 +7,7 @@ import { type ModelInfo, BEDROCK_REGIONS, BEDROCK_CLAUDE_SONNET_4_MODEL_ID, + BEDROCK_CLAUDE_SONNET_4_5_MODEL_ID, } from "@roo-code/types" import { useAppTranslation } from "@src/i18n/TranslationContext" @@ -24,8 +25,10 @@ export const Bedrock = ({ apiConfiguration, setApiConfigurationField, selectedMo const { t } = useAppTranslation() const [awsEndpointSelected, setAwsEndpointSelected] = useState(!!apiConfiguration?.awsBedrockEndpointEnabled) - // Check if the selected model supports 1M context (Claude Sonnet 4) - const supports1MContextBeta = apiConfiguration?.apiModelId === BEDROCK_CLAUDE_SONNET_4_MODEL_ID + // Check if the selected model supports 1M context (Claude Sonnet 4 or 4.5) + const supports1MContextBeta = + apiConfiguration?.apiModelId === BEDROCK_CLAUDE_SONNET_4_MODEL_ID || + apiConfiguration?.apiModelId === BEDROCK_CLAUDE_SONNET_4_5_MODEL_ID // Update the endpoint enabled state when the configuration changes useEffect(() => { diff --git a/webview-ui/src/components/ui/hooks/useSelectedModel.ts b/webview-ui/src/components/ui/hooks/useSelectedModel.ts index 3a24df2f85..cd597cf6a6 100644 --- a/webview-ui/src/components/ui/hooks/useSelectedModel.ts +++ b/webview-ui/src/components/ui/hooks/useSelectedModel.ts @@ -56,6 +56,7 @@ import { qwenCodeModels, vercelAiGatewayDefaultModelId, BEDROCK_CLAUDE_SONNET_4_MODEL_ID, + BEDROCK_CLAUDE_SONNET_4_5_MODEL_ID, deepInfraDefaultModelId, } from "@roo-code/types" @@ -200,8 +201,12 @@ function getSelectedModel({ } } - // Apply 1M context for Claude Sonnet 4 when enabled - if (id === BEDROCK_CLAUDE_SONNET_4_MODEL_ID && apiConfiguration.awsBedrock1MContext && baseInfo) { + // Apply 1M context for Claude Sonnet 4 or 4.5 when enabled + if ( + (id === BEDROCK_CLAUDE_SONNET_4_MODEL_ID || id === BEDROCK_CLAUDE_SONNET_4_5_MODEL_ID) && + apiConfiguration.awsBedrock1MContext && + baseInfo + ) { // Create a new ModelInfo object with updated context window const info: ModelInfo = { ...baseInfo,