Recipe assistant built with Retrieval-Augmented Generation, FastAPI, and Docker.
-
Clone the repository
-
Install
uv— A fast Python package manager
📖 Installation guide -
Create and activate a virtual environment
uv venv .venv source .venv/bin/activate -
Install dependencies
Development setup (app + dev tools):
uv sync
Production-only (skip dev tools):
uv sync --no-group dev
-
Enable pre-commit hooks [Optional]
uv run pre-commit install
All services (API, Postgres + pgvector, Ollama) can be started in one command:
docker compose up- API will be available at: http://localhost:8000
- Ollama runs on port
11434 - Postgres runs on port
5432
If you prefer to manage services separately:
-
Start Ollama
task ollama:up
-
Start Postgres
task db:up
-
Run the FastAPI app
task app:run
Create a .env file in the project root with your environment
variables:
OPENAI_API_KEY=ollama
OPENAI_BASE_URL=http://ollama:11434/v1
EMBEDDING_MODEL=nomic-embed-text
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_HOST=db
POSTGRES_DB=mydb
POSTGRES_PORT=5432
DATABASE_URL="postgresql+psycopg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}"
⚠️ Inside Docker Compose, usePOSTGRES_HOST=db(the service name), notlocalhost.
- Without RAG - see the existing notebook: notebooks/demo_without_rag.ipynb
Walks through creating an assistant, creating a chat, and getting completions.
- With RAG (ingredients + directions injected) - see the new notebook: notebooks/demo_with_rag.ipynb
Shows the same flow, but calls the /completions endpoint with ?rag=true.
✅ Prerequisite for RAG: run the offline indexer to populate the vector store
task app:index