Update Optional[x] -> x | None and Union[x, y] to x | y (#26633)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Harry Mellor
2025-10-12 09:51:31 -07:00
committed by GitHub
parent 9bb38130cb
commit 8fcaaf6a16
944 changed files with 9490 additions and 10121 deletions
+3 -4
View File
@@ -3,7 +3,6 @@
from abc import abstractmethod
from collections.abc import Sequence
from typing import Optional, Union
from vllm.entrypoints.openai.protocol import (
ChatCompletionRequest,
@@ -79,7 +78,7 @@ class BaseThinkingReasoningParser(ReasoningParser):
previous_token_ids: Sequence[int],
current_token_ids: Sequence[int],
delta_token_ids: Sequence[int],
) -> Union[DeltaMessage, None]:
) -> DeltaMessage | None:
"""
Extract reasoning content from a delta message.
Handles streaming output where previous + delta = current.
@@ -135,8 +134,8 @@ class BaseThinkingReasoningParser(ReasoningParser):
return DeltaMessage(content=delta_text)
def extract_reasoning_content(
self, model_output: str, request: Union[ChatCompletionRequest, ResponsesRequest]
) -> tuple[Optional[str], Optional[str]]:
self, model_output: str, request: ChatCompletionRequest | ResponsesRequest
) -> tuple[str | None, str | None]:
"""
Extract reasoning content from the model output.