[responsesAPI] parser.extract_response_outputs can take in token IDs (#37130)

Signed-off-by: Andrew Xia <axia@meta.com>
This commit is contained in:
Andrew Xia
2026-03-17 22:31:31 -07:00
committed by GitHub
parent ce2ef42fd3
commit 0e95916155
2 changed files with 6 additions and 0 deletions

View File

@@ -1012,6 +1012,7 @@ class OpenAIServingResponses(OpenAIServing):
parser = self.parser(tokenizer)
return parser.extract_response_outputs(
model_output=final_output.text,
model_output_token_ids=final_output.token_ids,
request=request,
enable_auto_tools=self.enable_auto_tools,
tool_call_id_type=self.tool_call_id_type,

View File

@@ -155,7 +155,9 @@ class Parser:
@abstractmethod
def extract_response_outputs(
self,
*,
model_output: str,
model_output_token_ids: Sequence[int],
request: ResponsesRequest,
enable_auto_tools: bool = False,
tool_call_id_type: str = "random",
@@ -170,6 +172,7 @@ class Parser:
Args:
model_output: The complete model-generated string.
model_output_token_ids: The token IDs of the model output.
request: The request object used to generate the output.
enable_auto_tools: Whether to enable automatic tool call parsing.
tool_call_id_type: Type of tool call ID generation ("random", etc).
@@ -313,7 +316,9 @@ class DelegatingParser(Parser):
def extract_response_outputs(
self,
*,
model_output: str,
model_output_token_ids: Sequence[int],
request: ResponsesRequest,
enable_auto_tools: bool = False,
tool_call_id_type: str = "random",