Skip to content

reyoung/chatgpt-python

 
 

Repository files navigation

PyPi License

ChatGPT Python SDK

Buy Me A Coffee

Install or update

pip install -U chatgpt

Create a file with your credentials

⚠️   Please, update the library. Note the change in the config file.

Create the file config.json in your working directory:

{
    "email": "[email protected]",
    "password": "xxx"
}

Usage

CLI

You can launch the CLI with:

chatgpt

or

python -m chatgpt

These are the available commands:

  • reset: forget the context of the current conversation.
  • clear: clear the terminal.
  • exit: exit the CLI.

SDK

from chatgpt import Conversation

conversation = Conversation()
print(
    conversation.chat(
        "We are going to start a conversation. "
        "I will speak English and you will speak Portuguese."
    )
)
print(conversation.chat("What's the color of the sky?"))

# The AI will forget it was speaking Portuguese
conversation.reset()
print(conversation.chat("What's the color of the sun?"))

About

Unofficial Python SDK for OpenAI's ChatGPT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 93.4%
  • JavaScript 5.9%
  • Other 0.7%