RestoRecommender: AI-Powered Restaurant Recommendation System
RestoRecommender leverages the power of artificial intelligence (AI) to suggest restaurants and bars based on user preferences and review analysis. It utilizes Retrieval-Augmented Generation (RAG) to extract meaningful insights from customer reviews.
Functionality Breakdown:
-
Data Collection (
places.ipynb):- This Jupyter Notebook scrapes data from Google Maps's Places API and stores the extracted information in CSV files (
places.csvandreviews.csv) within thedatadirectory.
- This Jupyter Notebook scrapes data from Google Maps's Places API and stores the extracted information in CSV files (
-
RAG LLM Model Creation (
rag_chatbit.ipynb):- This script outlines the process of building a RAG-based large language model (LLM). The steps involve:
- Data loading from CSV files
- Vector database construction
- Embedding model training
- LLM model creation
- The notebook also showcases demonstration use cases and evaluations based on synthetically generated questions.
- This script outlines the process of building a RAG-based large language model (LLM). The steps involve:
-
Answer Generation (
experiments.ipynb):- This Jupyter Notebook utilizes the
questions.txtfile containing user queries to generate corresponding answers and saves them in theQuestion-Answer.txtfile. It allows for the inclusion of additional user questions for enhanced personalization.
- This Jupyter Notebook utilizes the
-
Web User Interface (
web-UIfolder):- This folder houses the necessary files to create a web-based user interface (UI) that facilitates interaction with the RestoRecommender chatbot. It employs the Flask framework.
- To launch the UI:
- Navigate to the
web-UIdirectory in your terminal. - Run the command:
python app.py - Open your web browser and visit the following URL:
http://127.0.0.1:5000/
- Navigate to the
Setting Up the Environment
-
Create a Virtual Environment (Recommended):
- Virtual environments isolate project dependencies and prevent conflicts with other Python installations.
- To create a new virtual environment named
venv:- Linux/macOS:
python3 -m venv venv - Windows:
python -m venv venv
- Linux/macOS:
- Activate the virtual environment:
- Linux/macOS:
source venv/bin/activate - Windows:
venv\Scripts\activate
- Linux/macOS:
-
Install Required Libraries:
- Navigate to the project's root directory.
- Assuming you have a
requirements.txtfile listing project dependencies, install them using pip:pip install -r requirements.txt
Running the Project
- Make sure the virtual environment is activated (if used).
- Navigate to the project's root directory in your terminal.
- Run Jupyter Notebooks:
- Open a terminal or command prompt within the project directory.
- Use
jupyter notebookto launch the Jupyter Notebook server. - Interact with the notebooks (
places.ipynb,rag_chatbit.ipynb, andexperiments.ipynb) to perform data collection, model creation, and further experiments.
- Run Web UI (if applicable):
- To launch the UI:
- Navigate to the
web-UIdirectory in your terminal. - Run the command:
python app.py - Open your web browser and visit the following URL:
http://127.0.0.1:5000/
- Navigate to the
- The UI interface created in this manned is just for development environment. However, this is enough for the purpose of this project.
- To launch the UI:
Using the Gemini API
If you intend to leverage the Gemini API for their embedding and LLM model, you'll need an API key. Here's how to obtain one:
- Visit the Google AI Studio: https://aistudio.google.com/app/apikey
- Click on "Get API key" and follow the on-screen instructions.
- Once you have the API key, store it securely inside a
.envfile. - Update the
rag_chatbit.ipynbnotebook with your API key where necessary.
Alternative Embedding Models and LLM Models
While the rag_chatbit.ipynb notebook demonstrates using the Gemini API, you can explore alternative embedding models and LLM architectures. Here are some resources to get you started:
- Embedding Models:
- Sentence Transformers: https://huggingface.co/sentence-transformers
- LLM Models:
- Hugging Face Transformers Library: https://huggingface.co/docs/transformers/en/index
- OpenAI API: https://openai.com/ (requires account creation)
By following these instructions, you'll establish a clean environment, install necessary dependencies, and be ready to run the RestoRecommender project effectively.
References:
- https://pypi.org/project/googlemaps/
- https://github.com/googlemaps/google-maps-services-python/blob/master/googlemaps/places.py
- https://python.langchain.com/v0.1/docs/get_started/introduction
- https://ai.google.dev/gemini-api/docs
- https://github.com/facebookresearch/faiss
- https://ai.google.dev/gemini-api/docs/api-key