Download src/app/api/ingest.py from ZhangNguyen/Legislation_GraphRag: direct link, hf CLI and curl.
- Browser
- Download file 777 Bytes
-
https://huggingface.co/spaces/ZhangNguyen/Legislation_GraphRag/resolve/main/src/app/api/ingest.py
- Command line
-
hf download hf://spaces/ZhangNguyen/Legislation_GraphRag/src/app/api/ingest.py
-
curl -L -o ingest.py https://huggingface.co/spaces/ZhangNguyen/Legislation_GraphRag/resolve/main/src/app/api/ingest.py
777 Bytes
| from __future__ import annotations | |
| from typing import Any, Dict, Optional | |
| from fastapi import APIRouter | |
| from pydantic import BaseModel | |
| from src.app.runtime import rebuild_everything, reindex_qdrant_from_normalized | |
| router = APIRouter(prefix="/ingest", tags=["ingest"]) | |
| class ReindexRequest(BaseModel): | |
| input_dir: Optional[str] = None | |
| glob_pattern: Optional[str] = None | |
| def reindex(req: ReindexRequest) -> Dict[str, Any]: | |
| return reindex_qdrant_from_normalized( | |
| input_dir=req.input_dir, | |
| glob_pattern=req.glob_pattern, | |
| ) | |
| def rebuild_all(req: ReindexRequest) -> Dict[str, Any]: | |
| return rebuild_everything( | |
| input_dir=req.input_dir, | |
| glob_pattern=req.glob_pattern, | |
| ) |