add tools into TokenizeChatRequest (#18187)

Signed-off-by: yangxia <yangxiast@gmail.com>
This commit is contained in:
hustxiayang
2025-05-15 07:01:49 -04:00
committed by GitHub
parent 07ad27121f
commit 451da4bcbd
3 changed files with 84 additions and 0 deletions

View File

@@ -65,6 +65,8 @@ class OpenAIServingTokenization(OpenAIServing):
tokenizer = await self.engine_client.get_tokenizer(lora_request)
if isinstance(request, TokenizeChatRequest):
tool_dicts = (None if request.tools is None else
[tool.model_dump() for tool in request.tools])
(
_,
request_prompts,
@@ -73,6 +75,7 @@ class OpenAIServingTokenization(OpenAIServing):
request,
tokenizer,
request.messages,
tool_dicts=tool_dicts,
chat_template=request.chat_template or self.chat_template,
chat_template_content_format=self.
chat_template_content_format,