Skip to content

Commit

Permalink
[Frontend] Improve StreamingResponse Exception Handling (#11752)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertgshaw2-redhat authored Jan 5, 2025
1 parent eba1717 commit 33fc1e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions vllm/entrypoints/openai/serving_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ async def chat_completion_stream_generator(
] * num_choices
else:
tool_parsers = [None] * num_choices
except RuntimeError as e:
except Exception as e:
logger.exception("Error in tool parser creation.")
data = self.create_streaming_error_response(str(e))
yield f"data: {data}\n\n"
Expand Down Expand Up @@ -591,7 +591,7 @@ async def chat_completion_stream_generator(
completion_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
logger.exception("Error in chat completion stream generator.")
data = self.create_streaming_error_response(str(e))
Expand Down
2 changes: 1 addition & 1 deletion vllm/entrypoints/openai/serving_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ async def completion_stream_generator(
# report to FastAPI middleware aggregate usage across all choices
request_metadata.final_usage_info = final_usage_info

except ValueError as e:
except Exception as e:
# TODO: Use a vllm-specific Validation Error
data = self.create_streaming_error_response(str(e))
yield f"data: {data}\n\n"
Expand Down

0 comments on commit 33fc1e2

Please sign in to comment.