[Frontend] Cache chat template kwargs resolution (#26227)

Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
This commit is contained in:
Isotr0py
2025-10-04 23:32:30 +08:00
committed by GitHub
parent 5c057e068f
commit a42d2df75f
7 changed files with 81 additions and 18 deletions

View File

@@ -65,6 +65,7 @@ class OpenAIServingPooling(OpenAIServing):
request_logger: Optional[RequestLogger],
chat_template: Optional[str],
chat_template_content_format: ChatTemplateContentFormatOption,
trust_request_chat_template: bool = False,
log_error_stack: bool = False,
) -> None:
super().__init__(engine_client=engine_client,
@@ -75,6 +76,7 @@ class OpenAIServingPooling(OpenAIServing):
self.chat_template = chat_template
self.chat_template_content_format: Final = chat_template_content_format
self.trust_request_chat_template = trust_request_chat_template
io_processor_plugin = self.model_config.io_processor_plugin
self.io_processor = get_io_processor(vllm_config, io_processor_plugin)
@@ -129,6 +131,14 @@ class OpenAIServingPooling(OpenAIServing):
prompt=validated_prompt, request_id=request_id)
elif isinstance(request, PoolingChatRequest):
error_check_ret = self._validate_chat_template(
request_chat_template=request.chat_template,
chat_template_kwargs=request.chat_template_kwargs,
trust_request_chat_template=self.
trust_request_chat_template,
)
if error_check_ret is not None:
return error_check_ret
(
_,
_,