mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
feat: add "Enable Reasoning" checkbox for Bedrock custom ARNs
- Add awsCustomArnEnableReasoning field to ProviderSettings type - Add UI checkbox in Bedrock settings when custom ARN is used - Update bedrock.ts logic to check awsCustomArnEnableReasoning for custom ARNs - Only enable reasoning for custom ARNs when explicitly enabled by user - Fixes issue where custom ARNs like Nova Lite received unsupported reasoning flag Addresses #10040
This commit is contained in:
parent
f97b5155ac
commit
1b327bbe38
3 changed files with 28 additions and 2 deletions
|
|
@ -226,6 +226,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(),
|
||||
|
|
|
|||
|
|
@ -384,7 +384,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: {
|
||||
|
|
@ -717,11 +723,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),
|
||||
|
|
|
|||
|
|
@ -226,6 +226,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>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue