[BugFix]: properly catch templating error when preprocess input (#13976)

Signed-off-by: Guillaume Calmettes <gcalmettes@scaleway.com>
This commit is contained in:
Guillaume Calmettes
2025-03-14 08:58:34 -04:00
committed by GitHub
parent ab93f1360f
commit fd8e055ffb
5 changed files with 37 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
from typing import Final, Optional, Union
import jinja2
from fastapi import Request
from vllm.config import ModelConfig
@@ -91,6 +92,12 @@ class OpenAIServingTokenization(OpenAIServing):
except ValueError as e:
logger.exception("Error in preprocessing prompt inputs")
return self.create_error_response(str(e))
except TypeError as e:
logger.exception("Error in preprocessing prompt inputs")
return self.create_error_response(str(e))
except jinja2.TemplateError as e:
logger.exception("Error in preprocessing prompt inputs")
return self.create_error_response(str(e))
input_ids: list[int] = []
for i, engine_prompt in enumerate(engine_prompts):