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
33fc1e2e
Unverified
Commit
33fc1e2e
authored
Jan 05, 2025
by
Robert Shaw
Committed by
GitHub
Jan 05, 2025
Browse files
[Frontend] Improve `StreamingResponse` Exception Handling (#11752)
parent
eba17173
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
vllm/entrypoints/openai/serving_chat.py
vllm/entrypoints/openai/serving_chat.py
+2
-2
vllm/entrypoints/openai/serving_completion.py
vllm/entrypoints/openai/serving_completion.py
+1
-1
No files found.
vllm/entrypoints/openai/serving_chat.py
View file @
33fc1e2e
...
@@ -301,7 +301,7 @@ class OpenAIServingChat(OpenAIServing):
...
@@ -301,7 +301,7 @@ class OpenAIServingChat(OpenAIServing):
]
*
num_choices
]
*
num_choices
else
:
else
:
tool_parsers
=
[
None
]
*
num_choices
tool_parsers
=
[
None
]
*
num_choices
except
RuntimeError
as
e
:
except
Exception
as
e
:
logger
.
exception
(
"Error in tool parser creation."
)
logger
.
exception
(
"Error in tool parser creation."
)
data
=
self
.
create_streaming_error_response
(
str
(
e
))
data
=
self
.
create_streaming_error_response
(
str
(
e
))
yield
f
"data:
{
data
}
\n\n
"
yield
f
"data:
{
data
}
\n\n
"
...
@@ -591,7 +591,7 @@ class OpenAIServingChat(OpenAIServing):
...
@@ -591,7 +591,7 @@ class OpenAIServingChat(OpenAIServing):
completion_tokens
=
num_completion_tokens
,
completion_tokens
=
num_completion_tokens
,
total_tokens
=
num_prompt_tokens
+
num_completion_tokens
)
total_tokens
=
num_prompt_tokens
+
num_completion_tokens
)
except
ValueError
as
e
:
except
Exception
as
e
:
# TODO: Use a vllm-specific Validation Error
# TODO: Use a vllm-specific Validation Error
logger
.
exception
(
"Error in chat completion stream generator."
)
logger
.
exception
(
"Error in chat completion stream generator."
)
data
=
self
.
create_streaming_error_response
(
str
(
e
))
data
=
self
.
create_streaming_error_response
(
str
(
e
))
...
...
vllm/entrypoints/openai/serving_completion.py
View file @
33fc1e2e
...
@@ -371,7 +371,7 @@ class OpenAIServingCompletion(OpenAIServing):
...
@@ -371,7 +371,7 @@ class OpenAIServingCompletion(OpenAIServing):
# report to FastAPI middleware aggregate usage across all choices
# report to FastAPI middleware aggregate usage across all choices
request_metadata
.
final_usage_info
=
final_usage_info
request_metadata
.
final_usage_info
=
final_usage_info
except
ValueError
as
e
:
except
Exception
as
e
:
# TODO: Use a vllm-specific Validation Error
# TODO: Use a vllm-specific Validation Error
data
=
self
.
create_streaming_error_response
(
str
(
e
))
data
=
self
.
create_streaming_error_response
(
str
(
e
))
yield
f
"data:
{
data
}
\n\n
"
yield
f
"data:
{
data
}
\n\n
"
...
...
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