Giter Club home page Giter Club logo

groq-chatbot's Introduction

Groq API Telegram Bot

A Python Telegram bot powered by Groq API.

This is a Python Telegram bot that uses Groq API to generate creative text formats based on user input. It is designed to be a fun and interactive way to explore the possibilities of large language models.

Features

  • Generate creative text formats like poems, code, scripts, musical pieces, etc.
  • Stream the generation process, so you can see the text unfold in real-time.
  • Reply to your messages with Bard's creative output.
  • Easy to use with simple commands:
    • /start: Greet the bot and get started.
    • /help: Get information about the bot's capabilities.
  • Send any text message to trigger the generation process.
  • Send any image with captions to generate responses based on the image. (Multi-modal support)
  • User authentication to prevent unauthorized access by setting AUTHORIZED_USERS in the .env file (optional).

Requirements

  • Python 3.10+
  • Telegram Bot API token
  • Groq API Key
  • dotenv (for environment variables)
  • MongoDB (for storing chat history - optional)

Docker

GitHub Container Registry

Simply run the following command to run the pre-built image from GitHub Container Registry:

# Save your environment variables in a file .env
docker run --env-file .env ghcr.io/rabilrbl/groq-chatbot:latest

Update the image with:

docker pull ghcr.io/rabilrbl/groq-chatbot:latest

Build

Build the image with:

docker build -t groq-chatbot .

Once the image is built, you can run it with:

docker run --env-file .env groq-chatbot

Installation

  1. Clone this repository.
  2. Install the required dependencies:
    • pipenv install (if using pipenv)
    • pip install -r requirements.txt (if not using pipenv)
  3. Create a .env file and add the following environment variables:
    • BOT_TOKEN: Your Telegram Bot API token. You can get one by talking to @BotFather.
    • GROQ_API_KEY: Your Groq API key. You can get one by signing up at Groq Console.
    • MONGODB_URL: Your MongoDB connection URL. Get one from MongoDB Atlas. (optional)
    • AUTHORIZED_USERS: A comma-separated list of Telegram usernames or user IDs that are authorized to access the bot. (optional) Example value: shonan23,1234567890
  4. Run the bot:
    • python main.py (if not using pipenv)
    • pipenv run python main.py (if using pipenv)

Usage

  1. Start the bot by running the script.
    python main.py
  2. Open the bot in your Telegram chat.
  3. Send any text message to the bot.
  4. The bot will generate creative text formats based on your input and stream the results back to you.
  5. If you want to restrict public access to the bot, you can set AUTHORIZED_USERS in the .env file to a comma-separated list of Telegram user IDs. Only these users will be able to access the bot. Example:
    AUTHORIZED_USERS=shonan23,1234567890

Bot Commands

Command Description
/start Greet the bot and get started.
/help Get information about the bot's capabilities.
/new Start a new chat session.
/model Change the LLM model.
/system_prompt Change the system prompt.

Star History

Star History Chart

Contributing

We welcome contributions to this project. Please feel free to fork the repository and submit pull requests.

Disclaimer

This bot is still under development and may sometimes provide nonsensical or inappropriate responses. Use it responsibly and have fun!

License

This is a free and open-source project released under the GNU Affero General Public License v3.0 license. See the LICENSE file for details.

groq-chatbot's People

Contributors

dependabot[bot] avatar rabilrbl avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

alfsoft

groq-chatbot's Issues

Responses based on images.

Hi !

love this project, deployed it yesterday. So far so gooof but Iโ€™m no able to generate responses based on the image.

Using docker version, maybe I do it wrong.

Thanks a lot for your great work !

Julien

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.