Coder Social home page Coder Social logo

rochoa85 / chatgpt-wrapper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from llm-workflow-engine/llm-workflow-engine

1.0 0.0 0.0 2.09 MB

API for interacting with ChatGPT using Python and from Shell.

License: MIT License

Shell 1.06% Python 98.94%

chatgpt-wrapper's Introduction

ChatGPT Wrapper

ChatGPT Wrapper is an open-source tool unofficial API that lets you interact with ChatGPT in Python and from Terminal.

Highlights

๐Ÿค– 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

How it works

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

Screenshot 2022-12-03 at 21 11 44

chatgpt-shell_cHeKWvs6.mp4

Requirements

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.

Installation

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

Usage

Python

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.

shell

You can run the command chatGPT in shell and you can talk with it in shell

Contributing

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

chatgpt-wrapper's People

Contributors

mmabrouk avatar natanel-shitrit avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.