/tg-openai-binder

A simple Telegram bot to interact with Open AI models 🤖

Primary LanguagePythonMIT LicenseMIT

tg-openai-binder

ChatGPT Telegram

Python Docker

A simple Telegram bot to interact with Open AI models

Build

  1. clone this repo via

    git clone https://github.com/m0t9/tg-openai-binder
  2. set your parameters in .env file

    Parameter Meaning
    API_KEY Your OpenAI API key
    MODEL Name of used OpenAI model
    PROXY Optional. Proxy server for OpenAI queries processing
    TOKEN Telegram bot token
    START_PLACEHOLDER Message that bot will send as response to /start command
    PLACEHOLDER Message that bot will show while request processing
    CLEAR_CONTEXT_ANSWER Message that bot will send as response to /delete_context command
    CONTEXT_SIZE Number of the last messages in the dialogue with bot that will be considered as context. High values affect RAM usage
    OPEN_AI_ERROR Message that bot will send if something goes wrong during OpenAI query processing
    ALLOWED_IDS List of Telegram users (separated by comma) IDs that are allowed to interact with bot
    ENABLE_RENDER True or False. Exposes the web-server on :10000 (required for render.com free-tier web-service deployment)
  3. execute this command in repo root directory

    docker-compose up -d --build

Interaction

Command Meaning
/start Start dialogue with bot. As response it sends START_PLACEHOLDER
/delete_context Clears the dialogue context with user. Sends CLEAR_CONTEXT_ANSWER
any other text Will be considered as a query to OpenAI
image