Skip to content

Commit 0b7e78c

Browse files
committed
Address comment
Signed-off-by: Chang Liu (Enterprise Products) <[email protected]>
1 parent 96d93e0 commit 0b7e78c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tensorrt_llm/serve/openai_protocol.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
from openai.types.responses.tool import Tool
2020
from openai.types.shared import Metadata, Reasoning
2121
from openai_harmony import ReasoningEffort
22-
from pydantic import BaseModel, ConfigDict, Field, model_validator
22+
from pydantic import (BaseModel, ConfigDict, Field, field_validator,
23+
model_validator)
2324
from typing_extensions import Annotated, Required, TypeAlias, TypedDict
2425

2526
from tensorrt_llm.executor.request import LoRARequest
@@ -678,16 +679,15 @@ def check_suffix(cls, data):
678679
raise ValueError("suffix is not supported")
679680
return data
680681

681-
@model_validator(mode="before")
682+
@field_validator("cache_salt")
682683
@classmethod
683-
def check_cache_salt_support(cls, data):
684-
if data.get("cache_salt") is not None:
685-
if not isinstance(data["cache_salt"],
686-
str) or not data["cache_salt"]:
684+
def check_cache_salt_support(cls, v):
685+
if v is not None:
686+
if not isinstance(v, str) or not v.strip():
687687
raise ValueError(
688688
"Parameter 'cache_salt' must be a non-empty string if provided."
689689
)
690-
return data
690+
return v
691691

692692

693693
ResponseInputOutputItem: TypeAlias = Union[ResponseInputItemParam,

0 commit comments

Comments
 (0)