fix: skip topP for Anthropic models when temperature is set on Bedrock#1840
Closed
xlyoung wants to merge 1 commit into
Closed
fix: skip topP for Anthropic models when temperature is set on Bedrock#1840xlyoung wants to merge 1 commit into
xlyoung wants to merge 1 commit into
Conversation
Anthropic Claude 4.x models on AWS Bedrock reject requests that set both temperature and top_p in inferenceConfig: 'temperature' and 'top_p' cannot both be specified for this model. Since DEFAULT_PARAMS sets both (temperature=0.7, top_p=1.0), every request to Claude 4.x fails out of the box. Fix: for Anthropic models, skip topP when temperature is already present in inferenceConfig. Other providers continue to receive both parameters as before. Fixes NVIDIA#1812
This was referenced Jun 5, 2026
Collaborator
|
Declining in favor of #1842 which approaches the issue in a pattern that allows more flexibility. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Anthropic Claude 4.x models on AWS Bedrock reject requests that set both
temperatureandtop_pininferenceConfig:Since
DEFAULT_PARAMSsets both (temperature=0.7,top_p=1.0), every request to Claude 4.x on Bedrock fails out of the box.Fixes #1812
Fix
For Anthropic models, skip
topPwhentemperatureis already present ininferenceConfig. Other providers continue to receive both parameters as before (they accept both without error).The check uses
'anthropic' not in self.name.lower()to detect Anthropic models, which covers all standard Bedrock model IDs likeus.anthropic.claude-sonnet-4-6,anthropic.claude-v2, etc.