Skip to content

Add plugin for OpenAI CLI - #152

Merged
jodyheavener merged 1 commit into
mainfrom
jh/add-openai
Jan 19, 2023
Merged

jodyheavener merged 1 commit into
mainfrom
jh/add-openai

Conversation

@jodyheavener

Copy link
Copy Markdown
Member

This PR adds a new plugin for the CLI in OpenAI's Python libary.

This CLI uses a single API Key environment variable, so the plugin simply provisions that.

Testing steps

  • Install the OpenAI CLI
  • Create an OpenAI account
  • From your account, create a new API Key
    • Either create a new vault item with this key, or manually create one during plugin init
  • Checkout this branch: git pull && git checkout jh/add-openai
  • Build the plugin make openai/build
  • Init the plugin: op plugin init openai, source plugins
    • If you haven't created a vault item, this is where you'll manually create one with you API Key
  • Run a command, for example: openai api completions.create -e ada -p "Hello world"

The command should successfully execute. Using the above example, the result would be:

CleanShot 2023-01-17 at 19 31 32@2x

Example secrets:

API Key:
  API Key: sk-yEyY18xzH5IiiORdCDzstp1h2xrxCydfh9tjFveUyEXAMPLE
Comment thread plugins/openai/api_key.go Resolved

@hculea hculea left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this addition! Looks good, code-wise, just a more conceptual question from my part.

@accraw accraw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me too!

@jodyheavener
jodyheavener merged commit 570b3f0 into main Jan 19, 2023
@jodyheavener
jodyheavener deleted the jh/add-openai branch January 19, 2023 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants