mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix: also strip reasoning_content from Mistral messages
Fixes #30835 — reasoning_content in assistant messages causes 422 extra_forbidden when forwarded to Mistral API.
This commit is contained in:
parent
159a5e47f7
commit
d600d7a668
2 changed files with 4 additions and 0 deletions
|
|
@ -272,6 +272,7 @@ class MistralConfig(OpenAIGPTConfig):
|
|||
m.pop("provider_specific_fields", None)
|
||||
m.pop("thinking_blocks", None)
|
||||
m.pop("cache_control", None)
|
||||
m.pop("reasoning_content", None)
|
||||
new_messages.append(m)
|
||||
|
||||
if is_async:
|
||||
|
|
@ -306,6 +307,7 @@ class MistralConfig(OpenAIGPTConfig):
|
|||
m.pop("provider_specific_fields", None)
|
||||
m.pop("thinking_blocks", None)
|
||||
m.pop("cache_control", None)
|
||||
m.pop("reasoning_content", None)
|
||||
return messages
|
||||
|
||||
def _handle_message_with_file(self, messages: List[AllMessageValues]) -> List[AllMessageValues]:
|
||||
|
|
|
|||
|
|
@ -266,6 +266,7 @@ class TestMistralReasoningSupport:
|
|||
"provider_specific_fields": {"foo": "bar"},
|
||||
"thinking_blocks": [],
|
||||
"cache_control": {"type": "ephemeral"},
|
||||
"reasoning_content": "some thinking",
|
||||
},
|
||||
)
|
||||
]
|
||||
|
|
@ -278,6 +279,7 @@ class TestMistralReasoningSupport:
|
|||
assert "provider_specific_fields" not in msg
|
||||
assert "thinking_blocks" not in msg
|
||||
assert "cache_control" not in msg
|
||||
assert "reasoning_content" not in msg
|
||||
|
||||
def test_transform_request_magistral_with_reasoning(self):
|
||||
"""Test transform_request method for magistral model with reasoning."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue