Skip to content

ItzRoBeerT/WAIter_assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

30 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง‘โ€๐Ÿณ WAIter: Voice Chatbot for Restaurants

WAIter is an interactive chatbot with voice capabilities designed for restaurant scenarios. It simulates Miguel, a friendly and helpful Cadiz waiter who can respond to customers' spoken questions in real-time, take orders, and send them directly to the kitchen.

๐Ÿ—ฃ๏ธ Note: The voice assistant operates in Spanish - Miguel speaks authentic Andalusian Spanish, making it perfect for Spanish-speaking restaurants and customers who want an authentic Spanish dining experience.

You can try WAIter right now without installation on our HuggingFace Space. You just need a microphone to talk to Miguel in Spanish!


๐Ÿ› ๏ธ Tech Stack

Voice and Audio Processing

  • ๐ŸŽ™๏ธ FastRTC - Real-time audio streaming with Voice Activity Detection (VAD)
  • ๐Ÿ”Š ElevenLabs - Expressive and natural voice synthesis (TTS)
  • ๐Ÿ—ฃ๏ธ Whisper (via Groq) - High-precision speech recognition

Artificial Intelligence

Data Management

  • ๐Ÿ’พ Markdown Knowledge Base - Complete restaurant menu
  • ๐Ÿ—„๏ธ Supabase - Real-time order management database
  • ๐Ÿ“Š RAG (Retrieval Augmented Generation) - Intelligent menu search

Interface and Deployment

  • ๐Ÿงช Gradio - Interactive web interface with voice support
  • โ˜๏ธ HuggingFace Spaces - Deployment and live demo

โœจ Key Features

๐ŸŽฏ User Experience

  • Natural voice interaction - Talk directly to Miguel as if he were a real waiter (in Spanish)
  • Text and audio responses - Choose how you want to interact
  • Authentic personality - Miguel is a Cadiz waiter with charm and professionalism
  • Conversational memory - Remembers your order throughout the entire conversation

๐Ÿฝ๏ธ Restaurant Functionality

  • Complete menu consultation - Detailed information about all dishes
  • Intelligent search - Find dishes by ingredients, prices, or dietary preferences
  • Allergen management - Complete information about allergens and special dietary options
  • Complete order taking - From consultation to sending to kitchen
  • Dietary options - Vegetarian, vegan, gluten-free, and diabetic menus

๐Ÿ”ง Advanced Technology

  • Real-time processing - Immediate responses without perceptible latency
  • Intelligent RAG - Vector search to find relevant menu information
  • Kitchen integration - Orders are automatically sent to the database
  • Specialized tool system - Specific tools for menu consultation and order sending

๐Ÿš€ Getting Started

Prerequisites

  • Python 3.10 or higher
  • API keys for required services (see below)
  • Microphone (for voice functionality)
  • Basic Spanish understanding (for voice interaction with Miguel)

1. Clone and Installation

# Clone the repository
git clone https://github.com/yourusername/waiter-chatbot.git
cd waiter-chatbot

# Create a virtual environment (recommended)
python -m venv waiter-env
source waiter-env/bin/activate  # On Windows: waiter-env\Scripts\activate

# Install dependencies
pip install -r requirements.txt

2. Environment Variables Configuration

Create a .env file in the project root with your API keys:

# REQUIRED - For the language model
OPENROUTER_API_KEY=your_openrouter_key
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1

# REQUIRED for voice functionality - Transcription
GROQ_API_KEY=your_groq_key

# REQUIRED for voice functionality - Voice synthesis
ELEVENLABS_API_KEY=your_elevenlabs_key

# OPTIONAL - For advanced logging
HELICONE_API_KEY=your_optional_helicone_key

# REQUIRED for sending orders to kitchen
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key

3. Getting API Keys

OpenRouter (REQUIRED)

  1. Go to OpenRouter
  2. Create an account and get your API key
  3. Make sure you have credits to use Gemini 2.5 Flash

Groq (REQUIRED for voice)

  1. Go to Groq
  2. Create a free account
  3. Get your API key to use Whisper

ElevenLabs (REQUIRED for voice)

  1. Go to ElevenLabs
  2. Create an account (free plan available)
  3. Get your API key

Supabase (REQUIRED for orders)

  1. Go to Supabase
  2. Create a new project
  3. Set up the necessary tables (see Database Setup section)
  4. Get your project URL and API key

4. Supabase Database Setup

Run these SQL commands in the Supabase SQL editor:

