Skip to content

drisskhattabi6/Moroccan-Meal-Recipes-Chatbot

Repository files navigation

πŸ₯˜ Moroccan Meal Recipes Chatbot πŸ—

An AI-powered chatbot designed to provide authentic Moroccan recipes using Retrieval-Augmented Generation (RAG). Users can ask about any Moroccan dish, and the chatbot responds with the recipe name, description, ingredients, preparation steps, and even images (if you're connected to the internet). Also the user can choose to search or recommed a recipe based on their ingredients.

You can choose your preferred LLM provider:

  • 🧠 Ollama (Local inference)
  • 🌐 OpenRouter (API-based inference)

✨ Features

  • πŸ” RAG-powered Retrieval: Combines local/remote LLMs with vector-based document search to find the most relevant recipe.
  • πŸ‘¨β€πŸ³ Authentic Recipe Info: Get detailed info including ingredients, instructions, and cultural context.
  • 🌐 Dual LLM Support: Choose between Ollama (offline) or OpenRouter (online).
  • πŸ–ΌοΈ Dynamic Meal Images: If internet access is available, the chatbot fetches related images.
  • πŸ’¬ Interactive Chat Interface: Friendly UI for conversational recipe discovery.
  • πŸ” Secure API key handling via .env.

πŸ“ Project Structure

The project is organized as follows:

β”œβ”€β”€ .env                        # Environment variables (store OPENROUTER_API_KEY here)
β”œβ”€β”€ .gitignore                  # Git ignore rules
β”œβ”€β”€ README.md                   # Project documentation
β”œβ”€β”€ app.py                      # Main entry point for chatbot UI
β”œβ”€β”€ rag.py                      # RAG pipeline: document retrieval + LLM generation
β”œβ”€β”€ Moroccan_Recipes_FaissDB/   # Faiss vector database Contains Moroccan recipes
β”œβ”€β”€ imgs/                       # Folder for images and UI screenshots
β”œβ”€β”€ Data_Preparation_Notebooks/ # Notebooks for data preparation and vector DB setup (recipe documents / embeddings)

βš™οΈ Installation & Setup

1. πŸ“¦ Clone the repository

git clone git@github.com:drisskhattabi6/Moroccan-Meal-Recipes-Chatbot.git
cd Moroccan-Meal-Recipes-Chatbot

2. πŸ§ͺ Create and activate a virtual environment (optional but recommended)

python -m venv venv
source venv/bin/activate   # On Windows: venv\Scripts\activate

3. πŸ› οΈ Install dependencies

pip install -r requirements.txt

4. πŸ”‘ Setup OpenRouter (if using cloud LLM)

  • Get your API key from OpenRouter.ai
  • Create a .env file and add your key:
OPENROUTER_API_KEY='your_api_key_here'

5. 🧠 Install Ollama (for local LLM)

ollama pull llama3.2-vision:latest

πŸš€ Usage

Start the app:

streamlit run app.py
  • Select the LLM provider: Ollama or OpenRouter
  • Ask: "How do I make couscous?"
  • Get a beautifully formatted response including:
    • πŸ–ΌοΈ dish image
    • πŸ› Recipe name and description
    • πŸ“œ Ingredients list
    • πŸ“ Step-by-step instructions

πŸ“Έ Screenshots

App

Side bar

Task

Ollama Provider

Openrouter Provider

Chat Example

Chat Example

Chat Example

Chat Example

Chat Example

Chat Example

Chat Example


πŸ“Œ Notes

  • Internet connection is required only for image fetching and OpenRouter usage.
  • All recipe data is stored and retrieved locally for fast, reliable results.

Releases

No releases published

Packages

No packages published