Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions mods/fix-mistral-reasoning-effort/fix.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- a/vllm/tokenizers/mistral.py
+++ b/vllm/tokenizers/mistral.py
@@ -432,7 +432,13 @@
# NOTE: This is for backward compatibility.
# Transformers should be passed arguments it knows.
if self.version >= 15:
- version_kwargs["reasoning_effort"] = kwargs.get("reasoning_effort")
+ _re = kwargs.get("reasoning_effort")
+ if _re is not None:
+ try:
+ from mistral_common.protocol.instruct.messages import REASONING_EFFORTS
+ version_kwargs["reasoning_effort"] = _re
+ except (ImportError, AttributeError):
+ pass

messages, tools = _prepare_apply_chat_template_tools_and_messages(
messages, tools, continue_final_message, add_generation_prompt
19 changes: 19 additions & 0 deletions mods/fix-mistral-reasoning-effort/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -e

# Fix: vLLM unconditionally passes reasoning_effort to apply_chat_template,
# but mistral_common <1.11 doesn't support it, causing 400 on every request.
# Workaround until PR #37081 lands in a release.
#
# Safe to apply on any version: skips if already patched or not applicable.

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SITE_PACKAGES=$(python3 -c "import site; print(site.getsitepackages()[0])")

echo "Applying fix-mistral-reasoning-effort patch..."
if patch --dry-run -p1 -d "$SITE_PACKAGES" < "$SCRIPT_DIR/fix.diff" &>/dev/null; then
patch -p1 -d "$SITE_PACKAGES" < "$SCRIPT_DIR/fix.diff"
echo "Patch applied successfully."
else
echo "Patch not applicable (already applied or code has changed), skipping."
fi