[GPT-OSS] Strict tool call and constrained decoding for Harmony (#45560)

Signed-off-by: Yifan Zong <yzong@redhat.com>
This commit is contained in:
yzong-rh
2026-08-01 12:10:26 -04:00
committed by GitHub
parent 127a7cebc9
commit dc818c198d
10 changed files with 632 additions and 511 deletions
+8 -5
View File
@@ -749,11 +749,14 @@ class OpenAIServingResponses(GenerateBaseServing):
request: ResponsesRequest,
prev_response: ResponsesResponse | None,
):
if request.tool_choice not in ("auto", "none"):
raise NotImplementedError(
"Only 'auto' or 'none' tool_choice is supported "
"in response API with Harmony"
)
if self.parser is not None:
# HarmonyParser doesn't need chat_template_kwargs
# TODO: Unify adjust_request() call with non-harmony branch
self.parser(
self.renderer.get_tokenizer(),
request.tools,
model_config=self.model_config,
).adjust_request(request=request)
arrival_time = time.time()
messages = self._construct_input_messages_with_harmony(request, prev_response)