Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

🍽️ RAG Recipe Retrieval System

A Retrieval-Augmented Generation (RAG) system for intelligent recipe search using natural language queries. Built with Streamlit, ChromaDB, and Ollama LLM.

✨ Features

  • Natural Language Queries: Ask recipe questions in plain English
  • Semantic Search: Find recipes based on meaning, not just keywords
  • Interactive Web Interface: User-friendly Streamlit application
  • Local LLM: Ollama Mistral for response generation

🚀 Quick Start

Prerequisites

  • Python 3.8+
  • Ollama installed

Installation

# Install dependencies
pip install streamlit langchain langchain-community chromadb pypdf

# Install Ollama models
ollama pull mistral
ollama pull nomic-embed-text

# Add PDF recipe files to 'data' folder
mkdir data
# Copy your PDF files to data/

# Build database
python populate_database.py

# Run application
streamlit run app.py

📁 Project Structure

├── app.py                    # Streamlit web app
├── populate_database.py      # Database creation
├── query_data.py            # CLI interface  
├── get_embedding_function.py # Embedding config
├── data/                    # PDF files (add yours)
└── chroma/                  # Vector database

💡 Usage

The system offers two modes of interaction:

🌐 Web Interface (Streamlit)

💻 Command Line Interface (CLI)

python query_data.py "How do I make bread?"
  • Direct terminal-based queries
  • Faster for single questions
  • Returns response with source references
  • Ideal for testing and automation

Database Management

# Reset database
python populate_database.py --reset

# Add new documents
python populate_database.py

⚙️ Configuration

Change models in the respective files:

  • LLM: Ollama(model="mistral") in app.py
  • Embeddings: OllamaEmbeddings(model="nomic-embed-text") in get_embedding_function.py

Adjust retrieval in app.py:

results = db.similarity_search_with_score(query_text, k=5)  # Change k

🔧 How It Works

PDFs → Text chunks → Vector embeddings → ChromaDB User query → Similarity search → Context retrieval → LLM response

🛠️ Troubleshooting

Ollama errors: Ensure ollama serve is running Empty results: Check PDFs in data/ folder Slow responses: Reduce k parameter or chunk size

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages