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
dynamo
Commits
22f1ab15
Unverified
Commit
22f1ab15
authored
Mar 05, 2026
by
Ayush Agarwal
Committed by
GitHub
Mar 05, 2026
Browse files
fix(vllm-omni): Fix call to normalize_finish_reason on OmniHandler for main (#6910)
Signed-off-by:
ayushag
<
ayushag@nvidia.com
>
parent
844000eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
components/src/dynamo/vllm/omni/omni_handler.py
components/src/dynamo/vllm/omni/omni_handler.py
+2
-1
components/src/dynamo/vllm/tests/test_vllm_omni_handler.py
components/src/dynamo/vllm/tests/test_vllm_omni_handler.py
+18
-1
No files found.
components/src/dynamo/vllm/omni/omni_handler.py
View file @
22f1ab15
...
...
@@ -25,6 +25,7 @@ from dynamo.common.protocols.video_protocol import (
VideoData
,
)
from
dynamo.common.storage
import
upload_to_fs
from
dynamo.common.utils.engine_response
import
normalize_finish_reason
from
dynamo.common.utils.output_modalities
import
RequestType
,
parse_request_type
from
dynamo.common.utils.video_utils
import
(
compute_num_frames
,
...
...
@@ -513,7 +514,7 @@ class OmniHandler(BaseOmniHandler):
"role"
:
"assistant"
,
"content"
:
delta_text
,
},
"finish_reason"
:
self
.
_
normalize_finish_reason
(
output
.
finish_reason
)
"finish_reason"
:
normalize_finish_reason
(
output
.
finish_reason
)
if
output
.
finish_reason
else
None
,
}
...
...
components/src/dynamo/vllm/tests/test_vllm_omni_handler.py
View file @
22f1ab15
...
...
@@ -151,7 +151,6 @@ class TestFormatTextChunk:
def
test_finish_reason_included
(
self
):
"""Final chunk includes finish_reason and usage stats."""
handler
=
_make_handler
()
handler
.
_normalize_finish_reason
=
lambda
r
:
r
handler
.
_build_completion_usage
=
lambda
ro
:
{
"prompt_tokens"
:
3
,
"completion_tokens"
:
1
,
...
...
@@ -161,6 +160,24 @@ class TestFormatTextChunk:
assert
chunk
[
"choices"
][
0
][
"finish_reason"
]
==
"stop"
assert
"usage"
in
chunk
def
test_finish_reason_abort_normalized
(
self
):
"""Abort finish reason is normalized to 'cancelled'."""
handler
=
_make_handler
()
handler
.
_build_completion_usage
=
lambda
ro
:
{
"prompt_tokens"
:
3
,
"completion_tokens"
:
1
,
}
ro
=
self
.
_make_output
(
"done"
,
finish_reason
=
"abort"
)
chunk
=
handler
.
_format_text_chunk
(
ro
,
"req-1"
,
""
)
assert
chunk
[
"choices"
][
0
][
"finish_reason"
]
==
"cancelled"
def
test_finish_reason_none_when_not_finished
(
self
):
"""finish_reason is None when output has no finish_reason."""
handler
=
_make_handler
()
ro
=
self
.
_make_output
(
"partial"
)
chunk
=
handler
.
_format_text_chunk
(
ro
,
"req-1"
,
""
)
assert
chunk
[
"choices"
][
0
][
"finish_reason"
]
is
None
class
TestFormatImageChunk
:
@
pytest
.
mark
.
asyncio
...
...
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