Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -335,24 +335,23 @@ Next, create an `AzureOpenAiChatModel` instance and use it to generate text resp

[source,java]
----
var openAIClient = new OpenAIClientBuilder()
var openAIClientBuilder = new OpenAIClientBuilder()
.credential(new AzureKeyCredential(System.getenv("AZURE_OPENAI_API_KEY")))
.endpoint(System.getenv("AZURE_OPENAI_ENDPOINT"))
.buildClient();
.endpoint(System.getenv("AZURE_OPENAI_ENDPOINT"));

var openAIChatOptions = AzureOpenAiChatOptions.builder()
.deploymentName("gpt-4o")
.temperature(0.4)
.maxTokens(200)
.build();

var chatModel = new AzureOpenAiChatModel(this.openAIClient, this.openAIChatOptions);
var chatModel = new AzureOpenAiChatModel(openAIClientBuilder, openAIChatOptions);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this constructor method is deprecated and will be removed, I will update this to use the builder instead when merging.


ChatResponse response = this.chatModel.call(
ChatResponse response = chatModel.call(
new Prompt("Generate the names of 5 famous pirates."));

// Or with streaming responses
Flux<ChatResponse> response = this.chatModel.stream(
Flux<ChatResponse> streamingResponses = chatModel.stream(
new Prompt("Generate the names of 5 famous pirates."));

----
Expand Down
Loading