An intelligent conversational chatbot that shares authentic Mexican recipes from the García family collection. Built with LangChain agents, OpenAI GPT-4o-mini, and a warm, bilingual personality.
- 🤖 Intelligent Agent: Powered by LangChain with 11+ specialized tools for recipe search, scaling, substitutions, and more
- 🌎 Bilingual Support: Natural English/Spanish conversation with code-switching
- 🔍 Semantic Recipe Search: Vector-based search using FAISS and OpenAI embeddings
- 📹 Rich Media: Embedded YouTube cooking videos and food images
- 📏 Recipe Scaling: Automatically adjust ingredients for any serving size
- 🔄 Ingredient Substitutions: Smart alternatives for dietary restrictions and missing ingredients
- 📱 Responsive Design: Beautiful mobile-first UI with smooth animations
- 💾 Session Memory: Maintains conversation context per user
- 🎨 Mexican-Themed UI: Custom color palette inspired by Mexican culture
Frontend: https://sazonbot.vercel.app
API: https://mexican-ai-chatbot.onrender.com/docs
⚠️ Note: First request may take 20-30 seconds on Render's free tier due to cold starts.
- Framework: FastAPI (Python)
- AI/ML: LangChain, OpenAI GPT-4o-mini
- Vector Store: FAISS with OpenAI embeddings
- Tools: Google Serper API (web search), Pushover (notifications)
- PDF Processing: PyPDF for recipe extraction
- Framework: Next.js 15 (React 19)
- Language: TypeScript
- Styling: Tailwind CSS
- HTTP Client: Axios
- Python 3.11+
- Node.js 18+
- OpenAI API key
- Serper API key (optional, for web search)
- Pushover keys (optional, for feedback notifications)
- Clone the repository
git clone https://github.com/yourusername/mexican-recipe-chatbot.git
cd mexican-recipe-chatbot/backend- Create virtual environment (using uv)
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install dependencies
uv pip install -r requirements.txt- Create
.envfile
cp .env.example .envAdd your API keys:
OPENAI_API_KEY=sk-...
SERPER_API_KEY=... # Optional
PUSHOVER_USER_KEY=... # Optional
PUSHOVER_API_TOKEN=... # Optional- Create vector store
python -m app.vector_store
# Choose option 1 to create new vector store- Run the server
python -m uvicorn app.main:app --reloadBackend will be available at http://localhost:8000
API docs at http://localhost:8000/docs
- Navigate to frontend directory
cd ../frontend- Install dependencies
npm install- Create
.env.localfile
echo "NEXT_PUBLIC_API_URL=http://localhost:8000" > .env.local- Run development server
npm run devFrontend will be available at http://localhost:3000
mexican-recipe-chatbot/
├── backend/
│ ├── app/
│ │ ├── __init__.py
│ │ ├── agent.py # LangChain agent with 11 tools
│ │ ├── config.py # Environment configuration
│ │ ├── main.py # FastAPI application
│ │ ├── models.py # Pydantic models
│ │ ├── tools.py # Agent tools (search, scale, etc.)
│ │ ├── vector_store.py # FAISS vector store management
│ │ └── utils/
│ │ ├── recipe_parser.py # Recipe scaling logic
│ │ └── safety.py # Prompt injection protection
│ ├── data/
│ │ ├── recipes.pdf # García family recipes
│ │ └── recipe_vectors/ # FAISS index (generated)
│ ├── requirements.txt
│ └── .env
├── frontend/
│ ├── pages/
│ │ ├── index.tsx # Main chat interface
│ │ ├── _app.tsx
│ │ └── _document.tsx
│ ├── lib/
│ │ ├── api.ts # API client
│ │ └── translations.ts # i18n translations
│ ├── styles/
│ │ └── globals.css
│ ├── public/
│ │ └── logo.png
│ ├── package.json
│ └── .env.local
└── README.md
GET /health
POST /agent-chat
Body: { "message": "How do I make pozole?" }
Response: { "response": "...", "sources_used": [...], "session_id": "..." }
POST /agent-chat/clear/{session_id}
POST /search-recipes
Body: { "query": "chicken", "limit": 3 }
Full API documentation available at /docs when server is running.
The chatbot uses 11 specialized tools:
- recipe_search_tool - Semantic search in recipe database
- recipe_list_by_type_tool - Browse recipes by category
- get_full_recipe_tool - Get complete recipe details
- web_search_tool - Search web for cooking information
- recipe_scale_tool - Scale recipes for different servings
- ingredient_substitution_tool - Find ingredient alternatives
- cooking_technique_tool - Explain cooking methods
- recipe_filter_by_criteria_tool - Complex recipe filtering
- video_search_tool - Find YouTube cooking tutorials
- image_search_tool - Find food images
- record_unknown_question_tool - Log unanswered questions
The UI uses a Mexican-inspired color scheme:
- Turkey Red (
#a81007) - Primary actions - Oxford Blue (
#0d082d) - Sidebar background - Fulvous (
#dc8300) - Accents and highlights - Cornsilk (
#f9edcc) - Message bubbles - Ghost White (
#f8f4f9) - Main background
- Create new Web Service on Render
- Connect your GitHub repo
- Configure:
- Root Directory:
backend - Build Command:
pip install -r requirements.txt - Start Command:
uvicorn app.main:app --host 0.0.0.0 --port $PORT
- Root Directory:
- Add environment variables (API keys)
- Deploy
- Import project on Vercel
- Configure:
- Root Directory:
frontend - Framework: Next.js
- Root Directory:
- Add environment variable:
NEXT_PUBLIC_API_URL: Your Render backend URL
- Deploy
After deployment, update backend/app/main.py CORS settings with your Vercel URL.
OPENAI_API_KEY=sk-... # Required
SERPER_API_KEY=... # Optional (for web search)
PUSHOVER_USER_KEY=... # Optional (for feedback)
PUSHOVER_API_TOKEN=... # Optional (for feedback)NEXT_PUBLIC_API_URL=http://localhost:8000 # Backend URLcd backend
python -m app.vector_store # Option 2: Test vector store
python -m app.agent # Test agent (uncomment test code)Visit http://localhost:8000/docs for interactive API testing.
- Model: GPT-4o-mini for 5-10x faster responses vs GPT-4
- Streaming: Real-time response streaming (ready for SSE implementation)
- Caching: Session-based memory for context retention
- Vector Search: FAISS for sub-second recipe lookups
- Responsive UI: Smooth animations and optimistic updates
- Prompt injection protection
- Off-topic query filtering
- Session isolation per user
- CORS configuration
- Environment variable management
The chatbot has access to authentic Mexican recipes including:
- Pozole Blanco
- Fajitas a la Vizcaína
- Tortitas de Atún
- And many more traditional dishes!
Recipes are stored in backend/data/recipes.pdf and processed into a vector database.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- García family for the authentic Mexican recipes
- OpenAI for GPT-4o-mini
- LangChain for the agent framework
- The open-source community
Cristina Rodriguez - LinkedIn
Project Link: https://github.com/Yosolita1978/mexican-ai-chatbot
¡Buen provecho! 🌮🇲🇽
