Files
AIRegulation-DocAnalysis/backend/app/schemas/doc.py

54 lines
1.2 KiB
Python

"""Define schema models for doc."""
from pydantic import BaseModel
from typing import Optional
from datetime import datetime
# Group related schema definitions so validation rules stay consistent.
class DocumentUploadResponse(BaseModel):
"""Define the Document Upload Response API model."""
doc_id: str
filename: str
size: int
status: str = "uploaded"
class DocumentInfo(BaseModel):
"""Define the Document Info API model."""
id: str
name: str
chunks: int
status: str
created_at: Optional[datetime] = None
class DocumentListResponse(BaseModel):
"""Define the Document List Response API model."""
docs: list[DocumentInfo]
class ChunkInfo(BaseModel):
"""Define the Chunk Info API model."""
chunk_id: str
doc_name: str
clause_id: Optional[str] = None
chapter: Optional[str] = None
content: str
token_count: int
chunk_index: int
class ParseResponse(BaseModel):
"""Define the Parse Response API model."""
doc_id: str
chunks: int
status: str = "parsed"
class EmbedResponse(BaseModel):
"""Define the Embed Response API model."""
doc_id: str
vectors: int
status: str = "embedded"