@llamaindex/llama-cloud 1.8.0 → 2.1.0
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/CHANGELOG.md +72 -0
- package/README.md +10 -8
- package/client.d.mts +4 -6
- package/client.d.mts.map +1 -1
- package/client.d.ts +4 -6
- package/client.d.ts.map +1 -1
- package/client.js +7 -6
- package/client.js.map +1 -1
- package/client.mjs +7 -6
- package/client.mjs.map +1 -1
- package/core/pagination.d.mts +0 -23
- package/core/pagination.d.mts.map +1 -1
- package/core/pagination.d.ts +0 -23
- package/core/pagination.d.ts.map +1 -1
- package/core/pagination.js +1 -32
- package/core/pagination.js.map +1 -1
- package/core/pagination.mjs +0 -30
- package/core/pagination.mjs.map +1 -1
- package/package.json +12 -1
- package/resources/beta/batch/batch.d.mts +55 -30
- package/resources/beta/batch/batch.d.mts.map +1 -1
- package/resources/beta/batch/batch.d.ts +55 -30
- package/resources/beta/batch/batch.d.ts.map +1 -1
- package/resources/beta/batch/batch.js +14 -11
- package/resources/beta/batch/batch.js.map +1 -1
- package/resources/beta/batch/batch.mjs +14 -11
- package/resources/beta/batch/batch.mjs.map +1 -1
- package/resources/beta/batch/job-items.d.mts +36 -13
- package/resources/beta/batch/job-items.d.mts.map +1 -1
- package/resources/beta/batch/job-items.d.ts +36 -13
- package/resources/beta/batch/job-items.d.ts.map +1 -1
- package/resources/beta/batch/job-items.js +6 -8
- package/resources/beta/batch/job-items.js.map +1 -1
- package/resources/beta/batch/job-items.mjs +6 -8
- package/resources/beta/batch/job-items.mjs.map +1 -1
- package/resources/beta/parse-configurations.d.mts +7 -9
- package/resources/beta/parse-configurations.d.mts.map +1 -1
- package/resources/beta/parse-configurations.d.ts +7 -9
- package/resources/beta/parse-configurations.d.ts.map +1 -1
- package/resources/beta/parse-configurations.js +7 -9
- package/resources/beta/parse-configurations.js.map +1 -1
- package/resources/beta/parse-configurations.mjs +7 -9
- package/resources/beta/parse-configurations.mjs.map +1 -1
- package/resources/beta/sheets.d.mts +16 -0
- package/resources/beta/sheets.d.mts.map +1 -1
- package/resources/beta/sheets.d.ts +16 -0
- package/resources/beta/sheets.d.ts.map +1 -1
- package/resources/beta/split.d.mts +60 -16
- package/resources/beta/split.d.mts.map +1 -1
- package/resources/beta/split.d.ts +60 -16
- package/resources/beta/split.d.ts.map +1 -1
- package/resources/beta/split.js.map +1 -1
- package/resources/beta/split.mjs.map +1 -1
- package/resources/classifier/jobs.d.mts +12 -3
- package/resources/classifier/jobs.d.mts.map +1 -1
- package/resources/classifier/jobs.d.ts +12 -3
- package/resources/classifier/jobs.d.ts.map +1 -1
- package/resources/classify.d.mts +93 -38
- package/resources/classify.d.mts.map +1 -1
- package/resources/classify.d.ts +93 -38
- package/resources/classify.d.ts.map +1 -1
- package/resources/classify.js +19 -2
- package/resources/classify.js.map +1 -1
- package/resources/classify.mjs +19 -2
- package/resources/classify.mjs.map +1 -1
- package/resources/extract.d.mts +1593 -0
- package/resources/extract.d.mts.map +1 -0
- package/resources/extract.d.ts +1593 -0
- package/resources/extract.d.ts.map +1 -0
- package/resources/extract.js +215 -0
- package/resources/extract.js.map +1 -0
- package/resources/extract.mjs +211 -0
- package/resources/extract.mjs.map +1 -0
- package/resources/files.d.mts +53 -39
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +53 -39
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +11 -10
- package/resources/files.js.map +1 -1
- package/resources/files.mjs +11 -10
- package/resources/files.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/parsing.d.mts +292 -138
- package/resources/parsing.d.mts.map +1 -1
- package/resources/parsing.d.ts +292 -138
- package/resources/parsing.d.ts.map +1 -1
- package/resources/parsing.js +30 -4
- package/resources/parsing.js.map +1 -1
- package/resources/parsing.mjs +30 -4
- package/resources/parsing.mjs.map +1 -1
- package/resources/pipelines/pipelines.d.mts +59 -13
- package/resources/pipelines/pipelines.d.mts.map +1 -1
- package/resources/pipelines/pipelines.d.ts +59 -13
- package/resources/pipelines/pipelines.d.ts.map +1 -1
- package/resources/pipelines/pipelines.js +24 -9
- package/resources/pipelines/pipelines.js.map +1 -1
- package/resources/pipelines/pipelines.mjs +24 -9
- package/resources/pipelines/pipelines.mjs.map +1 -1
- package/resources/pipelines/sync.d.mts +5 -3
- package/resources/pipelines/sync.d.mts.map +1 -1
- package/resources/pipelines/sync.d.ts +5 -3
- package/resources/pipelines/sync.d.ts.map +1 -1
- package/resources/pipelines/sync.js +5 -3
- package/resources/pipelines/sync.js.map +1 -1
- package/resources/pipelines/sync.mjs +5 -3
- package/resources/pipelines/sync.mjs.map +1 -1
- package/src/client.ts +50 -15
- package/src/core/pagination.ts +0 -71
- package/src/resources/beta/batch/batch.ts +75 -30
- package/src/resources/beta/batch/job-items.ts +56 -13
- package/src/resources/beta/parse-configurations.ts +7 -9
- package/src/resources/beta/sheets.ts +20 -0
- package/src/resources/beta/split.ts +70 -17
- package/src/resources/classifier/jobs.ts +12 -3
- package/src/resources/classify.ts +101 -38
- package/src/resources/extract.ts +2055 -0
- package/src/resources/files.ts +53 -39
- package/src/resources/index.ts +22 -1
- package/src/resources/parsing.ts +327 -136
- package/src/resources/pipelines/pipelines.ts +80 -14
- package/src/resources/pipelines/sync.ts +5 -3
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/extraction/extraction-agents/extraction-agents.d.mts +0 -126
- package/resources/extraction/extraction-agents/extraction-agents.d.mts.map +0 -1
- package/resources/extraction/extraction-agents/extraction-agents.d.ts +0 -126
- package/resources/extraction/extraction-agents/extraction-agents.d.ts.map +0 -1
- package/resources/extraction/extraction-agents/extraction-agents.js +0 -56
- package/resources/extraction/extraction-agents/extraction-agents.js.map +0 -1
- package/resources/extraction/extraction-agents/extraction-agents.mjs +0 -51
- package/resources/extraction/extraction-agents/extraction-agents.mjs.map +0 -1
- package/resources/extraction/extraction-agents/index.d.mts +0 -3
- package/resources/extraction/extraction-agents/index.d.mts.map +0 -1
- package/resources/extraction/extraction-agents/index.d.ts +0 -3
- package/resources/extraction/extraction-agents/index.d.ts.map +0 -1
- package/resources/extraction/extraction-agents/index.js +0 -9
- package/resources/extraction/extraction-agents/index.js.map +0 -1
- package/resources/extraction/extraction-agents/index.mjs +0 -4
- package/resources/extraction/extraction-agents/index.mjs.map +0 -1
- package/resources/extraction/extraction-agents/schema.d.mts +0 -75
- package/resources/extraction/extraction-agents/schema.d.mts.map +0 -1
- package/resources/extraction/extraction-agents/schema.d.ts +0 -75
- package/resources/extraction/extraction-agents/schema.d.ts.map +0 -1
- package/resources/extraction/extraction-agents/schema.js +0 -28
- package/resources/extraction/extraction-agents/schema.js.map +0 -1
- package/resources/extraction/extraction-agents/schema.mjs +0 -24
- package/resources/extraction/extraction-agents/schema.mjs.map +0 -1
- package/resources/extraction/extraction-agents.d.mts +0 -2
- package/resources/extraction/extraction-agents.d.mts.map +0 -1
- package/resources/extraction/extraction-agents.d.ts +0 -2
- package/resources/extraction/extraction-agents.d.ts.map +0 -1
- package/resources/extraction/extraction-agents.js +0 -6
- package/resources/extraction/extraction-agents.js.map +0 -1
- package/resources/extraction/extraction-agents.mjs +0 -3
- package/resources/extraction/extraction-agents.mjs.map +0 -1
- package/resources/extraction/extraction.d.mts +0 -118
- package/resources/extraction/extraction.d.mts.map +0 -1
- package/resources/extraction/extraction.d.ts +0 -118
- package/resources/extraction/extraction.d.ts.map +0 -1
- package/resources/extraction/extraction.js +0 -91
- package/resources/extraction/extraction.js.map +0 -1
- package/resources/extraction/extraction.mjs +0 -86
- package/resources/extraction/extraction.mjs.map +0 -1
- package/resources/extraction/index.d.mts +0 -5
- package/resources/extraction/index.d.mts.map +0 -1
- package/resources/extraction/index.d.ts +0 -5
- package/resources/extraction/index.d.ts.map +0 -1
- package/resources/extraction/index.js +0 -13
- package/resources/extraction/index.js.map +0 -1
- package/resources/extraction/index.mjs +0 -6
- package/resources/extraction/index.mjs.map +0 -1
- package/resources/extraction/jobs.d.mts +0 -280
- package/resources/extraction/jobs.d.mts.map +0 -1
- package/resources/extraction/jobs.d.ts +0 -280
- package/resources/extraction/jobs.d.ts.map +0 -1
- package/resources/extraction/jobs.js +0 -179
- package/resources/extraction/jobs.js.map +0 -1
- package/resources/extraction/jobs.mjs +0 -175
- package/resources/extraction/jobs.mjs.map +0 -1
- package/resources/extraction/runs.d.mts +0 -198
- package/resources/extraction/runs.d.mts.map +0 -1
- package/resources/extraction/runs.d.ts +0 -198
- package/resources/extraction/runs.d.ts.map +0 -1
- package/resources/extraction/runs.js +0 -42
- package/resources/extraction/runs.js.map +0 -1
- package/resources/extraction/runs.mjs +0 -38
- package/resources/extraction/runs.mjs.map +0 -1
- package/resources/extraction.d.mts +0 -2
- package/resources/extraction.d.mts.map +0 -1
- package/resources/extraction.d.ts +0 -2
- package/resources/extraction.d.ts.map +0 -1
- package/resources/extraction.js +0 -6
- package/resources/extraction.js.map +0 -1
- package/resources/extraction.mjs +0 -3
- package/resources/extraction.mjs.map +0 -1
- package/src/resources/extraction/extraction-agents/extraction-agents.ts +0 -196
- package/src/resources/extraction/extraction-agents/index.ts +0 -18
- package/src/resources/extraction/extraction-agents/schema.ts +0 -100
- package/src/resources/extraction/extraction-agents.ts +0 -3
- package/src/resources/extraction/extraction.ts +0 -224
- package/src/resources/extraction/index.ts +0 -34
- package/src/resources/extraction/jobs.ts +0 -414
- package/src/resources/extraction/runs.ts +0 -315
- package/src/resources/extraction.ts +0 -3
package/src/client.ts
CHANGED
|
@@ -25,8 +25,6 @@ import {
|
|
|
25
25
|
type PaginatedCursorPostParams,
|
|
26
26
|
PaginatedCursorPostResponse,
|
|
27
27
|
PaginatedCursorResponse,
|
|
28
|
-
type PaginatedExtractRunsParams,
|
|
29
|
-
PaginatedExtractRunsResponse,
|
|
30
28
|
type PaginatedJobsHistoryParams,
|
|
31
29
|
PaginatedJobsHistoryResponse,
|
|
32
30
|
type PaginatedPipelineFilesParams,
|
|
@@ -67,6 +65,28 @@ import {
|
|
|
67
65
|
DataSourceUpdateParams,
|
|
68
66
|
DataSources,
|
|
69
67
|
} from './resources/data-sources';
|
|
68
|
+
import {
|
|
69
|
+
Extract,
|
|
70
|
+
ExtractConfiguration,
|
|
71
|
+
ExtractCreateParams,
|
|
72
|
+
ExtractDeleteParams,
|
|
73
|
+
ExtractDeleteResponse,
|
|
74
|
+
ExtractGenerateSchemaParams,
|
|
75
|
+
ExtractGenerateSchemaResponse,
|
|
76
|
+
ExtractGetParams,
|
|
77
|
+
ExtractJobMetadata,
|
|
78
|
+
ExtractJobUsage,
|
|
79
|
+
ExtractListParams,
|
|
80
|
+
ExtractV2Job,
|
|
81
|
+
ExtractV2JobCreate,
|
|
82
|
+
ExtractV2JobQueryResponse,
|
|
83
|
+
ExtractV2JobsPaginatedCursor,
|
|
84
|
+
ExtractV2SchemaGenerateRequest,
|
|
85
|
+
ExtractV2SchemaValidateRequest,
|
|
86
|
+
ExtractV2SchemaValidateResponse,
|
|
87
|
+
ExtractValidateSchemaParams,
|
|
88
|
+
ExtractedFieldMetadata,
|
|
89
|
+
} from './resources/extract';
|
|
70
90
|
import {
|
|
71
91
|
File,
|
|
72
92
|
FileCreate,
|
|
@@ -117,7 +137,6 @@ import {
|
|
|
117
137
|
} from './resources/projects';
|
|
118
138
|
import { Beta } from './resources/beta/beta';
|
|
119
139
|
import { Classifier } from './resources/classifier/classifier';
|
|
120
|
-
import { Extraction, ExtractionRunParams } from './resources/extraction/extraction';
|
|
121
140
|
import {
|
|
122
141
|
AdvancedModeTransformConfig,
|
|
123
142
|
AutoTransformConfig,
|
|
@@ -326,7 +345,7 @@ export class LlamaCloud {
|
|
|
326
345
|
parseLogLevel(readEnv('LLAMA_CLOUD_LOG'), "process.env['LLAMA_CLOUD_LOG']", this) ??
|
|
327
346
|
defaultLogLevel;
|
|
328
347
|
this.fetchOptions = options.fetchOptions;
|
|
329
|
-
this.maxRetries = options.maxRetries ??
|
|
348
|
+
this.maxRetries = options.maxRetries ?? 5;
|
|
330
349
|
this.fetch = options.fetch ?? Shims.getDefaultFetch();
|
|
331
350
|
this.#encoder = Opts.FallbackEncoder;
|
|
332
351
|
|
|
@@ -409,8 +428,9 @@ export class LlamaCloud {
|
|
|
409
428
|
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
410
429
|
|
|
411
430
|
const defaultQuery = this.defaultQuery();
|
|
412
|
-
|
|
413
|
-
|
|
431
|
+
const pathQuery = Object.fromEntries(url.searchParams);
|
|
432
|
+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
|
|
433
|
+
query = { ...pathQuery, ...defaultQuery, ...query };
|
|
414
434
|
}
|
|
415
435
|
|
|
416
436
|
if (typeof query === 'object' && query && !Array.isArray(query)) {
|
|
@@ -905,7 +925,7 @@ export class LlamaCloud {
|
|
|
905
925
|
|
|
906
926
|
files: API.Files = new API.Files(this);
|
|
907
927
|
parsing: API.Parsing = new API.Parsing(this);
|
|
908
|
-
|
|
928
|
+
extract: API.Extract = new API.Extract(this);
|
|
909
929
|
classifier: API.Classifier = new API.Classifier(this);
|
|
910
930
|
classify: API.Classify = new API.Classify(this);
|
|
911
931
|
projects: API.Projects = new API.Projects(this);
|
|
@@ -918,7 +938,7 @@ export class LlamaCloud {
|
|
|
918
938
|
|
|
919
939
|
LlamaCloud.Files = Files;
|
|
920
940
|
LlamaCloud.Parsing = Parsing;
|
|
921
|
-
LlamaCloud.
|
|
941
|
+
LlamaCloud.Extract = Extract;
|
|
922
942
|
LlamaCloud.Classifier = Classifier;
|
|
923
943
|
LlamaCloud.Classify = Classify;
|
|
924
944
|
LlamaCloud.Projects = Projects;
|
|
@@ -949,12 +969,6 @@ export declare namespace LlamaCloud {
|
|
|
949
969
|
type PaginatedBatchItemsResponse as PaginatedBatchItemsResponse,
|
|
950
970
|
};
|
|
951
971
|
|
|
952
|
-
export import PaginatedExtractRuns = Pagination.PaginatedExtractRuns;
|
|
953
|
-
export {
|
|
954
|
-
type PaginatedExtractRunsParams as PaginatedExtractRunsParams,
|
|
955
|
-
type PaginatedExtractRunsResponse as PaginatedExtractRunsResponse,
|
|
956
|
-
};
|
|
957
|
-
|
|
958
972
|
export import PaginatedCloudDocuments = Pagination.PaginatedCloudDocuments;
|
|
959
973
|
export {
|
|
960
974
|
type PaginatedCloudDocumentsParams as PaginatedCloudDocumentsParams,
|
|
@@ -1022,7 +1036,28 @@ export declare namespace LlamaCloud {
|
|
|
1022
1036
|
type ParsingGetParams as ParsingGetParams,
|
|
1023
1037
|
};
|
|
1024
1038
|
|
|
1025
|
-
export {
|
|
1039
|
+
export {
|
|
1040
|
+
Extract as Extract,
|
|
1041
|
+
type ExtractConfiguration as ExtractConfiguration,
|
|
1042
|
+
type ExtractJobMetadata as ExtractJobMetadata,
|
|
1043
|
+
type ExtractJobUsage as ExtractJobUsage,
|
|
1044
|
+
type ExtractV2Job as ExtractV2Job,
|
|
1045
|
+
type ExtractV2JobCreate as ExtractV2JobCreate,
|
|
1046
|
+
type ExtractV2JobQueryResponse as ExtractV2JobQueryResponse,
|
|
1047
|
+
type ExtractV2SchemaGenerateRequest as ExtractV2SchemaGenerateRequest,
|
|
1048
|
+
type ExtractV2SchemaValidateRequest as ExtractV2SchemaValidateRequest,
|
|
1049
|
+
type ExtractV2SchemaValidateResponse as ExtractV2SchemaValidateResponse,
|
|
1050
|
+
type ExtractedFieldMetadata as ExtractedFieldMetadata,
|
|
1051
|
+
type ExtractDeleteResponse as ExtractDeleteResponse,
|
|
1052
|
+
type ExtractGenerateSchemaResponse as ExtractGenerateSchemaResponse,
|
|
1053
|
+
type ExtractV2JobsPaginatedCursor as ExtractV2JobsPaginatedCursor,
|
|
1054
|
+
type ExtractCreateParams as ExtractCreateParams,
|
|
1055
|
+
type ExtractListParams as ExtractListParams,
|
|
1056
|
+
type ExtractDeleteParams as ExtractDeleteParams,
|
|
1057
|
+
type ExtractGenerateSchemaParams as ExtractGenerateSchemaParams,
|
|
1058
|
+
type ExtractGetParams as ExtractGetParams,
|
|
1059
|
+
type ExtractValidateSchemaParams as ExtractValidateSchemaParams,
|
|
1060
|
+
};
|
|
1026
1061
|
|
|
1027
1062
|
export { Classifier as Classifier };
|
|
1028
1063
|
|
package/src/core/pagination.ts
CHANGED
|
@@ -315,77 +315,6 @@ export class PaginatedBatchItems<Item>
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
export interface PaginatedExtractRunsResponse<Item> {
|
|
319
|
-
items: Array<Item>;
|
|
320
|
-
|
|
321
|
-
total: number;
|
|
322
|
-
|
|
323
|
-
skip: number;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
export interface PaginatedExtractRunsParams {
|
|
327
|
-
/**
|
|
328
|
-
* Number of extraction runs to skip
|
|
329
|
-
*/
|
|
330
|
-
skip?: number;
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Maximum number of extraction runs to return
|
|
334
|
-
*/
|
|
335
|
-
limit?: number;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
export class PaginatedExtractRuns<Item>
|
|
339
|
-
extends AbstractPage<Item>
|
|
340
|
-
implements PaginatedExtractRunsResponse<Item>
|
|
341
|
-
{
|
|
342
|
-
items: Array<Item>;
|
|
343
|
-
|
|
344
|
-
total: number;
|
|
345
|
-
|
|
346
|
-
skip: number;
|
|
347
|
-
|
|
348
|
-
constructor(
|
|
349
|
-
client: LlamaCloud,
|
|
350
|
-
response: Response,
|
|
351
|
-
body: PaginatedExtractRunsResponse<Item>,
|
|
352
|
-
options: FinalRequestOptions,
|
|
353
|
-
) {
|
|
354
|
-
super(client, response, body, options);
|
|
355
|
-
|
|
356
|
-
this.items = body.items || [];
|
|
357
|
-
this.total = body.total || 0;
|
|
358
|
-
this.skip = body.skip || 0;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
getPaginatedItems(): Item[] {
|
|
362
|
-
return this.items ?? [];
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
nextPageRequestOptions(): PageRequestOptions | null {
|
|
366
|
-
const offset = this.skip ?? 0;
|
|
367
|
-
const length = this.getPaginatedItems().length;
|
|
368
|
-
const currentCount = offset + length;
|
|
369
|
-
|
|
370
|
-
const totalCount = this.total;
|
|
371
|
-
if (!totalCount) {
|
|
372
|
-
return null;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
if (currentCount < totalCount) {
|
|
376
|
-
return {
|
|
377
|
-
...this.options,
|
|
378
|
-
query: {
|
|
379
|
-
...maybeObj(this.options.query),
|
|
380
|
-
skip: currentCount,
|
|
381
|
-
},
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
return null;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
318
|
export interface PaginatedCloudDocumentsResponse<Item> {
|
|
390
319
|
documents: Array<Item>;
|
|
391
320
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { APIResource } from '../../../core/resource';
|
|
4
4
|
import * as ParsingAPI from '../../parsing';
|
|
5
5
|
import * as JobsAPI from '../../classifier/jobs';
|
|
6
|
-
import * as ExtractionJobsAPI from '../../extraction/jobs';
|
|
7
6
|
import * as JobItemsAPI from './job-items';
|
|
8
7
|
import {
|
|
9
8
|
JobItemGetProcessingResultsParams,
|
|
@@ -23,11 +22,14 @@ export class Batch extends APIResource {
|
|
|
23
22
|
jobItems: JobItemsAPI.JobItems = new JobItemsAPI.JobItems(this._client);
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
|
-
* Create a
|
|
25
|
+
* Create a batch processing job.
|
|
27
26
|
*
|
|
28
|
-
* Processes
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* Processes files from a directory or a specific list of item IDs. Supports batch
|
|
28
|
+
* parsing and classification operations.
|
|
29
|
+
*
|
|
30
|
+
* Provide either `directory_id` to process all files in a directory, or `item_ids`
|
|
31
|
+
* for specific items. The job runs asynchronously — poll `GET /batch/{job_id}` for
|
|
32
|
+
* progress.
|
|
31
33
|
*/
|
|
32
34
|
create(params: BatchCreateParams, options?: RequestOptions): APIPromise<BatchCreateResponse> {
|
|
33
35
|
const { organization_id, project_id, 'temporal-namespace': temporalNamespace, ...body } = params;
|
|
@@ -43,11 +45,10 @@ export class Batch extends APIResource {
|
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
/**
|
|
46
|
-
* List
|
|
48
|
+
* List batch processing jobs with optional filtering.
|
|
47
49
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* specific jobs.
|
|
50
|
+
* Filter by `directory_id`, `job_type`, or `status`. Results are paginated with
|
|
51
|
+
* configurable `limit` and `offset`.
|
|
51
52
|
*/
|
|
52
53
|
list(
|
|
53
54
|
query: BatchListParams | null | undefined = {},
|
|
@@ -62,8 +63,8 @@ export class Batch extends APIResource {
|
|
|
62
63
|
/**
|
|
63
64
|
* Cancel a running batch processing job.
|
|
64
65
|
*
|
|
65
|
-
* Stops processing and marks
|
|
66
|
-
* processed may complete
|
|
66
|
+
* Stops processing and marks pending items as cancelled. Items currently being
|
|
67
|
+
* processed may still complete.
|
|
67
68
|
*/
|
|
68
69
|
cancel(
|
|
69
70
|
jobID: string,
|
|
@@ -85,7 +86,8 @@ export class Batch extends APIResource {
|
|
|
85
86
|
/**
|
|
86
87
|
* Get detailed status of a batch processing job.
|
|
87
88
|
*
|
|
88
|
-
* Returns current progress, file counts,
|
|
89
|
+
* Returns current progress percentage, file counts (total, processed, failed,
|
|
90
|
+
* skipped), and timestamps.
|
|
89
91
|
*/
|
|
90
92
|
getStatus(
|
|
91
93
|
jobID: string,
|
|
@@ -108,7 +110,7 @@ export interface BatchCreateResponse {
|
|
|
108
110
|
id: string;
|
|
109
111
|
|
|
110
112
|
/**
|
|
111
|
-
* Type of processing operation
|
|
113
|
+
* Type of processing operation (parse or classify)
|
|
112
114
|
*/
|
|
113
115
|
job_type: 'parse' | 'extract' | 'classify';
|
|
114
116
|
|
|
@@ -118,7 +120,7 @@ export interface BatchCreateResponse {
|
|
|
118
120
|
project_id: string;
|
|
119
121
|
|
|
120
122
|
/**
|
|
121
|
-
* Current status
|
|
123
|
+
* Current job status
|
|
122
124
|
*/
|
|
123
125
|
status: 'pending' | 'running' | 'dispatched' | 'completed' | 'failed' | 'cancelled';
|
|
124
126
|
|
|
@@ -180,7 +182,7 @@ export interface BatchCreateResponse {
|
|
|
180
182
|
updated_at?: string | null;
|
|
181
183
|
|
|
182
184
|
/**
|
|
183
|
-
*
|
|
185
|
+
* Async job tracking ID
|
|
184
186
|
*/
|
|
185
187
|
workflow_id?: string | null;
|
|
186
188
|
}
|
|
@@ -195,7 +197,7 @@ export interface BatchListResponse {
|
|
|
195
197
|
id: string;
|
|
196
198
|
|
|
197
199
|
/**
|
|
198
|
-
* Type of processing operation
|
|
200
|
+
* Type of processing operation (parse or classify)
|
|
199
201
|
*/
|
|
200
202
|
job_type: 'parse' | 'extract' | 'classify';
|
|
201
203
|
|
|
@@ -205,7 +207,7 @@ export interface BatchListResponse {
|
|
|
205
207
|
project_id: string;
|
|
206
208
|
|
|
207
209
|
/**
|
|
208
|
-
* Current status
|
|
210
|
+
* Current job status
|
|
209
211
|
*/
|
|
210
212
|
status: 'pending' | 'running' | 'dispatched' | 'completed' | 'failed' | 'cancelled';
|
|
211
213
|
|
|
@@ -267,7 +269,7 @@ export interface BatchListResponse {
|
|
|
267
269
|
updated_at?: string | null;
|
|
268
270
|
|
|
269
271
|
/**
|
|
270
|
-
*
|
|
272
|
+
* Async job tracking ID
|
|
271
273
|
*/
|
|
272
274
|
workflow_id?: string | null;
|
|
273
275
|
}
|
|
@@ -323,7 +325,7 @@ export namespace BatchGetStatusResponse {
|
|
|
323
325
|
id: string;
|
|
324
326
|
|
|
325
327
|
/**
|
|
326
|
-
* Type of processing operation
|
|
328
|
+
* Type of processing operation (parse or classify)
|
|
327
329
|
*/
|
|
328
330
|
job_type: 'parse' | 'extract' | 'classify';
|
|
329
331
|
|
|
@@ -333,7 +335,7 @@ export namespace BatchGetStatusResponse {
|
|
|
333
335
|
project_id: string;
|
|
334
336
|
|
|
335
337
|
/**
|
|
336
|
-
* Current status
|
|
338
|
+
* Current job status
|
|
337
339
|
*/
|
|
338
340
|
status: 'pending' | 'running' | 'dispatched' | 'completed' | 'failed' | 'cancelled';
|
|
339
341
|
|
|
@@ -395,7 +397,7 @@ export namespace BatchGetStatusResponse {
|
|
|
395
397
|
updated_at?: string | null;
|
|
396
398
|
|
|
397
399
|
/**
|
|
398
|
-
*
|
|
400
|
+
* Async job tracking ID
|
|
399
401
|
*/
|
|
400
402
|
workflow_id?: string | null;
|
|
401
403
|
}
|
|
@@ -403,8 +405,7 @@ export namespace BatchGetStatusResponse {
|
|
|
403
405
|
|
|
404
406
|
export interface BatchCreateParams {
|
|
405
407
|
/**
|
|
406
|
-
* Body param: Job configuration
|
|
407
|
-
* BatchParseJobRecordCreate or ClassifyJob.
|
|
408
|
+
* Body param: Job configuration — either a parse or classify config
|
|
408
409
|
*/
|
|
409
410
|
job_config: BatchCreateParams.BatchParseJobRecordCreate | JobsAPI.ClassifyJob;
|
|
410
411
|
|
|
@@ -419,9 +420,8 @@ export interface BatchCreateParams {
|
|
|
419
420
|
project_id?: string | null;
|
|
420
421
|
|
|
421
422
|
/**
|
|
422
|
-
* Body param: Maximum
|
|
423
|
-
*
|
|
424
|
-
* mode)
|
|
423
|
+
* Body param: Maximum files to process per execution cycle in directory mode.
|
|
424
|
+
* Defaults to page_size.
|
|
425
425
|
*/
|
|
426
426
|
continue_as_new_threshold?: number | null;
|
|
427
427
|
|
|
@@ -437,8 +437,7 @@ export interface BatchCreateParams {
|
|
|
437
437
|
item_ids?: Array<string> | null;
|
|
438
438
|
|
|
439
439
|
/**
|
|
440
|
-
* Body param: Number of files to
|
|
441
|
-
* directory mode)
|
|
440
|
+
* Body param: Number of files to process per batch when using directory mode
|
|
442
441
|
*/
|
|
443
442
|
page_size?: number;
|
|
444
443
|
|
|
@@ -813,12 +812,58 @@ export namespace BatchCreateParams {
|
|
|
813
812
|
version?: string | null;
|
|
814
813
|
|
|
815
814
|
/**
|
|
816
|
-
*
|
|
815
|
+
* Outbound webhook endpoints to notify on job status changes
|
|
817
816
|
*/
|
|
818
|
-
webhook_configurations?: Array<
|
|
817
|
+
webhook_configurations?: Array<Parameters.WebhookConfiguration> | null;
|
|
819
818
|
|
|
820
819
|
webhook_url?: string | null;
|
|
821
820
|
}
|
|
821
|
+
|
|
822
|
+
export namespace Parameters {
|
|
823
|
+
/**
|
|
824
|
+
* Configuration for a single outbound webhook endpoint.
|
|
825
|
+
*/
|
|
826
|
+
export interface WebhookConfiguration {
|
|
827
|
+
/**
|
|
828
|
+
* Events to subscribe to (e.g. 'parse.success', 'extract.error'). If null, all
|
|
829
|
+
* events are delivered.
|
|
830
|
+
*/
|
|
831
|
+
webhook_events?: Array<
|
|
832
|
+
| 'extract.pending'
|
|
833
|
+
| 'extract.success'
|
|
834
|
+
| 'extract.error'
|
|
835
|
+
| 'extract.partial_success'
|
|
836
|
+
| 'extract.cancelled'
|
|
837
|
+
| 'parse.pending'
|
|
838
|
+
| 'parse.running'
|
|
839
|
+
| 'parse.success'
|
|
840
|
+
| 'parse.error'
|
|
841
|
+
| 'parse.partial_success'
|
|
842
|
+
| 'parse.cancelled'
|
|
843
|
+
| 'classify.pending'
|
|
844
|
+
| 'classify.success'
|
|
845
|
+
| 'classify.error'
|
|
846
|
+
| 'classify.partial_success'
|
|
847
|
+
| 'classify.cancelled'
|
|
848
|
+
| 'unmapped_event'
|
|
849
|
+
> | null;
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Custom HTTP headers sent with each webhook request (e.g. auth tokens)
|
|
853
|
+
*/
|
|
854
|
+
webhook_headers?: { [key: string]: string } | null;
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Response format sent to the webhook: 'string' (default) or 'json'
|
|
858
|
+
*/
|
|
859
|
+
webhook_output_format?: string | null;
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* URL to receive webhook POST notifications
|
|
863
|
+
*/
|
|
864
|
+
webhook_url?: string | null;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
822
867
|
}
|
|
823
868
|
}
|
|
824
869
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { APIResource } from '../../../core/resource';
|
|
4
4
|
import * as ParsingAPI from '../../parsing';
|
|
5
5
|
import * as JobsAPI from '../../classifier/jobs';
|
|
6
|
-
import * as ExtractionJobsAPI from '../../extraction/jobs';
|
|
7
6
|
import { APIPromise } from '../../../core/api-promise';
|
|
8
7
|
import { PagePromise, PaginatedBatchItems, type PaginatedBatchItemsParams } from '../../../core/pagination';
|
|
9
8
|
import { RequestOptions } from '../../../internal/request-options';
|
|
@@ -13,9 +12,8 @@ export class JobItems extends APIResource {
|
|
|
13
12
|
/**
|
|
14
13
|
* List items in a batch job with optional status filtering.
|
|
15
14
|
*
|
|
16
|
-
* Useful for finding failed items, viewing completed items, or debugging
|
|
17
|
-
*
|
|
18
|
-
* parameters.
|
|
15
|
+
* Useful for finding failed items, viewing completed items, or debugging
|
|
16
|
+
* processing issues.
|
|
19
17
|
*/
|
|
20
18
|
list(
|
|
21
19
|
jobID: string,
|
|
@@ -30,12 +28,11 @@ export class JobItems extends APIResource {
|
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
/**
|
|
33
|
-
* Get all processing results for a specific item
|
|
31
|
+
* Get all processing results for a specific item.
|
|
34
32
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* by job type to see only specific processing operations.
|
|
33
|
+
* Returns the complete processing history for an item including what operations
|
|
34
|
+
* were performed, parameters used, and where outputs are stored. Optionally filter
|
|
35
|
+
* by `job_type`.
|
|
39
36
|
*/
|
|
40
37
|
getProcessingResults(
|
|
41
38
|
itemID: string,
|
|
@@ -144,12 +141,12 @@ export namespace JobItemGetProcessingResultsResponse {
|
|
|
144
141
|
job_type: 'parse' | 'extract' | 'classify';
|
|
145
142
|
|
|
146
143
|
/**
|
|
147
|
-
*
|
|
144
|
+
* Location of the processing output
|
|
148
145
|
*/
|
|
149
146
|
output_s3_path: string;
|
|
150
147
|
|
|
151
148
|
/**
|
|
152
|
-
*
|
|
149
|
+
* Content hash of the job configuration for dedup
|
|
153
150
|
*/
|
|
154
151
|
parameters_hash: string;
|
|
155
152
|
|
|
@@ -537,12 +534,58 @@ export namespace JobItemGetProcessingResultsResponse {
|
|
|
537
534
|
version?: string | null;
|
|
538
535
|
|
|
539
536
|
/**
|
|
540
|
-
*
|
|
537
|
+
* Outbound webhook endpoints to notify on job status changes
|
|
541
538
|
*/
|
|
542
|
-
webhook_configurations?: Array<
|
|
539
|
+
webhook_configurations?: Array<Parameters.WebhookConfiguration> | null;
|
|
543
540
|
|
|
544
541
|
webhook_url?: string | null;
|
|
545
542
|
}
|
|
543
|
+
|
|
544
|
+
export namespace Parameters {
|
|
545
|
+
/**
|
|
546
|
+
* Configuration for a single outbound webhook endpoint.
|
|
547
|
+
*/
|
|
548
|
+
export interface WebhookConfiguration {
|
|
549
|
+
/**
|
|
550
|
+
* Events to subscribe to (e.g. 'parse.success', 'extract.error'). If null, all
|
|
551
|
+
* events are delivered.
|
|
552
|
+
*/
|
|
553
|
+
webhook_events?: Array<
|
|
554
|
+
| 'extract.pending'
|
|
555
|
+
| 'extract.success'
|
|
556
|
+
| 'extract.error'
|
|
557
|
+
| 'extract.partial_success'
|
|
558
|
+
| 'extract.cancelled'
|
|
559
|
+
| 'parse.pending'
|
|
560
|
+
| 'parse.running'
|
|
561
|
+
| 'parse.success'
|
|
562
|
+
| 'parse.error'
|
|
563
|
+
| 'parse.partial_success'
|
|
564
|
+
| 'parse.cancelled'
|
|
565
|
+
| 'classify.pending'
|
|
566
|
+
| 'classify.success'
|
|
567
|
+
| 'classify.error'
|
|
568
|
+
| 'classify.partial_success'
|
|
569
|
+
| 'classify.cancelled'
|
|
570
|
+
| 'unmapped_event'
|
|
571
|
+
> | null;
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Custom HTTP headers sent with each webhook request (e.g. auth tokens)
|
|
575
|
+
*/
|
|
576
|
+
webhook_headers?: { [key: string]: string } | null;
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Response format sent to the webhook: 'string' (default) or 'json'
|
|
580
|
+
*/
|
|
581
|
+
webhook_output_format?: string | null;
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* URL to receive webhook POST notifications
|
|
585
|
+
*/
|
|
586
|
+
webhook_url?: string | null;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
546
589
|
}
|
|
547
590
|
}
|
|
548
591
|
}
|
|
@@ -13,7 +13,7 @@ export class ParseConfigurations extends APIResource {
|
|
|
13
13
|
* Create a new parse configuration.
|
|
14
14
|
*
|
|
15
15
|
* Args: config_create: Parse configuration creation data project: Validated
|
|
16
|
-
* project from dependency user: Current user
|
|
16
|
+
* project from dependency user: Current user
|
|
17
17
|
*
|
|
18
18
|
* Returns: The created parse configuration
|
|
19
19
|
*/
|
|
@@ -30,8 +30,7 @@ export class ParseConfigurations extends APIResource {
|
|
|
30
30
|
* Update a parse configuration.
|
|
31
31
|
*
|
|
32
32
|
* Args: config_id: The ID of the parse configuration to update config_update:
|
|
33
|
-
* Update data project: Validated project from dependency user: Current user
|
|
34
|
-
* Database session
|
|
33
|
+
* Update data project: Validated project from dependency user: Current user
|
|
35
34
|
*
|
|
36
35
|
* Returns: The updated parse configuration
|
|
37
36
|
*/
|
|
@@ -51,10 +50,9 @@ export class ParseConfigurations extends APIResource {
|
|
|
51
50
|
/**
|
|
52
51
|
* List parse configurations for the current project.
|
|
53
52
|
*
|
|
54
|
-
* Args: project: Validated project from dependency user: Current user
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* version
|
|
53
|
+
* Args: project: Validated project from dependency user: Current user page_size:
|
|
54
|
+
* Number of items per page page_token: Token for pagination name: Filter by
|
|
55
|
+
* configuration name creator: Filter by creator version: Filter by version
|
|
58
56
|
*
|
|
59
57
|
* Returns: Paginated response with parse configurations
|
|
60
58
|
*/
|
|
@@ -72,7 +70,7 @@ export class ParseConfigurations extends APIResource {
|
|
|
72
70
|
* Delete a parse configuration.
|
|
73
71
|
*
|
|
74
72
|
* Args: config_id: The ID of the parse configuration to delete project: Validated
|
|
75
|
-
* project from dependency user: Current user
|
|
73
|
+
* project from dependency user: Current user
|
|
76
74
|
*/
|
|
77
75
|
delete(
|
|
78
76
|
configID: string,
|
|
@@ -91,7 +89,7 @@ export class ParseConfigurations extends APIResource {
|
|
|
91
89
|
* Get a parse configuration by ID.
|
|
92
90
|
*
|
|
93
91
|
* Args: config_id: The ID of the parse configuration project: Validated project
|
|
94
|
-
* from dependency user: Current user
|
|
92
|
+
* from dependency user: Current user
|
|
95
93
|
*
|
|
96
94
|
* Returns: The parse configuration
|
|
97
95
|
*/
|
|
@@ -417,11 +417,31 @@ export interface SheetCreateParams {
|
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
export interface SheetListParams extends PaginatedCursorParams {
|
|
420
|
+
/**
|
|
421
|
+
* Include items created at or after this timestamp (inclusive)
|
|
422
|
+
*/
|
|
423
|
+
created_at_on_or_after?: string | null;
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Include items created at or before this timestamp (inclusive)
|
|
427
|
+
*/
|
|
428
|
+
created_at_on_or_before?: string | null;
|
|
429
|
+
|
|
420
430
|
include_results?: boolean;
|
|
421
431
|
|
|
432
|
+
/**
|
|
433
|
+
* Filter by specific job IDs
|
|
434
|
+
*/
|
|
435
|
+
job_ids?: Array<string> | null;
|
|
436
|
+
|
|
422
437
|
organization_id?: string | null;
|
|
423
438
|
|
|
424
439
|
project_id?: string | null;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Filter by job status
|
|
443
|
+
*/
|
|
444
|
+
status?: ParsingAPI.StatusEnum | null;
|
|
425
445
|
}
|
|
426
446
|
|
|
427
447
|
export interface SheetDeleteJobParams {
|