[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

@@ -6,6 +6,7 @@ import time
from collections.abc import AsyncGenerator
from typing import Final, Literal, Optional, Union, cast
import jinja2
import numpy as np
from fastapi import Request
from typing_extensions import assert_never
@@ -138,6 +139,12 @@ class OpenAIServingPooling(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))
# Schedule the request and get the result generator.
generators: list[AsyncGenerator[PoolingRequestOutput, None]] = []