Skip to content

Embula Restaurant Chatbot backend and frontend integration using FastAPI and Mistral AI. Features : NLP-based menu suggestions (vegan/vegetarian/non-veg) - Table availability and reservation queries - Restaurant info - SQL query restrictions- Input sanitization and safe query handling

Notifications You must be signed in to change notification settings

Embula-Project/embula-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Embula Restaurant Chatbot Backend (Python FastAPI)

This is the Python FastAPI version of the Embula Restaurant Chatbot backend, powered by Mistral AI. It handles:

  • Menu queries (filter by vegan/vegetarian/non-veg)
  • Table availability & reservations
  • Restaurant info (location, contact, opening hours)
  • Safe SQL access (restricted tables are blocked)
  • Frontend integration ready

Features

  • FastAPI: High-performance, easy-to-learn, production-ready framework
  • Mistral AI Integration: Uses mistral-small-latest for intelligent natural language understanding
  • Context Awareness: Maintains conversation history per session (in-memory)
  • System Personality: Friendly restaurant assistant
  • Profanity & SQL Injection Filter: Sanitizes user input using better-profanity and a custom sanitizer
  • Database-Safe Queries: Only reads from allowed tables: food_item, food_item_ingredients, reservations, restaurant_tables, discounts
  • Frontend Integration Ready: API endpoints can be called via JS, React, Next.js, or any frontend

Project Structure

Project Structure

embula-chatbot-python/
├── src/
│   ├── config/         # Configuration settings
│   ├── models/         # Pydantic models
│   ├── routers/        # API endpoints
│   ├── services/       # Business logic
│   ├── utils/          # Helpers (Memory store)
│   └── main.py         # Application entry point
├── .env                # Environment variables
├── requirements.txt    # Python dependencies
└── README.md           # Documentation

Setup Instructions

1.Prerequisites

  • Python 3.9+
  • MySQL 8+ (if using a real database)
  • Mistral AI API Key
  • pip package manager
  1. Create Virtual Environment (Recommended):

    python -m venv venv
    # Windows
    .\venv\Scripts\activate
    # Mac/Linux
    source venv/bin/activate
  2. Install Dependencies:

    pip install -r requirements.txt
  3. Configure Environment:

    • Open .env file.
    • Add your Mistral API Key: MISTRAL_API_KEY=your_actual_key_here
  4. Run the Server:

    # Run from the root directory
    python src/main.py
    # OR using uvicorn directly
    uvicorn src.main:app --reload

About

Embula Restaurant Chatbot backend and frontend integration using FastAPI and Mistral AI. Features : NLP-based menu suggestions (vegan/vegetarian/non-veg) - Table availability and reservation queries - Restaurant info - SQL query restrictions- Input sanitization and safe query handling

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages