This project is an AI-powered real estate property search platform built with FastAPI and MongoDB. It leverages OpenAI's GPT model to provide personalized property recommendations based on natural language descriptions and user preferences.
The Real Estate Property Search platform allows users to search for properties using natural language descriptions. The platform utilizes OpenAI's GPT model to extract key information such as the number of rooms, location, and rent from user descriptions. These details are then used to query a MongoDB database to find matching properties. The system also incorporates user preferences to enhance search results, providing personalized recommendations tailored to each user's needs.
Follow these instructions to set up the project locally for development and testing purposes.
Ensure you have the following software installed:
- Docker
- Docker Compose
- An OpenAI API Key (Sign up at OpenAI)
-
Clone the repository:
git clone https://github.com/seun-beta/real-estate-ai.git cd real-estate-ai
-
Create a
.env
file in the root directory:MONGO_URL=mongodb://localhost:27017 MONGO_DB_NAME=real_estate_db OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx JWT_SECRET=supersecretkey JWT_ALGORITHM=HS256 JWT_ACCESS_TOKEN_EXP_MINUTES=30
-
Build and start the Docker containers:
docker-compose up --build
-
Access the application:
The application will be running at
http://localhost:8000
.
Once the application is running, you can:
- Register/Login: Use the
/users/register
and/users/login
endpoints to create an account and authenticate. - Set Preferences: Set your property search preferences using the
/users/preferences/
endpoint. - Search Properties: Use the
/properties/search_properties/
endpoints to search for properties based on natural language descriptions. The platform supports zero-shot, single-shot, and few-shot learning techniques for entity extraction.
- POST
/users/register
: Register a new user. - POST
/users/login
: Login and receive a JWT token. - POST
/users/preferences/
: Set user preferences for property search. - GET
/users/preferences/
: Get the current user’s property search preferences.
- POST
/properties/search_properties/zero_shot/
: Search properties using zero-shot learning. - POST
/properties/search_properties/single_shot/
: Search properties using single-shot learning. - POST
/properties/search_properties/few_shot/
: Search properties using few-shot learning.
- Python - Programming Language
- FastAPI - Web Framework
- MongoDB - Database
- Docker - Containerization
- OpenAI GPT - AI Model
.
├── app
│ ├── config.py # Configuration settings
│ ├── users
│ │ ├── models.py # User and UserPreference models
│ │ ├── schemas.py # User and UserPreference schemas
│ │ ├── routers.py # User routes including registration, login, and preferences
│ │ ├── auth.py # User authentication utilities
│ ├── properties
│ │ ├── models.py # Property model
│ │ ├── schemas.py # PropertyInquiry and PropertyListResponse schemas
│ │ ├── routers.py # Property search routes
├── main.py # FastAPI application initialization
├── requirements.txt # Python dependencies
├── Dockerfile # Dockerfile for FastAPI app
├── docker-compose.yml # Docker Compose file
├── .env # Environment variables
└── README.md # Project documentation
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
- Fork the project
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a pull request
- @seun-beta - Idea & Initial work
See also the list of contributors who participated in this project.
- Thanks to the FastAPI community for their invaluable documentation.
- Special thanks to OpenAI for providing the GPT model.
- Inspiration from modern real estate platforms and AI-driven applications.