@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 70ed01550c
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 5, 04:45 UTC

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

Signed-off-by: rishitdholakia13 <rishit+github@cohere.com> Signed-off-by: rishitdholakia13 <123388671+rishitdholakia13@users.noreply.github.com> Signed-off-by: Aaron Pham <contact@aarnphm.xyz> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Aaron Pham <contact@aarnphm.xyz>

rishitdholakia13 committed Apr 15, 2026 at 00:29 UTC 70ed01550c2a47d1888450935f30b8cf2f55d6bd
2 files changed +7 -1
vllm/entrypoints/serve/render/serving.py
+3 -1
@@ -548,7 +548,9 @@ class OpenAIServingRender:
548
549 if reasoning_parser is not None:
550 tokenizer = renderer.get_tokenizer()
551 - request = reasoning_parser(tokenizer).adjust_request(request=request)
551 + request = reasoning_parser(
552 + tokenizer, model_config=self.model_config
553 + ).adjust_request(request=request)
554
555 # tool parsing is done only if a tool_parser has been set and if
556 # tool_choice is not "none" (if tool_choice is "none" but a tool_parser
vllm/reasoning/abs_reasoning_parsers.py
+4
@@ -14,6 +14,7 @@ from vllm.utils.collection_utils import is_list_of
14 from vllm.utils.import_utils import import_from_path
15
16 if TYPE_CHECKING:
17 + from vllm.config import ModelConfig
18 from vllm.entrypoints.openai.chat_completion.protocol import ChatCompletionRequest
19 from vllm.entrypoints.openai.engine.protocol import DeltaMessage
20 from vllm.entrypoints.openai.responses.protocol import ResponsesRequest
@@ -32,6 +33,9 @@ class ReasoningParser:
33
34 def __init__(self, tokenizer: "TokenizerLike", *args, **kwargs):
35 self.model_tokenizer = tokenizer
36 + # Optional vLLM ModelConfig from the server. Use get (not pop) so composite
37 + # parsers can forward **kwargs to nested parsers.
38 + self._model_config: ModelConfig | None = kwargs.get("model_config")
39
40 @cached_property
41 def vocab(self) -> dict[str, int]: