unstructured-transform-client 0.18.104 → 0.18.106

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.
@@ -53,6 +53,10 @@ export interface ParseRunRequest {
53
53
  * Optional JSON object of advanced options. The only supported option is enrichments.image_description, a boolean that defaults to false.
54
54
  */
55
55
  advancedOptions?: string;
56
+ /**
57
+ * Enable field-level Extract confidence when schema is supplied.
58
+ */
59
+ extractConfidence?: boolean;
56
60
  }
57
61
  /**
58
62
  *
@@ -78,6 +78,9 @@ export class ParseApi extends runtime.BaseAPI {
78
78
  if (requestParameters['advancedOptions'] != null) {
79
79
  formParams.append('advanced_options', requestParameters['advancedOptions']);
80
80
  }
81
+ if (requestParameters['extractConfidence'] != null) {
82
+ formParams.append('extract_confidence', requestParameters['extractConfidence']);
83
+ }
81
84
  let urlPath = `/api/v2/parse`;
82
85
  return {
83
86
  path: urlPath,
@@ -20,6 +20,10 @@ export interface AdvancedOptions {
20
20
  *
21
21
  */
22
22
  enrichments: Enrichments;
23
+ /**
24
+ * Whether field-level Extract confidence was enabled for the job.
25
+ */
26
+ extractConfidence?: boolean;
23
27
  }
24
28
  /**
25
29
  * Check if a given object implements the AdvancedOptions interface.
@@ -29,6 +29,7 @@ export function AdvancedOptionsFromJSONTyped(json, ignoreDiscriminator) {
29
29
  }
30
30
  return {
31
31
  'enrichments': EnrichmentsFromJSON(json['enrichments']),
32
+ 'extractConfidence': json['extract_confidence'] == null ? undefined : json['extract_confidence'],
32
33
  };
33
34
  }
34
35
  export function AdvancedOptionsToJSON(json) {
@@ -40,5 +41,6 @@ export function AdvancedOptionsToJSONTyped(value, ignoreDiscriminator = false) {
40
41
  }
41
42
  return {
42
43
  'enrichments': EnrichmentsToJSON(value['enrichments']),
44
+ 'extract_confidence': value['extractConfidence'],
43
45
  };
44
46
  }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Unstructured Transform API
3
+ * One document in, the parsed document back. A single call takes a document and returns structured output — no job graph, no strategy selection, no model provider setup, and no polling loop. An optional schema switches the request from parse-only to parse-then-extract.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface DegradedPage
16
+ */
17
+ export interface DegradedPage {
18
+ /**
19
+ * The 1-based page number.
20
+ */
21
+ page: number;
22
+ /**
23
+ * Detected regions on the page whose content could not be recognized.
24
+ */
25
+ failedRegions: number;
26
+ /**
27
+ * Detected regions on the page.
28
+ */
29
+ totalRegions: number;
30
+ }
31
+ /**
32
+ * Check if a given object implements the DegradedPage interface.
33
+ */
34
+ export declare function instanceOfDegradedPage(value: object): value is DegradedPage;
35
+ export declare function DegradedPageFromJSON(json: any): DegradedPage;
36
+ export declare function DegradedPageFromJSONTyped(json: any, ignoreDiscriminator: boolean): DegradedPage;
37
+ export declare function DegradedPageToJSON(json: any): DegradedPage;
38
+ export declare function DegradedPageToJSONTyped(value?: DegradedPage | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,51 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Unstructured Transform API
5
+ * One document in, the parsed document back. A single call takes a document and returns structured output — no job graph, no strategy selection, no model provider setup, and no polling loop. An optional schema switches the request from parse-only to parse-then-extract.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ /**
15
+ * Check if a given object implements the DegradedPage interface.
16
+ */
17
+ export function instanceOfDegradedPage(value) {
18
+ if (!('page' in value) || value['page'] === undefined)
19
+ return false;
20
+ if ((!('failedRegions' in value) && !('failed_regions' in value)) || (value['failedRegions'] === undefined && value['failed_regions'] === undefined))
21
+ return false;
22
+ if ((!('totalRegions' in value) && !('total_regions' in value)) || (value['totalRegions'] === undefined && value['total_regions'] === undefined))
23
+ return false;
24
+ return true;
25
+ }
26
+ export function DegradedPageFromJSON(json) {
27
+ return DegradedPageFromJSONTyped(json, false);
28
+ }
29
+ export function DegradedPageFromJSONTyped(json, ignoreDiscriminator) {
30
+ if (json == null) {
31
+ return json;
32
+ }
33
+ return {
34
+ 'page': json['page'],
35
+ 'failedRegions': json['failed_regions'],
36
+ 'totalRegions': json['total_regions'],
37
+ };
38
+ }
39
+ export function DegradedPageToJSON(json) {
40
+ return DegradedPageToJSONTyped(json, false);
41
+ }
42
+ export function DegradedPageToJSONTyped(value, ignoreDiscriminator = false) {
43
+ if (value == null) {
44
+ return value;
45
+ }
46
+ return {
47
+ 'page': value['page'],
48
+ 'failed_regions': value['failedRegions'],
49
+ 'total_regions': value['totalRegions'],
50
+ };
51
+ }
@@ -29,6 +29,10 @@ export interface ExtractRequest {
29
29
  * Optional free-text guidance that shapes how extracted fields are filled. Limited to 1,048,576 bytes when encoded as UTF-8.
30
30
  */
31
31
  prompt?: string;
32
+ /**
33
+ * Enable field-level Extract confidence for this request.
34
+ */
35
+ extractConfidence?: boolean;
32
36
  }
33
37
  /**
34
38
  * Check if a given object implements the ExtractRequest interface.
@@ -32,6 +32,7 @@ export function ExtractRequestFromJSONTyped(json, ignoreDiscriminator) {
32
32
  'parseId': json['parse_id'],
33
33
  'schema': json['schema'],
34
34
  'prompt': json['prompt'] == null ? undefined : json['prompt'],
35
+ 'extractConfidence': json['extract_confidence'] == null ? undefined : json['extract_confidence'],
35
36
  };
36
37
  }
37
38
  export function ExtractRequestToJSON(json) {
@@ -45,5 +46,6 @@ export function ExtractRequestToJSONTyped(value, ignoreDiscriminator = false) {
45
46
  'parse_id': value['parseId'],
46
47
  'schema': value['schema'],
47
48
  'prompt': value['prompt'],
49
+ 'extract_confidence': value['extractConfidence'],
48
50
  };
49
51
  }
@@ -17,7 +17,7 @@ import type { FieldMetadata } from './FieldMetadata.js';
17
17
  */
18
18
  export interface ExtractionResult {
19
19
  /**
20
- * Extracted value conforming to the caller's schema.
20
+ * Natural schema-shaped data in version 2.0; version 2.1 recursively wraps each present object property as value and extract_confidence.
21
21
  */
22
22
  data: any | null;
23
23
  /**
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Unstructured Transform API
3
+ * One document in, the parsed document back. A single call takes a document and returns structured output — no job graph, no strategy selection, no model provider setup, and no polling loop. An optional schema switches the request from parse-only to parse-then-extract.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface FailedPage
16
+ */
17
+ export interface FailedPage {
18
+ /**
19
+ * The 1-based page number.
20
+ */
21
+ page: number;
22
+ /**
23
+ * Stable identifier, safe to branch on.
24
+ */
25
+ code: string;
26
+ /**
27
+ * Human-readable reason.
28
+ */
29
+ message: string;
30
+ }
31
+ /**
32
+ * Check if a given object implements the FailedPage interface.
33
+ */
34
+ export declare function instanceOfFailedPage(value: object): value is FailedPage;
35
+ export declare function FailedPageFromJSON(json: any): FailedPage;
36
+ export declare function FailedPageFromJSONTyped(json: any, ignoreDiscriminator: boolean): FailedPage;
37
+ export declare function FailedPageToJSON(json: any): FailedPage;
38
+ export declare function FailedPageToJSONTyped(value?: FailedPage | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,51 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Unstructured Transform API
5
+ * One document in, the parsed document back. A single call takes a document and returns structured output — no job graph, no strategy selection, no model provider setup, and no polling loop. An optional schema switches the request from parse-only to parse-then-extract.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ /**
15
+ * Check if a given object implements the FailedPage interface.
16
+ */
17
+ export function instanceOfFailedPage(value) {
18
+ if (!('page' in value) || value['page'] === undefined)
19
+ return false;
20
+ if (!('code' in value) || value['code'] === undefined)
21
+ return false;
22
+ if (!('message' in value) || value['message'] === undefined)
23
+ return false;
24
+ return true;
25
+ }
26
+ export function FailedPageFromJSON(json) {
27
+ return FailedPageFromJSONTyped(json, false);
28
+ }
29
+ export function FailedPageFromJSONTyped(json, ignoreDiscriminator) {
30
+ if (json == null) {
31
+ return json;
32
+ }
33
+ return {
34
+ 'page': json['page'],
35
+ 'code': json['code'],
36
+ 'message': json['message'],
37
+ };
38
+ }
39
+ export function FailedPageToJSON(json) {
40
+ return FailedPageToJSONTyped(json, false);
41
+ }
42
+ export function FailedPageToJSONTyped(value, ignoreDiscriminator = false) {
43
+ if (value == null) {
44
+ return value;
45
+ }
46
+ return {
47
+ 'page': value['page'],
48
+ 'code': value['code'],
49
+ 'message': value['message'],
50
+ };
51
+ }
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import type { AdvancedOptions } from './AdvancedOptions.js';
13
13
  /**
14
- * The saved settings of one Parse job.
14
+ * The saved settings of one Parse or Extract job.
15
15
  * @export
16
16
  * @interface JobConfiguration
17
17
  */
@@ -49,7 +49,7 @@ export interface JobResult {
49
49
  */
50
50
  error?: Error;
51
51
  /**
52
- * The settings this job ran with, available in every status. Null for extraction jobs, which run no partitioner of their own.
52
+ * The settings this job ran with, available in every status. Null for Extract jobs that ran without field confidence, because they run no partitioner of their own. When field confidence was requested, this contains the saved Extract settings.
53
53
  */
54
54
  configuration?: JobConfiguration | null;
55
55
  /**
@@ -9,12 +9,14 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
+ import type { FailedPage } from './FailedPage.js';
12
13
  import type { TransformWarning } from './TransformWarning.js';
13
14
  import type { DocumentMetadata } from './DocumentMetadata.js';
14
15
  import type { TransformStatus } from './TransformStatus.js';
15
16
  import type { Element } from './Element.js';
16
17
  import type { ExtractionResult } from './ExtractionResult.js';
17
18
  import type { SourceFile } from './SourceFile.js';
19
+ import type { DegradedPage } from './DegradedPage.js';
18
20
  /**
19
21
  * Parse operation metadata plus the canonical document, possibly before extraction has finished.
20
22
  * @export
@@ -38,9 +40,9 @@ export interface ParseResult {
38
40
  */
39
41
  markdown: string | null;
40
42
  /**
41
- * The document envelope version.
43
+ * The document envelope version. Version 2.1 is returned only when extract_confidence was enabled and uses value/confidence wrappers.
42
44
  */
43
- formatVersion: ParseResultFormatVersionEnum;
45
+ formatVersion: string;
44
46
  /**
45
47
  *
46
48
  */
@@ -53,6 +55,14 @@ export interface ParseResult {
53
55
  * Notes about a result that still succeeded.
54
56
  */
55
57
  warnings?: Array<TransformWarning>;
58
+ /**
59
+ * Pages that could not be processed and have no elements in this result.
60
+ */
61
+ failedPages?: Array<FailedPage>;
62
+ /**
63
+ * Pages that are in this result although some of their content could not be recognized.
64
+ */
65
+ degradedPages?: Array<DegradedPage>;
56
66
  /**
57
67
  * Public document elements.
58
68
  */
@@ -71,13 +81,6 @@ export declare const ParseResultProfileEnum: {
71
81
  readonly Test: "test";
72
82
  };
73
83
  export type ParseResultProfileEnum = typeof ParseResultProfileEnum[keyof typeof ParseResultProfileEnum];
74
- /**
75
- * @export
76
- */
77
- export declare const ParseResultFormatVersionEnum: {
78
- readonly _20: "2.0";
79
- };
80
- export type ParseResultFormatVersionEnum = typeof ParseResultFormatVersionEnum[keyof typeof ParseResultFormatVersionEnum];
81
84
  /**
82
85
  * Check if a given object implements the ParseResult interface.
83
86
  */
@@ -11,12 +11,14 @@
11
11
  * https://openapi-generator.tech
12
12
  * Do not edit the class manually.
13
13
  */
14
+ import { FailedPageFromJSON, FailedPageToJSON, } from './FailedPage.js';
14
15
  import { TransformWarningFromJSON, TransformWarningToJSON, } from './TransformWarning.js';
15
16
  import { DocumentMetadataFromJSON, DocumentMetadataToJSON, } from './DocumentMetadata.js';
16
17
  import { TransformStatusFromJSON, TransformStatusToJSON, } from './TransformStatus.js';
17
18
  import { ElementFromJSON, ElementToJSON, } from './Element.js';
18
19
  import { ExtractionResultFromJSON, ExtractionResultToJSON, } from './ExtractionResult.js';
19
20
  import { SourceFileFromJSON, SourceFileToJSON, } from './SourceFile.js';
21
+ import { DegradedPageFromJSON, DegradedPageToJSON, } from './DegradedPage.js';
20
22
  /**
21
23
  * @export
22
24
  */
@@ -25,12 +27,6 @@ export const ParseResultProfileEnum = {
25
27
  Best: 'best',
26
28
  Test: 'test',
27
29
  };
28
- /**
29
- * @export
30
- */
31
- export const ParseResultFormatVersionEnum = {
32
- _20: '2.0',
33
- };
34
30
  /**
35
31
  * Check if a given object implements the ParseResult interface.
36
32
  */
@@ -45,8 +41,6 @@ export function instanceOfParseResult(value) {
45
41
  return false;
46
42
  if ((!('formatVersion' in value) && !('format_version' in value)) || (value['formatVersion'] === undefined && value['format_version'] === undefined))
47
43
  return false;
48
- if (value['formatVersion'] !== '2.0' && value['format_version'] !== '2.0')
49
- return false;
50
44
  if (!('metadata' in value) || value['metadata'] === undefined)
51
45
  return false;
52
46
  if ((!('extractedData' in value) && !('extracted_data' in value)) || (value['extractedData'] === undefined && value['extracted_data'] === undefined))
@@ -73,6 +67,8 @@ export function ParseResultFromJSONTyped(json, ignoreDiscriminator) {
73
67
  'metadata': DocumentMetadataFromJSON(json['metadata']),
74
68
  'extractedData': (json['extracted_data'] == null ? null : json['extracted_data'].map(ExtractionResultFromJSON)),
75
69
  'warnings': json['warnings'] == null ? undefined : (json['warnings'].map(TransformWarningFromJSON)),
70
+ 'failedPages': json['failed_pages'] == null ? undefined : (json['failed_pages'].map(FailedPageFromJSON)),
71
+ 'degradedPages': json['degraded_pages'] == null ? undefined : (json['degraded_pages'].map(DegradedPageFromJSON)),
76
72
  'elements': (json['elements'].map(ElementFromJSON)),
77
73
  'source': SourceFileFromJSON(json['source']),
78
74
  };
@@ -93,6 +89,8 @@ export function ParseResultToJSONTyped(value, ignoreDiscriminator = false) {
93
89
  'metadata': DocumentMetadataToJSON(value['metadata']),
94
90
  'extracted_data': (value['extractedData'] == null ? null : value['extractedData'].map(ExtractionResultToJSON)),
95
91
  'warnings': value['warnings'] == null ? undefined : (value['warnings'].map(TransformWarningToJSON)),
92
+ 'failed_pages': value['failedPages'] == null ? undefined : (value['failedPages'].map(FailedPageToJSON)),
93
+ 'degraded_pages': value['degradedPages'] == null ? undefined : (value['degradedPages'].map(DegradedPageToJSON)),
96
94
  'elements': (value['elements'].map(ElementToJSON)),
97
95
  'source': SourceFileToJSON(value['source']),
98
96
  };
@@ -1,5 +1,6 @@
1
1
  export * from './AdvancedOptions.js';
2
2
  export * from './Citation.js';
3
+ export * from './DegradedPage.js';
3
4
  export * from './DocumentMetadata.js';
4
5
  export * from './Element.js';
5
6
  export * from './ElementMetadata.js';
@@ -7,6 +8,7 @@ export * from './Enrichments.js';
7
8
  export * from './ErrorCode.js';
8
9
  export * from './ExtractRequest.js';
9
10
  export * from './ExtractionResult.js';
11
+ export * from './FailedPage.js';
10
12
  export * from './FieldMetadata.js';
11
13
  export * from './JobAccepted.js';
12
14
  export * from './JobConfiguration.js';
@@ -2,6 +2,7 @@
2
2
  /* eslint-disable */
3
3
  export * from './AdvancedOptions.js';
4
4
  export * from './Citation.js';
5
+ export * from './DegradedPage.js';
5
6
  export * from './DocumentMetadata.js';
6
7
  export * from './Element.js';
7
8
  export * from './ElementMetadata.js';
@@ -9,6 +10,7 @@ export * from './Enrichments.js';
9
10
  export * from './ErrorCode.js';
10
11
  export * from './ExtractRequest.js';
11
12
  export * from './ExtractionResult.js';
13
+ export * from './FailedPage.js';
12
14
  export * from './FieldMetadata.js';
13
15
  export * from './JobAccepted.js';
14
16
  export * from './JobConfiguration.js';
package/dist/client.d.ts CHANGED
@@ -79,6 +79,8 @@ export interface ParseOptions extends RequestOptions {
79
79
  profile?: ParseRunProfileEnum;
80
80
  /** `{ enrichments: { imageDescription: true } }` describes the images in the document. */
81
81
  advancedOptions?: AdvancedOptions;
82
+ /** Return field-level Extract confidence with the 2.1 response shape. */
83
+ extractConfidence?: boolean;
82
84
  waitSeconds?: number;
83
85
  }
84
86
  declare class ParseNamespace {
@@ -97,6 +99,7 @@ export interface ExtractOptions extends RequestOptions {
97
99
  parseId: string;
98
100
  schema: Record<string, unknown>;
99
101
  prompt?: string;
102
+ extractConfidence?: boolean;
100
103
  waitSeconds?: number;
101
104
  }
102
105
  export interface ExtractFromDocumentOptions extends RequestOptions {
@@ -107,6 +110,7 @@ export interface ExtractFromDocumentOptions extends RequestOptions {
107
110
  schema: Record<string, unknown>;
108
111
  prompt?: string;
109
112
  profile?: ParseRunProfileEnum;
113
+ extractConfidence?: boolean;
110
114
  waitSeconds?: number;
111
115
  }
112
116
  declare class ExtractNamespace {
package/dist/client.js CHANGED
@@ -163,6 +163,7 @@ class ParseNamespace {
163
163
  prompt: options.prompt,
164
164
  profile: options.profile,
165
165
  advancedOptions: advancedOptionsToWire(options.advancedOptions),
166
+ ...(options.extractConfidence ? { extractConfidence: true } : {}),
166
167
  }, requestInit(options)));
167
168
  }
168
169
  }
@@ -178,6 +179,7 @@ class ExtractNamespace {
178
179
  parseId: options.parseId,
179
180
  schema: options.schema,
180
181
  prompt: options.prompt,
182
+ ...(options.extractConfidence ? { extractConfidence: true } : {}),
181
183
  },
182
184
  prefer: prefer(options.waitSeconds),
183
185
  }, requestInit(options)));
@@ -210,6 +212,7 @@ class ExtractNamespace {
210
212
  schema: JSON.stringify(options.schema),
211
213
  prompt: options.prompt,
212
214
  profile: options.profile,
215
+ extract_confidence: options.extractConfidence ? "true" : undefined,
213
216
  },
214
217
  waitSeconds: options.waitSeconds,
215
218
  signal: options.signal,
package/dist/version.d.ts CHANGED
@@ -12,4 +12,4 @@
12
12
  * (tools/release/derived_versions.py); change the series only for a
13
13
  * deliberate minor or major release.
14
14
  */
15
- export declare const VERSION = "0.18.104";
15
+ export declare const VERSION = "0.18.106";
package/dist/version.js CHANGED
@@ -12,4 +12,4 @@
12
12
  * (tools/release/derived_versions.py); change the series only for a
13
13
  * deliberate minor or major release.
14
14
  */
15
- export const VERSION = "0.18.104";
15
+ export const VERSION = "0.18.106";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unstructured-transform-client",
3
- "version": "0.18.104",
3
+ "version": "0.18.106",
4
4
  "description": "TypeScript client for the Unstructured Transform v2 API — one document in, structured output back.",
5
5
  "license": "MIT",
6
6
  "author": "Unstructured",