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
9d696492
Unverified
Commit
9d696492
authored
Oct 14, 2025
by
Nan Qin
Committed by
GitHub
Oct 14, 2025
Browse files
fix: response_format for completion (#23212)
Signed-off-by:
Nan2018
<
qinnanjoshua@gmail.com
>
parent
0e658189
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
vllm/entrypoints/openai/protocol.py
vllm/entrypoints/openai/protocol.py
+21
-7
No files found.
vllm/entrypoints/openai/protocol.py
View file @
9d696492
...
@@ -1197,6 +1197,10 @@ class CompletionRequest(OpenAIBaseModel):
...
@@ -1197,6 +1197,10 @@ class CompletionRequest(OpenAIBaseModel):
"Please pass `grammar` to `structured_outputs` instead."
"Please pass `grammar` to `structured_outputs` instead."
),
),
)
)
structural_tag
:
str
|
None
=
Field
(
default
=
None
,
description
=
(
"If specified, the output will follow the structural tag schema."
),
)
guided_decoding_backend
:
str
|
None
=
Field
(
guided_decoding_backend
:
str
|
None
=
Field
(
default
=
None
,
default
=
None
,
description
=
(
description
=
(
...
@@ -1357,10 +1361,27 @@ class CompletionRequest(OpenAIBaseModel):
...
@@ -1357,10 +1361,27 @@ class CompletionRequest(OpenAIBaseModel):
echo_without_generation
=
self
.
echo
and
self
.
max_tokens
==
0
echo_without_generation
=
self
.
echo
and
self
.
max_tokens
==
0
guided_json_object
=
None
if
self
.
response_format
is
not
None
:
if
self
.
response_format
.
type
==
"json_object"
:
guided_json_object
=
True
elif
self
.
response_format
.
type
==
"json_schema"
:
json_schema
=
self
.
response_format
.
json_schema
assert
json_schema
is
not
None
self
.
guided_json
=
json_schema
.
json_schema
elif
self
.
response_format
.
type
==
"structural_tag"
:
structural_tag
=
self
.
response_format
assert
structural_tag
is
not
None
and
isinstance
(
structural_tag
,
StructuralTagResponseFormat
)
s_tag_obj
=
structural_tag
.
model_dump
(
by_alias
=
True
)
self
.
structural_tag
=
json
.
dumps
(
s_tag_obj
)
# Forward deprecated guided_* parameters to structured_outputs
# Forward deprecated guided_* parameters to structured_outputs
if
self
.
structured_outputs
is
None
:
if
self
.
structured_outputs
is
None
:
kwargs
=
dict
[
str
,
Any
](
kwargs
=
dict
[
str
,
Any
](
json
=
self
.
guided_json
,
json
=
self
.
guided_json
,
json_object
=
guided_json_object
,
regex
=
self
.
guided_regex
,
regex
=
self
.
guided_regex
,
choice
=
self
.
guided_choice
,
choice
=
self
.
guided_choice
,
grammar
=
self
.
guided_grammar
,
grammar
=
self
.
guided_grammar
,
...
@@ -1370,13 +1391,6 @@ class CompletionRequest(OpenAIBaseModel):
...
@@ -1370,13 +1391,6 @@ class CompletionRequest(OpenAIBaseModel):
if
len
(
kwargs
)
>
0
:
if
len
(
kwargs
)
>
0
:
self
.
structured_outputs
=
StructuredOutputsParams
(
**
kwargs
)
self
.
structured_outputs
=
StructuredOutputsParams
(
**
kwargs
)
if
(
self
.
structured_outputs
is
not
None
and
self
.
response_format
is
not
None
and
self
.
response_format
.
type
==
"json_object"
):
self
.
structured_outputs
.
json_object
=
True
extra_args
:
dict
[
str
,
Any
]
=
self
.
vllm_xargs
if
self
.
vllm_xargs
else
{}
extra_args
:
dict
[
str
,
Any
]
=
self
.
vllm_xargs
if
self
.
vllm_xargs
else
{}
if
self
.
kv_transfer_params
:
if
self
.
kv_transfer_params
:
# Pass in kv_transfer_params via extra_args
# Pass in kv_transfer_params via extra_args
...
...
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