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

@@ -1,9 +1,6 @@
from typing import List, Optional
from fastapi import UploadFile
from dbgpt._private.pydantic import BaseModel
from dbgpt.rag.chunk_manager import ChunkParameters
from dbgpt._private.pydantic import BaseModel, ConfigDict
class KnowledgeQueryRequest(BaseModel):
@@ -59,6 +56,8 @@ class DocumentQueryRequest(BaseModel):
class DocumentSyncRequest(BaseModel):
"""Sync request"""
model_config = ConfigDict(protected_namespaces=())
"""doc_ids: doc ids"""
doc_ids: List
@@ -104,6 +103,8 @@ class SpaceArgumentRequest(BaseModel):
class DocumentSummaryRequest(BaseModel):
"""Sync request"""
model_config = ConfigDict(protected_namespaces=())
"""doc_ids: doc ids"""
doc_id: int
model_name: str
@@ -113,5 +114,7 @@ class DocumentSummaryRequest(BaseModel):
class EntityExtractRequest(BaseModel):
"""argument: argument"""
model_config = ConfigDict(protected_namespaces=())
text: str
model_name: str

View File

@@ -1,28 +1,29 @@
from typing import List
from typing import List, Optional
from dbgpt._private.pydantic import BaseModel
from dbgpt._private.pydantic import BaseModel, Field
from dbgpt.serve.rag.api.schemas import DocumentChunkVO, DocumentVO
class ChunkQueryResponse(BaseModel):
"""data: data"""
data: List = None
data: List[DocumentChunkVO] = Field(..., description="document chunk list")
"""summary: document summary"""
summary: str = None
summary: Optional[str] = Field(None, description="document summary")
"""total: total size"""
total: int = None
total: Optional[int] = Field(None, description="total size")
"""page: current page"""
page: int = None
page: Optional[int] = Field(None, description="current page")
class DocumentQueryResponse(BaseModel):
"""data: data"""
data: List = None
data: List[DocumentVO] = Field(..., description="document list")
"""total: total size"""
total: int = None
total: Optional[int] = Field(None, description="total size")
"""page: current page"""
page: int = None
page: Optional[int] = Field(None, description="current page")
class SpaceQueryResponse(BaseModel):