AI-powered chatbot for answering questions about African foods, recipes, ingredients, and cooking techniques.
# AfricanFoodBot
A conversational Flask application for exploring African recipes and cuisine.
## Overview
AfricanFoodBot combines a retrieval-backed recipe store with an LLM-powered
assistant. Users can ask questions about ingredients, preparation steps,
regional dishes, and cooking techniques, and receive responses grounded in
recipe metadata.
## Features
- Flask web interface with a simple chat UI
- Recipe retrieval using ChromaDB
- Prompt generation and response delivery using Google Gemini via the
GenAI client
- Local persistence of indexed recipe content in `chromadb_data/`
## Repository structure
```
app.py
chromad_db_retriever.py
food_bot.py
llm.py
prompts.txt
README.md
recipes.json
requirements.txt
chromadb_data/
static/
templates/
```
## Getting started
### Prerequisites
- Python 3.10+ recommended
- `pip` installed
- A Google API key for the Gemini model if you want LLM responses
### Installation
```bash
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
```
### Configuration
Create a `.env` file in the project root with the following value:
```env
GOOGLE_API_KEY=your_api_key_here
```
### Run the application
```bash
python app.py
```
Open `
127.0.0.1` in your browser to start chatting.
## Usage
- The home page provides a chat box for asking about African recipes.
- The backend exposes `/api/chat`, which accepts JSON payloads like:
```json
{ "message": "How do I make jollof rice?" }
```
- Successful responses return:
```json
{ "response": "..." }
```
## Notes
- `app.py` gracefully handles missing backend dependencies by falling back to
a stub response, so the UI can still be demonstrated without a complete
integration.
- `chromad_db_retriever.py` stores indexed recipe data in the
`chromadb_data/` folder.
- `recipes.json` contains the recipe source data used for retrieval.
## Recommended improvements
- Add more recipes to `recipes.json` for broader knowledge coverage
- Enhance prompt design in `ll …