Giter VIP home page Giter VIP logo

gpt3-telegram-chatbot's Introduction

GPT3-Telegram-Chatbot

OpenAI chatbot for Telegram using GPT-3 with sentiment analysis safety using VaderSentiment.

security: bandit Python 3.9.7

Command reference:

start - Basic start command.
help - Show quick help command.
reset - Reset the conversation.
retry - Retry the current input.
username - Set your character. See /help
botname - Set the bot character. See /help 

To set your character see this example: /username Bill Gates

To set the bot character name see this example: /botname Elon Musk Bot

Set these options in the python file:

#OpenAI API key
openai.api_key = "YOUR OPENAI API KEY GOES HERE"
#Telegram bot key
tgkey = "YOUR TELEGRAM BOT KEY GOES HERE"

Runs on latest python and latest python-telegram-bot pip plugins.

Screenshots

This is the chat and what the backend console looks like in debug mode: Alt text

For user privacy you can turn off debug in the python file.

Notes

  • The chat memory is configurable and might be safely set up to 3500 characters. Once it reaches 3000 characters the memory of the chat is reduced for api requirements. Each token is about 4-5 characters, and the api limit is 2000 tokens. When the limit is reached, the chat is cut off at a newline for continual operation. This can get expensive though, and if you can use less characters and reduce the memory by tweaking the ask function that would be helpful so the chat is not repetitive.

  • The bot has a 5 minute configurable timer, each user has 5 minutes to make a response and then it will be available to the next user.

  • The sentiment analysis should be set to around > 0.6 or > 0.7, when the negativity of the sentiment analysis is above this it will prompt for different input or a retry option.

  • If you want to change the bot to roleplay mode, change lines 223 and 238 to:

chat_log = 'The following is a roleplay between two users:\n\n'

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.