docs: update custom API key example using OpenAiChatModel.builder() (#3335)

Signed-off-by: Cho-Hyun-Seung <toki0327@naver.com>
This commit is contained in:
Cho-Hyun-Seung
2025-05-27 15:43:15 +09:00
committed by Ilayaperumal Gopinathan
parent cc5379344f
commit 03a2cb76ed

View File

@@ -631,9 +631,12 @@ OpenAiApi openAiApi = OpenAiApi.builder()
.apiKey(customApiKey)
.build();
// Create a chat client with the custom OpenAiApi instance
OpenAiChatClient chatClient = new OpenAiChatClient(openAiApi);
// Create a chat model with the custom OpenAiApi instance
OpenAiChatmodel chatModel = OpenAiChatModel.builder()
.openAiApi(openAiApi)
.build();
// Build the ChatClient using the custom chat model
ChatClient openAiChatClient = ChatClient.builder(chatModel).build();
----
This is useful when you need to: