Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "f9e2519", "specHash": "ccdb456", "version": "10.4.0" }
{ "engineHash": "b181eba", "specHash": "ccdb456", "version": "10.4.0" }
2 changes: 1 addition & 1 deletion docs/ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ See the endpoint docs at

<!-- sample post_ai_extract_structured -->
```
client.getAi().createAiExtractStructured(new AiExtractStructured.Builder(Arrays.asList(new AiItemBase(file.getId()))).fields(Arrays.asList(new AiExtractStructuredFieldsField.Builder("firstName").description("Person first name").displayName("First name").prompt("What is the your first name?").type("string").build(), new AiExtractStructuredFieldsField.Builder("lastName").description("Person last name").displayName("Last name").prompt("What is the your last name?").type("string").build(), new AiExtractStructuredFieldsField.Builder("dateOfBirth").description("Person date of birth").displayName("Birth date").prompt("What is the date of your birth?").type("date").build(), new AiExtractStructuredFieldsField.Builder("age").description("Person age").displayName("Age").prompt("How old are you?").type("float").build(), new AiExtractStructuredFieldsField.Builder("hobby").description("Person hobby").displayName("Hobby").prompt("What is your hobby?").type("multiSelect").options(Arrays.asList(new AiExtractStructuredFieldsOptionsField("guitar"), new AiExtractStructuredFieldsOptionsField("books"))).build())).aiAgent(aiExtractStructuredAgentBasicTextConfig).build())
client.getAi().createAiExtractStructured(new AiExtractStructured.Builder(Arrays.asList(new AiItemBase(file.getId()))).fields(Arrays.asList(new AiExtractStructuredFieldsField.Builder("firstName").description("Person first name").displayName("First name").prompt("What is the your first name?").type("string").build(), new AiExtractStructuredFieldsField.Builder("lastName").description("Person last name").displayName("Last name").prompt("What is the your last name?").type("string").build(), new AiExtractStructuredFieldsField.Builder("dateOfBirth").description("Person date of birth").displayName("Birth date").prompt("What is the date of your birth?").type("date").build(), new AiExtractStructuredFieldsField.Builder("age").description("Person age").displayName("Age").prompt("How old are you?").type("float").build(), new AiExtractStructuredFieldsField.Builder("hobby").description("Person hobby").displayName("Hobby").prompt("What is your hobby?").type("multiSelect").options(Arrays.asList(new AiExtractStructuredFieldsOptionsField("guitar"), new AiExtractStructuredFieldsOptionsField("books"))).build())).includeConfidenceScore(true).aiAgent(aiExtractStructuredAgentBasicTextConfig).build())
```

### Arguments
Expand Down
12 changes: 10 additions & 2 deletions src/test/java/com/box/sdkgen/ai/AiITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,10 @@ public void testAiExtractStructuredWithFields() {
String.join("", getUuid(), ".txt"),
new UploadFileRequestBodyAttributesParentField("0")),
stringToByteStream(
"My name is John Doe. I was born in 4th July 1990. I am 34 years old. My hobby is guitar.")));
String.join(
"",
"My name is John Doe. I was born in 4th July 1990. I am 34 years old. My hobby is guitar. My UUID is ",
getUuid()))));
FileFull file = uploadedFiles.getEntries().get(0);
delayInSeconds(5);
AiExtractStructuredResponse response =
Expand Down Expand Up @@ -305,8 +308,10 @@ public void testAiExtractStructuredWithFields() {
new AiExtractStructuredFieldsOptionsField("guitar"),
new AiExtractStructuredFieldsOptionsField("books")))
.build()))
.includeConfidenceScore(true)
.aiAgent(aiExtractStructuredAgentBasicTextConfig)
.build());
assert !(response.getConfidenceScore() == null);
assert convertToString(response.getAnswer().get("hobby"))
.equals(convertToString(Arrays.asList("guitar")));
assert convertToString(response.getAnswer().get("firstName")).equals("John");
Expand All @@ -328,7 +333,10 @@ public void testAiExtractStructuredWithMetadataTemplate() {
String.join("", getUuid(), ".txt"),
new UploadFileRequestBodyAttributesParentField("0")),
stringToByteStream(
"My name is John Doe. I was born in 4th July 1990. I am 34 years old. My hobby is guitar.")));
String.join(
"",
"My name is John Doe. I was born in 4th July 1990. I am 34 years old. My hobby is guitar. My UUID is ",
getUuid()))));
FileFull file = uploadedFiles.getEntries().get(0);
delayInSeconds(5);
String templateKey = String.join("", "key", getUuid());
Expand Down
Loading