A lightweight, stateless RAG chatbot built with Gradio and a Notion page knowledge base, designed for simple and low-cost deployment.
This project provides a minimal RAG chatbot that answers questions using information retrieved from a Notion knowledge base.
The chatbot is stateless: each question is processed independently without appending conversation history to the LLM prompt. This reduces token usage and keeps inference costs low, making the architecture suitable for lightweight deployments and high-volume use cases.
Tech stack: Python · Gradio · Google Gemini · Notion · Supabase
- 🧠 RAG-powered answers — Retrieve relevant information from a Notion knowledge base
- 💬 Simple chat interface — Lightweight Gradio front-end requiring minimal infrastructure
- 💰 Low-cost architecture — Stateless queries minimise unnecessary LLM token usage
- 📄 Notion knowledge base — Use an existing Notion page as the source of knowledge
- 💾 Query persistence — Optionally store user questions in Supabase for analysis and evaluation
- ⚙️ Configurable — Adapt the knowledge base, retrieval strategy and model to different applications
- 🚀 Easy deployment — Suitable for lightweight cloud deployments such as Hugging Face Spaces
User question
↓
Retrieve relevant knowledge
↓
Construct RAG prompt
↓
LLM generates answer
↓
Display response
↓
Optionally store question
The chatbot can be adapted to a range of use cases, for example:
Hospitality
A hostel can provide a QR code allowing guests to ask questions about check-in, facilities, local recommendations and house rules.
Internal knowledge
A small organisation can provide employees with a low-cost interface for querying internal documentation.
Product information
A business can create a chatbot that answers customer questions using product documentation or FAQs.
git clone https://github.com/jcarterlab/<repository>.git
cd <repository>
python -m venv .venv
source .venv/bin/activate # macOS/Linux or
.venv\Scripts\Activate.ps1 # Windows PowerShell
pip install -r requirements.txt
cp .env.example .envConfigure the required environment variables, then run:
python app.pyCreate a .env file and configure the knowledge base, LLM and retrieval settings.
Provide the Notion API credentials and page ID:
NOTION_API_KEY=your_notion_api_key
NOTION_PAGE_ID=your_notion_page_idSet your Gemini API key and model:
GEMINI_API_KEY=your_gemini_api_key
MODEL=gemini-2.5-flash-liteUSE_AI controls whether AI-assisted processing is enabled:
USE_AI=falseConfigure the number of chunks retrieved and the retrieval method:
CHUNKS_USED=3
RETRIEVAL_METHOD=tfidfSupported retrieval methods are tfidf, dense_embeddings and hybrid.
For hybrid retrieval, configure the relative weighting of TF-IDF and dense embeddings:
TFIDF_WEIGHT=0.3
DENSE_EMBEDDINGS_WEIGHT=0.7Set STORE_QUERIES=true to persist user questions in Supabase:
STORE_QUERIES=true
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_keyQuery storage is optional and can be disabled by setting STORE_QUERIES=false.
- Retrieval quality: Answers depend on the quality of the retrieval strategy and underlying knowledge base.
- LLM responses: The model may generate inaccurate or incomplete answers despite retrieved context.
- Notion dependency: Changes to the knowledge base may require the application to refresh or reprocess its content.
- Stateless conversations: The chatbot does not retain conversational context between questions.
- API costs and limits: Although designed to minimise LLM usage, costs and rate limits still depend on query volume and the selected model.
This project was inspired by ChatSJB, a chatbot built for Saint James Backpackers in 2023 to help onboard new staff and volunteers.
ChatSJB used the hostel's 57-page operations manual as its knowledge base, allowing reception staff to ask questions about policies and procedures through a Gradio chatbot hosted on Hugging Face Spaces.
This project revisits the same idea. However, instead of a Word document that must be re-uploaded when changes are made, it makes API calls to a Notion page to update its knowledge while supporting a range of configurable retrieval strategies.