Download app/api/models.py from aionaion/chatdoc: direct link, hf CLI and curl.
- Browser
- Download file 2.03 kB
-
https://huggingface.co/spaces/aionaion/chatdoc/resolve/main/app/api/models.py
- Command line
-
hf download hf://spaces/aionaion/chatdoc/app/api/models.py
-
curl -L -o models.py https://huggingface.co/spaces/aionaion/chatdoc/resolve/main/app/api/models.py
2.03 kB
| from pydantic import BaseModel, Field | |
| from typing import List, Optional, Dict, Any | |
| class QueryRequest(BaseModel): | |
| question: str = Field(..., description="The question to answer") | |
| chat_history: Optional[List[Dict[str, str]]] = Field(None, description="Conversation history") | |
| k: Optional[int] = Field(50, description="Number of documents to retrieve for reranking") | |
| class QueryResponse(BaseModel): | |
| answer: str = Field(..., description="The generated answer") | |
| sources: List[Dict[str, Any]] = Field(..., description="Source documents used") | |
| context_preview: Optional[str] = Field(None, description="Preview of the context used") | |
| llm_model: Optional[str] = Field(None, description="The LLM model used to generate the answer") | |
| class SearchRequest(BaseModel): | |
| query: str = Field(..., description="Search query") | |
| k: Optional[int] = Field(10, description="Number of results to return") | |
| class SearchResponse(BaseModel): | |
| results: List[Dict[str, Any]] = Field(..., description="Search results") | |
| total_results: int = Field(..., description="Total number of results") | |
| class DocumentUploadResponse(BaseModel): | |
| message: str = Field(..., description="Status message") | |
| documents_processed: int = Field(..., description="Number of files processed") | |
| chunks_added: int = Field(..., description="Number of document chunks added") | |
| class CollectionStatsResponse(BaseModel): | |
| total_documents: int = Field(..., description="Total documents in collection") | |
| collection_name: str = Field(..., description="Collection name") | |
| metadata: Optional[Dict[str, Any]] = Field(None, description="Collection metadata") | |
| class HealthResponse(BaseModel): | |
| status: str = Field(..., description="Service status") | |
| vector_store: bool = Field(..., description="Vector store status") | |
| chroma_directory: str = Field(..., description="Chroma persistence directory") | |
| embeddings_model: Optional[str] = Field(None, description="Embeddings model in use") | |