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
23 changes: 15 additions & 8 deletions docs/code_samples/default_v2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,30 @@ 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";

// 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
);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/mindee/input/LocalInputSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 4 additions & 3 deletions src/test/java/com/mindee/MindeeClientV2IT.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
Loading