Skip to content

Commit c5f80f4

Browse files
committed
Minor documentation updates
1 parent 6d13da1 commit c5f80f4

File tree

7 files changed

+20
-135
lines changed

7 files changed

+20
-135
lines changed

models/spring-ai-azure-openai/src/main/java/org/springframework/ai/azure/openai/AzureOpenAiChatClient.java

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.util.Collections;
2020
import java.util.List;
21+
import java.util.Objects;
2122

2223
import com.azure.ai.openai.OpenAIClient;
2324
import com.azure.ai.openai.models.ChatChoice;
@@ -225,20 +226,13 @@ private ChatCompletionsOptions merge(ChatCompletionsOptions azureOptions, AzureO
225226
ChatCompletionsOptions mergedAzureOptions = new ChatCompletionsOptions(azureOptions.getMessages());
226227
mergedAzureOptions.setStream(azureOptions.isStream());
227228

228-
mergedAzureOptions.setMaxTokens(azureOptions.getMaxTokens());
229-
if (mergedAzureOptions.getMaxTokens() == null) {
230-
mergedAzureOptions.setMaxTokens(springAiOptions.getMaxTokens());
231-
}
229+
mergedAzureOptions.setMaxTokens(
230+
(azureOptions.getMaxTokens() != null) ? azureOptions.getMaxTokens() : springAiOptions.getMaxTokens());
232231

233-
mergedAzureOptions.setLogitBias(azureOptions.getLogitBias());
234-
if (mergedAzureOptions.getLogitBias() == null) {
235-
mergedAzureOptions.setLogitBias(springAiOptions.getLogitBias());
236-
}
232+
mergedAzureOptions.setLogitBias(
233+
azureOptions.getLogitBias() != null ? azureOptions.getLogitBias() : springAiOptions.getLogitBias());
237234

238-
mergedAzureOptions.setStop(azureOptions.getStop());
239-
if (mergedAzureOptions.getStop() == null) {
240-
mergedAzureOptions.setStop(springAiOptions.getStop());
241-
}
235+
mergedAzureOptions.setStop(azureOptions.getStop() != null ? azureOptions.getStop() : springAiOptions.getStop());
242236

243237
mergedAzureOptions.setTemperature(azureOptions.getTemperature());
244238
if (mergedAzureOptions.getTemperature() == null && springAiOptions.getTemperature() != null) {
@@ -260,20 +254,12 @@ private ChatCompletionsOptions merge(ChatCompletionsOptions azureOptions, AzureO
260254
mergedAzureOptions.setPresencePenalty(springAiOptions.getPresencePenalty().doubleValue());
261255
}
262256

263-
mergedAzureOptions.setN(azureOptions.getN());
264-
if (mergedAzureOptions.getN() == null) {
265-
mergedAzureOptions.setN(springAiOptions.getN());
266-
}
257+
mergedAzureOptions.setN(azureOptions.getN() != null ? azureOptions.getN() : springAiOptions.getN());
267258

268-
mergedAzureOptions.setUser(azureOptions.getUser());
269-
if (mergedAzureOptions.getUser() == null) {
270-
mergedAzureOptions.setUser(springAiOptions.getUser());
271-
}
259+
mergedAzureOptions.setUser(azureOptions.getUser() != null ? azureOptions.getUser() : springAiOptions.getUser());
272260

273-
mergedAzureOptions.setModel(azureOptions.getModel());
274-
if (mergedAzureOptions.getModel() == null) {
275-
mergedAzureOptions.setModel(springAiOptions.getModel());
276-
}
261+
mergedAzureOptions
262+
.setModel(azureOptions.getModel() != null ? azureOptions.getModel() : springAiOptions.getModel());
277263

278264
return mergedAzureOptions;
279265
}

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/clients/azure-openai-chat.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Azure's OpenAI offering, powered by ChatGPT, extends beyond traditional OpenAI c
44

55
Azure offers Java developers the opportunity to leverage AI's full potential by integrating it with an array of Azure services, which includes AI-related resources such as Vector Stores on Azure.
66

7-
== Pre-requisites
7+
== Prerequisites
88

99
Obtain your Azure OpenAI `endpoint` and `api-key` from the Azure OpenAI Service section on the link:https://portal.azure.com[Azure Portal].
1010

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/clients/azure-openai.adoc

Lines changed: 0 additions & 103 deletions
This file was deleted.

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/clients/bedrock/bedrock-anthropic.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Bedrock Anthropic Chat
1+
= Anthropic Chat
22

33
https://www.anthropic.com/product[Anthropic's Claude] is an AI assistant based on Anthropic’s research into training helpful, honest, and harmless AI systems.
44

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/clients/bedrock/bedrock-llama2.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Bedrock Llama2 Chat
1+
= Llama2 Chat
22

33
https://ai.meta.com/llama/[Meta's Llama 2 Chat] is part of the Llama 2 collection of large language models.
44
It excels in dialogue-based applications with a parameter scale ranging from 7 billion to 70 billion.

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/azure-openai-embeddings.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Azure's OpenAI extends the OpenAI capabilities, offering safe text generation an
88
99
The Azure OpenAI embeddings rely on `cosine similarity` to compute similarity between documents and a query.
1010

11-
== Pre-requisites
11+
== Prerequisites
1212

1313
Obtain your Azure OpenAI `endpoint` and `api-key` from the Azure OpenAI Service section on the link:https://portal.azure.com[Azure Portal].
1414

@@ -146,6 +146,8 @@ EmbeddingResponse embeddingResponse = embeddingClient
146146

147147
NOTE: the `text-embedding-ada-002` is actually the `Deployment Name` as presented in the Azure AI Portal.
148148

149+
=== Embedding Options
150+
149151
The `AzureOpenAiEmbeddingOptions` provides the configuration information for the embedding requests.
150152
The `AzureOpenAiEmbeddingOptions` offers a builder to create the options.
151153

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Refer to the official Ollama project link:https://github.com/jmorganca/ollama[RE
1616
Note, installing `ollama run llama2` will download a 4GB docker image.
1717

1818

19-
=== OllamaEmbeddingClient Auto-configuration
19+
== Auto-configuration
2020

2121
Spring AI provides Spring Boot auto-configuration for the Azure Ollama Embedding Client.
2222
To enable it add the following dependency to your Maven `pom.xml` file:
@@ -44,7 +44,7 @@ NOTE: Refer to the xref:getting-started.adoc#_dependency_management[Dependency M
4444
The `spring.ai.ollama.embedding.options.*` properties are used to configure the default options used for all embedding requests.
4545
(It is used as `OllamaEmbeddingClient#withDefaultOptions()` instance).
4646

47-
== Embedding Properties
47+
=== Embedding Properties
4848

4949
The prefix `spring.ai.ollama` is the property prefix to configure the connection to Ollama
5050

@@ -57,7 +57,7 @@ The prefix `spring.ai.ollama` is the property prefix to configure the connection
5757

5858
The prefix `spring.ai.ollama.embedding.options` is the property prefix that configures the `EmbeddingClient` implementation for Ollama.
5959

60-
[cols="3,6,1"]
60+
[cols="3,5,1"]
6161
|====
6262
| Property | Description | Default
6363

@@ -168,7 +168,7 @@ EmbeddingResponse embeddingResponse = embeddingClient
168168

169169
The `OllamaOptions` provides the configuration information for all embedding requests.
170170

171-
=== Chat Options
171+
=== Embedding Options
172172

173173
The https://github.com/spring-projects/spring-ai/blob/main/models/spring-ai-ollama/src/main/java/org/springframework/ai/ollama/api/OllamaOptions.java[OllamaOptions.java] provides the Ollama configurations, such as the model to use, the low level GPU and CPU tunning, etc.
174174

0 commit comments

Comments
 (0)