The Recipe Chatbot is an advanced AI-powered tool developed in Google Colab to assist users in the kitchen. Whether you're looking for recipes, ingredient substitutions, or tips on cooking techniques, this chatbot provides instant, accurate, and context-aware answers. It uses cutting-edge technologies like Retrieval-Augmented Generation (RAG), HuggingFace models, Groq APIs, and large language models (LLMs) to deliver an interactive and seamless experience.
- Recipe Suggestions: Based on ingredients, preferences, or user queries.
- Ingredient Substitutions: Offers alternatives for unavailable ingredients.
- Cooking Tips: Provides guidance on various culinary techniques and methods.
- Custom Measurement Conversions: Automatically converts units (e.g., ounces to grams, Fahrenheit to Celsius).
- Interactive Chat Interface: User-friendly interface for engaging conversations with the chatbot.
- Data Organization: Recipes are categorized for quick and efficient retrieval.
- Google Colab: Used for scripting, testing, and prototyping the chatbot functionalities.
- PyPDF2 & PyMuPDF: Extract recipe data and related text from PDF files.
- JSON Conversion: Extracted data from the PDF is structured and converted into a JSON file for efficient access and management.
- FAISS (Facebook AI Similarity Search): Efficient vector-based document storage and retrieval.
- LangChain: Framework for building conversational AI with structured workflows.
- HuggingFace Models:
- Embeddings: Semantic search using
sentence-transformers/all-MiniLM-l6-v2
. - Language Models: Generating natural, context-aware responses.
- Embeddings: Semantic search using
- Groq APIs: Handles conversational capabilities and advanced AI integration.
- Large Language Models (LLMs): Mistral-7B-Instruct for high-quality text generation.
- Streamlit: Builds an interactive web-based interface for the chatbot.
- Localtunnel: Allows public access to the chatbot via secure URLs.
Google Colab served as the primary environment for:
- Extracting recipe data from a PDF using PyPDF2 and PyMuPDF.
- Converting the extracted PDF data into a JSON file for structured access and reuse.
- Categorizing recipes into structured formats like soups, desserts, and vegetarian options.
- Testing and refining conversational logic using LangChain and FAISS.
Recipes are extracted from a PDF recipe book and converted to JSON. This structured data includes:
- Recipe Categories: Organized into types like soups, desserts, and vegetarian.
- Measurement Conversions: E.g., "1 oz = 28.35 g".
- Cooking Tips: Guidelines for freezing, defrosting, and food safety.
The JSON data is further stored in a FAISS vector database for fast and accurate retrieval.
The chatbot uses LangChain’s Conversational Retrieval Chain, which combines:
- Semantic search with HuggingFace embeddings.
- Context-aware responses powered by Groq APIs and LLMs.
The chatbot is deployed via Streamlit, allowing users to:
- Query recipes based on ingredients.
- Get real-time substitutions for missing ingredients.
- Learn cooking techniques or ask for tips.
- Python 3.7 or higher
- Installed dependencies:
PyPDF2
,pymupdf
,gradio
,faiss-cpu
,langchain
- Clone the Repository:
git clone <repository-url> cd recipe-chatbot
- Install Dependencies:
pip install -r requirements.txt
- Prepare the Data:
- Place the recipe book PDF in the /content directory of Google Colab.
- Update the file path in the script if necessary.
- Extract and Convert Recipes:
Run the script in Google Colab to process the PDF and convert it into a structured JSON file:
python extract_recipes.py
- Launch the Chatbot: Start the Streamlit application:
streamlit run rag_app.py
- Access the Chatbot:
- Use the local URL provided by Streamlit.
- If hosted remotely, the public URL will be generated by Localtunnel.
User Input:
"What can I make with tomatoes and basil?"
Chatbot Response: