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: add support to custom base URL and models #143

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MagdielCAS
Copy link

This pull request is related to:

  • A bug
  • A new feature
  • Documentation
  • Enhancement

I have checked the following:

  • I have read and understood the contribution guidelines and the code of conduct;
  • I have added new tests (for bug fixes/features);
  • I have added/updated the documentation (for bug fixes / features).

Description:
This Pull Request adds support for custom Base URL and custom models for the OpenAI client. With tools like LiteLLM, and LLM providers like OpenRouter that offers a great variety of models under the OpenAI API Specification, we support private and custom LLMs with the same plugin.

Related issues:
Please, link the related issues that this pull request will resolve here (if any).

This Resolves #56

@xavidop
Copy link
Collaborator

xavidop commented Nov 19, 2024

you will need to update this to work with genkit 0.9.1

Copy link
Collaborator

@xavidop xavidop left a comment

Choose a reason for hiding this comment

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

update code with 0.9

@@ -106,7 +112,8 @@ export const openAI: Plugin<[PluginOptions] | []> = genkitPlugin(
throw new Error(
'please pass in the API key or set the OPENAI_API_KEY environment variable'
);
const client = new OpenAI({ apiKey });
const baseURL = options?.baseURL || process.env.OPENAI_BASE_URL;
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should set one by default if both are empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for openai baseurl/models
3 participants