Skip to content

Fix: enable parameter suppression to LiteLLM#1411

Merged
jmartin-tech merged 5 commits intoNVIDIA:mainfrom
JDSmith-F1:fix/claude-4-5-litellm
Oct 31, 2025
Merged

Fix: enable parameter suppression to LiteLLM#1411
jmartin-tech merged 5 commits intoNVIDIA:mainfrom
JDSmith-F1:fix/claude-4-5-litellm

Conversation

@JDSmith-F1
Copy link
Contributor

Summary

This fixes #1410

This ensure thats Claude 4.5 via AWS Bedrock on LiteLLM works and does not instantly fail.

Changes

  • Add check to see if its Claude 4.5 being called in LiteLLM
  • Change request params if Claude 4.5 is being called to remove top_p

Rationale

Currently Garak does not work with Claude 4.5 via AWS Bedrock on LiteLLM. It instantly fails due to this error:

litellm.BadRequestError: BedrockException - {"message":"The model returned the following errors: `temperature` and `top_p` cannot both be specified for this model. Please use only one."}. Received Model Group=eu.anthropic.claude-sonnet-4-5-20250929-v1:0 Available Model Group Fallbacks=None LiteLLM Retried: 1 times, LiteLLM Max Retries: 2

@github-actions
Copy link
Contributor

github-actions bot commented Oct 14, 2025

DCO Assistant Lite bot All contributors have signed the DCO ✍️ ✅

github-actions bot added a commit that referenced this pull request Oct 14, 2025
Copy link
Collaborator

@jmartin-tech jmartin-tech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this targets a single model family in a specific deployment method I am not sure the a hard coded restriction in the generator is maintainable.

It might be a good idea to refactor this to be more reusable, the OpenAICompatible generator does something similar where it gathers the parameters passed for inference based on excluding some configurable parameters using a suppressed_params list the user can override via a configuration file or an extending generator class.

@JDSmith-F1
Copy link
Contributor Author

Given this targets a single model family in a specific deployment method I am not sure the a hard coded restriction in the generator is maintainable.

It might be a good idea to refactor this to be more reusable, the OpenAICompatible generator does something similar where it gathers the parameters passed for inference based on excluding some configurable parameters using a suppressed_params list the user can override via a configuration file or an extending generator class.

Sure, let me refactor this.

@JDSmith-F1
Copy link
Contributor Author

@jmartin-tech I've added a suppressed_params list to the LiteLLM generator now. I've tested this myself and it's working with Claude 4.5 on Bedrock with a suppressed parameter present.

@jmartin-tech
Copy link
Collaborator

Test failure is addressed in #1420, new commits to this branch or merge of main will resolve.

End to end testing is in queue.

Copy link
Collaborator

@jmartin-tech jmartin-tech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, one minor suggestion on the type validation being performed.

Comment on lines +119 to +120
if hasattr(self, 'suppressed_params') and not isinstance(self.suppressed_params, set):
self.suppressed_params = set(self.suppressed_params)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existence check here is not required as DEFAULT_PARAMS will be projected on self even if provided as None/null values in the passed configuration.

The type check also seems reasonable to skip as yaml and json loaders will often be a list as I suspect users are unlikely to add the extra syntax in yaml for a set and json does not support set by default.

Consider:

Suggested change
if hasattr(self, 'suppressed_params') and not isinstance(self.suppressed_params, set):
self.suppressed_params = set(self.suppressed_params)
self.suppressed_params = set(self.suppressed_params)

Enforcement wise I believe this will would create the same result and allow set() to raise if provided a value that cannot be coalesced into a set. This is would still be imperfect type checking however the project has not yet settled on a pattern for type check enforcement in plugins. There are some ideas floating around about considering type providing hints on DEFAULT_PARAMS in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmartin-tech Good point, I've now simplified it based on your suggestion. I've also synced it up to main branch so hopefully the test will now succeed. Thanks

@jmartin-tech jmartin-tech changed the title Fix Claude 4.5 on AWS Bedrock with LiteLLM Fix: enable parameter suppression to LiteLLM Oct 31, 2025
@jmartin-tech jmartin-tech merged commit 1e6ba13 into NVIDIA:main Oct 31, 2025
15 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generator: Claude 4.5 on AWS Bedrock with LiteLLM

2 participants