This project provides a convenient way to communicate with OpenAI models through various interfaces. The following methods are currently supported:
Run the cli tool and enter your queries directly in the terminal.
./ask-gpt "Why do trees grow branches?"
Use the provided Alfred workflow to quickly access the model and input your queries without leaving your current application.
Fast answer:
qa Why do trees grow branches?
More expensive and larger answer:
qal Why do trees grow branches?
Activate Raycast, type ask
and <tab>
to start filling the prompt argument.
ask Why do trees grow branches?
Find out more in the Readme file located in the raycast
directory.
As you can see MacOS is doubly covered, but what about Windows and Linux? I'll be writing other integrations too, but you're more than welcome to submit PRs with your implementation for tools like Wox or Cerebro!
- Clone the repository to your local machine.
- Install
requests
usingpython3 -m pip install requests
Cmd+click
the.alfredworkflow
file and follow the instructions in the config step. You'll have to supply your OpenAI API key.
Build it yourself with the Golang build tool:
cd cli
go build
Create a .env
file where the executable is, and fill it in. More details in the cli README
Example of a .env
file:
OPENAI_API_KEY=sk-abcdefg
OPENAI_MODEL=text-davinci-003
OPENAI_TEMPERATURE=0.7
OPENAI_MAX_TOKENS=30
- Add the
ask-gpt.py
script to a directory of your choice, be it an already existing scripts directory or a new one like thisraycast
directory.
If it's a new directory, you'll have to tell Raycast about it
- In Raycast, go to
Extensions
, thenscripts
, click theAdd
icon,pick script directory
and point it to the directory you chose.
- Create a new file in the same scripting directory and name it
openai.toml
. Put your API key in it likeapikey = "sk-abcde"
- This script references
#!/usr/bin/env python3
for Python, but you might want to repoint it at an installation that works for you. The script needsrequests
andtoml
- though feel free to modify.
You should be good to go. Fire up Raycast, type ask
and <tab>
to start filling the prompt argument.
More details in the Raycast README