Git Product home page Git Product logo

brainy's Introduction

Brainy

Telegram Chatbot with OpenAI GPT

This project is a Telegram Chatbot that uses OpenAI's GPT language model to generate responses to user messages. The bot can be used in both private conversations and group chats.

Requirements

To use this Chatbot, you'll need the following:

  • A Telegram account
  • A Telegram bot token (you can get one by talking to the BotFather)
  • An OpenAI API key (you can get one by signing up for OpenAI's GPT service)

Installation

To install and run the Chatbot, follow these steps:

  1. Clone this repository to your local machine.
  2. Install the required dependencies using go get

go get github.com/go-telegram-bot-api/telegram-bot-api

  1. Set the following environment variables in config.yml:

telegram_api_key: your-Telegram-bot-token

openai_api_key: your-OpenAI-API-key

  1. Start the Chatbot by running the following command:

go run main.go

Usage

Start new chat with the bot by sending a message to it. The bot will respond with a generated message. You can also add the bot to a group chat and it will respond to messages in the group. For every user or chat ID bot stores some context, size of the context is defined by maxTokens parameter in a ContextManager. Bot recognizes commands in the following format:

ask regular question to the bot, you don`t need to use this command in a private chat, just ask a question

/ask question

set a topic or subject for the bot to talk about, this will be added to the beginning of the generated prompts

/topic some subject

clear the cashed context and topic

/clear

some experimental features to use ChatGPT as a word translator

/cat translate word from Catalan to English

/cas translate word from Spanish to English

bot will respond with a random fact

/hello

bot will respond with a help message, describing the commands

/help

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

This project was inspired by OpenAI's GPT language model and the Telegram Bot API. Thanks to both projects for their great work!

brainy's People

Contributors

ruslan-hut avatar

Stargazers

 avatar

Watchers

 avatar  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.