From e3bd7b776676bb5c15ce88d69d606b57efe37f63 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Sun, 21 Jun 2026 17:13:24 -0400 Subject: [PATCH] fix(mistral): strip reasoning_content in multimodal async/sync paths Remove 'reasoning_content' from assistant messages to comply with Mistral API requirements. --- litellm/llms/mistral/chat/transformation.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/litellm/llms/mistral/chat/transformation.py b/litellm/llms/mistral/chat/transformation.py index ec5caaacafb..005b9aa8ba3 100644 --- a/litellm/llms/mistral/chat/transformation.py +++ b/litellm/llms/mistral/chat/transformation.py @@ -285,6 +285,10 @@ class MistralConfig(OpenAIGPTConfig): """ Handle modification of messages for Mistral API in an async context. """ + # Strip reasoning_content from assistant messages — Mistral rejects it as input (extra_forbidden) + for m in messages: + if m.get("role") == "assistant": + m.pop("reasoning_content", None) # Call parent async method to handle basic transformations # and then apply Mistral-specific handling for files messages = await super()._transform_messages(messages, model, True) @@ -295,6 +299,10 @@ class MistralConfig(OpenAIGPTConfig): self, messages: List[AllMessageValues], model: str ) -> List[AllMessageValues]: """Handle modification of messages for Mistral API in a sync context.""" + # Strip reasoning_content from assistant messages — Mistral rejects it as input (extra_forbidden) + for m in messages: + if m.get("role") == "assistant": + m.pop("reasoning_content", None) # Call parent sync method to handle basic transformations # and then apply Mistral-specific handling for files # This is the sync version of the async method above