Skip to content
This repository was archived by the owner on Jun 6, 2024. It is now read-only.

Commit 210c25b

Browse files
committed
Update examples to use Collections.singletonList
List.of isn't compatible with java 8
1 parent ccc1024 commit 210c25b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

example/src/main/java/example/OpenAiApiFunctionsExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static void main(String... args) {
4242
String token = System.getenv("OPENAI_TOKEN");
4343
OpenAiService service = new OpenAiService(token);
4444

45-
FunctionExecutor functionExecutor = new FunctionExecutor(List.of(ChatFunction.builder()
45+
FunctionExecutor functionExecutor = new FunctionExecutor(Collections.singletonList(ChatFunction.builder()
4646
.name("get_weather")
4747
.description("Get the current weather of a location")
4848
.executor(Weather.class, w -> new WeatherResponse(w.location, w.unit, new Random().nextInt(50), "sunny"))

example/src/main/java/example/OpenAiApiFunctionsWithStreamExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static void main(String... args) {
1616
String token = System.getenv("OPENAI_TOKEN");
1717
OpenAiService service = new OpenAiService(token);
1818

19-
FunctionExecutor functionExecutor = new FunctionExecutor(List.of(ChatFunction.builder()
19+
FunctionExecutor functionExecutor = new FunctionExecutor(Collections.singletonList(ChatFunction.builder()
2020
.name("get_weather")
2121
.description("Get the current weather of a location")
2222
.executor(Weather.class, w -> new WeatherResponse(w.location, w.unit, new Random().nextInt(50), "sunny"))

0 commit comments

Comments
 (0)