unstructured-transform-client 0.18.105 → 0.18.107
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/dist/_generated/apis/ParseApi.d.ts +4 -0
- package/dist/_generated/apis/ParseApi.js +3 -0
- package/dist/_generated/models/AdvancedOptions.d.ts +4 -0
- package/dist/_generated/models/AdvancedOptions.js +2 -0
- package/dist/_generated/models/ErrorCode.d.ts +1 -0
- package/dist/_generated/models/ErrorCode.js +1 -0
- package/dist/_generated/models/ExtractRequest.d.ts +4 -0
- package/dist/_generated/models/ExtractRequest.js +2 -0
- package/dist/_generated/models/ExtractionResult.d.ts +1 -1
- package/dist/_generated/models/JobConfiguration.d.ts +1 -1
- package/dist/_generated/models/JobResult.d.ts +1 -1
- package/dist/_generated/models/ParseResult.d.ts +2 -9
- package/dist/_generated/models/ParseResult.js +0 -8
- package/dist/client.d.ts +4 -0
- package/dist/client.js +3 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -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
|
}
|
|
@@ -40,6 +40,7 @@ export declare const ErrorCode: {
|
|
|
40
40
|
readonly JobNotTerminal: "job_not_terminal";
|
|
41
41
|
readonly Forbidden: "forbidden";
|
|
42
42
|
readonly AuthorizationUnavailable: "authorization_unavailable";
|
|
43
|
+
readonly ClientClosedRequest: "client_closed_request";
|
|
43
44
|
};
|
|
44
45
|
export type ErrorCode = typeof ErrorCode[keyof typeof ErrorCode];
|
|
45
46
|
export declare function instanceOfErrorCode(value: any): boolean;
|
|
@@ -42,6 +42,7 @@ export const ErrorCode = {
|
|
|
42
42
|
JobNotTerminal: 'job_not_terminal',
|
|
43
43
|
Forbidden: 'forbidden',
|
|
44
44
|
AuthorizationUnavailable: 'authorization_unavailable',
|
|
45
|
+
ClientClosedRequest: 'client_closed_request',
|
|
45
46
|
};
|
|
46
47
|
export function instanceOfErrorCode(value) {
|
|
47
48
|
for (const key in ErrorCode) {
|
|
@@ -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
|
-
*
|
|
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
|
/**
|
|
@@ -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
|
|
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
|
/**
|
|
@@ -40,9 +40,9 @@ export interface ParseResult {
|
|
|
40
40
|
*/
|
|
41
41
|
markdown: string | null;
|
|
42
42
|
/**
|
|
43
|
-
* 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.
|
|
44
44
|
*/
|
|
45
|
-
formatVersion:
|
|
45
|
+
formatVersion: string;
|
|
46
46
|
/**
|
|
47
47
|
*
|
|
48
48
|
*/
|
|
@@ -81,13 +81,6 @@ export declare const ParseResultProfileEnum: {
|
|
|
81
81
|
readonly Test: "test";
|
|
82
82
|
};
|
|
83
83
|
export type ParseResultProfileEnum = typeof ParseResultProfileEnum[keyof typeof ParseResultProfileEnum];
|
|
84
|
-
/**
|
|
85
|
-
* @export
|
|
86
|
-
*/
|
|
87
|
-
export declare const ParseResultFormatVersionEnum: {
|
|
88
|
-
readonly _20: "2.0";
|
|
89
|
-
};
|
|
90
|
-
export type ParseResultFormatVersionEnum = typeof ParseResultFormatVersionEnum[keyof typeof ParseResultFormatVersionEnum];
|
|
91
84
|
/**
|
|
92
85
|
* Check if a given object implements the ParseResult interface.
|
|
93
86
|
*/
|
|
@@ -27,12 +27,6 @@ export const ParseResultProfileEnum = {
|
|
|
27
27
|
Best: 'best',
|
|
28
28
|
Test: 'test',
|
|
29
29
|
};
|
|
30
|
-
/**
|
|
31
|
-
* @export
|
|
32
|
-
*/
|
|
33
|
-
export const ParseResultFormatVersionEnum = {
|
|
34
|
-
_20: '2.0',
|
|
35
|
-
};
|
|
36
30
|
/**
|
|
37
31
|
* Check if a given object implements the ParseResult interface.
|
|
38
32
|
*/
|
|
@@ -47,8 +41,6 @@ export function instanceOfParseResult(value) {
|
|
|
47
41
|
return false;
|
|
48
42
|
if ((!('formatVersion' in value) && !('format_version' in value)) || (value['formatVersion'] === undefined && value['format_version'] === undefined))
|
|
49
43
|
return false;
|
|
50
|
-
if (value['formatVersion'] !== '2.0' && value['format_version'] !== '2.0')
|
|
51
|
-
return false;
|
|
52
44
|
if (!('metadata' in value) || value['metadata'] === undefined)
|
|
53
45
|
return false;
|
|
54
46
|
if ((!('extractedData' in value) && !('extracted_data' in value)) || (value['extractedData'] === undefined && value['extracted_data'] === undefined))
|
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
package/dist/version.js
CHANGED
package/package.json
CHANGED