Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.
/ GPT3-cli Public archive

A python script which lets you ask questions OPEN AI chat GPT-3 using OPENAI API

Notifications You must be signed in to change notification settings

R34LUS3R/GPT3-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Archiving becuase there is a better version avaialable which lets you intereact with the unreleased chatgpt model and not just OpenAI's davinci model:
https://github.com/acheong08/ChatGPT

Installation

pip3 install revChatGPT

Command line

OfficialChatGPT --api_key API_KEY

GPT-3 CLI

A command-line interface for interacting with the OpenAI GPT-3 API.

Bellow is the repository before Archived

(Though you should be able to interact with the offical davinci model of OpenAI)

Requirements:

  1. Python 3.5 or later
  2. The requests library (install with pip3 install requests)
  3. The pygments library (install with pip3 install pygments)
  4. An OpenAI API key (sign up for a free API key at https://beta.openai.com/ and after login head towards https://beta.openai.com/account/api-keys for API key"

Usage:

gpt.py [-h] [-k API_KEY] [prompt]

optional arguments:

-h, --help show this help message and exit

-k API_KEY, --api-key API_KEY OpenAI API key

You can specify the OpenAI API key either as a command-line argument (-k or --api-key) or as an environment variable called OPENAI_API_KEY. If you do not specify the API key, the script will look for the OPENAI_API_KEY environment variable.

To setup the environment variable:

export OPENAI_API_KEY=sk-ny0KrxyJrYMAqPuq+EpKiGmlkfUfrTvberror // demo key

Its recommended to add this into .bashrc, .zshrc or .profile in your home root directory as this way you wouldn't have to set it up or declare each time:

echo "export OPENAI_API_KEY=sk-ny0KrxyJrYMAqPuq+EpKiGmlkfUfrTvberror" >> ~/.bashrc

To run the script, enter the following command:

pip3 install -r requirements.txt

chmod +x gpt.py

./gpt.py or python3 gpt.py "give me a ruby script for scraping a website"

You can also make the script executable and move it to a directory in your PATH (e.g. /usr/local/bin):

cp gpt.py /usr/local/bin/g3

Then you can run the script from any directory by simply typing g3 from anywhere.

g3 "how do I convrt pdf to docx from cli?"


Configuration:

The default values for the script's arguments are hardcoded at the top of the script. You can modify these values to change the behavior of the script.

MODEL: Specifies the model to use (default: text-davinci-003)

TOKEN_COUNT: Specifies the number of tokens to generate (default: 300)

TEMPERATURE: Specifies the temperature (default: 0.4)

TOP_P: Specifies the top_p value (default: 1)

FREQUENCY: Specifies the frequency penalty (default: 0.5)

PRESENCE: Specifies the presence penalty (default: 0.5)

About

A python script which lets you ask questions OPEN AI chat GPT-3 using OPENAI API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages