Skip to content

Commit a09972a

Browse files
committed
Dock: improve chat-model documentation
1 parent 8eef6e6 commit a09972a

File tree

4 files changed

+30
-29
lines changed

4 files changed

+30
-29
lines changed
110 KB
Loading
131 KB
Loading

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chat/comparison.adoc

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,38 @@
66

77
This table compares various Chat Models supported by Spring AI, detailing their capabilities:
88

9-
- Multimodality: The types of input the model can process (e.g., text, image, audio, video).
10-
- Tools/Functions: Whether the model supports function calling or tool use.
9+
- xref:api/multimodality.adoc[Multimodality]: The types of input the model can process (e.g., text, image, audio, video).
10+
- xref:api/functions.adoc[Tools/Functions]: Whether the model supports function calling or tool use.
1111
- Streaming: If the model offers streaming responses.
1212
- Retry: Support for retry mechanisms.
13-
- Observability: Features for monitoring and debugging.
14-
- Built-in JSON: Native support for JSON output.
13+
- xref:observability/index.adoc[Observability]: Features for monitoring and debugging.
14+
- xref:api/structured-output-converter.adoc#_built_in_json_mode[Built-in JSON]: Native support for JSON output.
1515
- Local deployment: Whether the model can be run locally.
1616
- OpenAI API Compatibility: If the model is compatible with OpenAI's API.
1717
1818
[cols="10,5,1,1,1,1,1,1,1", stripes=even]
1919
|====
20-
^| Provider ^a| xref:api/multimodality.adoc[Multimodality] ^a| xref:api/functions.adoc[Tools/Functions] ^| Streaming ^| Retry ^| xref:observability/index.adoc[Observability] ^a| xref:api/structured-output-converter.adoc#_built_in_json_mode[Built-in JSON] ^| Local ^| OpenAI API Compatibility
20+
| Provider | Multimodality ^| Tools/Functions ^| Streaming ^| Retry ^| Observability ^| Built-in JSON ^| Local ^| OpenAI API Compatible
2121

2222
| xref::api/chat/anthropic-chat.adoc[Anthropic Claude] | text, image ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12]
23-
2423
| xref::api/chat/azure-openai-chat.adoc[Azure OpenAI] | text, image ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::yes.svg[width=16]
25-
2624
| xref::api/chat/vertexai-gemini-chat.adoc[Google VertexAI Gemini] | text, image, audio, video ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::yes.svg[width=16]
27-
2825
| xref::api/chat/vertexai-palm2-chat.adoc[Google VertexAI PaML2] | text ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12]
29-
3026
| xref::api/chat/groq-chat.adoc[Groq (OpenAI-proxy)] | text, image ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::yes.svg[width=16]
31-
3227
| xref::api/chat/huggingface.adoc[HuggingFace] | text ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12]
33-
3428
| xref::api/chat/mistralai-chat.adoc[Mistral AI] | text ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::yes.svg[width=16]
35-
3629
| xref::api/chat/minimax-chat.adoc[MiniMax] | text ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a|
37-
3830
| xref::api/chat/minimax-chat.adoc[Moonshot AI] | text ^a| image::no.svg[width=12] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a|
39-
4031
| xref::api/chat/nvidia-chat.adoc[NVIDIA (OpenAI-proxy)] | text, image ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::yes.svg[width=16]
41-
4232
| xref::api/chat/ollama-chat.adoc[Ollama] | text, image ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16]
43-
4433
| xref::api/chat/openai-chat.adoc[OpenAI] | text, image ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::yes.svg[width=16]
45-
4634
| xref::api/chat/qianfan-chat.adoc[QianFan] | text ^a| image::no.svg[width=12] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12]
47-
4835
| xref::api/chat/zhipuai-chat.adoc[ZhiPu AI] | text ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12]
49-
5036
| xref::api/chat/watsonx-ai-chat.adoc[Watsonx.AI] | text ^a| image::no.svg[width=12] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12]
51-
5237
| xref::api/chat/bedrock/bedrock-cohere.adoc[Amazon Bedrock/Cohere] | text ^a| image::no.svg[width=12] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12]
53-
5438
| xref::api/chat/bedrock/bedrock-jurassic2.adoc[Amazon Bedrock/Jurassic] | text ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12]
55-
5639
| xref::api/chat/bedrock/bedrock-llama.adoc[Amazon Bedrock/Llama] | text ^a| image::no.svg[width=12] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12]
57-
5840
| xref::api/chat/bedrock/bedrock-titan.adoc[Amazon Bedrock/Titan] | text ^a| image::no.svg[width=12] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12]
59-
6041
| xref::api/chat/bedrock/bedrock-anthropic3.adoc[Amazon Bedrock/Anthropic 3] | text ^a| image::no.svg[width=12] ^a| image::yes.svg[width=16] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12] ^a| image::no.svg[width=12]
6142

