Files

54 lines
1.2 KiB
Python
Raw Permalink Normal View History

"""Define schema models for doc."""
2026-05-14 15:07:34 +08:00
from pydantic import BaseModel
from typing import Optional
from datetime import datetime
# Group related schema definitions so validation rules stay consistent.
2026-05-14 15:07:34 +08:00
class DocumentUploadResponse(BaseModel):
"""Define the Document Upload Response API model."""
2026-05-14 15:07:34 +08:00
doc_id: str
filename: str
size: int
status: str = "uploaded"
class DocumentInfo(BaseModel):
"""Define the Document Info API model."""
2026-05-14 15:07:34 +08:00
id: str
name: str
chunks: int
status: str
created_at: Optional[datetime] = None
class DocumentListResponse(BaseModel):
"""Define the Document List Response API model."""
2026-05-14 15:07:34 +08:00
docs: list[DocumentInfo]
class ChunkInfo(BaseModel):
"""Define the Chunk Info API model."""
2026-05-14 15:07:34 +08:00
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."""
2026-05-14 15:07:34 +08:00
doc_id: str
chunks: int
status: str = "parsed"
class EmbedResponse(BaseModel):
"""Define the Embed Response API model."""
2026-05-14 15:07:34 +08:00
doc_id: str
vectors: int
status: str = "embedded"