This repository contains the code for the Chat'Innov Hackathon with the goal of creating a chatbot that can help a "poor" student to buy a best laptop with a limited budget. In this hackathon, we won the 1st prize and the gift is an Dell 💻 Inspiron 15 laptop 😊
This chatbot is created using:
-
Streamlit framework for GUI
-
GPT-3.5-Turbo-16k model for the chatbot.
The interesting thing here is that the chatbot is guided using a SQLite database containing ~ 240 laptops crawled from Thế Giới Di Động and using the new feature of ChatGPT API - Function Calling to using some predefined functions.
- Clone this repository
git clone https://github.com/2uanDM/ChatGPT-Function-Calling-with-Laptop-Seller-Chatbot
- Change your environment variables in
.env
file
OPENAI="YOUR OPENAI API KEY"
TELEGRAM_ID="YOUR TELEGRAM ID"
TELEGRAM_BOT_TOKEN="YOUR BOT TOKEN"
- Creating a virtual environment
# On Windows
python -m venv .venv
# On Linux
python3 -m venv .
# Conda users
conda create -n .venv python=3.11
- Activate the virtual environment
# On Windows
source .venv/Scripts/activate
# On Linux
source .venv/bin/activate
# Conda users
conda activate .venv
- Install the requirements
pip install -r requirements.txt
- Run the app
streamlit run main.py
- Build the image
docker build -t chatinnov .
- Run the container
docker run -p 443:443 chatinnov
(You can change the port to whatever you want)
Name | Explain | Location |
---|---|---|
main.py | The main file to run the app | ~/ |
temp_queries | The folder that contain temporary csv (query results when user asking chatbot for a specific laptop spec) | ~/.temp |
config | Folder that contain some configs for the app, including the function calling description | ~/ |
images | Folder that contain some images for the README.md | ~/ |
prompts | Folder that contains some predefined prompts, acting as "system" in the GPT's API context | ~/ |
src | Folder that contains the source code for crawler | ~/ |
utils | Folder that contains some utility functions | ~/ |