Skip to content

Prompting ChatGPT-3 course by OpenAI. Bonus implementation of Yoda telegram AI

Notifications You must be signed in to change notification settings

AlessandroBonomo28/OpenAI-Prompting-Course

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI Prompting Course

Prompting ChatGPT-3 course by OpenAI https://www.deeplearning.ai/short-courses/chatgpt-prompt-engineering-for-developers/

Get started

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

What you will find in this repo

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

Sample-bot

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.

Multi ego bot

Is a more sofisticated bot that and can switch into its neapolitan alter ego.

Bot in action

Yoda can do a lot of things! Here's an example of me chatting with him

yodacommands

Now let's ask him some questions

story

Yoda is context-aware and can remember previous messages, let's prove it!

context

You can also empty Yoda's memory

clear

Yoda seems pretty chill, let's switch to its neapolitan ego

yodanapoli

.env configuration for scripts in the telegram folder

#.env file

OPENAI_API_KEY = "xxxxxxx"

TOKEN_TELEGRAM = "xxxxxxx"

WHITELIST_ID_TELEGRAM = "aaaa,bbbb,cccc,ddddd"

About

Prompting ChatGPT-3 course by OpenAI. Bonus implementation of Yoda telegram AI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages