feat(core): Upgrade pydantic to 2.x (#1428)

This commit is contained in:
Fangyin Cheng
2024-04-20 09:41:16 +08:00
committed by GitHub
parent baa1e3f9f6
commit 57be1ece18
103 changed files with 1146 additions and 534 deletions

View File

@@ -2,33 +2,30 @@
from abc import ABC
from typing import List, Optional
from dbgpt._private.pydantic import BaseModel
from dbgpt._private.pydantic import BaseModel, ConfigDict, Field
class Role(ABC, BaseModel):
"""Role class for role-based conversation."""
model_config = ConfigDict(arbitrary_types_allowed=True)
profile: str = ""
name: str = ""
resource_introduction = ""
resource_introduction: str = ""
goal: str = ""
expand_prompt: str = ""
fixed_subgoal: Optional[str] = None
fixed_subgoal: Optional[str] = Field(None, description="Fixed subgoal")
constraints: List[str] = []
constraints: List[str] = Field(default_factory=list, description="Constraints")
examples: str = ""
desc: str = ""
language: str = "en"
is_human: bool = False
is_team: bool = False
class Config:
"""Pydantic config."""
arbitrary_types_allowed = True
def prompt_template(
self,
specified_prompt: Optional[str] = None,