Spaces:
Running
Running
Download src/models/document.py from TalatMasud/chatbot-backend: direct link, hf CLI and curl.
- Browser
- Download file 982 Bytes
-
https://huggingface.co/spaces/TalatMasud/chatbot-backend/resolve/main/src/models/document.py
- Command line
-
hf download hf://spaces/TalatMasud/chatbot-backend/src/models/document.py
-
curl -L -o document.py https://huggingface.co/spaces/TalatMasud/chatbot-backend/resolve/main/src/models/document.py
982 Bytes
| # src/models/document.py | |
| from pydantic import BaseModel | |
| from typing import Optional, List, Dict, Any | |
| class DocumentInfo(BaseModel): | |
| """Document information model""" | |
| original_filename: str | |
| size: int | |
| content_type: str | |
| url_path: str | |
| class DocumentResponse(BaseModel): | |
| """Response model for document processing""" | |
| message: str | |
| document_id: str | |
| status: str | |
| document_info: Optional[DocumentInfo] = None | |
| class BatchUploadResponse(BaseModel): | |
| """Response model for batch document upload""" | |
| message: str | |
| processed_files: List[DocumentResponse] | |
| failed_files: List[dict] | |
| class StoredDocument(BaseModel): | |
| """Model for a document stored in the vector store""" | |
| id: str | |
| text: str | |
| embedding: Optional[List[float]] = None | |
| metadata: Optional[Dict[str, Any]] = None | |
| class AllDocumentsResponse(BaseModel): | |
| """Response model for retrieving all documents""" | |
| total_documents: int | |
| documents: List[StoredDocument] |