Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
LangChain4j committed Oct 15, 2024
1 parent e20ed91 commit ea69339
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/test/java/dev/ai4j/openai4j/chat/ChatCompletionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ void testStrictJsonResponseFormat(ChatCompletionModel model) {


@Test
void testJsonResponseFormatWithRecursion() {
void testJsonResponseFormatWithExplicitRecursion() {

// given
boolean strict = true;
Expand All @@ -620,7 +620,9 @@ void testJsonResponseFormatWithRecursion() {
.properties(new LinkedHashMap<String, JsonSchemaElement>() {{
put("name", JsonStringSchema.builder().build());
put("children", JsonArraySchema.builder()
.items(JsonReferenceSchema.builder().reference("#/$defs/person").build())
.items(JsonReferenceSchema.builder()
.reference("#/$defs/person")
.build())
.build());
}})
.required(asList("name", "children"))
Expand Down Expand Up @@ -663,9 +665,8 @@ void testJsonResponseFormatWithRecursion() {
"]}");
}

// TODO remove?
@Test
void testJsonResponseFormatWithRecursion2() {
void testJsonResponseFormatWithRootRecursion() {

// given
boolean strict = true;
Expand All @@ -676,7 +677,9 @@ void testJsonResponseFormatWithRecursion2() {
.properties(new LinkedHashMap<String, JsonSchemaElement>() {{
put("name", JsonStringSchema.builder().build());
put("children", JsonArraySchema.builder()
.items(JsonReferenceSchema.builder().reference("#").build())
.items(JsonReferenceSchema.builder()
.reference("#") // root recursion
.build())
.build());
}})
.required(asList("name", "children"))
Expand Down

0 comments on commit ea69339

Please sign in to comment.