From c8dea142b5357f4ab3692e1a8336b5d1ec9e162b Mon Sep 17 00:00:00 2001 From: Mark Pollack Date: Thu, 22 Feb 2024 22:36:46 -0500 Subject: [PATCH] Add contribution documention Fixes #296 --- .../src/main/antora/modules/ROOT/nav.adoc | 1 + .../ROOT/pages/contribution-guidelines.adoc | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 spring-ai-docs/src/main/antora/modules/ROOT/pages/contribution-guidelines.adoc diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/nav.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/nav.adoc index adf19c343..c95090631 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/nav.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/nav.adoc @@ -42,5 +42,6 @@ ** xref:api/etl-pipeline.adoc[] ** xref:api/testing.adoc[] ** xref:api/generic-model.adoc[] +* xref:contribution-guidelines.adoc[Contribution Guidelines] * Appendices ** xref:upgrade-notes.adoc[]] diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/contribution-guidelines.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/contribution-guidelines.adoc new file mode 100644 index 000000000..eabf39fd8 --- /dev/null +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/contribution-guidelines.adoc @@ -0,0 +1,36 @@ +[[contribution-guidelines]] += 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 the `OpenAiApi` class. + +. *Create a ModelClient implementation* +Ensure your client conforms to the link:https://docs.spring.io/spring-ai/reference/api/clients/generic-model.html[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 +link:https://docs.spring.io/spring-ai/reference/api/clients/openai-chat.html[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.