Unverified Commit 70ed0155 authored by rishitdholakia13's avatar rishitdholakia13 Committed by GitHub
Browse files

[Reasoning][Frontend] Add model config to adjust_request in reasoning parser (#37848)


Signed-off-by: default avatarrishitdholakia13 <rishit+github@cohere.com>
Signed-off-by: default avatarrishitdholakia13 <123388671+rishitdholakia13@users.noreply.github.com>
Signed-off-by: default avatarAaron Pham <contact@aarnphm.xyz>
Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: default avatarAaron Pham <contact@aarnphm.xyz>
parent 19ec9a0a
......@@ -548,7 +548,9 @@ class OpenAIServingRender:
if reasoning_parser is not None:
tokenizer = renderer.get_tokenizer()
request = reasoning_parser(tokenizer).adjust_request(request=request)
request = reasoning_parser(
tokenizer, model_config=self.model_config
).adjust_request(request=request)
# tool parsing is done only if a tool_parser has been set and if
# tool_choice is not "none" (if tool_choice is "none" but a tool_parser
......
......@@ -14,6 +14,7 @@ from vllm.utils.collection_utils import is_list_of
from vllm.utils.import_utils import import_from_path
if TYPE_CHECKING:
from vllm.config import ModelConfig
from vllm.entrypoints.openai.chat_completion.protocol import ChatCompletionRequest
from vllm.entrypoints.openai.engine.protocol import DeltaMessage
from vllm.entrypoints.openai.responses.protocol import ResponsesRequest
......@@ -32,6 +33,9 @@ class ReasoningParser:
def __init__(self, tokenizer: "TokenizerLike", *args, **kwargs):
self.model_tokenizer = tokenizer
# Optional vLLM ModelConfig from the server. Use get (not pop) so composite
# parsers can forward **kwargs to nested parsers.
self._model_config: ModelConfig | None = kwargs.get("model_config")
@cached_property
def vocab(self) -> dict[str, int]:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment