Skip to content

A discord bot integrated with gpt-3.5. Support add customized data and response according to the knowledge base qrdant.

License

Notifications You must be signed in to change notification settings

furoxr/discord-ai-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

discord-ai-bot

standard-readme compliant

The Discord AI Bot is a bot service that is integrated with GPT-3.5 and supports custom knowledge for responses.

You can add customized data to the Qdrant database using upsert. When the bot is asked a question, it will search for the most relevant knowledge from Qdrant, and GPT-3.5 will generate a response based on this knowledge.

Table of Contents

Build from Source

You will need these dependencies:

Usage

Currently, you will need to run a Qdrant database locally. You can check the configuration file (production.yaml) of Qdrant here.

docker pull qdrant/qdrant
docker run -p 6333:6333 -p 6334:6334 \
    -e EDRANT__SERVICE_GRPC_PORT="6334" \
    -v $(pwd)/data:/qdrant/storage \
    -v $(pwd)/production.yaml:/qdrant/config/production.yaml \
    qdrant/qdrant

How to start a discord bot service

export OPENAI_API_KEY=YOUR_OPENAI_API_KEY
export DISCORD_TOKEN=YOUR_DISCORD_BOT_TOKEN
./discord-ai-bot start COLLECTION_NAME
`COLLECTION_NAME` is the collection name of the qdrant database, where your knowledge store.

How to Update knowledge into qdrant database

export OPENAI_API_KEY=YOUR_OPENAI_API_KEY
export DISCORD_TOKEN=YOUR_DISCORD_BOT_TOKEN
./discord-ai-bot update COLLECTION_NAME DATA_FILE_PATH

COLLECTION_NAME is the collection name of the qdrant database, where you will upsert knowledge into. DATA_FILE_PATH is the JSON file containing your knowledge, and the format of json file should be like:

{
  "title": "Title of the Document",
  "url": "Related url",
  "content": "............."
}

How to query the most related knowledge in terminal

export OPENAI_API_KEY=YOUR_OPENAI_API_KEY
export DISCORD_TOKEN=YOUR_DISCORD_BOT_TOKEN
./discord-ai-bot query COLLECTION_NAME YOUR_QUESTION

COLLECTION_NAME is the collection name of the qdrant database, which you will upsert knowledge into. Then it will attempt to utilize the embedding service of OpenAI API and the Qdrant database to provide you with a relevant result.

How to clear collection

export OPENAI_API_KEY=YOUR_OPENAI_API_KEY
export DISCORD_TOKEN=YOUR_DISCORD_BOT_TOKEN
./discord-ai-bot query COLLECTION_NAME

This operation will clear all data of COLLECTION_NAME in the Qdrant database.

Maintainers

@nada

License

MIT © 2023

About

A discord bot integrated with gpt-3.5. Support add customized data and response according to the knowledge base qrdant.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages