Skip to content

Commit c7b3a7d

Browse files
TomerAberbachstainless-app[bot]
authored andcommitted
fix: examples
1 parent 7656bc0 commit c7b3a7d

File tree

5 files changed

+16
-18
lines changed

5 files changed

+16
-18
lines changed

openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureApiKeyExample.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ public static void main(String[] args) {
3131
OpenAIClient client = clientBuilder.build();
3232

3333
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
34-
.addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
34+
.addMessage(
3535
ChatCompletionUserMessageParam.builder()
36-
.content(ChatCompletionUserMessageParam.Content.ofTextContent("Who won the world series in 2020?"))
37-
.build()))
36+
.content("Who won the world series in 2020?")
37+
.build())
3838
.model("gpt-4o")
3939
.build();
4040

openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureApiKeyExampleAsync.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ public static void main(String[] args) {
3232
OpenAIClientAsync client = asyncClientBuilder.build();
3333

3434
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
35-
.addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
35+
.addMessage(
3636
ChatCompletionUserMessageParam.builder()
37-
.content(ChatCompletionUserMessageParam.Content.ofTextContent("Who won the world series in 2020?"))
38-
.build()))
37+
.content("Who won the world series in 2020?")
38+
.build())
3939
.model("gpt-4o")
4040
.build();
4141

openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureEntraIDExample.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public static void main(String[] args) {
3737
OpenAIClient client = clientBuilder.build();
3838

3939
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
40-
.addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
40+
.addMessage(
4141
ChatCompletionUserMessageParam.builder()
42-
.content(ChatCompletionUserMessageParam.Content.ofTextContent("Who won the world series in 2020?"))
43-
.build()))
42+
.content("Who won the world series in 2020?")
43+
.build())
4444
.model("gpt-4o")
4545
.build();
4646

openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureEntraIDExampleAsync.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public static void main(String[] args) {
3737
OpenAIClientAsync asyncClient = asyncClientBuilder.build();
3838

3939
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
40-
.addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
40+
.addMessage(
4141
ChatCompletionUserMessageParam.builder()
42-
.content(ChatCompletionUserMessageParam.Content.ofTextContent("Who won the world series in 2020?"))
43-
.build()))
42+
.content("Who won the world series in 2020?")
43+
.build())
4444
.model("gpt-4o")
4545
.build();
4646

openai-java-example/src/main/java/com/openai/example/Main.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ public static void main(String[] args) {
1212
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
1313
ChatCompletionCreateParams completionCreateParams = ChatCompletionCreateParams.builder()
1414
.model(ChatModel.GPT_3_5_TURBO)
15-
.maxTokens(1024)
16-
.addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
17-
ChatCompletionUserMessageParam.builder()
18-
.content(ChatCompletionUserMessageParam.Content.ofTextContent(
19-
"Tell me a story about building the best SDK!"))
20-
.build()))
15+
.maxCompletionTokens(1024)
16+
.addMessage(ChatCompletionUserMessageParam.builder()
17+
.content("Tell me a story about building the best SDK!")
18+
.build())
2119
.build();
2220

2321
// Non-streaming example

0 commit comments

Comments
 (0)