Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Airbnb Analyst Agent 🏠

An intelligent agent that analyzes Airbnb listing data stored in a local MongoDB database. It combines statistical analysis, data visualization, and LLM-powered insights to act as a virtual real estate analyst.

Features

  • 🔍 Market Analysis: Generates executive summaries of market conditions, pricing trends, and inventory.
  • 💬 Chat with Data: Interactive QA interface. Ask natural language questions like "Find 3-bedroom apartments with strict cancellation policy" and get precise answers derived from your database.
    • Supports complex logic: Filtering, Sorting, and Limits.
    • Full Schema Support: Queries 24+ fields including house_rules, transit, bed_type.
  • 📊 Visualizations: Auto-generates charts for Price Distribution, Property Types, and Room Types.
  • 🤖 Multi-LLM Support:
    • Providers: OpenAI, Anthropic, DeepSeek.
    • Model Selection: Granular control (e.g., gpt-4o, claude-3-opus, deepseek-coder).
  • 🚀 Scalable:
    • Full Dataset Mode: Processes 5,000+ listings locally for aggregation stats.
    • Smart Querying: Uses MongoDB Aggregation Pipelines to keep LLM context efficient.

Prerequisites

  • OS: Linux/macOS/Windows
  • Database: MongoDB (running locally on port 27017)
    • Database Name: sample_airbnb
    • Collection: listingsAndReviews
  • Python: Version 3.10+ (Conda recommended)

Installation

  1. Clone/Navigate to directory:

    cd /home/robert/Coding/analysis
  2. Create/Activate Conda Environment:

    conda create -n ai python=3.12
    conda activate ai
  3. Install Dependencies:

    pip install -r requirements.txt
  4. Configure API Keys: Create a .env file in the root directory:

    OPENAI_API_KEY=sk-...
    ANTHROPIC_API_KEY=sk-ant-...
    DEEPSEEK_API_KEY=sk-...

Usage

  1. Start the Application:

    python app.py
  2. Access UI: Open your browser to http://localhost:7860.

  3. Modes:

    • Market Analysis Tab: Select your provider/model, check "Analyze Full Dataset" (optional), and click "Run Analysis" to get a comprehensive report and charts.
    • Chat with Data Tab: Type questions like "What is the most expensive listing?" or "Show me apartments in Porto under $100".

Project Structure

  • analyst.py: Core logic class. Handles DB connections, data fetching, statistical calculations, plot generation, and LLM interaction.
  • app.py: Gradio web interface. Handles UI state, model dropdowns, and user interaction.
  • .env: Stores sensitive API keys (not committed to git).
  • requirements.txt: Python package dependencies.
  • static/plots/: Generated chart images.

Technologies

  • Backend: Python, PyMongo, Pandas
  • Frontend: Gradio
  • AI Integration: OpenAI SDK, Anthropic SDK
  • Visualization: Matplotlib, Seaborn

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages