PitchGen is a python Discord bot aimed at easing and improving the process of generating great pitches for your great ideas.
Leveraging Anthropic’s Claude 3.5 and OpenAI’s GPT-4o-mini to create effective and impressive texts and DALL-E 2 to generate suggestive visualizations of the concepts, PitchGen gives you thorough support in the creative process for your pitches!
Make sure that your environment has:
The installation process should work both on Windows and on Linux.
First of all, clone this repository:
# BOTH Windows and Linux
git clone https://github.com/AstraBert/pitchgen-bot
cd pitchgen-bot
Rename .env.example
to .env
and paste your OpenAI and Anthropic API keys in the dedicated fields:
# BOTH Windows and Linux
mv .env.example .env
Get the supabase
command line executables:
# BOTH Windows and Linux
npm install supabase
Create and start a Supabase instance:
# BOTH Windows and Linux
npx supabase init
npx supabase start
Retrieve the API URL from API URL
and the ANON key from anon key
that will be printed after this command:
# BOTH Windows and Linux
npx supabase status
Save the API URL and the ANON key respectively under the supabase_url
and the supabase_api_key
field in your .env file.
Create a virtual environment, activate it and install the necessary dependencies:
# Linux
python3 -m venv pitchgen
source pitchgen/bin/activate
python3 -m pip install -r requirements.txt
Or
# Windows
python3 -m venv .\pitchgen
.\pitchgen\Scripts\activate # For Command Prompt
# or
.\pitchgen\Activate.ps1 # For PowerShell
python3 -m pip install -r .\requirements.txt
If you wish to limit your chat history retrieval (say you want to keep only the latest 10 messages) or want to control the number of generated images (must be between 1 and 10, let’s say 7), you can edit the .config
file:
num_images=7
limit_history=10
How do you create a Discord bot? It is really simple!
discord_bot
field in your .env
file.channel_id
field in your .env
file, insert the last number that is displayed in your server’s #general channel url when you open it on the web.Now that the virtual python environment has been set up and activated, Supabase is running and all the secret keys are in .env
, we can finally run the bot:
python3 scripts/bot.py
You should see some logging and then receive a message on your server’s general channel, saying that the bot is up and running. From now on, you can chat directly with the bot on Discord.
There are four possibilities when messaging with the bot:
ChatHistory
, which will serve as storage for chat your chat history: this is managed by ChatHistory
class in utils.py. Chat history retrieval is session-based and user-based: user is defined by Discord user name (whicch should be unique) while session id is managed through the SessionHistory
class in utils.py.invoke
method in ChatAnthropic
class in utils.py.invoke
method in Summarizer
class in utils.py.generate_img
method in ImageGen
class in utils.py and returned to the user.Contributions are more than welcome! See contribution guidelines for more information :)
If you found this project useful, please consider to fund it and make it grow: let’s support open-source together!😊
This project is provided under MIT license: it will always be open-source and free to use.
If you use this project, please cite the author: Astra Clelia Bertelli