Git Product home page Git Product logo

chatbot's Introduction

chatbot

AI Discord chat bot using OpenAI fine-tuning

Installation

pip install -r requirements.txt

pip install --upgrade openai

cp .env.example .env

Setup

Create a Discord Bot:

  1. Navigate to https://discord.com/developers
  2. Add an application
  3. Click on the bot tab to add a bot to the application
  4. Click on OAuth2 -> URL Generator and select bot to generate a unique URL to add the bot to a server where you have admin privileges

Screen Shot 2021-11-20 at 4 39 33 PM

5. Save your bot's token (Under the bot tab, as pictured below) as DISCORD_TOKEN in .env

Screen Shot 2022-03-29 at 3 51 11 PM

Populate the required variables in .env:

  • DISCORD_TOKEN: As specified above, the unique token for the Discord bot you've created
  • BOT_USERNAME: Sets the command which the bot will respond to. For example if BOT_USERNAME = test, then the bot will respond to messages starting with !test
  • OPENAI_KEY: OpenAI API Key
  • OPENAI_MODEL: ID of the OpenAI model for the bot to use. This can be a standard model such as curie or a custom model you have fine-tuned based on chat history.

Usage

python bot.py to start the bot

  • In a discord server with the bot, send the message !history to have the bot log the current channel's history, by user.

    • This will create .jsonl files for each user in the channel, which can then be input to OpenAI's fine-tuning feature.
  • Select a user you'd like to model the AI on, and prepare the data:

openai tools fine_tunes.prepare_data -f channel_[channel_name]/[user].jsonl

  • It is recommended to accept all of the edits that OpenAI suggests - these will be saved in a new file. Finally, submit the prepared data to OpenAI:

openai api fine_tunes.create -t "channel_[channel_name]/[user]_prepared.jsonl" --batch_size 1

  • Once the model is created, update .env to use this model, and interact with the bot using ![BOT_USER]. For example, if your bot is based on the Discord user test, then the bot will respond to messages starting with !test

Questions?

Contact tv#3636 on Discord with any questions

chatbot's People

Contributors

tv3636 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.