Contribution Guidelines
Contributing a New AI Model Implementation
本节概述了为新的人工智能模型实施做出贡献的步骤。人工智能模型差异很大,输入和输出多种多样——从将文本输入翻译成文本输出的聊天模型,到根据文本描述生成图像的文本到图像模型。复杂模型甚至可以处理多种类型的输入和输出,例如组合文本、图像和视频以生成混合媒体输出。
This section outlines the steps for contributing a new AI model implementation. AI models vary significantly, with diverse inputs and outputs — from chat models that translate text input into text output, to text-to-image models that generate images from text descriptions. Complex models may even handle multiple types of input and output, such as combining text, images, and videos to produce mixed media output.
要为新模型做出贡献,请遵循以下步骤:
To contribute a new model, adhere to the following steps:
-
Create a Low-Level Client API Class: If no existing Java client suits the AI model, you’ll need to develop a low-level client API class. This often involves utilizing the
RestClient
class from the Spring Framework, similar to theOpenAiApi
class. -
Create a ModelClient implementation Ensure your client conforms to the Generic Model API. Use existing request and response classes if your model’s inputs and outputs are supported. If not, create new classes for the Generic Model API and establish a new Java package.
-
Implement Auto-Configuration and a Spring Boot Starter: This step involves creating the necessary auto-configuration and Spring Boot Starter to easily instantiate the new model with Spring Boot applications.
-
Write Tests: All new classes should be accompanied by comprehensive tests. Existing tests can serve as a useful reference for structuring and implementing your tests.
-
Document Your Contribution: Ensure your documentation follows the existing format, For an example of the suggested structure and formatting, refer to the Open AI Chat documentation.
通过遵循这些准则,我们可以在遵循通用实现和文档模式的同时,极大地扩展框架支持的模型范围。
By following these guidelines, we can greatly expand the framework’s range of supported models while following a common implementation and documentation pattern.