rfaile313 / alfred-gpt

Alfred GPT lookup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

alfred-gpt

A convinient way to call GPT using Alfred. This workflow sends an OpenAI/GPT request off and opens the response in a new browser tab when it's done. The output is also saved as an HTML document for later referencing.

Screen.Recording.2023-03-31.at.12.39.35.PM.mov

Requirements:

python3 > 3.6

requests module (python3 -m pip install requests)

How to use:

  1. Clone this repository and double click the "GPT-3 Lookup.alfredworkflow" file to add it to Alfred.

  2. You must add an API KEY to config.json:

{
"API_KEY" : "YOUR_API_KEY_GOES_HERE",
"MODEL" : "text-davinci-003",
"TEMPERATURE" : 0.0,
"MAX_TOKENS" : 1000
}

You can also change the model, temperature, or tokens here. Refer to the OpenAI docs for more information.

  1. Unfortunately because this is run through alfred, the tool requires absolute paths which are not the same at runtime (meaning trying to find them with tools like python's os module will not work).

So you must add these yourself. There are 2 manual paths to change. One in the code:

SOURCE_DIR="/path/to/your/dir/for/alfred-gpt"

example: SOURCE_DIR="/Users/rfaile313/alfred-gpt"

And one in the Alfred workflow itself:

Screenshot 2023-03-14 at 12 55 46 PM

Screenshot 2023-03-14 at 12 56 23 PM

example: /opt/homebrew/bin/python3 /Users/rfaile313/alfred-gpt/main.py "$1"

Note: your python3 path may be different than /opt/homebrew/bin/python3 -- you can check in your terminal with $which python3

About

Alfred GPT lookup


Languages

Language:Python 100.0%