mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-09 22:31:08 +00:00
fix: remove topP parameter from Bedrock inference config (#8388)
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
This commit is contained in:
parent
8111da66bd
commit
7b7bb49572
2 changed files with 5 additions and 11 deletions
|
|
@ -182,7 +182,7 @@ describe("AwsBedrockHandler - Extended Thinking", () => {
|
|||
)
|
||||
})
|
||||
|
||||
it("should include topP when thinking is disabled", async () => {
|
||||
it("should not include topP when thinking is disabled (global removal)", async () => {
|
||||
handler = new AwsBedrockHandler({
|
||||
apiProvider: "bedrock",
|
||||
apiModelId: "anthropic.claude-3-7-sonnet-20250219-v1:0",
|
||||
|
|
@ -216,10 +216,10 @@ describe("AwsBedrockHandler - Extended Thinking", () => {
|
|||
chunks.push(chunk)
|
||||
}
|
||||
|
||||
// Verify that topP IS present when thinking is disabled
|
||||
// Verify that topP is NOT present for any model (removed globally)
|
||||
expect(mockSend).toHaveBeenCalledTimes(1)
|
||||
expect(capturedPayload).toBeDefined()
|
||||
expect(capturedPayload.inferenceConfig).toHaveProperty("topP", 0.1)
|
||||
expect(capturedPayload.inferenceConfig).not.toHaveProperty("topP")
|
||||
|
||||
// Verify that additionalModelRequestFields is not present or empty
|
||||
expect(capturedPayload.additionalModelRequestFields).toBeUndefined()
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ import type { SingleCompletionHandler, ApiHandlerCreateMessageMetadata } from ".
|
|||
interface BedrockInferenceConfig {
|
||||
maxTokens: number
|
||||
temperature?: number
|
||||
topP?: number
|
||||
}
|
||||
|
||||
// Define interface for Bedrock additional model request fields
|
||||
|
|
@ -374,12 +373,8 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
|
|||
maxTokens: modelConfig.maxTokens || (modelConfig.info.maxTokens as number),
|
||||
temperature: modelConfig.temperature ?? (this.options.modelTemperature as number),
|
||||
}
|
||||
|
||||
if (!thinkingEnabled) {
|
||||
inferenceConfig.topP = 0.1
|
||||
}
|
||||
|
||||
// Check if 1M context is enabled for Claude Sonnet 4 / 4.5
|
||||
|
||||
// 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 =
|
||||
|
|
@ -649,7 +644,6 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
|
|||
const inferenceConfig: BedrockInferenceConfig = {
|
||||
maxTokens: modelConfig.maxTokens || (modelConfig.info.maxTokens as number),
|
||||
temperature: modelConfig.temperature ?? (this.options.modelTemperature as number),
|
||||
...(thinkingEnabled ? {} : { topP: 0.1 }), // Only set topP when thinking is NOT enabled
|
||||
}
|
||||
|
||||
// For completePrompt, use a unique conversation ID based on the prompt
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue