Skip to content

Commit 25708d3

Browse files
authored
[Bugfix] Mistral crashes on tool with no description (#21167)
Signed-off-by: HugoMichard <hugo@harfanglab.fr>
1 parent 0e18a5d commit 25708d3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

vllm/transformers_utils/tokenizers/mistral.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,17 @@ def make_mistral_chat_completion_request(
183183
message["content"] = content
184184

185185
# The Mistral client, in comparison to the OpenAI client, requires the
186-
# "parameters" dict to be present, even if it's empty.
186+
# "parameters" dict and the "description" string to be present
187+
# even if they are empty.
187188
if tools:
188189
for function in [
189190
tool["function"] for tool in tools
190191
if tool["type"] == "function"
191192
]:
192193
if function.get("parameters") is None:
193194
function["parameters"] = {}
195+
if function.get("description") is None:
196+
function["description"] = ""
194197

195198
from mistral_common.protocol.instruct.request import ChatCompletionRequest
196199
return ChatCompletionRequest(messages=messages,

0 commit comments

Comments
 (0)