This commit is contained in:
roomote-v0[bot] 2026-04-23 09:34:52 +00:00 committed by GitHub
commit 51d070e0be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 2 deletions

View file

@ -229,6 +229,7 @@ const bedrockSchema = apiModelIdProviderModelSchema.extend({
awsApiKey: z.string().optional(),
awsUseApiKey: z.boolean().optional(),
awsCustomArn: z.string().optional(),
awsCustomArnEnableReasoning: z.boolean().optional(), // Enable reasoning for custom ARNs
awsModelContextWindow: z.number().optional(),
awsBedrockEndpointEnabled: z.boolean().optional(),
awsBedrockEndpoint: z.string().optional(),

View file

@ -390,7 +390,13 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
modelConfig.reasoning &&
modelConfig.reasoningBudget
if ((isThinkingExplicitlyEnabled || isThinkingEnabledBySettings) && modelConfig.info.supportsReasoningBudget) {
// For custom ARNs, only enable reasoning if explicitly enabled via the awsCustomArnEnableReasoning setting
// For regular models, use the standard logic
const shouldEnableThinking = this.options.awsCustomArn
? this.options.awsCustomArnEnableReasoning && modelConfig.info.supportsReasoningBudget
: (isThinkingExplicitlyEnabled || isThinkingEnabledBySettings) && modelConfig.info.supportsReasoningBudget
if (shouldEnableThinking) {
thinkingEnabled = true
additionalModelRequestFields = {
thinking: {
@ -740,11 +746,16 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
// For completePrompt, thinking is typically not used, but we should still check
// if thinking was somehow enabled in the model config
const thinkingEnabled =
// For custom ARNs, only enable if explicitly set via awsCustomArnEnableReasoning
const thinkingEnabledBySettings =
shouldUseReasoningBudget({ model: modelConfig.info, settings: this.options }) &&
modelConfig.reasoning &&
modelConfig.reasoningBudget
const thinkingEnabled = this.options.awsCustomArn
? this.options.awsCustomArnEnableReasoning && modelConfig.reasoning && modelConfig.reasoningBudget
: thinkingEnabledBySettings
const inferenceConfig: BedrockInferenceConfig = {
maxTokens: modelConfig.maxTokens || (modelConfig.info.maxTokens as number),
temperature: modelConfig.temperature ?? (this.options.modelTemperature as number),

View file

@ -254,6 +254,20 @@ export const Bedrock = ({ apiConfiguration, setApiConfigurationField, selectedMo
</div>
</>
)}
{apiConfiguration?.awsCustomArn && (
<div>
<Checkbox
checked={apiConfiguration?.awsCustomArnEnableReasoning ?? false}
onChange={(checked: boolean) => {
setApiConfigurationField("awsCustomArnEnableReasoning", checked)
}}>
Enable Reasoning
</Checkbox>
<div className="text-sm text-vscode-descriptionForeground mt-1 ml-6">
Enable extended thinking for this custom ARN. Only enable if the model supports reasoning.
</div>
</div>
)}
</>
)
}