The Real Estate Assistant is an intelligent command-line tool designed to analyze and summarize Mongolian real estate listings from Unegui.mn. It uses a multi-agent workflow powered by a powerful LLM backend (Meta-LLaMA 3) to generate human-readable reports from raw listings.
- Extracts data from individual property URLs
- Parses details such as title, price, area, bedrooms, and description
- Summarizes listings into structured reports
- Context-aware analysis using market averages
- Modular agent architecture (
RetrieverAgent,WriterAgent)
python main.pyThen enter a query such as:
https://www.unegui.mn/adv/9341198_bgd-4-khoroolold-17-mkv-azhlyn-bair/
Ensure you're in a virtual environment and install:
pip install -r requirements.txtmain.py
├── classifies query type
├── invokes workflow
│ ├── RetrieverAgent
│ │ ├── fetches and parses URL
│ │ ├── extracts property details
│ └── WriterAgent
│ ├── formats and prompts the LLM
│ └── prints final report
URL: https://www.unegui.mn/adv/9341198...
Title: Бгд 4 хороололд 1 өрөө 17 мк байр
Price: MNT 65,000,000
Location: шууд нүүж ороход бэлэн... ← ⚠️ Not a true location!
Area: 17.0 м²
Bedrooms: 1
...
The current location value is incorrectly pulled from a nearby description tag instead of the actual address. To fix this:
-
Inspect the true HTML structure where location data like
Баянгол дүүрэг,Хан-Уул, etc. is stored. -
Update the
RetrieverAgentlogic to extract from:- A
<ul>block containing key-value pairs (like<li>where key isБайршил:or similar). - Or schema.org metadata (e.g.
itemprop="address"if available).
- A
-
Add fallback logic:
- If explicit address not found, look for district or khoroo names in breadcrumbs or tags.
-
Write a helper function
extract_detail_by_label(soup, label)to reuse for similar fields like area, floor, etc. -
Add a test case for listings that only include a vague or no location.
Follow these steps to set up and run the project locally.
git clone https://github.com/yourusername/langchain-app.git
cd langchain-appPython 3.10 or newer is required.
python3 -m venv .venv
source .venv/bin/activate # On Windows use: .venv\Scripts\activateIf you're using uv:
uv pip install -r requirements.txtOtherwise, install directly from pyproject.toml:
pip install .Or install using editable mode for development:
pip install -e .✅ Make sure
pipis the one from your virtual environment.
Create a .env file in the root directory and add your API keys:
OPENAI_API_KEY=your_openai_key
TOGETHER_API_KEY=your_together_api_key
python main.pyYou’ll be prompted to enter a real estate listing URL or a general query.