## I Built an AI Tourism Assistant for Kenya Using RAG, pgvector, and Streamlit

Published: (March 4, 2026 at 04:21 AM EST)
4 min read
Source: Dev.to

Source: Dev.to

Imagine asking:

“What’s the best luxury safari in Maasai Mara?”

and instantly getting personalized travel recommendations powered by AI.

That’s exactly what I built — an AI Tourism Intelligence Assistant that helps travelers discover the best travel packages in Kenya based on their budget, travel style, duration, and preferred destination.


The Idea

Kenya is one of the world’s most beautiful tourism destinations, offering:

  • Wildlife safaris 🦁
  • Tropical beaches 🏝
  • Mountain adventures ⛰
  • Cultural experiences

Planning trips can be frustrating because:

  • Travel packages are scattered across multiple websites
  • Platforms rarely provide personalized recommendations
  • Comparing destinations based on budget or style is difficult

The AI‑powered tourism assistant aims to:

  • Understand traveler preferences
  • Retrieve relevant travel packages
  • Generate intelligent recommendations

What the AI Assistant Does

Users simply input their preferences:

  • Budget
  • Travel duration
  • Travel style
  • Preferred destination

The system returns relevant travel packages from a tourism database.

Example query

Budget: $2000
Days: 5
Style: Relaxing
Destination: Diani

The assistant responds with recommended travel packages that match those criteria.


Tech Stack

Programming

  • Python

Data Engineering

  • PostgreSQL
  • pgvector

AI

  • Mistral AI embeddings
  • Retrieval‑Augmented Generation (RAG)

Data Collection

  • Playwright
  • BeautifulSoup

Backend

  • SQLAlchemy

Frontend

  • Streamlit

Deployment

  • Streamlit Cloud
  • Neon PostgreSQL

System Architecture

flowchart TD
    A[Tourism Websites] --> B[Web Scraping (Playwright)]
    B --> C[PostgreSQL Database]
    C --> D[Embedding Generation (Mistral AI)]
    D --> E[Vector Database (pgvector)]
    E --> F[Recommendation Engine]
    F --> G[Streamlit Web Application]

How the RAG System Works

The project uses Retrieval‑Augmented Generation (RAG) to deliver intelligent responses. Instead of the AI guessing answers, it first retrieves real travel packages from the database.

Pipeline

flowchart TD
    Q[User Query] --> E1[Convert Query → Embedding]
    E1 --> V[Vector Similarity Search]
    V --> R[Retrieve Relevant Travel Packages]
    R --> G[Generate Personalized Response]

This ensures the AI responds with actual tourism data rather than hallucinations.


Database Design

The database stores travel information in structured tables such as travel_packages and destinations.

Each travel package record includes:

  • Package name
  • Destination
  • Duration
  • Price
  • Description
  • Vector embedding

Why Vector Search Matters

Traditional keyword search relies on exact matches. Vector search understands meaning and context.

For example, a query like “Affordable safari in Kenya” can still return:

  • Budget Maasai Mara packages
  • Lake Nakuru safari deals
  • Amboseli wildlife tours

even if those exact words weren’t used in the query.


Building the Interface

The frontend is built with Streamlit, making it easy to create interactive data apps. Users can:

  • Enter travel preferences
  • Browse travel packages
  • Receive AI‑powered recommendations

Deployment

  • Streamlit Cloud hosts the web app.
  • Neon PostgreSQL provides a managed database.

The whole system runs fully online.


Key Results

  • AI‑powered tourism recommendations
  • Semantic search using vector embeddings
  • Fully deployed web application
  • Personalized travel package discovery

Challenges I Faced

Web Scraping Complexity

Many travel sites load content dynamically, requiring Playwright for reliable extraction.

Data Quality Issues

Scraped data often contained missing prices, duplicate packages, and inconsistent destination names.

Embedding Rate Limits

Generating embeddings hit API rate limits, necessitating retry logic and throttling.

Deployment Configuration

Setting up environment variables, Streamlit secrets, and database connection strings demanded careful handling.


Future Improvements

  • AI‑generated itineraries
  • Social‑media tourism trend analysis
  • Integration with booking APIs
  • User accounts and saved trips

Final Thoughts

Combining vector databases, AI retrieval systems, and interactive web apps opens powerful opportunities for building intelligent data products. This project demonstrates how AI can improve tourism discovery and travel planning.

0 views
Back to Blog

Related posts

Read more »