Plexi API
FastAPI RAG backend deployed on HuggingFace Spaces.
What It Does
- Loads the pre-built LlamaIndex vector store from the
plexi-materialsGitHub repo at startup - Exposes three endpoints consumed by the Cloudflare Worker middleman
Endpoints
| Method | Path | Purpose |
|---|---|---|
GET |
/health |
Liveness probe — used by keep-alive GitHub Actions |
GET |
/manifest |
Proxies + caches manifest.json from the materials repo |
POST |
/retrieve |
Embeds query, searches index, returns scoped top-k chunks |
Local Development
pip install -r requirements.txt
uvicorn main:app --reload --port 7860
Visit http://localhost:7860/docs for the interactive API docs.
Environment Variables
| Variable | Default | Purpose |
|---|---|---|
MATERIALS_REPO |
KunalGupta25/plexi-materials |
GitHub repo with study materials |
MANIFEST_BRANCH |
main |
Branch that holds manifest.json and index/ |
ALLOWED_ORIGINS |
(Cloudflare Pages URL) | CORS allowed origins |
Deploy to HuggingFace Spaces
- Create a new Space with Docker SDK
- Push this folder as the Space repo
- Set environment variables in the Space settings
- HF will build and run the Dockerfile automatically