Spaces:
Runtime error
Runtime error
File size: 780 Bytes
1e8bb26 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | """Pydantic request/response schemas."""
from typing import List, Optional
from pydantic import BaseModel, Field
class DocumentSummary(BaseModel):
id: str
filename: str
content_type: str
num_chunks: int
num_chars: int
ocr_used: bool
created_at: str
class IngestResponse(BaseModel):
document: DocumentSummary
message: str
class ChatRequest(BaseModel):
question: str = Field(..., min_length=1)
# Optionally restrict retrieval to specific uploaded documents.
document_ids: Optional[List[str]] = None
top_k: Optional[int] = None
class Source(BaseModel):
document_id: str
filename: str
chunk_index: int
score: float
snippet: str
class ChatResponse(BaseModel):
answer: str
sources: List[Source]
|