-- Orders table
CREATE TABLE orders (
    id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    order_id TEXT NOT NULL,
    table_number TEXT NOT NULL,
    special_instructions TEXT DEFAULT '',
    status TEXT DEFAULT 'pending',
    created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

-- Order items table
CREATE TABLE order_items (
    id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    order_id BIGINT REFERENCES orders(id) ON DELETE CASCADE,
    name TEXT NOT NULL,
    quantity INTEGER DEFAULT 1,
    variations TEXT DEFAULT '',
    created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

-- Indexes for better performance
CREATE INDEX idx_orders_order_id ON orders(order_id);
CREATE INDEX idx_orders_created_at ON orders(created_at);
CREATE INDEX idx_order_items_order_id ON order_items(order_id);

5. Running the Application

# Run the application
python app.py

# The application will automatically open in your browser
# Default at: http://localhost:7860

๐Ÿ“‚ Project Structure

waiter-chatbot/
โ”œโ”€โ”€ app.py                 # ๐ŸŽฏ Main application with Gradio interface
โ”œโ”€โ”€ agent.py              # ๐Ÿค– LangGraph agent for Miguel the waiter
โ”œโ”€โ”€ model.py              # ๐Ÿง  Language model manager
โ”œโ”€โ”€ tools.py              # ๐Ÿ”ง Specialized tools (menu, orders)
โ”œโ”€โ”€ supabase_client.py    # ๐Ÿ—„๏ธ Client for Supabase operations
โ”œโ”€โ”€ requirements.txt      # ๐Ÿ“ฆ Project dependencies
โ”œโ”€โ”€ .env                  # ๐Ÿ”‘ Environment variables (create manually)
โ”œโ”€โ”€ .gitignore           # ๐Ÿšซ Files ignored by git
โ”‚
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ carta.md         # ๐Ÿฝ๏ธ Complete menu (knowledge base)
โ”‚   โ””โ”€โ”€ system_prompt.txt # ๐Ÿ‘จโ€๐Ÿณ System prompt for Miguel (in Spanish)
โ”‚
โ””โ”€โ”€ utils/
    โ”œโ”€โ”€ classes.py       # ๐Ÿ“‹ Data classes (Order, etc.)
    โ”œโ”€โ”€ logger.py        # ๐Ÿ“ Colored logging system
    โ””โ”€โ”€ functions.py     # ๐Ÿ› ๏ธ Auxiliary functions

๐ŸŽญ Meet Miguel - Your Virtual Waiter

Miguel is an authentic Cadiz waiter working at a traditional restaurant in Cadiz specializing in traditional Andalusian cuisine.

Miguel's Personality:

  • ๐Ÿ›๏ธ Authentic Cadiz native - With genuine expressions and local idioms
  • ๐Ÿ‘” Professional but friendly - Knows how to balance efficiency with warmth
  • ๐Ÿ’ก Proactive - Suggests dishes and anticipates your needs
  • ๐Ÿง  Good memory - Remembers your order throughout the conversation
  • โšก Efficient - Optimized for natural and fluid voice responses
  • ๐Ÿ‡ช๐Ÿ‡ธ Spanish speaker - Communicates in authentic Andalusian Spanish

๐Ÿ”„ How the System Works

Voice Conversation Flow:

  1. ๐ŸŽค Audio Capture โ†’ FastRTC captures your voice in real-time
  2. ๐Ÿ“ Transcription โ†’ Groq (Whisper) converts audio to text
  3. ๐Ÿง  Processing โ†’ Miguel's LangGraph agent processes your request
  4. ๐Ÿ” RAG Search โ†’ Searches for relevant information in menu
  5. โš™๏ธ Tools โ†’ Uses specialized tools as needed:
    • restaurant_menu_lookup_tool - For menu queries
    • send_order_to_kitchen_tool - For sending orders
  6. ๐Ÿ’ฌ Generation โ†’ Gemini 2.5 generates contextual response as Miguel
  7. ๐Ÿ”Š Synthesis โ†’ ElevenLabs converts response to natural voice
  8. ๐Ÿ“ฑ Interface โ†’ Gradio displays conversation and plays audio

Text Conversation Flow:

Same process but without audio capture and voice synthesis steps, ideal for users who prefer typing or in environments where audio cannot be used.


๐Ÿฝ๏ธ Menu Capabilities

Available Sections:

  • ๐ŸŸ Bay and Almadraba Preserves - Tuna, mojama, anchovies
  • ๐Ÿค Cadiz Tapas - Shrimp fritters, marinated dogfish, sea anemones
  • ๐Ÿฅ˜ Hearty Stews - Cadiz cabbage stew, legume dishes, oxtail in sherry
  • ๐Ÿค Fried Fish and Seafood - Mixed fried fish, prawns, shrimp
  • ๐Ÿฅฉ Local Meats - Cadiz retinto beef, fighting bull meat
  • ๐Ÿš Bay Rice Dishes - With lobster, cuttlefish, almadraba tuna
  • ๐Ÿฎ Cadiz Desserts - Tocino de cielo, bienmesabe, pestiรฑos
  • ๐Ÿท Beverages - Sherry wines, manzanilla, rebujito

Dietary Options:

  • ๐ŸŒฑ Vegetarian and Vegan - Complete adapted menus
  • ๐ŸŒพ Gluten-Free - Preparation in contamination-free zone
  • ๐Ÿ’‰ For Diabetics - Options without added sugars
  • ๐Ÿ‘ถ Children's Menu - Adapted portions and flavors

Allergen Information:

Miguel can consult detailed information about all major allergens and help you find safe options according to your needs.


๐Ÿ—๏ธ Use Cases

For Restaurants:

  • Order taking automation during peak hours
  • 24/7 information about menu and allergens
  • Staff workload reduction
  • Consistent experience independent of human waiter

For Customers:

  • Natural menu exploration without pressure
  • Detailed information about ingredients and preparation
  • Personalized recommendations based on preferences
  • Accessibility for people with reading difficulties
  • Spanish language practice for learners

For Developers:

  • Complete template for restaurant chatbots
  • Multiple API integration for voice and AI
  • Specialized RAG system for hospitality
  • Scalable architecture with LangGraph

๐Ÿ”ง Advanced Configuration

Model Customization:

You can change the language model in model.py:

# Available models in OpenRouter
models = [
    "google/gemini-2.5-flash-preview",      # Fast and efficient (recommended)
    "anthropic/claude-3.5-sonnet",          # High quality
    "openai/gpt-4o",                        # Robust alternative
]

Waiter Customization:

Edit data/system_prompt.txt to change:

  • Waiter personality
  • Restaurant name
  • Conversation style
  • Specific behavior rules
  • Language (currently optimized for Spanish)

Menu Customization:

Edit data/carta.md to:

  • Change dishes and prices
  • Add new sections
  • Modify restaurant information
  • Adapt to your business

Voice Configuration:

In app.py you can adjust:

# ElevenLabs configuration
voice_settings = VoiceSettings(
    stability=0.0,        # Voice variability
    similarity_boost=1.0, # Similarity to base voice
    style=0.0,           # Expressive style
    use_speaker_boost=True, # Clarity enhancement
    speed=1.1,           # Speech speed
)

๐Ÿ› Troubleshooting

Common Issues:

Error: "No API key found"

  • โœ… Verify that the .env file is in the project root
  • โœ… Check that variables are written correctly
  • โœ… Restart the application after adding keys

Audio error: "Microphone not found"

  • โœ… Allow microphone access in your browser
  • โœ… Verify that your microphone works in other applications
  • โœ… Try different browsers (Chrome recommended)

Error: "Database connection failed"

  • โœ… Verify Supabase credentials in .env
  • โœ… Make sure tables are created correctly
  • โœ… Check internet connectivity

Slow responses or no voice:

  • โœ… Verify your internet connection
  • โœ… Check that you have credits in ElevenLabs
  • โœ… Try a faster model in OpenRouter

Language Issues:

  • โœ… Miguel speaks Spanish - make sure you're interacting in Spanish
  • โœ… The system prompt is optimized for Spanish responses
  • โœ… For English adaptation, modify data/system_prompt.txt

Logs and Debugging:

The system includes detailed colored logging:

  • ๐Ÿ”ต INFO - General information
  • ๐ŸŸก WARN - Warnings
  • ๐Ÿ”ด ERROR - Errors
  • ๐ŸŸข SUCCESS - Successful operations
  • ๐ŸŸฃ DEBUG - Debug information

๐Ÿ“Š Order Dashboard

Orders can be viewed in real-time through the web dashboard: ๐Ÿ”— Kitchen Dashboard

This dashboard shows:

  • ๐Ÿ“‹ Real-time orders
  • โฐ Timestamps for each order
  • ๐Ÿฝ๏ธ Complete details of each order
  • ๐Ÿ“Š Order status

๐ŸŒ Language Support

Current Language:

  • ๐Ÿ‡ช๐Ÿ‡ธ Spanish - Miguel operates entirely in Spanish with authentic Cadiz expressions
  • The voice assistant is optimized for Spanish speakers
  • Menu and responses are in Spanish

Adapting to Other Languages:

To adapt WAIter to other languages:

  1. Modify the system prompt in data/system_prompt.txt
  2. Translate the menu in data/carta.md
  3. Adjust voice settings in ElevenLabs for the target language
  4. Update the personality to match local culture

๐Ÿค Contributing

How to Contribute:

  1. Fork the repository
  2. Create a branch for your feature (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Areas for Improvement:

  • ๐ŸŒ Translation to other languages
  • ๐ŸŽจ User interface improvements
  • ๐Ÿ”ง New tools for the agent
  • ๐Ÿฝ๏ธ Menu templates for different types of restaurants
  • ๐Ÿ“ฑ Native mobile application
  • ๐Ÿง  Conversational model improvements
  • ๐Ÿ—ฃ๏ธ Multi-language voice support

๐Ÿ“„ License

This project is under the MIT License. See the LICENSE file for more details or clicking here.


๐Ÿ™ Acknowledgments

  • OpenAI for Whisper and inspiration in conversational models
  • Google for Gemini 2.5 Flash
  • ElevenLabs for voice synthesis technology
  • LangChain/LangGraph for the agent framework
  • Gradio for the easy-to-use interface
  • HuggingFace for hosting and embeddings
  • Supabase for real-time database

๐Ÿ‘จโ€๐Ÿ’ป Author

Roberto - Lead Developer


๐Ÿ”— Useful Links


โญ Don't forget to star the project if you found it useful! โญ

๐Ÿฝ๏ธ ยกQue aproveche with Miguel! ๐Ÿฝ๏ธ

About

Voice Chatbot for Restaurants

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages