mindee 4.29.0 → 4.30.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,12 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v4.30.0 - 2025-09-04
4
+ ### Changes
5
+ * :sparkles: add support for inference options
6
+ * :recycle: refactor rst display to match other SDKs
7
+ ### ¡Breaking Changes!
8
+ * :recycle: :boom: update raw text output from server
9
+
3
10
  ## v4.29.0 - 2025-08-29
4
11
  ### Changes
5
12
  * :sparkles: add typed accessors for fields, list, object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindee",
3
- "version": "4.29.0",
3
+ "version": "4.30.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
@@ -52,7 +52,11 @@ export interface PollingOptions {
52
52
  * All fields are optional except `modelId`.
53
53
  *
54
54
  * @property modelId Identifier of the model that must process the document. **Required**.
55
- * @property rag When `true`, activates Retrieval-Augmented Generation (RAG).
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.
56
60
  * @property alias Custom alias assigned to the uploaded document.
57
61
  * @property webhookIds List of webhook UUIDs that will receive the final API response.
58
62
  * @property pollingOptions Client-side polling configuration (see {@link PollingOptions}).
@@ -73,6 +77,9 @@ export interface PollingOptions {
73
77
  export interface InferenceParameters {
74
78
  modelId: string;
75
79
  rag?: boolean;
80
+ rawText?: boolean;
81
+ polygon?: boolean;
82
+ confidence?: boolean;
76
83
  alias?: string;
77
84
  webhookIds?: string[];
78
85
  pollingOptions?: PollingOptions;
@@ -82,8 +82,17 @@ _MindeeApiV2_instances = new WeakSet(), _MindeeApiV2_processResponse = function
82
82
  }, _MindeeApiV2_documentEnqueuePost = function _MindeeApiV2_documentEnqueuePost(inputSource, params) {
83
83
  const form = new form_data_1.default();
84
84
  form.append("model_id", params.modelId);
85
- if (params.rag) {
86
- form.append("rag", "true");
85
+ if (params.rag !== undefined && params.rag !== null) {
86
+ form.append("rag", params.rag.toString());
87
+ }
88
+ if (params.polygon !== undefined && params.polygon !== null) {
89
+ form.append("polygon", params.polygon.toString().toLowerCase());
90
+ }
91
+ if (params.confidence !== undefined && params.confidence !== null) {
92
+ form.append("confidence", params.confidence.toString().toLowerCase());
93
+ }
94
+ if (params.rawText !== undefined && params.rawText !== null) {
95
+ form.append("raw_text", params.rawText.toString().toLowerCase());
87
96
  }
88
97
  if (params.webhookIds && params.webhookIds.length > 0) {
89
98
  form.append("webhook_ids", params.webhookIds.join(","));
@@ -1,6 +1,7 @@
1
1
  export { CommonResponse } from "./commonResponse";
2
2
  export { ErrorResponse } from "./errorResponse";
3
3
  export { Inference } from "./inference";
4
+ export { InferenceActiveOptions } from "./inferenceActiveOptions";
4
5
  export { InferenceFile } from "./inferenceFile";
5
6
  export { InferenceModel } from "./inferenceModel";
6
7
  export { InferenceResponse } from "./inferenceResponse";
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JobWebhook = exports.RawText = exports.JobResponse = exports.Job = exports.InferenceResult = exports.InferenceResponse = exports.InferenceModel = exports.InferenceFile = exports.Inference = exports.ErrorResponse = exports.CommonResponse = void 0;
3
+ exports.JobWebhook = exports.RawText = exports.JobResponse = exports.Job = exports.InferenceResult = exports.InferenceResponse = exports.InferenceModel = exports.InferenceFile = exports.InferenceActiveOptions = exports.Inference = exports.ErrorResponse = exports.CommonResponse = void 0;
4
4
  var commonResponse_1 = require("./commonResponse");
5
5
  Object.defineProperty(exports, "CommonResponse", { enumerable: true, get: function () { return commonResponse_1.CommonResponse; } });
6
6
  var errorResponse_1 = require("./errorResponse");
7
7
  Object.defineProperty(exports, "ErrorResponse", { enumerable: true, get: function () { return errorResponse_1.ErrorResponse; } });
8
8
  var inference_1 = require("./inference");
9
9
  Object.defineProperty(exports, "Inference", { enumerable: true, get: function () { return inference_1.Inference; } });
10
+ var inferenceActiveOptions_1 = require("./inferenceActiveOptions");
11
+ Object.defineProperty(exports, "InferenceActiveOptions", { enumerable: true, get: function () { return inferenceActiveOptions_1.InferenceActiveOptions; } });
10
12
  var inferenceFile_1 = require("./inferenceFile");
11
13
  Object.defineProperty(exports, "InferenceFile", { enumerable: true, get: function () { return inferenceFile_1.InferenceFile; } });
12
14
  var inferenceModel_1 = require("./inferenceModel");
@@ -2,6 +2,7 @@ import { StringDict } from "../common";
2
2
  import { InferenceModel } from "./inferenceModel";
3
3
  import { InferenceResult } from "./inferenceResult";
4
4
  import { InferenceFile } from "./inferenceFile";
5
+ import { InferenceActiveOptions } from "./inferenceActiveOptions";
5
6
  export declare class Inference {
6
7
  /**
7
8
  * Model info for the inference.
@@ -19,6 +20,10 @@ export declare class Inference {
19
20
  * ID of the inference.
20
21
  */
21
22
  id?: string;
23
+ /**
24
+ * Active options for the inference.
25
+ */
26
+ activeOptions: InferenceActiveOptions;
22
27
  constructor(serverResponse: StringDict);
23
28
  toString(): string;
24
29
  }
@@ -4,22 +4,20 @@ exports.Inference = void 0;
4
4
  const inferenceModel_1 = require("./inferenceModel");
5
5
  const inferenceResult_1 = require("./inferenceResult");
6
6
  const inferenceFile_1 = require("./inferenceFile");
7
+ const inferenceActiveOptions_1 = require("./inferenceActiveOptions");
7
8
  class Inference {
8
9
  constructor(serverResponse) {
9
10
  this.model = new inferenceModel_1.InferenceModel(serverResponse["model"]);
10
11
  this.file = new inferenceFile_1.InferenceFile(serverResponse["file"]);
11
12
  this.result = new inferenceResult_1.InferenceResult(serverResponse["result"]);
12
- if ("id" in serverResponse) {
13
- this.id = serverResponse["id"];
14
- }
13
+ this.activeOptions = new inferenceActiveOptions_1.InferenceActiveOptions(serverResponse["active_options"]);
15
14
  }
16
15
  toString() {
17
16
  return ("Inference\n" +
18
17
  "#########\n" +
19
- "Model\n" +
20
- "=====\n" +
21
- `:ID: ${this.model.id}\n\n` +
18
+ this.model.toString() + "\n" +
22
19
  this.file.toString() + "\n" +
20
+ this.activeOptions.toString() + "\n" +
23
21
  this.result + "\n");
24
22
  }
25
23
  }
@@ -0,0 +1,21 @@
1
+ import { StringDict } from "../common";
2
+ export declare class InferenceActiveOptions {
3
+ /**
4
+ * Whether the RAG feature was activated.
5
+ */
6
+ rag: boolean;
7
+ /**
8
+ * Whether the Raw Text feature was activated.
9
+ */
10
+ rawText: boolean;
11
+ /**
12
+ * Whether the polygon feature was activated.
13
+ */
14
+ polygon: boolean;
15
+ /**
16
+ * Whether the confidence feature was activated.
17
+ */
18
+ confidence: boolean;
19
+ constructor(serverResponse: StringDict);
20
+ toString(): string;
21
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InferenceActiveOptions = void 0;
4
+ class InferenceActiveOptions {
5
+ constructor(serverResponse) {
6
+ this.rag = serverResponse["rag"];
7
+ this.rawText = serverResponse["raw_text"];
8
+ this.polygon = serverResponse["polygon"];
9
+ this.confidence = serverResponse["confidence"];
10
+ }
11
+ toString() {
12
+ return "Active Options\n" +
13
+ "==============\n" +
14
+ `:Raw Text: ${this.rawText ? "True" : "False"}\n` +
15
+ `:Polygon: ${this.polygon ? "True" : "False"}\n` +
16
+ `:Confidence: ${this.confidence ? "True" : "False"}\n` +
17
+ `:RAG: ${this.rag ? "True" : "False"}\n`;
18
+ }
19
+ }
20
+ exports.InferenceActiveOptions = InferenceActiveOptions;
@@ -5,4 +5,5 @@ export declare class InferenceModel {
5
5
  */
6
6
  id: string;
7
7
  constructor(serverResponse: StringDict);
8
+ toString(): string;
8
9
  }
@@ -5,5 +5,10 @@ class InferenceModel {
5
5
  constructor(serverResponse) {
6
6
  this.id = serverResponse["id"];
7
7
  }
8
+ toString() {
9
+ return "Model\n" +
10
+ "=====\n" +
11
+ `:ID: ${this.id}\n`;
12
+ }
8
13
  }
9
14
  exports.InferenceModel = InferenceModel;
@@ -11,12 +11,7 @@ class InferenceResult {
11
11
  }
12
12
  }
13
13
  toString() {
14
- const parts = [
15
- "Fields",
16
- "======",
17
- this.fields.toString(),
18
- ];
19
- return parts.join("\n");
14
+ return `Fields\n======\n${this.fields}`;
20
15
  }
21
16
  }
22
17
  exports.InferenceResult = InferenceResult;
@@ -6,4 +6,5 @@ export declare class RawText {
6
6
  */
7
7
  pages: Array<RawTextPage>;
8
8
  constructor(serverResponse: StringDict);
9
+ toString(): string;
9
10
  }
@@ -6,5 +6,8 @@ class RawText {
6
6
  constructor(serverResponse) {
7
7
  this.pages = serverResponse["pages"] ? serverResponse["pages"].map((rawTextPage) => new rawTextPage_1.RawTextPage(rawTextPage)) : [];
8
8
  }
9
+ toString() {
10
+ return this.pages.map(page => page.toString()).join("\n\n");
11
+ }
9
12
  }
10
13
  exports.RawText = RawText;