Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update(openai): Support "oaieval" and "oaievalset" as executables within the "openai" shell plugin #208

Merged
merged 5 commits into from Jun 28, 2023

Conversation

arunsathiya
Copy link
Contributor

This PR introduces a Shell Plugin for OpenAI's new Evals framework that was announced as part of the GPT-4 language model.

This is a fairly straightforward shell plugin as the Evals CLI expects a OPENAI_API_KEY environment variable with the OpenAI API Key which can be obtained on the OpenAI API Keys page. There's no CLI flag that accepts the API Key, nor a configuration file.

There's a way to set the API Key within an individual Evals module code though, using openai.api_key or a path to the configuration file using openai.api_key_path but neither are applicable to Shell Plugins because that's within the context of the Evals module code:

No API key provided. You can set your API key in code using 'openai.api_key = <API-KEY>', or you can set the environment variable OPENAI_API_KEY=<API-KEY>). If your API key is stored in a file, you can point the openai module at it with 'openai.api_key_path = <PATH>'. You can generate API keys in the OpenAI web interface. See https://onboard.openai.com for details, or email support@openai.com if you have any questions.

Here's how to test

  • Clone the Evals repository and set it up as outlined under Making evals section.
  • Checkout the current PR branch and run make evals/build
  • Set up API Key on 1Password by running op plugin init oaieval (API Key can be obtained from this page)
  • Future runs for oaieval will use the API Key stored on 1Password.
  • To test, run an example eval like oaieval gpt-3.5-turbo test-match and ensure it runs successfully.

Blockers

  • The Evals framework project introduces not only oaieval CLI command but also oaievalset to test eval sets.
  • As my understanding stands (from the flyctl PR), there isn't currently a way to introduce more than one executable command for a shell plugin without changes to the op CLI code. So, I am not sure how to proceed here.

@arunsathiya arunsathiya changed the title new(OpenAI Evals): New Plugin with Environment variable based importing and provisioning new(evals): OpenAI Evals plugin with Environment variable based importing and provisioning Mar 15, 2023
@hculea
Copy link
Member

hculea commented Mar 21, 2023

Hey Arun, thank you for your contribution!

I am wondering, what similarity does this plugin bear with the openai plugin? https://github.com/1Password/shell-plugins/blob/main/plugins/openai

Would it make sense to add another executable to the same plugin, or perhaps at least reuse the credential definition?

@arunsathiya
Copy link
Contributor Author

Hi @hculea, great question! OpenAI Evals is a different project from OpenAI's openai CLI project. The latter is access to the OpenAI API, while Evals is only a framework/benchmark registry for OpenAI models and allows the general public to contribute evaluations that help understand where GPT 3.5 (current ChatGPT model) and GPT 4 (the newest model) stand.

Also, OpenAI CLI's executable is openai while Evals framework's executable is oaieval, which means we cannot include both of them in the same Shell Plugin.

@hculea
Copy link
Member

hculea commented Mar 29, 2023

Thanks for clarifying! 😄 Is the credential definition the same between the two, though?

I see that both use an envvar provisioner with OPENAI_API_KEY, not sure if the credential composition is the same across the two of them?

edit: just to clarify, the rest looks good to me. This comment only aims to reduce some code duplication.

@arunsathiya
Copy link
Contributor Author

I haven't compared the credential composition so far, but the main blocker is that we cannot configure a Shell Plugin with two executables. I've started a conversation here:

Will mark this PR as a draft until that's a possibility.

@arunsathiya arunsathiya marked this pull request as draft March 29, 2023 10:07
@arunsathiya arunsathiya changed the title new(evals): OpenAI Evals plugin with Environment variable based importing and provisioning update(openai): Support "oaieval" and "oaievalset" as executables within the "openai" shell plugin Apr 24, 2023
@arunsathiya arunsathiya marked this pull request as ready for review April 24, 2023 07:32
@arunsathiya
Copy link
Contributor Author

@hculea Following the same guidance as in Flyctl PR, evals shell plugin has been completely dropped, and oaieval and oaievalset executables are now supported within the openai shell plugin. After all, those two executables and openai use the same credential composition.

Please let me know how things look now.

@AndyTitu AndyTitu added the waiting-on-reviewer signals that a certain PR is waiting for a review from a 1Password team member label Apr 26, 2023
Copy link
Contributor

@accraw accraw left a comment

Choose a reason for hiding this comment

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

Tested, it worked for me!

@accraw accraw added waiting-on-sec-review and removed waiting-on-reviewer signals that a certain PR is waiting for a review from a 1Password team member labels Apr 26, 2023
@hculea hculea added waiting-on-reviewer signals that a certain PR is waiting for a review from a 1Password team member and removed waiting-on-sec-review labels Jun 2, 2023
@accraw accraw merged commit 1e4048c into 1Password:main Jun 28, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-reviewer signals that a certain PR is waiting for a review from a 1Password team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants