Prompting ChatGPT-3 course by OpenAI https://www.deeplearning.ai/short-courses/chatgpt-prompt-engineering-for-developers/
Note: I am using Python 3.11.0 but I think that this will work also for 3.9 and 3.10
- Get the GPT API key from the offical website of OpenAI
- Create a virtual environment
python -v venv env
- Create a file named .env and edit as follows
# .env file
OPENAI_API_KEY = "xxxxxxx"
TOKEN_TELEGRAM = "xxxxxxx"
WHITELIST_ID_TELEGRAM = "aaaa,bbbb,cccc,ddddd"
- run the environment
# If you are using windows Windows
./env/Scripts/activate
# If you are using Linux
source env/bin/activate
- install dependencies
pip install -r requirements.txt
Now you can run any python file in the repository
python file.py
In this repo there are two main folders
- lessons
- telegramAI
In the lesson folder there are code example of gpt prompting. I advice you to start with start.py.
In the telegram folder I made a telegram chatbot powered by ChatGPT AI. You will find two scripts in this folder:
- multi-ego-bot.py
- sample-bot.py
Is a basic template that I made for making custom telegram bots. This bot speaks like Yoda from Star Wars, can remember previous questions, is context-aware and can produce pretty funny answers.
Is a more sofisticated bot that and can switch into its neapolitan alter ego.
Yoda can do a lot of things! Here's an example of me chatting with him
Now let's ask him some questions
Yoda is context-aware and can remember previous messages, let's prove it!
You can also empty Yoda's memory
Yoda seems pretty chill, let's switch to its neapolitan ego
#.env file
OPENAI_API_KEY = "xxxxxxx"
TOKEN_TELEGRAM = "xxxxxxx"
WHITELIST_ID_TELEGRAM = "aaaa,bbbb,cccc,ddddd"