[Reasoning + Structured Output] make reasoning compatible with structured output (#12551)

Signed-off-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
Co-authored-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
This commit is contained in:
Muqi Li
2025-12-08 01:28:39 -08:00
committed by GitHub
co-authored by Xinyuan Tong
parent f72a77038f
commit 06836ad02a
8 changed files with 72 additions and 33 deletions
+4 -1
View File
@@ -1304,6 +1304,7 @@ class Scheduler(
lora_id=recv_req.lora_id,
input_embeds=recv_req.input_embeds,
custom_logit_processor=recv_req.custom_logit_processor,
reasoning=recv_req.reasoning,
return_hidden_states=recv_req.return_hidden_states,
eos_token_ids=self.model_config.hf_eos_token_id,
bootstrap_host=recv_req.bootstrap_host,
@@ -1431,7 +1432,9 @@ class Scheduler(
elif req.sampling_params.structural_tag:
key = ("structural_tag", req.sampling_params.structural_tag)
value, cache_hit = self.grammar_backend.get_cached_or_future_value(key)
value, cache_hit = self.grammar_backend.get_cached_or_future_value(
key, req.reasoning
)
req.grammar = value
if not cache_hit: