[Frontend] Require cache_salt to be non-empty via schema (#50816)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
Cyrus Leung
2026-08-03 06:51:27 +00:00
committed by GitHub
parent e481da9508
commit b3f97dae24
5 changed files with 4 additions and 51 deletions
+1 -12
View File
@@ -184,6 +184,7 @@ class CompletionRequest(OpenAIBaseModel):
cache_salt: str | None = Field(
default=None,
min_length=1,
description=(
"If specified, the prefix cache will be salted with the provided "
"string to prevent an attacker to guess prompts in multi-user "
@@ -575,18 +576,6 @@ class CompletionRequest(OpenAIBaseModel):
return data
@model_validator(mode="before")
@classmethod
def check_cache_salt_support(cls, data):
if data.get("cache_salt") is not None and (
not isinstance(data["cache_salt"], str) or not data["cache_salt"]
):
raise VLLMValidationError(
"Parameter 'cache_salt' must be a non-empty string if provided.",
parameter="cache_salt",
)
return data
class CompletionLogProbs(OpenAIBaseModel):
text_offset: list[int] = Field(default_factory=list)