fix(core): Reorder field_validator and classmethod to fit Pydantic V2. (#5257)
This commit is contained in:
parent
e95f8fa3dc
commit
5a99aeb864
11 changed files with 17 additions and 15 deletions
|
|
@ -32,8 +32,8 @@ class TwilioAPIWrapper(BaseModel):
|
|||
must be empty.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
@field_validator('client', mode='before')
|
||||
@classmethod
|
||||
def set_validator(cls, values: dict) -> dict:
|
||||
"""Validate that api key and python package exists in environment."""
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class BuiltinTool(Tool):
|
|||
tenant_id=self.runtime.tenant_id,
|
||||
prompt_messages=prompt_messages
|
||||
)
|
||||
|
||||
|
||||
def summary(self, user_id: str, content: str) -> str:
|
||||
max_tokens = self.get_max_tokens()
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ class Tool(BaseModel, ABC):
|
|||
# pydantic configs
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
@classmethod
|
||||
@field_validator('parameters', mode='before')
|
||||
@classmethod
|
||||
def set_parameters(cls, v, validation_info: ValidationInfo) -> list[ToolParameter]:
|
||||
return v or []
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue