Skip to content

A smart chatbot that uses Generative AI, LLMs, and Retrieval-Augmented Generation (RAG) to provide personalized gift suggestions. It combines real-time information retrieval with creative responses for tailored recommendations. Built with Python, utilizing frameworks like LangChain and OpenAI API.

License

Notifications You must be signed in to change notification settings

Medkallel/Gift-Recommendation-Chatbot

Repository files navigation

🎁 Gift Generative Recommendation System


banner.jpg


Table of Contents


Technologies Used

Python Streamlit LangChain HuggingFace OpenAI Chroma Pandas NumPy


Description

This project aims to provide gift recommendations using a chatbot interface. The system leverages embeddings and vector stores along with LLMs to process and recommend products from store's catalogue based on user queries.

Objectives

The main goal is to develop a Proof Of Concept that is could be used by a customer.

  1. Load and embed product data from CSV files.
  2. Utilize a pretrained language model (LLM) with Retrieval-Augmented Generation (RAG) for recommendations.
  3. Implement conversation and chat history with the retrieval & answer chain
  4. Create a Streamlit front end for the app.

Dataset

The dataset used, compiled by McAuley Lab in 2023, encompasses a comprehensive collection of Amazon Reviews. It features:

  • User Reviews (ratings, text, helpfulness votes, etc.)
  • Item Metadata (descriptions, price, raw image, etc.)

Important

Disclaimer: The source code as well as the demo currently use free embedidng and llm models provided by TogetherAI. Those models are thus not performant and generally do not offer great recommendations. It is recommended to switch to higher performance models like those from OpenAI, Anthropic... or capable Local models to get better results. An up to date more refined product database would also contribute to getting better results as the database contains rather "random" results

Demo

The app demo is hosted & available on the following link: Demo Link

Streamlit App

  • App Screenshot: image

Notebooks Overview

  1. create_llm_ready_csv.ipynb:
    • Used to preprocess the Amazon Dataset and extract products with rich text features for the demo.

Using Docker

1. Pulling the Docker Image

You can pull the docker image from Docker Hub or Github Packages To pull the Docker image from Docker Hub, run the following command:

# Pull the docker image
$ docker pull medkallel/gift-recommendation-chatbot:latest

2. Building the Docker Image

If you prefer to build the Docker image locally, navigate to the project directory and run:

# Build the docker image
$ docker build -t gift-recommendation-chatbot .

3. Running the Docker Container

To run the Docker container, use the following command:

# Run the docker container
$ docker run -p 8501:8501 -e TOGETHER_API_KEY=<your_api_key_here> gift-recommendation-chatbot

Tip

Do not forget to add your TogetherAI api key You can access the app on another device by following the link: http://<server-ip>:8501



Installation

Important

The project was developed and tested on Python 3.11.6

To run this project locally, follow these steps:

  1. Clone the repository:
$ git clone https://github.com/yourusername/Gift-Recommendation-ChatBot
$ cd Gift-Recommendation-ChatBot
  1. Install requirements:
$ pip install -r requirements.txt
  1. Download the Chroma VecStore & upload it to your Dropbox App: Chroma Store Download Link

Important

Ensure you have the necessary API keys for TogetherAI and Dropbox set up in the secrets.toml file.


Usage

  1. Run the app using:
$ streamlit run src/Gift_Recommendation_Bot.py 
  1. Use the Products Catalogue βš™οΈ script to upload and embed product data.
  2. Use the Gift Recommendation Bot script to start the chatbot interface and get gift recommendations.

TIP: The embedding process may take a while depending on the size of the CSV file. Please be patient.


Project structure

πŸ“¦ Gift-Recommendation-ChatBot/
β”œβ”€β”€ πŸ“.github/workflows
β”‚   └── πŸ€–github-docker-cicd.yaml # Used for CI/CD workflows
β”œβ”€β”€ πŸ“chroma_vectorstore/ # Contains the vector store
β”œβ”€β”€ πŸ“Data/ # Contains the dataset
β”œβ”€β”€ └── πŸ““create_llm_ready_csv.ipynb
β”œβ”€β”€ πŸ“src/
β”‚   β”œβ”€β”€ 🐍Gift_Recommendation_Bot.py 
β”‚   β”œβ”€β”€ πŸ“pages/
β”‚   β”‚   └── 🐍Products Catalogue βš™οΈ.py
β”œβ”€β”€ πŸ“tmp/ # Used to store temporary csv file for data embedding
β”œβ”€β”€ πŸ“.streamlit/
β”‚   └── πŸ”‘secrets.toml # Used to store api Keys for running locally
β”œβ”€β”€ πŸ“„.gitignore
β”œβ”€β”€ πŸ‹.dockerignore
β”œβ”€β”€ πŸ‹.Dockerfile
β”œβ”€β”€ πŸ“„README.md
β”œβ”€β”€ πŸ“„LICENCE.md
β”œβ”€β”€ πŸ“„requirements.txt
└── πŸ–ΌοΈbanner.png

Collaborators

This project was developed by a collaborative team. Each member played a crucial role in the research, development, and analysis:

  • Mohamed Kallel
  • Jean Christophe Rigoni
  • Simon Pierre Rodner

πŸ“« Contact me

LinkedIn


License

This project is under the CC BY-NC 4.0 License. For more information, refer to the license file.
License: CC BY-NC 4.0

About

A smart chatbot that uses Generative AI, LLMs, and Retrieval-Augmented Generation (RAG) to provide personalized gift suggestions. It combines real-time information retrieval with creative responses for tailored recommendations. Built with Python, utilizing frameworks like LangChain and OpenAI API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 3

  •  
  •  
  •