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
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) {
31
31
OpenAIClient client = clientBuilder .build ();
32
32
33
33
ChatCompletionCreateParams params = ChatCompletionCreateParams .builder ()
34
- .addMessage (ChatCompletionMessageParam . ofChatCompletionUserMessageParam (
34
+ .addMessage (
35
35
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 ())
38
38
.model ("gpt-4o" )
39
39
.build ();
40
40
Original file line number Diff line number Diff line change @@ -32,10 +32,10 @@ public static void main(String[] args) {
32
32
OpenAIClientAsync client = asyncClientBuilder .build ();
33
33
34
34
ChatCompletionCreateParams params = ChatCompletionCreateParams .builder ()
35
- .addMessage (ChatCompletionMessageParam . ofChatCompletionUserMessageParam (
35
+ .addMessage (
36
36
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 ())
39
39
.model ("gpt-4o" )
40
40
.build ();
41
41
Original file line number Diff line number Diff line change @@ -37,10 +37,10 @@ public static void main(String[] args) {
37
37
OpenAIClient client = clientBuilder .build ();
38
38
39
39
ChatCompletionCreateParams params = ChatCompletionCreateParams .builder ()
40
- .addMessage (ChatCompletionMessageParam . ofChatCompletionUserMessageParam (
40
+ .addMessage (
41
41
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 ())
44
44
.model ("gpt-4o" )
45
45
.build ();
46
46
Original file line number Diff line number Diff line change @@ -37,10 +37,10 @@ public static void main(String[] args) {
37
37
OpenAIClientAsync asyncClient = asyncClientBuilder .build ();
38
38
39
39
ChatCompletionCreateParams params = ChatCompletionCreateParams .builder ()
40
- .addMessage (ChatCompletionMessageParam . ofChatCompletionUserMessageParam (
40
+ .addMessage (
41
41
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 ())
44
44
.model ("gpt-4o" )
45
45
.build ();
46
46
Original file line number Diff line number Diff line change @@ -12,12 +12,10 @@ public static void main(String[] args) {
12
12
OpenAIClient client = OpenAIOkHttpClient .fromEnv ();
13
13
ChatCompletionCreateParams completionCreateParams = ChatCompletionCreateParams .builder ()
14
14
.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 ())
21
19
.build ();
22
20
23
21
// Non-streaming example
You can’t perform that action at this time.
0 commit comments