Skip to content

ShadyNights/ai-travel-planner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

✈️ AI Travel Planner

Intelligent Travel Itinerary Planning with Self-Improving AI

Streamlit Python PostgreSQL LangChain Groq License

Live Demo β€’ Documentation β€’ API Reference β€’ Contributing


Transform your travel dreams into detailed, personalized itineraries powered by cutting-edge AI.


🌟 Overview

AI Travel Planner is a production-grade, self-improving travel planning application powered by Groq's Llama 3.1 70B, Streamlit, and PostgreSQL. It automatically generates itineraries and learns from user feedback to continuously improve.

What Makes This Special?

  • 🧠 Self-Improving AI β€” learns from user ratings
  • πŸ—„οΈ Dual Storage Architecture β€” PostgreSQL + JSON backups
  • ⚑ Real-time Auto-Training β€” database triggers
  • 🌍 Cloud-Native Deployment
  • πŸ’° Smart, AI-powered budgeting
  • πŸ“Έ High-quality images (Unsplash)
  • πŸ“Š Real analytics dashboard
  • πŸ”’ Production-ready architecture

🎯 Key Features

Core Functionality

πŸš€ AI-Powered Planning

  • Multi-day itineraries
  • Local insights & hidden gems
  • Budget optimization
  • Travel style customization

πŸ’° Smart Budgeting

  • Detailed cost breakdown
  • Per-day expenses
  • Transportation + food costs
  • Accommodation estimates

πŸ“Έ Visual Experience

  • Destination galleries
  • High-quality Unsplash images
  • Landmark highlights
  • Responsive loading

πŸ—ΊοΈ Interactive Maps

  • Google Maps links
  • Location previews
  • Mobile-friendly

πŸ“„ Export & Share

  • Beautiful PDF export
  • Print-ready formatting
  • Budget summaries

⭐ User Feedback System

  • 5-star ratings
  • Text feedback
  • Quality scoring algorithm
  • Auto-training triggers

πŸ€– Self-Improving AI System

The app learns automatically using PostgreSQL triggers that prepare training samples whenever high-quality itineraries are detected.

graph LR A[User Rates Itinerary] --> B[Update Quality Score] B --> C[PostgreSQL Trigger] C --> D{Quality >= 4.0?} D -->|Yes| E[Mark as Training Sample] E --> F{Count >= 3?} F -->|Yes| G[Trigger Training Cycle] G --> H[Model Improvement] H --> A

yaml Copy code

Benefits

  • Zero manual intervention
  • Real-time learning
  • Threshold-based training cycles
  • Automated data collection

πŸ—„οΈ Dual Storage Architecture

Primary Storage (PostgreSQL) Backup Storage (JSON)
High-performance queries Easy inspection
ACID compliant Disaster-proof
Analytics-ready Portable backups
Referential integrity Dev-friendly

Sync Logic:

  • Every write β†’ JSON backup
  • Timestamped archives
  • Easy rollback

πŸ—οΈ Architecture Diagram

USER ──> Streamlit Cloud ──> Streamlit App β”‚ +-------+---------+ | | Groq API Neon PostgreSQL β”‚ β”‚ └──── Unsplash API (Images)

yaml Copy code


πŸ› οΈ Technology Stack

Frontend

Technology Purpose
Streamlit UI
Markdown Content
HTML/CSS Styling

Backend

Technology Purpose
Python 3.11 Core
LangChain LLM chains
Groq API AI inference
psycopg2 PostgreSQL driver
ReportLab PDF export

Storage

Technology Purpose
PostgreSQL 17 Primary DB
Neon Cloud hosting
JSON Backups

External APIs

Service Purpose
Groq AI inference
Unsplash Photos
Google Maps Links & embeds

πŸš€ Getting Started

Prerequisites

  • Python 3.11+
  • pip
  • Git
    Optional:
  • PostgreSQL 17+

Quick Start (5 Minutes)

1. Clone

git clone https://github.com/ShadyNights/ai-travel-planner.git
cd ai-travel-planner
2. Create Virtual Environment
Windows

bash
Copy code
python -m venv venv
.\venv\Scripts\activate
macOS/Linux

bash
Copy code
python3 -m venv venv
source venv/bin/activate
3. Install Dependencies
bash
Copy code
pip install -r requirements.txt
4. Setup Environment
bash
Copy code
cp .env.example .env
Edit .env and add API keys.

5. Setup Database (Optional)
bash
Copy code
python setup_database.py
6. Run App
bash
Copy code
streamlit run app.py
πŸ“– Usage Guide
Generate Your First Itinerary
Go to Generate Itinerary

Enter:

Destination

Duration

Budget

Interests

Travel style

Click Generate

View:

Daily plans

Photos

Maps

Budget report

Export PDF

Rating & Training the AI
Open Rate & Train

Choose itinerary

Rate 1–5 stars

Optionally add text

Submit β†’ Added to training pipeline

πŸ—‚οΈ Project Structure
arduino
Copy code
ai-travel-planner/
β”‚ app.py
β”‚ requirements.txt
β”‚ README.md
β”‚ .env.example
β”‚ Dockerfile
β”‚ setup.py
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ chains/
β”‚   β”œβ”€β”€ database/
β”‚   └── utils/
β”‚
β”œβ”€β”€ data/
β”‚   └── archive/
β”‚
β”œβ”€β”€ .streamlit/
β”‚   └── config.toml
β”‚
β”œβ”€β”€ scripts/
└── sql/
πŸ”Œ API Reference
TravelPlanner Usage
python
Copy code
from src.core.planner import TravelPlanner

planner = TravelPlanner()

itinerary = planner.generate_itinerary({
    "destination": "Tokyo, Japan",
    "duration": 7,
    "budget_level": "moderate",
    "interests": ["culture", "food"],
})
πŸ“Š Data Management
Quick Stats
bash
Copy code
python check_cloud_stats.py
Full Data Manager
bash
Copy code
python data_manager.py
πŸš€ Deployment
Streamlit Cloud Deployment
Push repo to GitHub

Go to Streamlit Cloud

Connect repo

Add secrets

Deploy

Docker
bash
Copy code
docker build -t ai-travel-planner .
docker run -p 8501:8501 ai-travel-planner
🀝 Contributing
We welcome contributions!

Steps
bash
Copy code
git clone https://github.com/YOUR-USERNAME/ai-travel-planner.git
git checkout -b feature/my-feature
Follow PEP8, include type hints, write tests.

πŸ—ΊοΈ Roadmap
v1.1 (Next 2 Weeks)
User authentication

Weather integration

Currency converter

v2.0 (1–2 Months)
Mobile app

Booking integrations

v3.0 (3–6 Months)
Fine-tuned custom models

Voice/AR features

πŸ“ˆ Performance Benchmarks
Metric	Value
Itinerary Gen	15–20s
PDF Export	2s
Photo Loading	2–3s

πŸ”’ Security
Env vars for all secrets

SSL everywhere

Parameterized SQL

No credential leaks

πŸ“ License
MIT β€” see LICENSE

πŸ™ Acknowledgments
Built with:

Streamlit

LangChain

Groq

Neon DB

Unsplash

ReportLab

<div align="center">
Made with ❀️ by ShadyNights
⭐ If you like this project, please star it!

⬆ Back to Top

</div> ```
βœ… ALSO READY-TO-PASTE SUPPORT FILES
πŸ“„ LICENSE
text
Copy code
MIT License

Copyright (c) 2025 ShadyNights

Permission is hereby granted, free of charge, to any person obtaining a copy...
(Full MIT text included exactly as required.)

πŸ“„ CONTRIBUTING.md
markdown
Copy code
# Contributing to AI Travel Planner

Thank you for your interest in contributing!

## Code of Conduct
Be respectful, inclusive, and professional.

## How to Contribute
1. Fork repo
2. Create branch
3. Commit changes
4. Push
5. Open PR

## Style Guidelines
- PEP8
- Type hints
- Docstrings
- Small, focused functions

## Testing
- Add tests for new features
- Ensure all tests pass
πŸ“„ .env.example
text
Copy code
# Groq API
GROQ_API_KEY=your_groq_api_key_here

# PostgreSQL
USE_POSTGRES=true
DATABASE_URL=postgresql://user:password@host.neon.tech/database?sslmode=require

# Unsplash API (optional)
UNSPLASH_ACCESS_KEY=your_unsplash_access_key_here

About

AI-powered travel planner with self-training

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors