Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
60ca7981
Unverified
Commit
60ca7981
authored
Feb 14, 2026
by
Julien Denize
Committed by
GitHub
Feb 13, 2026
Browse files
Add explicit validation error for tool calls. (#34438)
Signed-off-by:
juliendenize
<
julien.denize@mistral.ai
>
parent
0ef5b914
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
vllm/tokenizers/mistral.py
vllm/tokenizers/mistral.py
+10
-7
No files found.
vllm/tokenizers/mistral.py
View file @
60ca7981
...
...
@@ -17,6 +17,7 @@ from mistral_common.tokens.tokenizers.sentencepiece import (
SentencePieceTokenizer
,
)
from
mistral_common.tokens.tokenizers.tekken
import
Tekkenizer
from
pydantic
import
ValidationError
from
vllm.entrypoints.chat_utils
import
ChatCompletionMessageParam
from
vllm.entrypoints.openai.chat_completion.protocol
import
ChatCompletionRequest
...
...
@@ -64,14 +65,16 @@ def maybe_serialize_tool_calls(request: "MistralChatCompletionRequest"):
# TODO: remove when pydantic v2.11 is released
for
i
,
message
in
enumerate
(
request
.
messages
):
if
message
.
get
(
"role"
)
==
"assistant"
:
tool_calls_validator
=
message
.
get
(
"tool_calls"
,
().
__iter__
())
validated_tool_calls
=
[]
while
True
:
if
(
tool_calls_validator
:
=
message
.
get
(
"tool_calls"
,
None
))
is
not
None
:
try
:
tool_call
=
next
(
tool_calls_validator
)
# type: ignore
validated_tool_calls
.
append
(
tool_call
)
except
StopIteration
:
break
validated_tool_calls
=
list
(
tool_calls_validator
)
except
ValidationError
as
e
:
raise
ValueError
(
"Validating messages' `tool_calls` raised an error. "
"Please ensure `tool_calls` are iterable of tool calls."
)
from
e
else
:
validated_tool_calls
=
[]
request
.
messages
[
i
][
"tool_calls"
]
=
validated_tool_calls
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment