@retab/node 1.0.69 → 1.0.70

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.
@@ -1,5 +1,5 @@
1
1
  import { CompositionClient, RequestOptions } from "../../client.js";
2
- import { DocumentExtractRequest, RetabParsedChatCompletion, ParseRequest, ParseResult, DocumentCreateMessageRequest, DocumentMessage, DocumentCreateInputRequest, RetabParsedChatCompletionChunk } from "../../types.js";
2
+ import { DocumentExtractRequest, RetabParsedChatCompletion, ParseRequest, ParseResult, DocumentCreateMessageRequest, DocumentMessage, DocumentCreateInputRequest, RetabParsedChatCompletionChunk, EditRequest, EditResponse } from "../../types.js";
3
3
  export default class APIDocuments extends CompositionClient {
4
4
  constructor(client: CompositionClient);
5
5
  extract(params: DocumentExtractRequest, options?: RequestOptions): Promise<RetabParsedChatCompletion>;
@@ -7,5 +7,20 @@ export default class APIDocuments extends CompositionClient {
7
7
  parse(params: ParseRequest, options?: RequestOptions): Promise<ParseResult>;
8
8
  create_messages(params: DocumentCreateMessageRequest, options?: RequestOptions): Promise<DocumentMessage>;
9
9
  create_inputs(params: DocumentCreateInputRequest, options?: RequestOptions): Promise<DocumentMessage>;
10
+ /**
11
+ * Edit a PDF document by automatically detecting and filling form fields.
12
+ *
13
+ * This method combines OCR text detection with LLM-based form field inference
14
+ * and filling. It accepts any PDF document and natural language instructions
15
+ * describing the values to fill in.
16
+ *
17
+ * @param params - EditRequest containing:
18
+ * - document: MIMEData object with filename and url (data URI with base64 content)
19
+ * - filling_instructions: Natural language instructions for filling
20
+ * - model: LLM model for inference (default: "gemini-2.5-pro")
21
+ * @param options - Optional request options
22
+ * @returns EditResponse containing ocr_result, form_data (filled fields), and filled_pdf (MIMEData)
23
+ */
24
+ edit(params: EditRequest, options?: RequestOptions): Promise<EditResponse>;
10
25
  }
11
26
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/docum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AAM,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;CASnF"}
@@ -1,5 +1,5 @@
1
1
  import { CompositionClient } from "../../client.js";
2
- import { ZDocumentExtractRequest, ZRetabParsedChatCompletion, ZParseResult, ZParseRequest, ZDocumentMessage, ZDocumentCreateMessageRequest, ZDocumentCreateInputRequest, ZRetabParsedChatCompletionChunk } from "../../types.js";
2
+ import { ZDocumentExtractRequest, ZRetabParsedChatCompletion, ZParseResult, ZParseRequest, ZDocumentMessage, ZDocumentCreateMessageRequest, ZDocumentCreateInputRequest, ZRetabParsedChatCompletionChunk, ZEditRequest, ZEditResponse } from "../../types.js";
3
3
  export default class APIDocuments extends CompositionClient {
4
4
  constructor(client) {
5
5
  super(client);
@@ -51,4 +51,27 @@ export default class APIDocuments extends CompositionClient {
51
51
  headers: options?.headers,
52
52
  });
53
53
  }
54
+ /**
55
+ * Edit a PDF document by automatically detecting and filling form fields.
56
+ *
57
+ * This method combines OCR text detection with LLM-based form field inference
58
+ * and filling. It accepts any PDF document and natural language instructions
59
+ * describing the values to fill in.
60
+ *
61
+ * @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")
65
+ * @param options - Optional request options
66
+ * @returns EditResponse containing ocr_result, form_data (filled fields), and filled_pdf (MIMEData)
67
+ */
68
+ async edit(params, options) {
69
+ return this._fetchJson(ZEditResponse, {
70
+ url: "/v1/documents/edit",
71
+ method: "POST",
72
+ body: { ...(await ZEditRequest.parseAsync(params)), ...(options?.body || {}) },
73
+ params: options?.params,
74
+ headers: options?.headers,
75
+ });
76
+ }
54
77
  }