Skip to content

Commit 5ebe485

Browse files
authored
document AzureOpenAIClientBuilderCustomizer (#2224)
Signed-off-by: Manuel Andreo Garcia <manuel@magware.dev>
1 parent 4d0caa2 commit 5ebe485

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,29 @@ dependencies {
110110

111111
TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build file.
112112

113+
The Azure OpenAI Chat Client is created using the link:https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClientBuilder.java[OpenAIClientBuilder] provided by the Azure SDK. Spring AI allows to customize the builder by providing link:https://github.com/spring-projects/spring-ai/blob/main/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/azure/openai/AzureOpenAIClientBuilderCustomizer.java[AzureOpenAIClientBuilderCustomizer] beans.
114+
115+
A customizer might be used for example to change the default response timeout:
116+
117+
[source,java]
118+
----
119+
@Configuration
120+
public class AzureOpenAiConfig {
121+
122+
@Bean
123+
public OpenAIClientBuilderCustomizer responseTimeoutCustomizer() {
124+
return openAiClientBuilder -> {
125+
HttpClientOptions clientOptions = new HttpClientOptions()
126+
.setResponseTimeout(Duration.ofMinutes(5));
127+
openAiClientBuilder.httpClient(HttpClient.createDefault(clientOptions));
128+
};
129+
}
130+
131+
}
132+
----
133+
134+
135+
113136
=== Chat Properties
114137

115138
The prefix `spring.ai.azure.openai` is the property prefix to configure the connection to Azure OpenAI.

0 commit comments

Comments
 (0)