6243
|====

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chatmodel.adoc

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,26 @@ public interface ChatOptions extends ModelOptions {
143143

144144
Additionally, every model specific ChatModel/StreamingChatModel implementation can have its own options that can be passed to the AI model. For example, the OpenAI Chat Completion model has its own options like `logitBias`, `seed`, and `user`.
145145

146-
This is a powerful feature that allows developers to use model-specific options when starting the application and then override them at runtime using the `Prompt` request:
146+
This is a powerful feature that allows developers to use model-specific options when starting the application and then override them at runtime using the `Prompt` request.
147+
148+
Spring AI provides a sophisticated system for configuring and using Chat Models.
149+
It allows for default configurations to be set at start-up, while also providing the flexibility to override these settings on a per-request basis.
150+
This approach enables developers to easily work with different AI models and adjust parameters as needed, all within a consistent interface provided by the Spring AI framework.
151+
152+
Following flow diagram illustrates how Spring AI handles the configuration and execution of Chat Models, combining start-up and runtime options:
147153

148154
image::chat-options-flow.jpg[align="center", width="800px"]
149155

156+
1. Start-up Configuration - The ChatModel/StreamingChatModel is initialized with "Start-Up" Chat Options.
157+
These options are set during the ChatModel initialization and are meant to provide default configurations.
158+
2. Runtime Configuration - For each request, the Prompt can contain a Runtime Chat Options: These can override the start-up options.
159+
3. Option Merging Process - The "Merge Options" step combines the start-up and runtime options.
160+
If runtime options are provided, they take precedence over the start-up options.
161+
4. Input Processing - The "Convert Input" step transforms the input instructions into native, model-specific formats.
162+
5. Output Processing - The "Convert Output" step transforms the model's response into a standardized `ChatResponse` format.
163+
164+
The separation of start-up and runtime options allows for both global configurations and request-specific adjustments.
165+
150166
[[ChatResponse]]
151167
=== ChatResponse
152168

@@ -197,9 +213,9 @@ public class Generation implements ModelResult<AssistantMessage> {
197213

198214
== Available Implementations
199215

200-
The `ChatModel` and `StreamingChatModel` implementations are provided for the following Model providers:
216+
This diagram illustrates the unified interfaces, `ChatModel` and `StreamingChatModel`, are used for interacting with various AI chat models from different providers, allowing easy integration and switching between different AI services while maintaining a consistent API for the client application.
201217

202-
image::spring-ai-chat-completions-clients.jpg[align="center", width="800px"]
218+
image::spring-ai-chat-completions-clients.jpg[align="center", width="1000px"]
203219

204220
* xref:api/chat/openai-chat.adoc[OpenAI Chat Completion] (streaming, multi-modality & function-calling support)
205221
* xref:api/chat/azure-openai-chat.adoc[Microsoft Azure Open AI Chat Completion] (streaming & function-calling support)
@@ -216,11 +232,15 @@ image::spring-ai-chat-completions-clients.jpg[align="center", width="800px"]
216232
* xref:api/chat/mistralai-chat.adoc[Mistral AI Chat Completion] (streaming & function-calling support)
217233
* xref:api/chat/anthropic-chat.adoc[Anthropic Chat Completion] (streaming & function-calling support)
218234

235+
TIP: Find a detailed comparison of the available Chat Models in the xref:api/chat/comparison.adoc[Chat Models Comparison] section.
236+
219237
== Chat Model API
220238

221-
The Spring AI Chat Model API is built on top of the Spring AI `Generic Model API` providing Chat specific abstractions and implementations. The following class diagram illustrates the main classes and interfaces of the Spring AI Chat Model API.
239+
The Spring AI Chat Model API is built on top of the Spring AI `Generic Model API` providing Chat specific abstractions and implementations.
240+
This allows an easy integration and switching between different AI services while maintaining a consistent API for the client application.
241+
The following class diagram illustrates the main classes and interfaces of the Spring AI Chat Model API.
222242

223-
image::spring-ai-chat-api.jpg[align="center", width="900px"]
243+
image::spring-ai-chat-api.jpg[align="center", width="1000px"]
224244

225245
// == Best Practices
226246
//

0 commit comments

Comments
 (0)