Skip to content

Commit eb52529

Browse files
committed
Address comment
Signed-off-by: Chang Liu (Enterprise Products) <[email protected]>
1 parent 57ea549 commit eb52529

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
@@ -10,7 +10,8 @@
1010
ChatCompletionContentPartParam as OpenAIChatCompletionContentPartParam
1111
from openai.types.chat import \
1212
ChatCompletionMessageParam as OpenAIChatCompletionMessageParam
13-
from pydantic import BaseModel, ConfigDict, Field, model_validator
13+
from pydantic import (BaseModel, ConfigDict, Field, field_validator,
14+
model_validator)
1415
from typing_extensions import Annotated, Required, TypedDict
1516

1617
from tensorrt_llm.executor.request import LoRARequest
@@ -640,16 +641,15 @@ def check_suffix(cls, data):
640641
raise ValueError("suffix is not supported")
641642
return data
642643

643-
@model_validator(mode="before")
644+
@field_validator("cache_salt")
644645
@classmethod
645-
def check_cache_salt_support(cls, data):
646-
if data.get("cache_salt") is not None:
647-
if not isinstance(data["cache_salt"],
648-
str) or not data["cache_salt"]:
646+
def check_cache_salt_support(cls, v):
647+
if v is not None:
648+
if not isinstance(v, str) or not v.strip():
649649
raise ValueError(
650650
"Parameter 'cache_salt' must be a non-empty string if provided."
651651
)
652-
return data
652+
return v
653653

654654

655655
def encode_opaque_state(opaque_state: Optional[bytes]) -> Optional[str]:

0 commit comments

Comments
 (0)