mindee 4.33.1 → 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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v4.34.0 - 2025-12-02
4
+ ### Changes
5
+ * :sparkles: add support for text context
6
+
7
+
3
8
  ## v4.33.1 - 2025-10-28
4
9
  ### Changes
5
10
  * :loud_sound: add error code to v2 exceptions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindee",
3
- "version": "4.33.1",
3
+ "version": "4.34.0",
4
4
  "description": "Mindee Client Library for Node.js",
5
5
  "main": "src/index.js",
6
6
  "bin": "bin/mindee.js",
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
  /**
@@ -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
- * The HTTP status code returned by the server.
7
+ * A JSON Pointer to the location of the body property.
5
8
  */
6
9
  pointer?: string;
7
10
  /**
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ErrorItem = void 0;
4
+ /**
5
+ * Explicit details on a problem.
6
+ */
4
7
  class ErrorItem {
5
8
  /**
6
9
  * @param serverResponse JSON response from the server.
@@ -18,7 +18,7 @@ export interface ErrorDetails {
18
18
  */
19
19
  code: string;
20
20
  /**
21
- * A machine-readable code specific to the occurrence of the problem.
21
+ * A list of explicit error details.
22
22
  */
23
23
  errors: ErrorItem[];
24
24
  }
@@ -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" +