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.
- 🔍 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.
- OS: Linux/macOS/Windows
- Database: MongoDB (running locally on port
27017)- Database Name:
sample_airbnb - Collection:
listingsAndReviews
- Database Name:
- Python: Version 3.10+ (Conda recommended)
-
Clone/Navigate to directory:
cd /home/robert/Coding/analysis -
Create/Activate Conda Environment:
conda create -n ai python=3.12 conda activate ai
-
Install Dependencies:
pip install -r requirements.txt
-
Configure API Keys: Create a
.envfile in the root directory:OPENAI_API_KEY=sk-... ANTHROPIC_API_KEY=sk-ant-... DEEPSEEK_API_KEY=sk-...
-
Start the Application:
python app.py
-
Access UI: Open your browser to
http://localhost:7860. -
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".
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.
- Backend: Python, PyMongo, Pandas
- Frontend: Gradio
- AI Integration: OpenAI SDK, Anthropic SDK
- Visualization: Matplotlib, Seaborn