A CLI to easily ask GPT-3 questions from your terminal.
Ask a question (ensure your question is wrapped in quotes), and then sit back and watch the magic of AI happen.
$ ask-gpt "who is the prime minister of canada?"
The prime minister of Canada is Justin Trudeau.
Additionally, you can pass the temperature parameter with -t <float>
like below.
ask-gpt -t 0.9 "best type of food"
That really depends on what you are looking for. Some of the most popular types of food include Italian, Chinese, Mexican, Mediterranean, American, French, and Japanese.
The configuration parameters to call the model with.
-
temperature
- The temperature of the model. Higher values will result in more creative responses, but also more mistakes. Lower values will result in more conservative responses.float
value between 0 and 1 inclusive. The default value is 0. -
max_tokens
- The maximum number of tokens to generate in the completion. The default value is 1,000. More info on tokens can be found here. -
completions_model
- The model to use for completions. The default value istext-davinci-003
. The list of available models can be found here.
- Ensure you have
docker
installed. Install it here if you don't yet have it. - Create an OpenAI API key (they have free trial keys), and save it in a safe place.
- Create a
.env
file in the root of the project and add the following line:
OPENAI_API_KEY=<your api key here>
-
Clone the repo
-
Build a docker image
docker build -t ask-gpt .
- You should now be able to run the CLI with docker
docker run -t ask-gpt "why is docker great?"
- (Optional) For a less verbose command, add an alias to your
.bashrc
or.zshrc
file, or the equivalent for your shell.
alias ask-gpt="docker run -t ask-gpt"
Now you can use
ask-gpt "why is docker great?"
- add more configuration options
- context memory for follow-up questions