Monorepo structure:
backend/- Python backend + CLI (FastAPI-ready)frontend/- Next.js frontend (to be created)
This repo currently contains a CLI-based question-answering system for the Lord of the Mysteries novel using LangChain and Groq.
python -m venv venv
venv\Scripts\activate # Windowspip install -r requirements.txt- Groq API Key: Sign up at https://console.groq.com (free, instant)
- OpenAI API Key: Get at https://platform.openai.com/api-keys (for embeddings)
Copy .env.example to .env and fill in your API keys:
GROQ_API_KEY=your_key_here
OPENAI_API_KEY=your_key_here
python backend\main.pyStarts the FastAPI API on :8000 and the Next.js UI on :3000:
./scripts/dev.ps1You can override ports:
./scripts/dev.ps1 -BackendPort 8001 -FrontendPort 3001The first run will:
- Load the LOTM novel text
- Split it into chunks
- Create embeddings (using OpenAI)
- Build a vector store in
./chroma_db/
Subsequent runs will use the cached vector store for faster startup.
Once running, just ask questions:
Ask a question about LOTM: Who is Klein Moretti?
Ask a question about LOTM: What are Pathways?
Ask a question about LOTM: Tell me about Mr. Fool
Type exit to quit.
backend/main.py- Main CLI scriptbackend/loader.py- Document loading and chunkingbackend/embeddings_setup.py- Local Chroma vector store helpersbackend/supabase_vectorstore.py- Supabase vector store helpersbackend/requirements.txt- Python dependencies.env- Your API keys (create from.env.example)chroma_db/- Local vector store (created on first run)
- First run takes 1-2 minutes (embedding the novel)
- Subsequent runs are fast (loads from cache)
- Answers are sourced from the novel text with citations