File size: 5,196 Bytes
c363d0e
 
 
 
 
 
 
 
 
 
 
8630e6c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
---

title: Property AI
emoji: 🏠
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: "3.44.0"
app_file: app.py
pinned: false
---


# NoBrokerage Chatbot

**AI-powered real estate assistant** for NoBrokerage.com that retrieves property data from a FAISS vectorstore, applies structured filters, and generates grounded summaries and property cards using Groq LLM.  

This project is built using **FastAPI**, **LangChain**, **FAISS**, **HuggingFace embeddings**, **Frontend**,  and **Groq LLM**, and is ready for **Docker deployment** and **Hugging Face Spaces**.

---

## Table of Contents

- [NoBrokerage Chatbot](#nobrokerage-chatbot)
  - [Table of Contents](#table-of-contents)
  - [Project Overview](#project-overview)
  - [Features](#features)
  - [Project Structure](#project-structure)
  - [Example Queries the Chatbot Can Handle](#example-queries-the-chatbot-can-handle)
  - [How to Run Locally](#how-to-run-locally)
    - [1. Clone the Repository](#1-clone-the-repository)
    - [2. Create Virtual Environment](#2-create-virtual-environment)
    - [3. Install Dependencies](#3-install-dependencies)
    - [4. Set Up Environment Variables](#4-set-up-environment-variables)
    - [5. Run the FastAPI Server](#5-run-the-fastapi-server)
  - [Tech Stack](#tech-stack)
  - [Features](#features-1)
  - [Deployment Ready](#deployment-ready)
  - [πŸ‘¨β€πŸ’» Author](#-author)

---

## Project Overview

NoBrokerage Chatbot allows users to query property listings by specifying filters like **city, BHK, budget, status, locality**, and returns **summary text** and **cards** with property details.  

- **Semantic search**: FAISS vectorstore with HuggingFace embeddings for similarity search.  
- **Deterministic filters**: Apply structured metadata filters for city, BHK, budget, status, and locality.  
- **LLM summarization**: Groq LLM produces grounded summaries and card outputs strictly from filtered property records.  
- **Deployment-ready**: Can run via CLI, FastAPI, Docker, or Hugging Face Spaces.

---

## Features

- Parse natural language queries for:
  - Budget (β‚Ή, Cr, Lakh)
  - BHK
  - City
  - Property status (Ready to move / Under construction)
  - Locality or project
- FAISS similarity search over property embeddings
- Deterministic filtering of search results
- Generate structured JSON output with:
  - `summary` (text summary)
  - `cards` (detailed property info)
- FastAPI backend with `/chat` endpoint
- Dockerized for easy deployment
- Compatible with Hugging Face Spaces

---

## Project Structure


```bash

NOBROKERAGE/

β”œβ”€β”€ backend/

β”‚   β”œβ”€β”€ api.py

β”‚   

β”œβ”€β”€ data/

β”œβ”€β”€ database/

β”œβ”€β”€ frontend/

β”œβ”€β”€ processed_data/

β”œβ”€β”€ src/

β”‚   └── chatbot.py

β”œβ”€β”€ subha/

β”œβ”€β”€ vectorstore/

β”‚   └── index.faiss

β”œβ”€β”€ .env

β”œβ”€β”€ .gitignore

β”œβ”€β”€ Dockerfile

β”œβ”€β”€ README.md

└── requirements.txt



```
---

##  Example Queries the Chatbot Can Handle

The chatbot can intelligently respond to natural language queries like:

- " Find 2BHK apartments in Chembur "
- " 3BHK flat in Pune under β‚Ή1.2 Cr "
- " Under-construction 3BHK in Mumbai "
- " 2bhk flat in pune "
- " 3bhk in Mumbai "
  

It uses:
- **FAISS** to find the most relevant property documents.
- **LangChain + Groq LLM** (`llama-3.1-8b-instant`) to summarize matching results.
- **Structured filters** for city, budget, BHK, locality, and status.
---

##  How to Run Locally

### 1. Clone the Repository
```bash

git clone https://github.com/yourusername/nobrokerage.git

cd nobrokerage

```
### 2. Create Virtual Environment
```bash

python -m venv venv

venv\Scripts\activate   # on Windows

# OR

source venv/bin/activate  # on Mac/Linux

```
### 3. Install Dependencies
```bash

pip install -r requirements.txt

```
### 4. Set Up Environment Variables
```bash

GROQ_API_KEY=your_groq_api_key_here

```
### 5. Run the FastAPI Server
```bash

cd backend

uvicorn api:app --reload

```
---

##  Tech Stack

- **FastAPI** β€” Backend API framework  
- **Frontend** - index.html, style.css, script.js
- **LangChain** β€” LLM orchestration  
- **Groq LLM (llama-3.1-8b-instant)** β€” Summarization & reasoning  
- **FAISS** β€” Semantic vector search  
- **HuggingFace Sentence Transformer** β€” Embeddings  
- **Docker** β€” Containerization  
- **Python 3.11**

---

##  Features

βœ… Semantic property search using FAISS  
βœ… Intelligent summaries and cards generated by Groq LLM  
βœ… Handles filters like city, budget, BHK, and project status  
βœ… Ready for Hugging Face Spaces or cloud deployment  
βœ… Modular architecture (backend + src separation)

---

##  Deployment Ready

This backend is designed to work seamlessly with **Docker** and can deploy directly to **Hugging Face Spaces**.  
Make sure `vectorstore/` and `.env` are included in your project before building the Docker image.

---

## πŸ‘¨β€πŸ’» Author

**Subhakanta Rath**  
πŸŽ“ MSc AI & ML β€” IIIT Lucknow  
πŸ’‘ Focused on ML, Data Engineering & Agentic AI Systems  
πŸ“ Lucknow, India