parze 0.2.2 → 0.2.3

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/README.md CHANGED
@@ -35,7 +35,7 @@ const extraction2 = await client.extract(parseResult.text, {
35
35
  }, parseResult.job_id);
36
36
 
37
37
  // Get AI-suggested schema
38
- const suggested = await client.suggestSchema(result.text);
38
+ const suggested = await client.suggestSchema(parseResult.text);
39
39
  console.log(suggested);
40
40
  ```
41
41
 
@@ -62,12 +62,16 @@ Extract structured data from text using a schema.
62
62
  - `extractionSchema` (object): Schema defining fields to extract
63
63
  - `jobId` (string): Job ID from parse response
64
64
 
65
- ### `extractFile(filePath, extractionSchema)`
65
+ ### `extractFile(filePath, extractionSchema, options?)`
66
66
  Extract structured data from a file. Parse runs internally.
67
67
 
68
68
  **Parameters:**
69
69
  - `filePath` (string): Path to document file
70
70
  - `extractionSchema` (object): Schema defining fields to extract
71
+ - `options` (object, optional):
72
+ - `preserveTables`: boolean
73
+ - `preserveLayout`: boolean
74
+ - `extractionMode`: "auto" | "ocr_only" | "llm_only" | "identity_doc"
71
75
 
72
76
  **Returns:** Promise with extracted data and confidence scores
73
77
 
package/dist/index.d.ts CHANGED
@@ -8,6 +8,11 @@ export interface ParseOptions {
8
8
  preserveLayout?: boolean;
9
9
  extractionMode?: 'auto' | 'ocr_only' | 'llm_only' | 'identity_doc';
10
10
  }
11
+ export interface ExtractFileOptions {
12
+ preserveTables?: boolean;
13
+ preserveLayout?: boolean;
14
+ extractionMode?: 'auto' | 'ocr_only' | 'llm_only' | 'identity_doc';
15
+ }
11
16
  export declare class ParzeClient {
12
17
  private apiKey;
13
18
  private baseUrl;
@@ -15,7 +20,7 @@ export declare class ParzeClient {
15
20
  constructor(options: ParzeClientOptions);
16
21
  parse(filePath: string, options?: ParseOptions): Promise<any>;
17
22
  extract(text: string, extractionSchema: object, jobId: string): Promise<any>;
18
- extractFile(filePath: string, extractionSchema: object): Promise<any>;
23
+ extractFile(filePath: string, extractionSchema: object, options?: ExtractFileOptions): Promise<any>;
19
24
  suggestSchema(text: string): Promise<any>;
20
25
  textToSchema(description: string): Promise<any>;
21
26
  }
package/dist/index.js CHANGED
@@ -75,10 +75,16 @@ class ParzeClient {
75
75
  });
76
76
  return response.data;
77
77
  }
78
- async extractFile(filePath, extractionSchema) {
78
+ async extractFile(filePath, extractionSchema, options) {
79
79
  const form = new form_data_1.default();
80
80
  form.append('file', fs.createReadStream(filePath));
81
81
  form.append('extraction_schema', JSON.stringify(extractionSchema));
82
+ if ((options === null || options === void 0 ? void 0 : options.preserveTables) !== undefined)
83
+ form.append('preserve_tables', String(options.preserveTables));
84
+ if ((options === null || options === void 0 ? void 0 : options.preserveLayout) !== undefined)
85
+ form.append('preserve_layout', String(options.preserveLayout));
86
+ if (options === null || options === void 0 ? void 0 : options.extractionMode)
87
+ form.append('extraction_mode', options.extractionMode);
82
88
  const response = await this.http.post('/extract', form, {
83
89
  headers: form.getHeaders(),
84
90
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parze",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "TypeScript SDK for the Parze API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",