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
c55c0289
Unverified
Commit
c55c0289
authored
Aug 24, 2025
by
Jiangyun Zhu
Committed by
GitHub
Aug 24, 2025
Browse files
[gpt-oss] Streaming Output for Python Tool (#23409)
Signed-off-by:
zjy0516
<
riverclouds.zhu@qq.com
>
parent
65197a5f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
26 deletions
+44
-26
vllm/entrypoints/openai/serving_responses.py
vllm/entrypoints/openai/serving_responses.py
+44
-26
No files found.
vllm/entrypoints/openai/serving_responses.py
View file @
c55c0289
...
...
@@ -1069,7 +1069,48 @@ class OpenAIServingResponses(OpenAIServing):
delta
=
ctx
.
parser
.
last_content_delta
,
sequence_number
=-
1
,
))
# built-in tools will be triggered on the analysis channel
# However, occasionally built-in tools will
# still be output to commentary.
elif
(
ctx
.
parser
.
current_channel
==
"commentary"
or
ctx
.
parser
.
current_channel
==
"analysis"
)
and
ctx
.
parser
.
current_recipient
==
"python"
:
if
not
sent_output_item_added
:
sent_output_item_added
=
True
yield
_send_event
(
openai_responses_types
.
ResponseOutputItemAddedEvent
(
type
=
"response.output_item.added"
,
sequence_number
=-
1
,
output_index
=
current_output_index
,
item
=
openai_responses_types
.
ResponseCodeInterpreterToolCallParam
(
type
=
"code_interpreter_call"
,
id
=
current_item_id
,
code
=
None
,
container_id
=
"auto"
,
outputs
=
None
,
status
=
"in_progress"
,
),
))
yield
_send_event
(
openai_responses_types
.
ResponseCodeInterpreterCallInProgressEvent
(
type
=
"response.code_interpreter_call.in_progress"
,
sequence_number
=-
1
,
output_index
=
current_output_index
,
item_id
=
current_item_id
,
))
yield
_send_event
(
openai_responses_types
.
ResponseCodeInterpreterCallCodeDeltaEvent
(
type
=
"response.code_interpreter_call_code.delta"
,
sequence_number
=-
1
,
output_index
=
current_output_index
,
item_id
=
current_item_id
,
delta
=
ctx
.
parser
.
last_content_delta
,
))
if
ctx
.
is_assistant_action_turn
()
and
len
(
ctx
.
parser
.
messages
)
>
0
:
previous_item
=
ctx
.
parser
.
messages
[
-
1
]
if
(
self
.
tool_server
is
not
None
...
...
@@ -1165,30 +1206,6 @@ class OpenAIServingResponses(OpenAIServing):
and
self
.
tool_server
.
has_tool
(
"python"
)
and
previous_item
.
recipient
is
not
None
and
previous_item
.
recipient
.
startswith
(
"python"
)):
yield
_send_event
(
openai_responses_types
.
ResponseOutputItemAddedEvent
(
type
=
"response.output_item.added"
,
sequence_number
=-
1
,
output_index
=
current_output_index
,
item
=
openai_responses_types
.
ResponseCodeInterpreterToolCallParam
(
type
=
"code_interpreter_call"
,
id
=
current_item_id
,
code
=
""
,
container_id
=
"auto"
,
outputs
=
[],
status
=
"in_progress"
,
),
))
yield
_send_event
(
openai_responses_types
.
ResponseCodeInterpreterCallInProgressEvent
(
type
=
"response.code_interpreter_call.in_progress"
,
sequence_number
=-
1
,
output_index
=
current_output_index
,
item_id
=
current_item_id
,
))
# TODO: do we need to add delta event here?
yield
_send_event
(
openai_responses_types
.
ResponseCodeInterpreterCallCodeDoneEvent
(
...
...
@@ -1196,7 +1213,8 @@ class OpenAIServingResponses(OpenAIServing):
sequence_number
=-
1
,
output_index
=
current_output_index
,
item_id
=
current_item_id
,
code
=
previous_item
.
content
[
0
].
text
))
code
=
previous_item
.
content
[
0
].
text
,
))
yield
_send_event
(
openai_responses_types
.
ResponseCodeInterpreterCallInterpretingEvent
(
...
...
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