Skip to content

NLP-based multi-agent chatbot for flight search, hotel booking, and AI-powered itinerary generation

Notifications You must be signed in to change notification settings

1234620/Travel-Based-Chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›« NLP Multi-Agent Travel Chatbot

A sophisticated NLP-based multi-agent chatbot application that provides comprehensive travel assistance including flight searches, hotel bookings, and AI-powered itinerary generation using Retrieval-Augmented Generation (RAG).

🌟 Features

Core Capabilities

  • ✈️ Flight Agent: Real-time flight availability using Amadeus API
  • 🏨 Hotel Agent: Hotel search and booking via Booking.com RapidAPI
  • πŸ€– RAG Agent: AI-powered itinerary generation using Amazon Bedrock Titan
  • πŸ’¬ Natural Language Processing: Intent recognition and entity extraction
  • 🌐 Web Interface: Modern, responsive chatbot UI

Advanced Features

  • Multi-Agent Architecture: Coordinated communication between specialized agents
  • Context-Aware Responses: Maintains conversation context across multiple turns
  • Personalized Recommendations: Tailored suggestions based on user preferences
  • Real-Time Data Integration: Live flight and hotel availability
  • Fallback Mechanisms: Robust error handling and graceful degradation

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚   Backend API    β”‚    β”‚  External APIs  β”‚
β”‚   (HTML/CSS/JS) │◄──►│   (FastAPI)      │◄──►│  (Amadeus,      β”‚
β”‚                 β”‚    β”‚                  β”‚    β”‚   Booking.com)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  Orchestrator    β”‚
                    β”‚  (Intent/Entity  β”‚
                    β”‚   Recognition)   β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β–Ό         β–Ό         β–Ό
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚  Flight  β”‚ β”‚  Hotel   β”‚ β”‚   RAG    β”‚
            β”‚  Agent   β”‚ β”‚  Agent   β”‚ β”‚  Agent   β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  AWS Bedrock     β”‚
                    β”‚  (Titan LLM +    β”‚
                    β”‚   Embeddings)    β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

  • Python 3.8+
  • AWS Account with Bedrock access
  • Amadeus API credentials
  • Booking.com RapidAPI key

Installation

  1. Clone the repository

    git clone <your-repo-url>
    cd nlp-travel-chatbot
  2. Set up virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies

    cd backend
    pip install -r requirements.txt
  4. Configure environment variables

    cp env_template.txt .env
    # Edit .env with your actual API keys
  5. Start the backend server

    uvicorn main:app --reload --host 0.0.0.0 --port 8000
  6. Open the frontend

    # Open frontend/index.html in your browser
    # Or serve it with a local server
    python -m http.server 3000  # From frontend directory

πŸ”§ Configuration

Environment Variables

Create a .env file in the backend directory with the following variables:

# Amadeus API (Flight searches)
AMADEUS_API_KEY=your_amadeus_api_key
AMADEUS_API_SECRET=your_amadeus_api_secret

# Booking.com RapidAPI (Hotel searches)
BOOKING_API_KEY=your_booking_rapidapi_key

# AWS Bedrock (RAG functionality)
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_DEFAULT_REGION=us-east-1
BEDROCK_MODEL_ID=amazon.titan-text-express-v1

API Keys Setup

  1. Amadeus API: Sign up at Amadeus for Developers
  2. Booking.com RapidAPI: Get your key from RapidAPI Booking.com
  3. AWS Bedrock: Enable Bedrock in your AWS account and configure IAM permissions

πŸ“ Project Structure

nlp-travel-chatbot/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ agents/
β”‚   β”‚   β”œβ”€β”€ flight_agent/          # Flight search functionality
β”‚   β”‚   β”œβ”€β”€ hotel_agent/           # Hotel search functionality
β”‚   β”‚   └── rag_agent/             # RAG-powered itinerary generation
β”‚   β”œβ”€β”€ orchestrator/              # Multi-agent coordination
β”‚   β”œβ”€β”€ main.py                    # FastAPI application
β”‚   β”œβ”€β”€ requirements.txt           # Python dependencies
β”‚   └── env_template.txt           # Environment variables template
β”œβ”€β”€ frontend/
β”‚   └── index.html                 # Chatbot web interface
β”œβ”€β”€ .gitignore                     # Git ignore rules
└── README.md                      # This file

🎯 Usage Examples

Flight Search

User: "Find flights from New York to London on 2025-06-15"
Bot: [Shows available flights with prices and details]

Hotel Search

User: "Show me hotels in Paris for 3 nights"
Bot: [Displays hotel options with ratings and prices]

Complete Itinerary

User: "I need a 5-day travel plan for Tokyo with flights and hotels"
Bot: [Generates comprehensive itinerary with:
      - Flight options
      - Hotel recommendations
      - Daily activities
      - Sightseeing suggestions
      - Travel tips]

πŸ”Œ API Endpoints

Core Endpoints

  • POST /chat - Main chat interface
  • GET /health - Health check
  • POST /rag/integrated - Generate complete travel itinerary

Agent-Specific Endpoints

  • POST /flight/search - Search flights
  • POST /hotel/search - Search hotels
  • POST /rag/generate - Generate itinerary

πŸ› οΈ Development

Running Tests

# Test individual components
python -m pytest tests/

# Test API endpoints
python test_api_endpoints.py

Adding New Agents

  1. Create agent class in backend/agents/
  2. Implement required methods
  3. Register with orchestrator
  4. Update API endpoints

Customizing NLP

  • Modify intent patterns in orchestrator/chatbot_orchestrator.py
  • Add new entity extraction rules
  • Update response templates

πŸš€ Deployment

Docker Deployment

# Build image
docker build -t travel-chatbot .

# Run container
docker run -p 8000:8000 --env-file .env travel-chatbot

Cloud Deployment

  • AWS: Use ECS, Lambda, or EC2
  • Google Cloud: App Engine or Cloud Run
  • Azure: Container Instances or App Service

🀝 Contributing

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

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support

For support, email amoosani123@gmail.com or create an issue in this repository.


Happy Traveling! ✈️🏨🌍

About

NLP-based multi-agent chatbot for flight search, hotel booking, and AI-powered itinerary generation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published