Logo Lanfrica

steph851/kenya-tax-qa

Domain:

socioeconomic

Record type:

softwaretools
Creator:
ste
Host:
# Kenya Tax Q&A πŸ‡°πŸ‡ͺ A free, instant Q&A assistant for Kenyan tax law β€” PAYE, VAT, TOT, WHT, NSSF, SHIF, Housing Levy, TCC, iTax deadlines β€” powered by Groq's free API (`llama-3.1-70b-versatile`). **No API costs. Ever.** Live demo: **cheerful-reflection-product… ## Why this exists Kenyan taxpayers need instant, free answers to tax questions. This is a minimal, production-shaped reference showing how to build a stateless, streaming Q&A service with **zero API costs** using Groq's free tier and FastAPI. ## Architecture ``` Browser ──POST /ask──► FastAPI ──messages.stream──► Groq API β–² β”‚ β”‚ β”‚ SSE token stream β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ (free tier) β”˜ ``` - **Model**: `llama-3.1-70b-versatile` (free, no rate limits for reasonable use) - **Streaming**: Server-Sent Events; the frontend renders tokens as they arrive - **Cost**: Zero API fees (Groq free tier) - **Stateless**: no database, no auth β€” sessions live only in the browser ## Files | File | Purpose | |------|---------| | `main.py` | FastAPI app β€” `/ask` SSE streaming endpoint, `/` serves the UI | | `system_prompt.py` | Kenya tax law system prompt (2025/26 Finance Act figures) | | `static/index.html` | Vanilla-JS single-file chat UI consuming the SSE stream | | `requirements.txt` | `groq`, `fastapi`, `uvicorn`, `pydantic` | | `Procfile` / `railway.json` | Railway deployment config | | `.env.example` | Expected env: `GROQ_API_KEY` | ## Run locally ```bash git clone github.com cd kenya-tax-qa python -m venv venv && source venv/bin/activate # or venv\Scripts\activate on Windows pip install -r requirements.txt export GROQ_API_KEY=gsk_... uvicorn main:app --reload ``` Open localhost. ## Deploy to Railway 1. Push this repo to GitHub. 2. On railway.app β†’ **New Project** β†’ **Deploy from GitHub repo** β†’ pick this repo. 3. Under the service β†’ **Variabl …

Licenses