From 5e31c9605a23238180fb9d05c4910107abe7919a Mon Sep 17 00:00:00 2001 From: Minh Nguyen Cong Date: Fri, 11 Oct 2024 12:01:01 +0200 Subject: [PATCH] Update docs --- doc/ai.md | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/doc/ai.md b/doc/ai.md index d457bf291..e675196d3 100644 --- a/doc/ai.md +++ b/doc/ai.md @@ -95,19 +95,16 @@ Extract metadata freeform -------------------------- To send an AI request to supported Large Language Models (LLMs) and extract metadata in form of key-value pairs, call static -[` extractMetadataFreeform(BoxAPIConnection api, String prompt, List items, BoxAIAgentExtract agent)`][extract-metadata-freeform] method. +[`extractMetadataFreeform(BoxAPIConnection api, String prompt, List items, BoxAIAgentExtract agent)`][extract-metadata-freeform] method. In the request you have to provide a prompt, a list of items that your prompt refers to and an optional agent configuration. ```java -BoxAIAgent agent = BoxAI.getAiAgentDefaultConfig(api, BoxAIAgent.Mode.EXTRACT, "en-US", null); -BoxAIAgentExtract agentExtract = (BoxAIAgentExtract) agent; - BoxAIResponse response = BoxAI.extractMetadataFreeform( api, - "What is the content of the file?", + "firstName, lastName, location, yearOfBirth, company", Collections.singletonList(new BoxAIItem("123456", BoxAIItem.Type.FILE)), - agentExtract + agent ); ``` @@ -122,18 +119,15 @@ To send an AI request to extract metadata from files, call static ```java -BoxAIAgent agent = BoxAI.getAiAgentDefaultConfig(api, BoxAIAgent.Mode.EXTRACT_STRUCTURED, "en-US", null); -BoxAIAgentExtractStructured agentExtractStructured = (BoxAIAgentExtractStructured) agent; BoxAIExtractMetadataTemplate template = new BoxAIExtractMetadataTemplate("templateKey", "enterprise"); - BoxAIExtractStructuredResponse result = BoxAI.extractMetadataStructured( api, Collections.singletonList(new BoxAIItem("123456", BoxAIItem.Type.FILE)), template, null, - agentExtractStructured + agent ); JsonObject sourceJson = result.getSourceJson(); ``` -[extract-metadata-structured]: https://opensource.box.com/box-java-sdk/javadoc/com/box/sdk/BoxAI.html#extractMetadataStructured-com.box.sdk.BoxAPIConnection-java.util.List-com.box.sdk.ai.BoxAIExtractMetadataTemplate-java.util.List-com.box.sdk.ai.BoxAIAgentExtractStructured- \ No newline at end of file +[extract-metadata-structured]: https://opensource.box.com/box-java-sdk/javadoc/com/box/sdk/BoxAI.html#extractMetadataStructured-com.box.sdk.BoxAPIConnection-java.util.List-com.box.sdk.ai.BoxAIExtractMetadataTemplate-java.util.List-com.box.sdk.ai.BoxAIAgentExtractStructured-