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

feat: support custom keys for custom Open AI models #14299

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

sdirix
Copy link
Member

@sdirix sdirix commented Oct 11, 2024

What it does

The configuration for custom OpenAI models now allows specifying a unique 'apiKey' for each model, or reusing the global OpenAI API key.

fixes #14288

How to test

  • Add a custom Open AI model (does not need to be reachable for testing)
  • Debug the "initializeOpenAi" method in the Open AI language models
    • should use no-key if no apiKey is specified
    • should use the specified key in apiKey if it exists
    • should use the global key (preference or environment variable) if apiKey is set to true

Note that during my testing not every nested change of the custom model preference resulted in a preference notification. To be safe you can reload the whole window which will trigger a "force-read" of the preferences. I think this issue is unrelated to the changes here.

Review checklist

Reminder for reviewers

The configuration for custom OpenAI models now allows specifying a
unique 'apiKey' for each model, or reusing the global OpenAI API key.

fixes eclipse-theia#14288
@planger planger self-requested a review October 17, 2024 13:55
Copy link
Contributor

@planger planger left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to me! 👍 Works as advertised. I just tested it via debugging through the code, but not with an actual custom OpenAI compatible model though.

@sdirix sdirix merged commit fc1b88e into eclipse-theia:master Oct 17, 2024
11 checks passed
@sdirix sdirix deleted the openai-custom-key branch October 17, 2024 14:17
@sdirix sdirix added this to the 1.55.0 milestone Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

API key passthrough missing for custom OpenAI-compatible models
2 participants