Skip to content

Commit d8bab9c

Browse files
Cho-Hyun-Seungsolnone
authored andcommitted
docs: update custom API key example using OpenAiChatModel.builder() (spring-projects#3335)
Signed-off-by: Cho-Hyun-Seung <[email protected]> Signed-off-by: Solomon Hsu <[email protected]>
1 parent a24e7b6 commit d8bab9c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,12 @@ OpenAiApi openAiApi = OpenAiApi.builder()
631631
.apiKey(customApiKey)
632632
.build();
633633
634-
// Create a chat client with the custom OpenAiApi instance
635-
OpenAiChatClient chatClient = new OpenAiChatClient(openAiApi);
636-
634+
// Create a chat model with the custom OpenAiApi instance
635+
OpenAiChatmodel chatModel = OpenAiChatModel.builder()
636+
.openAiApi(openAiApi)
637+
.build();
638+
// Build the ChatClient using the custom chat model
639+
ChatClient openAiChatClient = ChatClient.builder(chatModel).build();
637640
----
638641

639642
This is useful when you need to:

0 commit comments

Comments
 (0)