@retab/node 1.0.74 → 1.0.75

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.
@@ -15,12 +15,17 @@ export default class APIDocuments extends CompositionClient {
15
15
  * and filling. It accepts any PDF document and natural language instructions
16
16
  * describing the values to fill in.
17
17
  *
18
+ * Either `document` OR `template_id` must be provided, but not both.
19
+ * - When `document` is provided: OCR + LLM inference to detect and fill form fields
20
+ * - When `template_id` is provided: Uses pre-defined form fields from the template (PDF only)
21
+ *
18
22
  * @param params - EditRequest containing:
19
- * - document: MIMEData object with filename and url (data URI with base64 content)
20
- * - filling_instructions: Natural language instructions for filling
21
- * - model: LLM model for inference (default: "gemini-2.5-pro")
23
+ * - filling_instructions: Natural language instructions for filling (required)
24
+ * - document: MIMEData object, file path, Buffer, or Readable stream (optional, mutually exclusive with template_id)
25
+ * - model: LLM model for inference (default: "retab-small")
26
+ * - template_id: Template ID to use for filling with pre-defined form fields (optional, mutually exclusive with document)
22
27
  * @param options - Optional request options
23
- * @returns EditResponse containing ocr_result, form_data (filled fields), and filled_document (MIMEData)
28
+ * @returns EditResponse containing form_data (filled fields) and filled_document (MIMEData)
24
29
  */
25
30
  edit(params: EditRequest, options?: RequestOptions): Promise<EditResponse>;
26
31
  /**
@@ -32,7 +37,7 @@ export default class APIDocuments extends CompositionClient {
32
37
  * @param params - SplitRequest containing:
33
38
  * - document: MIMEData object, file path, Buffer, or Readable stream
34
39
  * - categories: Array of categories with 'name' and 'description'
35
- * - model: LLM model for inference (e.g., "gemini-2.5-flash")
40
+ * - model: LLM model for inference (e.g., "retab-small")
36
41
  * @param options - Optional request options
37
42
  * @returns SplitResponse containing splits array with name, start_page, and end_page for each section
38
43
  *
@@ -40,7 +45,7 @@ export default class APIDocuments extends CompositionClient {
40
45
  * ```typescript
41
46
  * const response = await retab.documents.split({
42
47
  * document: "invoice_batch.pdf",
43
- * model: "gemini-2.5-flash",
48
+ * model: "retab-small",
44
49
  * categories: [
45
50
  * { name: "invoice", description: "Invoice documents with billing information" },
46
51
  * { name: "receipt", description: "Receipt documents for payments" },
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/documents/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAA2B,sBAAsB,EAAE,yBAAyB,EAA8B,YAAY,EAAE,WAAW,EAA+B,4BAA4B,EAAE,eAAe,EAAmD,0BAA0B,EAA+B,8BAA8B,EAAmC,WAAW,EAAE,YAAY,EAA+B,YAAY,EAAiC,MAAM,gBAAgB,CAAC;AAC/f,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,iBAAiB;gBAC3C,MAAM,EAAE,iBAAiB;IAG/B,OAAO,CAAC,MAAM,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAUrG,cAAc,CAAC,MAAM,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,8BAA8B,CAAC,CAAC;IAUjI,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC;IAS3E,eAAe,CAAC,MAAM,EAAE,4BAA4B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IASzG,aAAa,CAAC,MAAM,EAAE,0BAA0B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAS3G;;;;;;;;;;;;;OAaG;IACG,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAShF;;;;;;;;;;;;;;;;;;;;;;;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AC;IAShF;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAStF"}
@@ -58,12 +58,17 @@ export default class APIDocuments extends CompositionClient {
58
58
  * and filling. It accepts any PDF document and natural language instructions
59
59
  * describing the values to fill in.
60
60
  *
61
+ * Either `document` OR `template_id` must be provided, but not both.
62
+ * - When `document` is provided: OCR + LLM inference to detect and fill form fields
63
+ * - When `template_id` is provided: Uses pre-defined form fields from the template (PDF only)
64
+ *
61
65
  * @param params - EditRequest containing:
62
- * - document: MIMEData object with filename and url (data URI with base64 content)
63
- * - filling_instructions: Natural language instructions for filling
64
- * - model: LLM model for inference (default: "gemini-2.5-pro")
66
+ * - filling_instructions: Natural language instructions for filling (required)
67
+ * - document: MIMEData object, file path, Buffer, or Readable stream (optional, mutually exclusive with template_id)
68
+ * - model: LLM model for inference (default: "retab-small")
69
+ * - template_id: Template ID to use for filling with pre-defined form fields (optional, mutually exclusive with document)
65
70
  * @param options - Optional request options
66
- * @returns EditResponse containing ocr_result, form_data (filled fields), and filled_document (MIMEData)
71
+ * @returns EditResponse containing form_data (filled fields) and filled_document (MIMEData)
67
72
  */
68
73
  async edit(params, options) {
69
74
  return this._fetchJson(ZEditResponse, {
@@ -83,7 +88,7 @@ export default class APIDocuments extends CompositionClient {
83
88
  * @param params - SplitRequest containing:
84
89
  * - document: MIMEData object, file path, Buffer, or Readable stream
85
90
  * - categories: Array of categories with 'name' and 'description'
86
- * - model: LLM model for inference (e.g., "gemini-2.5-flash")
91
+ * - model: LLM model for inference (e.g., "retab-small")
87
92
  * @param options - Optional request options
88
93
  * @returns SplitResponse containing splits array with name, start_page, and end_page for each section
89
94
  *
@@ -91,7 +96,7 @@ export default class APIDocuments extends CompositionClient {
91
96
  * ```typescript
92
97
  * const response = await retab.documents.split({
93
98
  * document: "invoice_batch.pdf",
94
- * model: "gemini-2.5-flash",
99
+ * model: "retab-small",
95
100
  * categories: [
96
101
  * { name: "invoice", description: "Invoice documents with billing information" },
97
102
  * { name: "receipt", description: "Receipt documents for payments" },