Skip to content

kiet21042003/ChatGPT-Function-Calling-with-Laptop-Seller-Chatbot

 
 

Repository files navigation

Chat'Innov Hackathon - Laptop Seller Chatbot

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:

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.

image


Installation

  • 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"

Way 1: Run directly on your machine

  • 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

Way 2: Using Docker

  • 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)


Repository Structure

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 ~/

About

This repository keeps code for my hackathon competition in creating ChatGPT integrated chatbot for selling laptop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.6%
  • Dockerfile 0.4%