Closed sklarfox closed 2 months ago
The changes introduce functionality for managing OpenAI and Large Language Model (LLM) API keys within a Visual Studio Code extension. This includes the addition of commands for registering these API keys, securely handling secrets, and enhancing the overall capabilities of the ZenML environment. The updates span multiple files, establishing a structured approach to API key management and secret storage.
File | Change Summary |
---|---|
package.json |
Added command entries for registering OpenAI and LLM API keys. |
src/commands/secrets/cmds.ts |
Implemented registerOpenAIAPIKey and registerLLMAPIKey functions for secure key management. |
src/commands/secrets/registry.ts |
Defined registerSecretsCommands function to register secrets-related commands. |
src/common/vscodeapi.ts |
Introduced getSecret function for retrieving secrets securely using the provided context. |
πβ¨
In the garden of code, a secret we keep,
An API key tucked away, safe in its sleep.
With a hop and a jump, itβs now easy to find,
ZenML's magic has flourished, oh so kind!
So letβs celebrate changes, both shiny and bright,
A brave little bunny dances in delight!
ππ₯
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@coderabbitai review
@strickvl Thanks for the review! I've generalized the function to now also support Anthropic and Gemini on top of OpenAI.
I've made one additional change to the code; I have changed the naming convention for the secrets to prevent collision issues with other extensions. The previous names were {provider}_API_KEY
, but this seemed a little generic and could collide with other secrets the the vscode store. The new naming scheme is zenml.{provider}.key
, which is similar to other extensions' implementations.
@coderabbitai review
This pull request adds the ability to register an OpenAI API secret using VSCode's
SecretStorage
API.It adds one command to the command palette
Register OpenAI API Key
. You can use that to add/update your API key. It currently only supports OpenAI, but will be updated in the future to support other LLMs.To retrieve the API key, import the async function
getSecret
fromsrc/common/vscodeapi.ts
. You have to pass it anExtensionContext
object as an argument, along with a string for whichever secret you want (for OpenAI it will be'OPENAI_API_KEY'
). How exactly you get theExtensionContext
object is going to depend on how / where your code is executed.Summary by CodeRabbit
New Features
Bug Fixes
Documentation