Skip to content

preciousimo/Real-Estate-Bot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

House Rental Search API

Table of Contents

About

This project is designed to provide an API for a house rental service that enables users to find properties based on descriptions. It utilizes a state-of-the-art language model from Vertex AI to extract key information such as the number of rooms, location, and rent from natural language descriptions. The API then queries a pre-populated SQLite database to find matching properties based on the extracted data.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Before you begin, ensure you have the following installed:

  • Python 3.8 or higher
  • FastAPI
  • Uvicorn, an ASGI server for running FastAPI
  • SQLite3 for the database
  • vertexai for integrating with Google Vertex AI

You can install the necessary libraries with pip:

pip install fastapi uvicorn sqlite3 vertexai

Additionally, you will need to obtain a credentials.json file for accessing Google Cloud services:

  • Download the credentials.json from your Google Cloud Platform console.
  • Place the credentials.json in your project directory, or a secure location of your choice.
  • Download credentials.json here

Installing

Follow these steps to get your development environment running:

  1. Clone the repository to your local machine:
git clone https://yourrepository.com/yourproject.git
cd yourproject
  1. Install the required Python packages:
pip install -r requirements.txt
  1. Set up the environment variable for Google Cloud credentials:
export GOOGLE_APPLICATION_CREDENTIALS='path/to/your/credentials.json'
  1. Initialize the database with the seed data:
python seed.py
  1. Start the FastAPI server:
uvicorn main:app --reload

This will start the server on http://127.0.0.1:8000. You can interact with the API using this base URL.

Usage

To use the API, send HTTP requests to the appropriate endpoints:

  • Zero-Shot Prompting Endpoint:

    • POST /search_properties/zero_shot/
    • Description: Pass a property description and receive property matches without prior examples.
  • Single-Shot Prompting Endpoint:

    • POST /search_properties/single_shot/
    • Description: Pass a property description with a single example to guide the model.
  • Few-Shot Prompting Endpoint:

    • POST /search_properties/few_shot/
    • Description: Pass a property description along with multiple examples to help the model understand the context better.

For example, to query the few-shot endpoint, you might use a tool like curl:

curl -X 'POST' \
  'http://localhost:8000/search_properties/few_shot/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "description": "Searching for a 3-bedroom house in Lagos with a budget of N3,500,000."
}'

This sends a description to the API and retrieves matching properties based on the specified criteria.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%