Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
40148041
"vscode:/vscode.git/clone" did not exist on "bfc04ac8b8d7ff45695457398d869a6692c4f44d"
Unverified
Commit
40148041
authored
Mar 13, 2025
by
Wen Sun
Committed by
GitHub
Mar 12, 2025
Browse files
Ensure Usage Data in Streaming Responses Aligns with vLLM’s Implementation (#3814)
parent
ad46550d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
python/sglang/srt/openai_api/adapter.py
python/sglang/srt/openai_api/adapter.py
+4
-4
No files found.
python/sglang/srt/openai_api/adapter.py
View file @
40148041
...
...
@@ -820,13 +820,13 @@ async def v1_completions(tokenizer_manager, raw_request: Request):
)
final_usage_chunk
=
CompletionStreamResponse
(
id
=
str
(
uuid
.
uuid4
().
hex
)
,
id
=
content
[
"meta_info"
][
"id"
]
,
choices
=
[],
model
=
request
.
model
,
usage
=
usage
,
)
final_usage_data
=
final_usage_chunk
.
model_dump_json
(
exclude_unset
=
True
,
exclude_none
=
True
exclude_none
=
True
)
yield
f
"data:
{
final_usage_data
}
\n\n
"
except
ValueError
as
e
:
...
...
@@ -1495,13 +1495,13 @@ async def v1_chat_completions(tokenizer_manager, raw_request: Request):
)
final_usage_chunk
=
ChatCompletionStreamResponse
(
id
=
str
(
uuid
.
uuid4
().
hex
)
,
id
=
content
[
"meta_info"
][
"id"
]
,
choices
=
[],
model
=
request
.
model
,
usage
=
usage
,
)
final_usage_data
=
final_usage_chunk
.
model_dump_json
(
exclude_unset
=
True
,
exclude_none
=
True
exclude_none
=
True
)
yield
f
"data:
{
final_usage_data
}
\n\n
"
except
ValueError
as
e
:
...
...
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