mindee 4.33.0 → 4.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/src/clientV2.d.ts +23 -20
- package/src/errors/mindeeError.d.ts +2 -1
- package/src/errors/mindeeError.js +2 -1
- package/src/http/mindeeApiV2.js +3 -0
- package/src/parsing/v2/errorItem.d.ts +4 -1
- package/src/parsing/v2/errorItem.js +3 -0
- package/src/parsing/v2/errorResponse.d.ts +4 -3
- package/src/parsing/v2/inferenceActiveOptions.d.ts +4 -0
- package/src/parsing/v2/inferenceActiveOptions.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v4.34.0 - 2025-12-02
|
|
4
|
+
### Changes
|
|
5
|
+
* :sparkles: add support for text context
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## v4.33.1 - 2025-10-28
|
|
9
|
+
### Changes
|
|
10
|
+
* :loud_sound: add error code to v2 exceptions
|
|
11
|
+
|
|
12
|
+
|
|
3
13
|
## v4.33.0 - 2025-10-27
|
|
4
14
|
### Changes
|
|
5
15
|
* :sparkles: add more details to V2 errors
|
package/package.json
CHANGED
package/src/clientV2.d.ts
CHANGED
|
@@ -17,12 +17,6 @@ import { MindeeApiV2 } from "./http/mindeeApiV2";
|
|
|
17
17
|
* The `initialTimerOptions` and `recurringTimerOptions` objects let you pass an
|
|
18
18
|
* `AbortSignal` or make the timer `unref`-ed to the `setTimeout()`.
|
|
19
19
|
*
|
|
20
|
-
* @property initialDelaySec Number of seconds to wait **before the first poll**.
|
|
21
|
-
* @property delaySec Interval in seconds between two consecutive polls.
|
|
22
|
-
* @property maxRetries Maximum number of polling attempts (including the first one).
|
|
23
|
-
* @property initialTimerOptions Options passed to the initial `setTimeout()`.
|
|
24
|
-
* @property recurringTimerOptions Options passed to every recurring `setTimeout()`.
|
|
25
|
-
*
|
|
26
20
|
* @category ClientV2
|
|
27
21
|
* @example
|
|
28
22
|
* const params = {
|
|
@@ -34,13 +28,18 @@ import { MindeeApiV2 } from "./http/mindeeApiV2";
|
|
|
34
28
|
* const inference = await client.enqueueAndGetInference(inputDoc, params);
|
|
35
29
|
*/
|
|
36
30
|
export interface PollingOptions {
|
|
31
|
+
/** Number of seconds to wait *before the first poll*. */
|
|
37
32
|
initialDelaySec?: number;
|
|
33
|
+
/** Interval in seconds between two consecutive polls. */
|
|
38
34
|
delaySec?: number;
|
|
35
|
+
/** Maximum number of polling attempts (including the first one). */
|
|
39
36
|
maxRetries?: number;
|
|
37
|
+
/** Options passed to the initial `setTimeout()`. */
|
|
40
38
|
initialTimerOptions?: {
|
|
41
39
|
ref?: boolean;
|
|
42
40
|
signal?: AbortSignal;
|
|
43
41
|
};
|
|
42
|
+
/** Options passed to every recurring `setTimeout()`. */
|
|
44
43
|
recurringTimerOptions?: {
|
|
45
44
|
ref?: boolean;
|
|
46
45
|
signal?: AbortSignal;
|
|
@@ -51,16 +50,6 @@ export interface PollingOptions {
|
|
|
51
50
|
*
|
|
52
51
|
* All fields are optional except `modelId`.
|
|
53
52
|
*
|
|
54
|
-
* @property modelId Identifier of the model that must process the document. **Required**.
|
|
55
|
-
* @property rag Enhance extraction accuracy with Retrieval-Augmented Generation.
|
|
56
|
-
* @property rawText Extract the full text content from the document as strings, and fill the `raw_text` attribute.
|
|
57
|
-
* @property polygon Calculate bounding box polygons for all fields, and fill their `locations` attribute.
|
|
58
|
-
* @property confidence Boost the precision and accuracy of all extractions.
|
|
59
|
-
* Calculate confidence scores for all fields and fill their `confidence` attribute.
|
|
60
|
-
* @property alias Custom alias assigned to the uploaded document.
|
|
61
|
-
* @property webhookIds List of webhook UUIDs that will receive the final API response.
|
|
62
|
-
* @property pollingOptions Client-side polling configuration (see {@link PollingOptions}).
|
|
63
|
-
* @property closeFile By default the file is closed once the upload is finished, set to `false` to keep it open.
|
|
64
53
|
* @category ClientV2
|
|
65
54
|
* @example
|
|
66
55
|
* const params = {
|
|
@@ -75,23 +64,34 @@ export interface PollingOptions {
|
|
|
75
64
|
* };
|
|
76
65
|
*/
|
|
77
66
|
export interface InferenceParameters {
|
|
67
|
+
/** Model ID to use for the inference. **Required** */
|
|
78
68
|
modelId: string;
|
|
69
|
+
/** Use Retrieval-Augmented Generation during inference. */
|
|
79
70
|
rag?: boolean;
|
|
71
|
+
/** Extract the entire text from the document as strings, and fill the `rawText` attribute. */
|
|
80
72
|
rawText?: boolean;
|
|
73
|
+
/** Calculate bounding box polygons for values, and fill the `locations` attribute of fields. */
|
|
81
74
|
polygon?: boolean;
|
|
75
|
+
/** Calculate confidence scores for values, and fill the `confidence` attribute of fields.
|
|
76
|
+
* Useful for automation.*/
|
|
82
77
|
confidence?: boolean;
|
|
78
|
+
/** Use an alias to link the file to your own DB. If empty, no alias will be used. */
|
|
83
79
|
alias?: string;
|
|
80
|
+
/** Additional text context used by the model during inference.
|
|
81
|
+
* *Not recommended*, for specific use only. */
|
|
82
|
+
textContext?: string;
|
|
83
|
+
/** Webhook IDs to call after all processing is finished.
|
|
84
|
+
* If empty, no webhooks will be used. */
|
|
84
85
|
webhookIds?: string[];
|
|
86
|
+
/** Client-side polling configuration (see {@link PollingOptions}). */
|
|
85
87
|
pollingOptions?: PollingOptions;
|
|
88
|
+
/** By default, the file is closed once the upload is finished.
|
|
89
|
+
* Set to `false` to keep it open. */
|
|
86
90
|
closeFile?: boolean;
|
|
87
91
|
}
|
|
88
92
|
/**
|
|
89
93
|
* Options for the V2 Mindee Client.
|
|
90
94
|
*
|
|
91
|
-
* @property apiKey Your API key for all endpoints.
|
|
92
|
-
* @property throwOnError Raise an `Error` on errors.
|
|
93
|
-
* @property debug Log debug messages.
|
|
94
|
-
*
|
|
95
95
|
* @category ClientV2
|
|
96
96
|
* @example
|
|
97
97
|
* const client = new MindeeClientV2({
|
|
@@ -101,8 +101,11 @@ export interface InferenceParameters {
|
|
|
101
101
|
* });
|
|
102
102
|
*/
|
|
103
103
|
export interface ClientOptions {
|
|
104
|
+
/** Your API key for all endpoints. */
|
|
104
105
|
apiKey?: string;
|
|
106
|
+
/** Raise an `Error` on errors. */
|
|
105
107
|
throwOnError?: boolean;
|
|
108
|
+
/** Log debug messages. */
|
|
106
109
|
debug?: boolean;
|
|
107
110
|
}
|
|
108
111
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorDetails, ErrorResponse } from "../parsing/v2";
|
|
1
|
+
import { ErrorDetails, ErrorResponse, ErrorItem } from "../parsing/v2";
|
|
2
2
|
/**
|
|
3
3
|
* Main Mindee Error custom class.
|
|
4
4
|
*/
|
|
@@ -25,5 +25,6 @@ export declare class MindeeHttpErrorV2 extends MindeeError implements ErrorDetai
|
|
|
25
25
|
detail: string;
|
|
26
26
|
title: string;
|
|
27
27
|
code: string;
|
|
28
|
+
errors: ErrorItem[];
|
|
28
29
|
constructor(error: ErrorResponse);
|
|
29
30
|
}
|
|
@@ -44,11 +44,12 @@ class MindeeApiV2Error extends MindeeError {
|
|
|
44
44
|
exports.MindeeApiV2Error = MindeeApiV2Error;
|
|
45
45
|
class MindeeHttpErrorV2 extends MindeeError {
|
|
46
46
|
constructor(error) {
|
|
47
|
-
super(`HTTP ${error.status}
|
|
47
|
+
super(`HTTP ${error.status} - ${error.title} :: ${error.code} - ${error.detail}`);
|
|
48
48
|
this.status = error.status;
|
|
49
49
|
this.detail = error.detail;
|
|
50
50
|
this.title = error.title;
|
|
51
51
|
this.code = error.code;
|
|
52
|
+
this.errors = error.errors;
|
|
52
53
|
this.name = "MindeeHttpErrorV2";
|
|
53
54
|
}
|
|
54
55
|
}
|
package/src/http/mindeeApiV2.js
CHANGED
|
@@ -99,6 +99,9 @@ _MindeeApiV2_instances = new WeakSet(), _MindeeApiV2_processResponse = function
|
|
|
99
99
|
if (params.rawText !== undefined && params.rawText !== null) {
|
|
100
100
|
form.append("raw_text", params.rawText.toString().toLowerCase());
|
|
101
101
|
}
|
|
102
|
+
if (params.textContext !== undefined && params.textContext !== null) {
|
|
103
|
+
form.append("text_context", params.textContext);
|
|
104
|
+
}
|
|
102
105
|
if (params.webhookIds && params.webhookIds.length > 0) {
|
|
103
106
|
form.append("webhook_ids", params.webhookIds.join(","));
|
|
104
107
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { StringDict } from "../common";
|
|
2
|
+
/**
|
|
3
|
+
* Explicit details on a problem.
|
|
4
|
+
*/
|
|
2
5
|
export declare class ErrorItem {
|
|
3
6
|
/**
|
|
4
|
-
*
|
|
7
|
+
* A JSON Pointer to the location of the body property.
|
|
5
8
|
*/
|
|
6
9
|
pointer?: string;
|
|
7
10
|
/**
|
|
@@ -17,6 +17,10 @@ export interface ErrorDetails {
|
|
|
17
17
|
* A machine-readable code specific to the occurrence of the problem.
|
|
18
18
|
*/
|
|
19
19
|
code: string;
|
|
20
|
+
/**
|
|
21
|
+
* A list of explicit error details.
|
|
22
|
+
*/
|
|
23
|
+
errors: ErrorItem[];
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
26
|
* Error response detailing a problem. The format adheres to RFC 9457.
|
|
@@ -26,9 +30,6 @@ export declare class ErrorResponse implements ErrorDetails {
|
|
|
26
30
|
detail: string;
|
|
27
31
|
title: string;
|
|
28
32
|
code: string;
|
|
29
|
-
/**
|
|
30
|
-
* A machine-readable code specific to the occurrence of the problem.
|
|
31
|
-
*/
|
|
32
33
|
errors: ErrorItem[];
|
|
33
34
|
/**
|
|
34
35
|
* @param serverResponse JSON response from the server.
|
|
@@ -16,6 +16,10 @@ export declare class InferenceActiveOptions {
|
|
|
16
16
|
* Whether the confidence feature was activated.
|
|
17
17
|
*/
|
|
18
18
|
confidence: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the text context feature was activated.
|
|
21
|
+
*/
|
|
22
|
+
textContext: boolean;
|
|
19
23
|
constructor(serverResponse: StringDict);
|
|
20
24
|
toString(): string;
|
|
21
25
|
}
|
|
@@ -7,6 +7,7 @@ class InferenceActiveOptions {
|
|
|
7
7
|
this.rawText = serverResponse["raw_text"];
|
|
8
8
|
this.polygon = serverResponse["polygon"];
|
|
9
9
|
this.confidence = serverResponse["confidence"];
|
|
10
|
+
this.textContext = serverResponse["text_context"];
|
|
10
11
|
}
|
|
11
12
|
toString() {
|
|
12
13
|
return "Active Options\n" +
|