Skip to content

Bugfix11750 - Prevent unnecessary tool_choice injection in map_openai_params for Mistral models on AWS Bedrock #12190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

shagunb-acn
Copy link
Contributor

Fix: Prevent unnecessary tool_choice injection in map_openai_params for Mistral models on AWS Bedrock

Relevant issues

Fixes #11750

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • [✅] My PR passes all unit tests on make test-unit
  • [✅] My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix

Changes

  1. Removed the forced injection of tool_choice into optional_params in map_openai_params when not required.
  2. This resolves compatibility issues with Mistral models (mistral.mistral-large-2402-v1:0, mistral.mistral-small-2402-v1:0) on AWS Bedrock when using the converse API.
  3. Ensures that unsupported parameters like response_format are not passed, preventing UnsupportedParamsError.
  4. ✅ Clarification: This fix ensures tool_choice is not injected for any Bedrock model when using the converse API, as it is not requested or supported in that context.

…m Bedrock's `converse_transformation.py`. All models function correctly without `tool_choice`, and this change enables `mistral-small` to support the Structured Output feature using tools. Verified tool support across all Bedrock models using the Converse API.
…m Bedrock's `converse_transformation.py`. All models function correctly without `tool_choice`, and this change enables `mistral-small` to support the Structured Output feature using tools. Verified tool support across all Bedrock models using the Converse API.
Copy link

vercel bot commented Jul 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 1, 2025 4:56am

@krrishdholakia
Copy link
Contributor

Can you please share a sample to repro the issue?

@shagunb-acn
Copy link
Contributor Author

@krrishdholakia sure, I have added the CURL and response in bug:
#11750

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.

[Bug]: Invalid tool_choice mapping for models in converse_transformation.py
2 participants