Discord bot that leverages the power of Google's Gemini-Pro API to interact with users in both text and image formats. It processes messages and images sent to it, generating creative and engaging responses.
This Gemini bot now is running Gemini Flash 1.5, PDF's and text files are now supported along with parsing transcripts from youtube videos and scraping of text from URLs.
The original bot that just does text and images is under GeminiSimple.py
, If you don't want the extra capabilities and want to make something new.
beautifulsoup4 (scraping)
Recently updated to use Google Flash 1.5 you may need to update your python package
pip install --upgrade google-generativeai
Install the required Python libraries:
pip install -U -r requirements.txt
The bot will start listening to messages in your Discord server. It responds to direct mentions or direct messages.
Create a .env
file and copy the contents of .env.example
into it
Fill in the following values:
DISCORD_BOT_TOKEN
: Your Discord bot tokenGOOGLE_AI_KEY
: Your Google AI API key. Google API Key can be acquired from https://makersuite.google.com/MAX_HISTORY
: The maximum number of messages to retain in history for each user. 0 will disable historyGeminiDiscordBot.py
You can preprompt your request just like with images. If you just paste a URL and no context it default to the SUMMERIZE_PROMPT
which is set to Give me 5 Bullets about
feel free to change this in the code
Examples:
Write me a tweet about {url}
What did they think of {youtubeVideo transcript}
The system_prompt for Gemini Flash has been commented out just uncomment if you want to use it.
Feel free to fork the project and customize it according to your needs. Make sure to follow the guidelines set by Discord and Google for bot development and API usage.
Web Urls: