This commit is contained in:
Yeuoly 2024-09-14 01:26:22 +08:00
parent 70c001436e
commit 87c746f6bb
No known key found for this signature in database
GPG Key ID: A66E7E320FB19F61

View File

@ -120,6 +120,15 @@ class ToolInvokeMessage(BaseModel):
raise ValueError("When 'stream' is True, 'variable_value' must be a string.")
return value
@field_validator("variable_name", mode="before")
def transform_variable_name(cls, value) -> str:
"""
The variable name must be a string.
"""
if value in ["json", "text", "files"]:
raise ValueError(f"The variable name '{value}' is reserved.")
return value
class MessageType(Enum):
TEXT = "text"