Skip to content

Commit f159a96

Browse files
rename InferenceOptions -> InferenceParameters
1 parent 76b6eb6 commit f159a96

7 files changed

Lines changed: 27 additions & 28 deletions

File tree

docs/code_samples/default_v2.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import com.mindee.MindeeClientV2;
2-
import com.mindee.InferenceOptions;
2+
import com.mindee.InferenceParameters;
33
import com.mindee.input.LocalInputSource;
44
import com.mindee.parsing.v2.InferenceResponse;
55
import java.io.File;
@@ -20,7 +20,7 @@ public class SimpleMindeeClient {
2020

2121
// Prepare the enqueueing options
2222
// Note: modelId is mandatory.
23-
InferenceOptions options = InferenceOptions.builder(modelId).build();
23+
InferenceParameters options = InferenceParameters.builder(modelId).build();
2424

2525
// Parse the file
2626
InferenceResponse response = mindeeClient.enqueueAndParse(

src/main/java/com/mindee/InferenceOptions.java renamed to src/main/java/com/mindee/InferenceParameters.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
@Getter
1414
@Data
15-
public final class InferenceOptions {
15+
public final class InferenceParameters {
1616
/**
1717
* ID of the model (required).
1818
*/
@@ -49,7 +49,7 @@ public static Builder builder(String modelId) {
4949
}
5050

5151
/**
52-
* Fluent builder for {@link InferenceOptions}.
52+
* Fluent builder for {@link InferenceParameters}.
5353
*/
5454
public static final class Builder {
5555

@@ -92,9 +92,9 @@ public Builder pollingOptions(AsyncPollingOptions pollingOptions) {
9292
return this;
9393
}
9494

95-
/** Build an immutable {@link InferenceOptions} instance. */
96-
public InferenceOptions build() {
97-
return new InferenceOptions(
95+
/** Build an immutable {@link InferenceParameters} instance. */
96+
public InferenceParameters build() {
97+
return new InferenceParameters(
9898
modelId,
9999
rag,
100100
alias,

src/main/java/com/mindee/MindeeClientV2.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ public MindeeClientV2(PdfOperation pdfOperation, MindeeApiV2 mindeeApi) {
4444
*/
4545
public JobResponse enqueue(
4646
LocalInputSource inputSource,
47-
InferenceOptions options) throws IOException {
47+
InferenceParameters params) throws IOException {
4848
LocalInputSource finalInput;
49-
if (options.getPageOptions() != null) {
50-
finalInput = new LocalInputSource(getSplitFile(inputSource, options.getPageOptions()), inputSource.getFilename());
49+
if (params.getPageOptions() != null) {
50+
finalInput = new LocalInputSource(getSplitFile(inputSource, params.getPageOptions()), inputSource.getFilename());
5151
} else {
5252
finalInput = inputSource;
5353
}
54-
return mindeeApi.enqueuePost(finalInput, options);
54+
return mindeeApi.enqueuePost(finalInput, params);
5555
}
5656

5757
/**
@@ -78,7 +78,7 @@ public CommonResponse parseQueued(String jobId) {
7878
*/
7979
public InferenceResponse enqueueAndParse(
8080
LocalInputSource inputSource,
81-
InferenceOptions options) throws IOException, InterruptedException {
81+
InferenceParameters options) throws IOException, InterruptedException {
8282

8383
validatePollingOptions(options.getPollingOptions());
8484

src/main/java/com/mindee/http/MindeeApiV2.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package com.mindee.http;
22

3-
import com.mindee.InferenceOptions;
3+
import com.mindee.InferenceParameters;
44
import com.mindee.input.LocalInputSource;
5-
import com.mindee.parsing.v2.CommonResponse;
65
import com.mindee.parsing.v2.InferenceResponse;
76
import com.mindee.parsing.v2.JobResponse;
87
import java.io.IOException;
@@ -16,7 +15,7 @@ public abstract class MindeeApiV2 extends MindeeApiCommon {
1615
*/
1716
public abstract JobResponse enqueuePost(
1817
LocalInputSource inputSource,
19-
InferenceOptions options
18+
InferenceParameters options
2019
) throws IOException;
2120

2221
/**

src/main/java/com/mindee/http/MindeeHttpApiV2.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.mindee.http;
22

33
import com.fasterxml.jackson.databind.ObjectMapper;
4-
import com.mindee.InferenceOptions;
4+
import com.mindee.InferenceParameters;
55
import com.mindee.MindeeException;
66
import com.mindee.MindeeSettingsV2;
77
import com.mindee.input.LocalInputSource;
@@ -75,7 +75,7 @@ private MindeeHttpApiV2(
7575
*/
7676
public JobResponse enqueuePost(
7777
LocalInputSource inputSource,
78-
InferenceOptions options
78+
InferenceParameters options
7979
) {
8080
String url = this.mindeeSettings.getBaseUrl() + "/inferences/enqueue";
8181
HttpPost post = buildHttpPost(url, inputSource, options);
@@ -193,7 +193,7 @@ private MindeeHttpExceptionV2 getHttpError(ClassicHttpResponse response) {
193193

194194
private HttpEntity buildHttpBody(
195195
LocalInputSource inputSource,
196-
InferenceOptions options
196+
InferenceParameters options
197197
) {
198198
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
199199
builder.setMode(HttpMultipartMode.EXTENDED);
@@ -228,7 +228,7 @@ private HttpEntity buildHttpBody(
228228
private HttpPost buildHttpPost(
229229
String url,
230230
LocalInputSource inputSource,
231-
InferenceOptions options
231+
InferenceParameters options
232232
) {
233233
HttpPost post;
234234
try {

src/test/java/com/mindee/MindeeClientV2IT.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ void parseFile_emptyMultiPage_mustSucceed() throws IOException, InterruptedExcep
4040
LocalInputSource source = new LocalInputSource(
4141
new File("src/test/resources/file_types/pdf/multipage_cut-2.pdf"));
4242

43-
InferenceOptions options =
44-
InferenceOptions.builder(modelId).build();
43+
InferenceParameters options =
44+
InferenceParameters.builder(modelId).build();
4545

4646
InferenceResponse response = mindeeClient.enqueueAndParse(source, options);
4747

@@ -64,8 +64,8 @@ void parseFile_filledSinglePage_mustSucceed() throws IOException, InterruptedExc
6464
LocalInputSource source = new LocalInputSource(
6565
new File("src/test/resources/products/financial_document/default_sample.jpg"));
6666

67-
InferenceOptions options =
68-
InferenceOptions.builder(modelId).build();
67+
InferenceParameters options =
68+
InferenceParameters.builder(modelId).build();
6969

7070
InferenceResponse response = mindeeClient.enqueueAndParse(source, options);
7171

@@ -98,8 +98,8 @@ void invalidModel_mustThrowError() throws IOException {
9898
LocalInputSource source = new LocalInputSource(
9999
new File("src/test/resources/file_types/pdf/multipage_cut-2.pdf"));
100100

101-
InferenceOptions options =
102-
InferenceOptions.builder("INVALID MODEL ID").build();
101+
InferenceParameters options =
102+
InferenceParameters.builder("INVALID MODEL ID").build();
103103

104104
MindeeHttpExceptionV2 ex = assertThrows(
105105
MindeeHttpExceptionV2.class,

src/test/java/com/mindee/MindeeClientV2Test.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Enqueue {
3434
@DisplayName("sends exactly one HTTP call and yields a non-null response")
3535
void enqueue_post_async() throws IOException {
3636
MindeeApiV2 predictable = Mockito.mock(MindeeApiV2.class);
37-
when(predictable.enqueuePost(any(LocalInputSource.class), any(InferenceOptions.class)))
37+
when(predictable.enqueuePost(any(LocalInputSource.class), any(InferenceParameters.class)))
3838
.thenReturn(new JobResponse());
3939

4040
MindeeClientV2 mindeeClient = makeClientWithMockedApi(predictable);
@@ -43,12 +43,12 @@ void enqueue_post_async() throws IOException {
4343
new LocalInputSource(new File("src/test/resources/file_types/pdf/blank_1.pdf"));
4444
JobResponse response = mindeeClient.enqueue(
4545
input,
46-
InferenceOptions.builder("dummy-model-id").build()
46+
InferenceParameters.builder("dummy-model-id").build()
4747
);
4848

4949
assertNotNull(response, "enqueue() must return a response");
5050
verify(predictable, atMostOnce())
51-
.enqueuePost(any(LocalInputSource.class), any(InferenceOptions.class));
51+
.enqueuePost(any(LocalInputSource.class), any(InferenceParameters.class));
5252
}
5353
}
5454

0 commit comments

Comments
 (0)