File tree Expand file tree Collapse file tree 5 files changed +16
-18
lines changed
openai-azure-java-example/src/main/java/com.openai.azure.examples
openai-java-example/src/main/java/com/openai/example Expand file tree Collapse file tree 5 files changed +16
-18
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments