ChatGPT Wrapper is an open-source tool unofficial API that lets you interact with ChatGPT in Python and from Terminal.
🤖 Programmable ChatGPT. The ChatGPT Wrapper lets you use the powerful ChatGPT bot in your Python scripts or on the command line, making it easy to leverage its functionality into your projects.
💬 Runs in Shell. You can call and interact with ChatGPT in the terminal
Here's an example of how to use the ChatGPT Wrapper in Python:
from chatgpt_wrapper import ChatGPT
chatbot = ChatGPT()
while True:
inp = input("You: ")
response = chatbot.ask(inp)
print("\nChatGPT: " + response + "\n")
You can also use the ChatGPT Wrapper on the command line:
Run an interactive session in the terminal by using
$ chatGPT
Or get the response for one question
$ chatGPT Write a grep command to find all names of functions in a python script
chatgpt-shell_cHeKWvs6.mp4
To use this repository, you will need to have the following packages installed:
setuptools
: This package is used to create and manage Python packages.
You can install it using pip install setuptools
.
Clone this repository and install the required dependencies:
pip install git+https://github.com/mmabrouk/chatgpt-wrapper
Setup the script by logging in to your openai account for the first time only.
chatgpt install
To use the ChatGPT
class, create an instance of the class and use the ask
method to send a message to OpenAI and receive the response. For example:
from chatgpt_wrapper import ChatGPT
bot = ChatGPT()
response = bot.ask("Hello, world!")
print(response) # prints the response from chatGPT
The say method takes a string argument representing the message to send to ChatGPT, and returns a string representing the response received from ChatGPT.
You can run the command chatGPT in shell and you can talk with it in shell
We welcome contributions to ChatGPT Wrapper! If you have an idea for a new feature or have found a bug, please open an issue on the GitHub repository.
This project is licensed under the MIT License - see the LICENSE file for details.
- This project is a modification from Taranjeet code which is a modification of Daniel Gross code.