feat(compat-oai): add Novita AI provider plugin#4974
feat(compat-oai): add Novita AI provider plugin#4974Alex-wuhu wants to merge 1 commit intogenkit-ai:mainfrom
Conversation
Adds Novita AI as a new OpenAI-compatible provider in the compat-oai plugin, following the same pattern as the DeepSeek and xAI providers. - Supports moonshotai/kimi-k2.5 (vision + tools), zai-org/glm-5, and minimax/minimax-m2.5 chat models - Auth via NOVITA_API_KEY env var or plugin options - Exports @genkit-ai/compat-oai/novita entry point - Includes unit tests mirroring existing provider test structure
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces Novita AI as a new provider to the Genkit AI OpenAI-compatible plugin. This integration expands the range of available AI models, allowing developers to leverage Novita AI's offerings within their Genkit applications. The changes include the necessary code for model definitions, plugin initialization, and robust testing to ensure seamless functionality and proper authentication. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request adds support for Novita AI as a new OpenAI-compatible provider. The implementation follows the existing patterns for other providers like DeepSeek and xAI, including model definitions, plugin entry point, and unit tests. The code is well-structured and the changes are clear. I have one minor suggestion to improve code readability by using async/await syntax more consistently.
| return await client.models.list().then((response) => | ||
| response.data | ||
| .filter((model) => model.object === 'model') | ||
| .map((model: OpenAI.Model) => { | ||
| const modelRef = | ||
| SUPPORTED_NOVITA_MODELS[ | ||
| model.id as keyof typeof SUPPORTED_NOVITA_MODELS | ||
| ] ?? novitaModelRef({ name: model.id }); | ||
| return modelActionMetadata({ | ||
| name: modelRef.name, | ||
| info: modelRef.info, | ||
| configSchema: modelRef.configSchema, | ||
| }); | ||
| }) | ||
| ); |
There was a problem hiding this comment.
The use of await with .then() is redundant. Using async/await syntax consistently improves readability.
return (await client.models.list()).data
.filter((model) => model.object === 'model')
.map((model: OpenAI.Model) => {
const modelRef =
SUPPORTED_NOVITA_MODELS[
model.id as keyof typeof SUPPORTED_NOVITA_MODELS
] ?? novitaModelRef({ name: model.id });
return modelActionMetadata({
name: modelRef.name,
info: modelRef.info,
configSchema: modelRef.configSchema,
});
});
Summary
Adds Novita AI as a new OpenAI-compatible provider in the
@genkit-ai/compat-oaiplugin, following the same pattern as the existing DeepSeek and xAI providers.Changes
js/plugins/compat-oai/src/novita/novita.ts— model definitions for the three supported chat modelsjs/plugins/compat-oai/src/novita/index.ts— plugin entry (novitaPlugin,novitaexport)js/plugins/compat-oai/package.json— adds./novitaexport pathjs/plugins/compat-oai/tests/novita_test.ts— unit testsSupported models
moonshotai/kimi-k2.5zai-org/glm-5minimax/minimax-m2.5Usage
Auth: pass
apiKeyin plugin options, or set theNOVITA_API_KEYenvironment variable.Base URL:
https://api.novita.ai/openai(OpenAI-compatible).