Skip to content

Commit 29a2b47

Browse files
committed
Update azure-openai-chat.adoc
Signed-off-by: jaeyeonling <[email protected]>
1 parent 8e23422 commit 29a2b47

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,24 +335,23 @@ Next, create an `AzureOpenAiChatModel` instance and use it to generate text resp
335335

336336
[source,java]
337337
----
338-
var openAIClient = new OpenAIClientBuilder()
338+
var openAIClientBuilder = new OpenAIClientBuilder()
339339
.credential(new AzureKeyCredential(System.getenv("AZURE_OPENAI_API_KEY")))
340-
.endpoint(System.getenv("AZURE_OPENAI_ENDPOINT"))
341-
.buildClient();
340+
.endpoint(System.getenv("AZURE_OPENAI_ENDPOINT"));
342341
343342
var openAIChatOptions = AzureOpenAiChatOptions.builder()
344343
.deploymentName("gpt-4o")
345344
.temperature(0.4)
346345
.maxTokens(200)
347346
.build();
348347
349-
var chatModel = new AzureOpenAiChatModel(this.openAIClient, this.openAIChatOptions);
348+
var chatModel = new AzureOpenAiChatModel(openAIClientBuilder, openAIChatOptions);
350349
351-
ChatResponse response = this.chatModel.call(
350+
ChatResponse response = chatModel.call(
352351
new Prompt("Generate the names of 5 famous pirates."));
353352
354353
// Or with streaming responses
355-
Flux<ChatResponse> response = this.chatModel.stream(
354+
Flux<ChatResponse> streamingResponses = chatModel.stream(
356355
new Prompt("Generate the names of 5 famous pirates."));
357356
358357
----

0 commit comments

Comments
 (0)