AI-Powered Conversational Nutrition Assistant with Advanced RAG and Multimodal Capabilities
Course: Prompt Engineering and GenAI
Institution: Northeastren University
Team: Ashwin Badamikar [002055743] & Madhura Adadande [002306240]
The Nutrition Tutor Bot is a sophisticated generative AI system that provides personalized nutrition guidance through natural conversation. Built using cutting-edge RAG (Retrieval-Augmented Generation) technology, it combines a comprehensive nutrition knowledge base with conversational AI to deliver evidence-based, personalized nutrition coaching.
Our system uniquely combines conversational AI, retrieval-augmented generation, and multimodal capabilities to create a natural, ChatGPT-style nutrition coach that provides evidence-based advice with full source transparency.
๐บ Demo Video: 10-Minute Walkthrough
๐ Project Website: Project Showcase
๐ About the Project: nutrition-tutor-bot
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ NUTRITION TUTOR BOT ARCHITECTURE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ USER INTERFACE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ ๐ฑ Streamlit Web App โ
โ โโโ ๐ฌ Chat Interface โโโ ๐ Analytics Dashboard โ
โ โโโ ๐ Database Search โโโ ๐ค User Profile Manager โ
โ โโโ ๐ท Photo Upload โโโ โ๏ธ Settings Panel โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CORE AI ENGINE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ ๐ง CONVERSATIONAL AI COACH ๐ท MULTIMODAL PROCESSOR โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โข Context Management โ โ โข GPT-4 Vision โ โ
โ โ โข Personalized Responses โ โ โข Food Identification โ โ
โ โ โข Conversation Memory โ โ โข Portion Estimation โ โ
โ โ โข Dynamic Prompting โ โ โข Cross-Modal Integration โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ ๐ RAG QUERY ENGINE โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Query Processing โ Context Retrieval โ Response Generation โ โ
โ โ โ โ
โ โ 1๏ธโฃ Query Analysis 2๏ธโฃ Vector Search 3๏ธโฃ Context Injection โ โ
โ โ โข Intent Recognition โข Semantic Similarity โข Dynamic Integration โ โ
โ โ โข Context Extraction โข Metadata Filtering โข Source Attribution โ โ
โ โ โข Query Optimization โข Top-K Retrieval โข Response Generation โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ DATA & STORAGE LAYER โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ ๐ VECTOR DATABASE (ChromaDB) ๐ EXTERNAL APIs โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โข 66 Nutrition Documents โ โ ๐ค OpenAI GPT-4 โ โ
โ โ โข Vector Embeddings โ โ โโโ Text Generation โ โ
โ โ โข Metadata Storage โ โ โโโ Vision Processing โ โ
โ โ โข Semantic Search Index โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ ๐ USDA FoodData Central โ โ
โ โ โโโ 400K+ Foods โ โ
โ ๐ LOCAL PROCESSING โ โโโ Nutritional Data โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โโโ Real-time Updates โ โ
โ โ โข Sentence Transformers โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โข Local Embeddings โ โ
โ โ โข Privacy Protection โ โ
โ โ โข Fast Vector Operations โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CONVERSATION FLOW โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
TEXT QUERY PATH:
User Input โ Query Analysis โ Vector Search โ Context Retrieval โ LLM Generation โ Response
โ โ โ โ โ โ
๐ ๐ ๐ ๐ง โก ๐ฌ
Natural Intent Knowledge GPT-4 with Fast Natural
Language Detection Base Context & Processing Response
Lookup History + Sources
IMAGE QUERY PATH:
Photo Upload โ Vision Processing โ Food ID โ Nutrition API โ Combined Analysis โ Advice
โ โ โ โ โ โ
๐ท ๐๏ธ ๐ท๏ธ ๐ ๐ ๐ก
Image GPT-4 Food USDA API Cross-Modal Personal
Data Vision Recognition Integration Analysis Guidance
DATABASE SEARCH PATH:
Search Query โ Embedding โ Vector Match โ Results Ranking โ Formatted Output
โ โ โ โ โ
๐ ๐งฎ โก ๐ ๐
User Local Fast Quality Clean
Search Embedding ChromaDB Scoring Presentation
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ TECHNOLOGY ARCHITECTURE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ ๐จ PRESENTATION LAYER โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Streamlit Framework + Custom CSS + Responsive Design โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ ๐ง APPLICATION LAYER โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Python 3.11 + AsyncIO + Session Management + Error Handling โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ ๐ง AI/ML LAYER โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ OpenAI GPT-4 + Sentence-Transformers + Vector Operations + RAG โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ ๐พ DATA LAYER โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ChromaDB + Local Embeddings + USDA API + Knowledge Base โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SYSTEM METRICS โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โก PERFORMANCE BENCHMARKS โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Vector Search: 10.1ms average โ RAG Pipeline: 12.5s average โ โ
โ โ Database Scale: 66 documents โ Search Accuracy: High semantic โ โ
โ โ Reliability: 100% error handleโ Response Quality: 100% relevance โ โ
โ โ Knowledge Coverage: Comprehensive โ User Experience: Professional โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ ๐ฏ QUALITY ASSURANCE โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โข Automated Testing Suite (Unit + Integration + Performance) โ โ
โ โ โข Real-time Performance Monitoring and Quality Metrics โ โ
โ โ โข Evidence-based Responses with Full Source Attribution โ โ
โ โ โข Professional Error Handling and Graceful Degradation โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The heart of our system combines retrieval and generation for evidence-based responses:
Advanced cross-modal understanding for comprehensive nutrition analysis:
Comprehensive nutrition database with intelligent organization:
Professional interface designed for natural interaction:
User Query โ Vector Search โ Context Retrieval โ LLM Generation โ Response + Sources
Conversation History + User Profile + Retrieved Context โ Enhanced Prompt โ Natural Response
Photo Upload โ GPT-4 Vision โ Food ID โ USDA API โ Nutrition Data โ Personalized Advice
Backend:
Frontend:
AI/ML:
# 1. Clone the repository
git clone https://github.com/ashwin-badamikar/nutrition-tutor-bot.git
cd nutrition-tutor-bot
# 2. Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Set up environment variables
cp .env.example .env
# Edit .env with your API keys
# 5. Initialize the nutrition database
cd src
python init_database.py
# 6. Run the application
streamlit run app.py
Visit http://localhost:8501
to access your personal nutrition coach!
Create .env
file in project root:
OPENAI_API_KEY=your_openai_api_key_here
USDA_API_KEY=your_usda_api_key_here
OPENAI_MODEL=gpt-4-turbo-preview
MAX_TOKENS=2000
TEMPERATURE=0.7
nutrition-tutor-bot/
โโโ README.md # Project documentation
โโโ requirements.txt # Python dependencies
โโโ .env.example # Environment template
โโโ .streamlit/ # Streamlit configuration
โ โโโ config.toml
โโโ src/ # Main application code
โ โโโ app.py # Main Streamlit application
โ โโโ init_database.py # Database initialization
โ โโโ config/ # Configuration management
โ โ โโโ settings.py
โ โโโ models/ # AI and data models
โ โ โโโ rag_engine.py # RAG query engine
โ โ โโโ vector_store.py # ChromaDB vector store
โ โ โโโ nutrition_api.py # USDA API integration
โ โ โโโ conversational_nutrition_coach.py
โ โโโ data/ # Data processing
โ โ โโโ nutrition_data_collector.py
โ โ โโโ knowledge_processor.py
โ โโโ utils/ # Utility functions
โโโ data/ # Data storage
โ โโโ raw/ # Raw nutrition data
โ โโโ processed/ # Processed documents for RAG
โ โโโ chroma_db/ # Vector database files
โโโ tests/ # Comprehensive testing suite
โ โโโ unit/ # Unit tests
โ โโโ integration/ # Integration tests
โ โโโ performance/ # Performance benchmarks
โโโ docs/ # Project documentation
โ โโโ technical_documentation.md
โ โโโ user_guide.md
โ โโโ system_architecture.md
โโโ deployment/ # Production deployment configs
โโโ Dockerfile
โโโ docker-compose.yml
โโโ deploy_guides/
User: "Hi! I want to build muscle"
Coach: "Great goal! Building muscle requires the right nutrition strategy.
Tell me about your current activity level and eating habits..."
User: "I'm 25, lift weights 4x per week, but struggle with protein"
Coach: "Perfect! For a 25-year-old doing strength training 4x per week,
you'll want 1.6-2.2g protein per kg body weight daily..."
User: "Create a meal plan for weight loss, I'm vegetarian"
Coach: "I'll create a vegetarian weight loss meal plan for you. Based on
your profile, here's a balanced approach focusing on plant proteins..."
[Provides detailed meal plan with calories, macros, and specific food recommendations]
Search: "high protein vegetarian foods"
Results:
- Tofu (17.3g protein per 100g)
- Greek Yogurt (10g protein per 100g)
- Lentils (9g protein per 100g)
[With complete nutritional breakdowns and usage suggestions]
# Run all tests
cd tests
python -m pytest unit/ integration/ performance/ -v
# Performance benchmarks
cd performance
python test_focused_performance.py
Role:
Role:
# Clone repository
git clone https://github.com/ashwin-badamikar/nutrition-tutor-bot.git
cd nutrition-tutor-bot
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# Install required packages
pip install -r requirements.txt
# Verify installation
python -c "import streamlit, openai, chromadb; print('โ
All packages installed successfully')"
# Copy environment template
cp .env.example .env
# Edit .env file with your API keys:
# OPENAI_API_KEY=your_openai_key_here
# USDA_API_KEY=your_usda_key_here
Get API Keys:
# Navigate to source directory
cd src
# Initialize nutrition knowledge base
python init_database.py
# Expected output: "โ
Database ready with 66 documents"
# Start the nutrition coach
streamlit run app.py
# Open browser to: http://localhost:8501
python init_database.py
to reinitializestreamlit run app.py --server.port 8502
# Navigate to tests directory
cd tests
# Run unit tests
python -m pytest unit/ -v
# Run integration tests
python -m pytest integration/ -v
# Run performance benchmarks
cd performance
python test_focused_performance.py
This project is licensed under the MIT License - see the LICENSE file for complete terms.
Special thanks to the open-source AI/ML community for providing the foundational tools and libraries that made this project possible.