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
c6bb5b56
Unverified
Commit
c6bb5b56
authored
Jan 12, 2026
by
Nick Hill
Committed by
GitHub
Jan 13, 2026
Browse files
[BugFix] Fix engine crash caused by chat tools + response_format (#32127)
Signed-off-by:
Nick Hill
<
nickhill123@gmail.com
>
parent
9273a427
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
0 deletions
+47
-0
tests/tool_use/test_chat_completions.py
tests/tool_use/test_chat_completions.py
+42
-0
vllm/tool_parsers/abstract_tool_parser.py
vllm/tool_parsers/abstract_tool_parser.py
+1
-0
vllm/v1/engine/input_processor.py
vllm/v1/engine/input_processor.py
+4
-0
No files found.
tests/tool_use/test_chat_completions.py
View file @
c6bb5b56
...
@@ -151,3 +151,45 @@ async def test_chat_completion_with_tools(
...
@@ -151,3 +151,45 @@ async def test_chat_completion_with_tools(
assert
chunk
.
choices
[
0
].
finish_reason
!=
"tool_calls"
assert
chunk
.
choices
[
0
].
finish_reason
!=
"tool_calls"
assert
len
(
chunks
)
assert
len
(
chunks
)
assert
""
.
join
(
chunks
)
==
output_text
assert
""
.
join
(
chunks
)
==
output_text
# Regression test for https://github.com/vllm-project/vllm/issues/32006
# Engine crash when combining response_format: json_object with
# tool_choice: required
@
pytest
.
mark
.
asyncio
@
pytest
.
mark
.
timeout
(
120
)
async
def
test_response_format_with_tool_choice_required
(
client
:
openai
.
AsyncOpenAI
,
server_config
:
ServerConfig
):
"""
Test that combining response_format: json_object with tool_choice: required
doesn't crash the engine.
Before the fix, this would cause a validation error:
"You can only use one kind of structured outputs constraint but multiple
are specified" because both json_object and json (from tool schema) would
be set in StructuredOutputsParams.
"""
models
=
await
client
.
models
.
list
()
model_name
:
str
=
models
.
data
[
0
].
id
# This combination previously crashed the engine
chat_completion
=
await
client
.
chat
.
completions
.
create
(
messages
=
ensure_system_prompt
(
[{
"role"
:
"user"
,
"content"
:
"What is the weather in Dallas, Texas?"
}],
server_config
,
),
temperature
=
0
,
max_completion_tokens
=
150
,
model
=
model_name
,
tools
=
[
WEATHER_TOOL
],
tool_choice
=
"required"
,
response_format
=
{
"type"
:
"json_object"
},
)
# The fix clears response_format when tool_choice forces tool calling,
# so the request should complete successfully with tool calls
choice
=
chat_completion
.
choices
[
0
]
assert
choice
.
finish_reason
==
"tool_calls"
assert
choice
.
message
.
tool_calls
is
not
None
assert
len
(
choice
.
message
.
tool_calls
)
>
0
vllm/tool_parsers/abstract_tool_parser.py
View file @
c6bb5b56
...
@@ -67,6 +67,7 @@ class ToolParser:
...
@@ -67,6 +67,7 @@ class ToolParser:
# tool_choice: "Forced Function" or "required" will override
# tool_choice: "Forced Function" or "required" will override
# structured output json settings to make tool calling work correctly
# structured output json settings to make tool calling work correctly
request
.
structured_outputs
.
json
=
json_schema_from_tool
request
.
structured_outputs
.
json
=
json_schema_from_tool
request
.
response_format
=
None
if
isinstance
(
request
,
ResponsesRequest
):
if
isinstance
(
request
,
ResponsesRequest
):
request
.
text
=
ResponseTextConfig
()
request
.
text
=
ResponseTextConfig
()
request
.
text
.
format
=
ResponseFormatTextJSONSchemaConfig
(
request
.
text
.
format
=
ResponseFormatTextJSONSchemaConfig
(
...
...
vllm/v1/engine/input_processor.py
View file @
c6bb5b56
...
@@ -370,6 +370,10 @@ class InputProcessor:
...
@@ -370,6 +370,10 @@ class InputProcessor:
# Remember that this backend was set automatically
# Remember that this backend was set automatically
params
.
structured_outputs
.
_backend_was_auto
=
True
params
.
structured_outputs
.
_backend_was_auto
=
True
# Run post-init validation. This is also important to ensure subsequent
# roundtrip serialization/deserialization won't fail.
params
.
structured_outputs
.
__post_init__
()
def
_maybe_build_mm_uuids
(
def
_maybe_build_mm_uuids
(
self
,
self
,
request_id
:
str
,
request_id
:
str
,
...
...
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