AI-powered document Q&A service. Upload documents (text or PDF), ask questions, get answers grounded in those documents with source citations.
Built with FastAPI, Anthropic Claude, Voyage AI embeddings, and Pinecone for vector search.
- Query — ask a question, get an answer retrieved from indexed documents
- Ingest — index raw text documents
- PDF upload — upload a PDF and index its extracted text (admin)
- Support requests — submit a question async (simulated inbound email), poll for the generated answer
- Namespaces — keep document sets isolated (e.g. per team/customer)
Requires Python 3.12+ and uv.
uv syncCreate a .env file in the project root:
ANTHROPIC_API_KEY=your-anthropic-key
VOYAGE_API_KEY=your-voyage-key
PINECONE_API_KEY=your-pinecone-key
PINECONE_INDEX_NAME=rag-demoRun the server:
uv run fastapi dev main.pyAPI docs available at http://localhost:8000/docs.
| Method | Path | Description |
|---|---|---|
| GET | /health |
Service + dependency health check |
| POST | /query |
Ask a question, get an answer with sources |
| POST | /ingest |
Index raw text documents |
| POST | /admin/upload-pdf |
Upload a PDF, extract and index its text |
| POST | /support-request |
Submit a question for async RAG processing |
| GET | /support-request/{id} |
Check status/answer of a support request |
| DELETE | /namespace/{namespace} |
Delete all vectors in a namespace |
curl -X POST http://localhost:8000/query \
-H "Content-Type: application/json" \
-d '{"question": "What is our refund policy?"}'curl -X POST http://localhost:8000/admin/upload-pdf \
-F "file=@policy.pdf" \
-F "namespace=default"curl -X POST http://localhost:8000/support-request \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "question": "How do I reset my password?"}'
# then poll:
curl http://localhost:8000/support-request/{request_id}- Admin endpoints (
/admin/upload-pdf,/namespace/{namespace}delete) have no auth yet — add before deploying publicly. - Support requests are stored in memory and processed via FastAPI background tasks; this simulates an event-driven email flow. Swap in a real email provider webhook (e.g. SendGrid/Postmark inbound parse) and a persistent store (DB/queue) for production use.