A Retrieval-Augmented Generation (RAG) system for intelligent recipe search using natural language queries. Built with Streamlit, ChromaDB, and Ollama LLM.
- 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
- Python 3.8+
- Ollama installed
# 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├── 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
The system offers two modes of interaction:
💻 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
# Reset database
python populate_database.py --reset
# Add new documents
python populate_database.py
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
PDFs → Text chunks → Vector embeddings → ChromaDB User query → Similarity search → Context retrieval → LLM response
Ollama errors: Ensure ollama serve is running Empty results: Check PDFs in data/ folder Slow responses: Reduce k parameter or chunk size