Skip to content

fix: skip topP for Anthropic models when temperature is set on Bedrock#1840

Closed
xlyoung wants to merge 1 commit into
NVIDIA:mainfrom
xlyoung:fix/bedrock-anthropic-mutually-exclusive-params
Closed

fix: skip topP for Anthropic models when temperature is set on Bedrock#1840
xlyoung wants to merge 1 commit into
NVIDIA:mainfrom
xlyoung:fix/bedrock-anthropic-mutually-exclusive-params

Conversation

@xlyoung
Copy link
Copy Markdown

@xlyoung xlyoung commented Jun 5, 2026

Problem

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. Please use only one.

Since DEFAULT_PARAMS sets 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 topP when temperature is already present in inferenceConfig. 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 like us.anthropic.claude-sonnet-4-6, anthropic.claude-v2, etc.

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
@jmartin-tech
Copy link
Copy Markdown
Collaborator

jmartin-tech commented Jun 5, 2026

Declining in favor of #1842 which approaches the issue in a pattern that allows more flexibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BedrockGenerator sends both temperature and topP, which Claude 4.x on Bedrock rejects

2 participants