From 9728b5e8f5a800720688e9b785a1607a1ff20f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ianar=C3=A9=20S=C3=A9vi?= Date: Thu, 17 Jul 2025 18:27:49 +0200 Subject: [PATCH] :recycle: harmonize names with other libs --- docs/code_samples/default_v2.txt | 23 ++++++++++++------- .../com/mindee/input/LocalInputSource.java | 2 +- .../java/com/mindee/MindeeClientV2IT.java | 7 +++--- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/docs/code_samples/default_v2.txt b/docs/code_samples/default_v2.txt index 584e0f594..3b8237634 100644 --- a/docs/code_samples/default_v2.txt +++ b/docs/code_samples/default_v2.txt @@ -7,7 +7,9 @@ import java.io.IOException; public class SimpleMindeeClient { - public static void main(String[] args) throws IOException, InterruptedException { + public static void main(String[] args) + throws IOException, InterruptedException + { String apiKey = "MY_API_KEY"; String filePath = "/path/to/the/file.ext"; String modelId = "MY_MODEL_ID"; @@ -15,15 +17,20 @@ public class SimpleMindeeClient { // Init a new client MindeeClientV2 mindeeClient = new MindeeClientV2(apiKey); - // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(new File(filePath)); - - // Prepare the enqueueing options + // Set inference parameters // Note: modelId is mandatory. - InferenceParameters options = InferenceParameters.builder(modelId).build(); + InferenceParameters options = InferenceParameters.builder(modelId) + // If set to `true`, will enable Retrieval-Augmented Generation. + .rag(false) + .build(); + + // Load a file from disk + LocalInputSource inputSource = new LocalInputSource( + new File(filePath) + ); - // Parse the file - InferenceResponse response = mindeeClient.enqueueAndGetInference( + // Upload the file + InferenceResponse response = mindeeClient.enqueueAndGetInference( inputSource, options ); diff --git a/src/main/java/com/mindee/input/LocalInputSource.java b/src/main/java/com/mindee/input/LocalInputSource.java index 91cbee178..ed49b905e 100644 --- a/src/main/java/com/mindee/input/LocalInputSource.java +++ b/src/main/java/com/mindee/input/LocalInputSource.java @@ -55,7 +55,7 @@ public LocalInputSource(String fileAsBase64, String filename) { * @param pageOptions The options specifying which pages to modify or retain in the PDF file. * @throws IOException If an I/O error occurs during the PDF operation. */ - public void applyOperations (PageOptions pageOptions) throws IOException { + public void applyPageOptions(PageOptions pageOptions) throws IOException { if (pageOptions != null && this.isPdf()) { PdfOperation pdfOperation = new PdfBoxApi(); this.file = pdfOperation.split( diff --git a/src/test/java/com/mindee/MindeeClientV2IT.java b/src/test/java/com/mindee/MindeeClientV2IT.java index 9dedbfdd2..758d31f0c 100644 --- a/src/test/java/com/mindee/MindeeClientV2IT.java +++ b/src/test/java/com/mindee/MindeeClientV2IT.java @@ -12,7 +12,7 @@ @TestInstance(TestInstance.Lifecycle.PER_CLASS) @Tag("integration") @DisplayName("MindeeClientV2 – integration tests (V2)") -class MindeeClientV2IntegrationTest { +class MindeeClientV2IT { private MindeeClientV2 mindeeClient; private String modelId; @@ -64,8 +64,9 @@ void parseFile_filledSinglePage_mustSucceed() throws IOException, InterruptedExc LocalInputSource source = new LocalInputSource( new File("src/test/resources/products/financial_document/default_sample.jpg")); - InferenceParameters options = - InferenceParameters.builder(modelId).build(); + InferenceParameters options = InferenceParameters.builder(modelId) + .rag(false) + .build(); InferenceResponse response = mindeeClient.enqueueAndGetInference(source, options);