parze 0.2.2 → 0.2.4

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
 
@@ -49,7 +49,6 @@ Parse a document into structured text.
49
49
  - `options` (object, optional):
50
50
  - `outputFormat`: "structured" | "markdown" | "json"
51
51
  - `preserveTables`: boolean
52
- - `preserveLayout`: boolean
53
52
  - `extractionMode`: "auto" | "ocr_only" | "llm_only" | "identity_doc"
54
53
 
55
54
  **Returns:** Promise with parsed text and metadata
@@ -62,12 +61,15 @@ Extract structured data from text using a schema.
62
61
  - `extractionSchema` (object): Schema defining fields to extract
63
62
  - `jobId` (string): Job ID from parse response
64
63
 
65
- ### `extractFile(filePath, extractionSchema)`
64
+ ### `extractFile(filePath, extractionSchema, options?)`
66
65
  Extract structured data from a file. Parse runs internally.
67
66
 
68
67
  **Parameters:**
69
68
  - `filePath` (string): Path to document file
70
69
  - `extractionSchema` (object): Schema defining fields to extract
70
+ - `options` (object, optional):
71
+ - `preserveTables`: boolean
72
+ - `extractionMode`: "auto" | "ocr_only" | "llm_only" | "identity_doc"
71
73
 
72
74
  **Returns:** Promise with extracted data and confidence scores
73
75
 
package/dist/index.d.ts CHANGED
@@ -5,7 +5,10 @@ export interface ParzeClientOptions {
5
5
  export interface ParseOptions {
6
6
  outputFormat?: 'structured' | 'markdown' | 'json';
7
7
  preserveTables?: boolean;
8
- preserveLayout?: boolean;
8
+ extractionMode?: 'auto' | 'ocr_only' | 'llm_only' | 'identity_doc';
9
+ }
10
+ export interface ExtractFileOptions {
11
+ preserveTables?: boolean;
9
12
  extractionMode?: 'auto' | 'ocr_only' | 'llm_only' | 'identity_doc';
10
13
  }
11
14
  export declare class ParzeClient {
@@ -15,7 +18,7 @@ export declare class ParzeClient {
15
18
  constructor(options: ParzeClientOptions);
16
19
  parse(filePath: string, options?: ParseOptions): Promise<any>;
17
20
  extract(text: string, extractionSchema: object, jobId: string): Promise<any>;
18
- extractFile(filePath: string, extractionSchema: object): Promise<any>;
21
+ extractFile(filePath: string, extractionSchema: object, options?: ExtractFileOptions): Promise<any>;
19
22
  suggestSchema(text: string): Promise<any>;
20
23
  textToSchema(description: string): Promise<any>;
21
24
  }
package/dist/index.js CHANGED
@@ -58,8 +58,6 @@ class ParzeClient {
58
58
  form.append('output_format', options.outputFormat);
59
59
  if ((options === null || options === void 0 ? void 0 : options.preserveTables) !== undefined)
60
60
  form.append('preserve_tables', String(options.preserveTables));
61
- if ((options === null || options === void 0 ? void 0 : options.preserveLayout) !== undefined)
62
- form.append('preserve_layout', String(options.preserveLayout));
63
61
  if (options === null || options === void 0 ? void 0 : options.extractionMode)
64
62
  form.append('extraction_mode', options.extractionMode);
65
63
  const response = await this.http.post('/parse', form, {
@@ -75,10 +73,14 @@ class ParzeClient {
75
73
  });
76
74
  return response.data;
77
75
  }
78
- async extractFile(filePath, extractionSchema) {
76
+ async extractFile(filePath, extractionSchema, options) {
79
77
  const form = new form_data_1.default();
80
78
  form.append('file', fs.createReadStream(filePath));
81
79
  form.append('extraction_schema', JSON.stringify(extractionSchema));
80
+ if ((options === null || options === void 0 ? void 0 : options.preserveTables) !== undefined)
81
+ form.append('preserve_tables', String(options.preserveTables));
82
+ if (options === null || options === void 0 ? void 0 : options.extractionMode)
83
+ form.append('extraction_mode', options.extractionMode);
82
84
  const response = await this.http.post('/extract', form, {
83
85
  headers: form.getHeaders(),
84
86
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parze",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "TypeScript SDK for the Parze API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",