@llamaindex/llama-cloud 1.7.0 → 2.0.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 +80 -0
- package/README.md +10 -8
- package/client.d.mts +9 -8
- package/client.d.mts.map +1 -1
- package/client.d.ts +9 -8
- package/client.d.ts.map +1 -1
- package/client.js +16 -12
- package/client.js.map +1 -1
- package/client.mjs +16 -12
- 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/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 +20 -3
- package/resources/classifier/jobs.d.mts.map +1 -1
- package/resources/classifier/jobs.d.ts +20 -3
- package/resources/classifier/jobs.d.ts.map +1 -1
- package/resources/classifier/jobs.js +8 -0
- package/resources/classifier/jobs.js.map +1 -1
- package/resources/classifier/jobs.mjs +8 -0
- package/resources/classifier/jobs.mjs.map +1 -1
- package/resources/classify.d.mts +373 -0
- package/resources/classify.d.mts.map +1 -0
- package/resources/classify.d.ts +373 -0
- package/resources/classify.d.ts.map +1 -0
- package/resources/classify.js +54 -0
- package/resources/classify.js.map +1 -0
- package/resources/classify.mjs +50 -0
- package/resources/classify.mjs.map +1 -0
- package/resources/extract.d.mts +1588 -0
- package/resources/extract.d.mts.map +1 -0
- package/resources/extract.d.ts +1588 -0
- package/resources/extract.d.ts.map +1 -0
- package/resources/extract.js +217 -0
- package/resources/extract.js.map +1 -0
- package/resources/extract.mjs +213 -0
- package/resources/extract.mjs.map +1 -0
- package/resources/files.d.mts +52 -38
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +52 -38
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +10 -9
- package/resources/files.js.map +1 -1
- package/resources/files.mjs +10 -9
- package/resources/files.mjs.map +1 -1
- package/resources/index.d.mts +2 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -1
- package/resources/index.mjs.map +1 -1
- package/resources/parsing.d.mts +324 -138
- package/resources/parsing.d.mts.map +1 -1
- package/resources/parsing.d.ts +324 -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 +86 -22
- 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/sheets.ts +20 -0
- package/src/resources/beta/split.ts +70 -17
- package/src/resources/classifier/jobs.ts +20 -3
- package/src/resources/classify.ts +486 -0
- package/src/resources/extract.ts +2045 -0
- package/src/resources/files.ts +52 -38
- package/src/resources/index.ts +35 -1
- package/src/resources/parsing.ts +367 -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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as SplitAPI from './split';
|
|
4
5
|
import { APIPromise } from '../../core/api-promise';
|
|
5
6
|
import { PagePromise, PaginatedCursor, type PaginatedCursorParams } from '../../core/pagination';
|
|
6
7
|
import { RequestOptions } from '../../internal/request-options';
|
|
@@ -279,7 +280,7 @@ export interface SplitCreateResponse {
|
|
|
279
280
|
|
|
280
281
|
/**
|
|
281
282
|
* Current status of the job. Valid values are: pending, processing, completed,
|
|
282
|
-
* failed.
|
|
283
|
+
* failed, cancelled.
|
|
283
284
|
*/
|
|
284
285
|
status: string;
|
|
285
286
|
|
|
@@ -288,6 +289,11 @@ export interface SplitCreateResponse {
|
|
|
288
289
|
*/
|
|
289
290
|
user_id: string;
|
|
290
291
|
|
|
292
|
+
/**
|
|
293
|
+
* Split configuration ID used for this job.
|
|
294
|
+
*/
|
|
295
|
+
configuration_id?: string | null;
|
|
296
|
+
|
|
291
297
|
/**
|
|
292
298
|
* Creation datetime
|
|
293
299
|
*/
|
|
@@ -335,7 +341,7 @@ export interface SplitListResponse {
|
|
|
335
341
|
|
|
336
342
|
/**
|
|
337
343
|
* Current status of the job. Valid values are: pending, processing, completed,
|
|
338
|
-
* failed.
|
|
344
|
+
* failed, cancelled.
|
|
339
345
|
*/
|
|
340
346
|
status: string;
|
|
341
347
|
|
|
@@ -344,6 +350,11 @@ export interface SplitListResponse {
|
|
|
344
350
|
*/
|
|
345
351
|
user_id: string;
|
|
346
352
|
|
|
353
|
+
/**
|
|
354
|
+
* Split configuration ID used for this job.
|
|
355
|
+
*/
|
|
356
|
+
configuration_id?: string | null;
|
|
357
|
+
|
|
347
358
|
/**
|
|
348
359
|
* Creation datetime
|
|
349
360
|
*/
|
|
@@ -391,7 +402,7 @@ export interface SplitGetResponse {
|
|
|
391
402
|
|
|
392
403
|
/**
|
|
393
404
|
* Current status of the job. Valid values are: pending, processing, completed,
|
|
394
|
-
* failed.
|
|
405
|
+
* failed, cancelled.
|
|
395
406
|
*/
|
|
396
407
|
status: string;
|
|
397
408
|
|
|
@@ -400,6 +411,11 @@ export interface SplitGetResponse {
|
|
|
400
411
|
*/
|
|
401
412
|
user_id: string;
|
|
402
413
|
|
|
414
|
+
/**
|
|
415
|
+
* Split configuration ID used for this job.
|
|
416
|
+
*/
|
|
417
|
+
configuration_id?: string | null;
|
|
418
|
+
|
|
403
419
|
/**
|
|
404
420
|
* Creation datetime
|
|
405
421
|
*/
|
|
@@ -422,11 +438,6 @@ export interface SplitGetResponse {
|
|
|
422
438
|
}
|
|
423
439
|
|
|
424
440
|
export interface SplitCreateParams {
|
|
425
|
-
/**
|
|
426
|
-
* Body param: Categories to split documents into.
|
|
427
|
-
*/
|
|
428
|
-
categories: Array<SplitCategory>;
|
|
429
|
-
|
|
430
441
|
/**
|
|
431
442
|
* Body param: Document to be split.
|
|
432
443
|
*/
|
|
@@ -443,30 +454,72 @@ export interface SplitCreateParams {
|
|
|
443
454
|
project_id?: string | null;
|
|
444
455
|
|
|
445
456
|
/**
|
|
446
|
-
* Body param:
|
|
457
|
+
* Body param: Split configuration with categories and splitting strategy.
|
|
447
458
|
*/
|
|
448
|
-
|
|
459
|
+
configuration?: SplitCreateParams.Configuration | null;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Body param: Saved split configuration ID.
|
|
463
|
+
*/
|
|
464
|
+
configuration_id?: string | null;
|
|
449
465
|
}
|
|
450
466
|
|
|
451
467
|
export namespace SplitCreateParams {
|
|
452
468
|
/**
|
|
453
|
-
*
|
|
469
|
+
* Split configuration with categories and splitting strategy.
|
|
454
470
|
*/
|
|
455
|
-
export interface
|
|
471
|
+
export interface Configuration {
|
|
456
472
|
/**
|
|
457
|
-
*
|
|
458
|
-
* be grouped as 'uncategorized' and included in results. 'forbid': all pages must
|
|
459
|
-
* be assigned to a defined category. 'omit': pages can be classified as
|
|
460
|
-
* 'uncategorized' but are excluded from results.
|
|
473
|
+
* Categories to split documents into.
|
|
461
474
|
*/
|
|
462
|
-
|
|
475
|
+
categories: Array<SplitAPI.SplitCategory>;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Strategy for splitting documents.
|
|
479
|
+
*/
|
|
480
|
+
splitting_strategy?: Configuration.SplittingStrategy;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export namespace Configuration {
|
|
484
|
+
/**
|
|
485
|
+
* Strategy for splitting documents.
|
|
486
|
+
*/
|
|
487
|
+
export interface SplittingStrategy {
|
|
488
|
+
/**
|
|
489
|
+
* Controls handling of pages that don't match any category. 'include': pages can
|
|
490
|
+
* be grouped as 'uncategorized' and included in results. 'forbid': all pages must
|
|
491
|
+
* be assigned to a defined category. 'omit': pages can be classified as
|
|
492
|
+
* 'uncategorized' but are excluded from results.
|
|
493
|
+
*/
|
|
494
|
+
allow_uncategorized?: 'include' | 'forbid' | 'omit';
|
|
495
|
+
}
|
|
463
496
|
}
|
|
464
497
|
}
|
|
465
498
|
|
|
466
499
|
export interface SplitListParams extends PaginatedCursorParams {
|
|
500
|
+
/**
|
|
501
|
+
* Include jobs created at or after this timestamp (inclusive)
|
|
502
|
+
*/
|
|
503
|
+
created_at_on_or_after?: string | null;
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Include jobs created at or before this timestamp (inclusive)
|
|
507
|
+
*/
|
|
508
|
+
created_at_on_or_before?: string | null;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Filter by specific job IDs
|
|
512
|
+
*/
|
|
513
|
+
job_ids?: Array<string> | null;
|
|
514
|
+
|
|
467
515
|
organization_id?: string | null;
|
|
468
516
|
|
|
469
517
|
project_id?: string | null;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Filter by job status (pending, processing, completed, failed, cancelled)
|
|
521
|
+
*/
|
|
522
|
+
status?: 'pending' | 'processing' | 'completed' | 'failed' | 'cancelled' | null;
|
|
470
523
|
}
|
|
471
524
|
|
|
472
525
|
export interface SplitGetParams {
|
|
@@ -12,6 +12,8 @@ export class Jobs extends APIResource {
|
|
|
12
12
|
/**
|
|
13
13
|
* Create a classify job. Experimental: This endpoint is not yet ready for
|
|
14
14
|
* production use and is subject to change at any time.
|
|
15
|
+
*
|
|
16
|
+
* @deprecated Please use `client.classify.create()`
|
|
15
17
|
*/
|
|
16
18
|
create(params: JobCreateParams, options?: RequestOptions): APIPromise<ClassifyJob> {
|
|
17
19
|
const { organization_id, project_id, ...body } = params;
|
|
@@ -25,6 +27,8 @@ export class Jobs extends APIResource {
|
|
|
25
27
|
/**
|
|
26
28
|
* List classify jobs. Experimental: This endpoint is not yet ready for production
|
|
27
29
|
* use and is subject to change at any time.
|
|
30
|
+
*
|
|
31
|
+
* @deprecated Please use `client.classify.list()`
|
|
28
32
|
*/
|
|
29
33
|
list(
|
|
30
34
|
query: JobListParams | null | undefined = {},
|
|
@@ -39,6 +43,8 @@ export class Jobs extends APIResource {
|
|
|
39
43
|
/**
|
|
40
44
|
* Get a classify job. Experimental: This endpoint is not yet ready for production
|
|
41
45
|
* use and is subject to change at any time.
|
|
46
|
+
*
|
|
47
|
+
* @deprecated Please use `client.classify.get()`
|
|
42
48
|
*/
|
|
43
49
|
get(
|
|
44
50
|
classifyJobID: string,
|
|
@@ -51,6 +57,8 @@ export class Jobs extends APIResource {
|
|
|
51
57
|
/**
|
|
52
58
|
* Get the results of a classify job. Experimental: This endpoint is not yet ready
|
|
53
59
|
* for production use and is subject to change at any time.
|
|
60
|
+
*
|
|
61
|
+
* @deprecated Please use `client.classify.get()`
|
|
54
62
|
*/
|
|
55
63
|
getResults(
|
|
56
64
|
classifyJobID: string,
|
|
@@ -359,19 +367,28 @@ export interface JobCreateParams {
|
|
|
359
367
|
}
|
|
360
368
|
|
|
361
369
|
export namespace JobCreateParams {
|
|
370
|
+
/**
|
|
371
|
+
* Webhook configuration for receiving parsing job notifications.
|
|
372
|
+
*
|
|
373
|
+
* Webhooks are called when specified events occur during job processing. Configure
|
|
374
|
+
* multiple webhook configurations to send to different endpoints.
|
|
375
|
+
*/
|
|
362
376
|
export interface WebhookConfiguration {
|
|
363
377
|
/**
|
|
364
|
-
*
|
|
378
|
+
* Events that trigger this webhook. Options: 'parse.success' (job completed),
|
|
379
|
+
* 'parse.failure' (job failed), 'parse.partial' (some pages failed). If not
|
|
380
|
+
* specified, webhook fires for all events
|
|
365
381
|
*/
|
|
366
382
|
webhook_events?: Array<string> | null;
|
|
367
383
|
|
|
368
384
|
/**
|
|
369
|
-
* Custom headers to include in webhook requests
|
|
385
|
+
* Custom HTTP headers to include in webhook requests. Use for authentication
|
|
386
|
+
* tokens or custom routing. Example: {'Authorization': 'Bearer xyz'}
|
|
370
387
|
*/
|
|
371
388
|
webhook_headers?: { [key: string]: unknown } | null;
|
|
372
389
|
|
|
373
390
|
/**
|
|
374
|
-
*
|
|
391
|
+
* HTTPS URL to receive webhook POST requests. Must be publicly accessible
|
|
375
392
|
*/
|
|
376
393
|
webhook_url?: string | null;
|
|
377
394
|
}
|
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { PagePromise, PaginatedCursor, type PaginatedCursorParams } from '../core/pagination';
|
|
6
|
+
import { RequestOptions } from '../internal/request-options';
|
|
7
|
+
import { path } from '../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
export class Classify extends APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Create a classify job.
|
|
12
|
+
*
|
|
13
|
+
* Classifies a document against a set of rules. Provide either `file_id` or
|
|
14
|
+
* `parse_job_id` as the document input, and either inline `configuration` with
|
|
15
|
+
* rules or a `configuration_id` referencing a saved preset.
|
|
16
|
+
*
|
|
17
|
+
* Each rule has a `type` (the label to assign) and a `description` (natural
|
|
18
|
+
* language criteria). The classifier returns the best matching rule with a
|
|
19
|
+
* confidence score.
|
|
20
|
+
*
|
|
21
|
+
* The job runs asynchronously. Poll `GET /classify/{job_id}` to check status and
|
|
22
|
+
* retrieve results.
|
|
23
|
+
*/
|
|
24
|
+
create(params: ClassifyCreateParams, options?: RequestOptions): APIPromise<ClassifyCreateResponse> {
|
|
25
|
+
const { organization_id, project_id, ...body } = params;
|
|
26
|
+
return this._client.post('/api/v2/classify', {
|
|
27
|
+
query: { organization_id, project_id },
|
|
28
|
+
body,
|
|
29
|
+
...options,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* List classify jobs with optional filtering and pagination.
|
|
35
|
+
*
|
|
36
|
+
* Filter by `status`, `configuration_id`, specific `job_ids`, or creation date
|
|
37
|
+
* range.
|
|
38
|
+
*/
|
|
39
|
+
list(
|
|
40
|
+
query: ClassifyListParams | null | undefined = {},
|
|
41
|
+
options?: RequestOptions,
|
|
42
|
+
): PagePromise<ClassifyListResponsesPaginatedCursor, ClassifyListResponse> {
|
|
43
|
+
return this._client.getAPIList('/api/v2/classify', PaginatedCursor<ClassifyListResponse>, {
|
|
44
|
+
query,
|
|
45
|
+
...options,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get a classify job by ID.
|
|
51
|
+
*
|
|
52
|
+
* Returns the job status, configuration, and classify result when complete. The
|
|
53
|
+
* result includes the matched document type, confidence score, and reasoning.
|
|
54
|
+
*/
|
|
55
|
+
get(
|
|
56
|
+
jobID: string,
|
|
57
|
+
query: ClassifyGetParams | null | undefined = {},
|
|
58
|
+
options?: RequestOptions,
|
|
59
|
+
): APIPromise<ClassifyGetResponse> {
|
|
60
|
+
return this._client.get(path`/api/v2/classify/${jobID}`, { query, ...options });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type ClassifyListResponsesPaginatedCursor = PaginatedCursor<ClassifyListResponse>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Configuration for a classify job.
|
|
68
|
+
*/
|
|
69
|
+
export interface ClassifyConfiguration {
|
|
70
|
+
/**
|
|
71
|
+
* Classify rules to evaluate against the document (at least one required)
|
|
72
|
+
*/
|
|
73
|
+
rules: Array<ClassifyConfiguration.Rule>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Classify execution mode
|
|
77
|
+
*/
|
|
78
|
+
mode?: 'FAST';
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Parsing configuration for classify jobs.
|
|
82
|
+
*/
|
|
83
|
+
parsing_configuration?: ClassifyConfiguration.ParsingConfiguration | null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export namespace ClassifyConfiguration {
|
|
87
|
+
/**
|
|
88
|
+
* A rule for classifying documents.
|
|
89
|
+
*/
|
|
90
|
+
export interface Rule {
|
|
91
|
+
/**
|
|
92
|
+
* Natural language criteria for matching this rule
|
|
93
|
+
*/
|
|
94
|
+
description: string;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Document type to assign when rule matches
|
|
98
|
+
*/
|
|
99
|
+
type: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Parsing configuration for classify jobs.
|
|
104
|
+
*/
|
|
105
|
+
export interface ParsingConfiguration {
|
|
106
|
+
/**
|
|
107
|
+
* ISO 639-1 language code for the document
|
|
108
|
+
*/
|
|
109
|
+
lang?: string;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Maximum number of pages to process. Omit for no limit.
|
|
113
|
+
*/
|
|
114
|
+
max_pages?: number | null;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Comma-separated page numbers or ranges to process (1-based). Omit to process all
|
|
118
|
+
* pages.
|
|
119
|
+
*/
|
|
120
|
+
target_pages?: string | null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Request to create a classify job.
|
|
126
|
+
*/
|
|
127
|
+
export interface ClassifyCreateRequest {
|
|
128
|
+
/**
|
|
129
|
+
* Configuration for a classify job.
|
|
130
|
+
*/
|
|
131
|
+
configuration?: ClassifyConfiguration | null;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Product configuration ID for reusable presets
|
|
135
|
+
*/
|
|
136
|
+
configuration_id?: string | null;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* File ID to classify
|
|
140
|
+
*/
|
|
141
|
+
file_id?: string | null;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Parse job ID to classify
|
|
145
|
+
*/
|
|
146
|
+
parse_job_id?: string | null;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Idempotency key scoped to the project
|
|
150
|
+
*/
|
|
151
|
+
transaction_id?: string | null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Result of classifying a document.
|
|
156
|
+
*/
|
|
157
|
+
export interface ClassifyResult {
|
|
158
|
+
/**
|
|
159
|
+
* Confidence score between 0.0 and 1.0
|
|
160
|
+
*/
|
|
161
|
+
confidence: number;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Why the document matched (or didn't match) the returned rule
|
|
165
|
+
*/
|
|
166
|
+
reasoning: string;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Matched rule type, or null if no rule matched
|
|
170
|
+
*/
|
|
171
|
+
type: string | null;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Response for a classify job.
|
|
176
|
+
*/
|
|
177
|
+
export interface ClassifyCreateResponse {
|
|
178
|
+
/**
|
|
179
|
+
* Unique identifier
|
|
180
|
+
*/
|
|
181
|
+
id: string;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Classify configuration used for this job
|
|
185
|
+
*/
|
|
186
|
+
configuration: ClassifyConfiguration;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Whether the input was a file or parse job (FILE or PARSE_JOB)
|
|
190
|
+
*/
|
|
191
|
+
document_input_type: 'url' | 'file_id' | 'parse_job_id';
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* ID of the input file or parse job
|
|
195
|
+
*/
|
|
196
|
+
document_input_value: string;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Project this job belongs to
|
|
200
|
+
*/
|
|
201
|
+
project_id: string;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Current job status: PENDING, RUNNING, COMPLETED, or FAILED
|
|
205
|
+
*/
|
|
206
|
+
status: 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED';
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* User who created this job
|
|
210
|
+
*/
|
|
211
|
+
user_id: string;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Product configuration ID
|
|
215
|
+
*/
|
|
216
|
+
configuration_id?: string | null;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Creation datetime
|
|
220
|
+
*/
|
|
221
|
+
created_at?: string | null;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Error message if job failed
|
|
225
|
+
*/
|
|
226
|
+
error_message?: string | null;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Associated parse job ID
|
|
230
|
+
*/
|
|
231
|
+
parse_job_id?: string | null;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Result of classifying a document.
|
|
235
|
+
*/
|
|
236
|
+
result?: ClassifyResult | null;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Idempotency key
|
|
240
|
+
*/
|
|
241
|
+
transaction_id?: string | null;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Update datetime
|
|
245
|
+
*/
|
|
246
|
+
updated_at?: string | null;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Response for a classify job.
|
|
251
|
+
*/
|
|
252
|
+
export interface ClassifyListResponse {
|
|
253
|
+
/**
|
|
254
|
+
* Unique identifier
|
|
255
|
+
*/
|
|
256
|
+
id: string;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Classify configuration used for this job
|
|
260
|
+
*/
|
|
261
|
+
configuration: ClassifyConfiguration;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Whether the input was a file or parse job (FILE or PARSE_JOB)
|
|
265
|
+
*/
|
|
266
|
+
document_input_type: 'url' | 'file_id' | 'parse_job_id';
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* ID of the input file or parse job
|
|
270
|
+
*/
|
|
271
|
+
document_input_value: string;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Project this job belongs to
|
|
275
|
+
*/
|
|
276
|
+
project_id: string;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Current job status: PENDING, RUNNING, COMPLETED, or FAILED
|
|
280
|
+
*/
|
|
281
|
+
status: 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED';
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* User who created this job
|
|
285
|
+
*/
|
|
286
|
+
user_id: string;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Product configuration ID
|
|
290
|
+
*/
|
|
291
|
+
configuration_id?: string | null;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Creation datetime
|
|
295
|
+
*/
|
|
296
|
+
created_at?: string | null;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Error message if job failed
|
|
300
|
+
*/
|
|
301
|
+
error_message?: string | null;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Associated parse job ID
|
|
305
|
+
*/
|
|
306
|
+
parse_job_id?: string | null;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Result of classifying a document.
|
|
310
|
+
*/
|
|
311
|
+
result?: ClassifyResult | null;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Idempotency key
|
|
315
|
+
*/
|
|
316
|
+
transaction_id?: string | null;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Update datetime
|
|
320
|
+
*/
|
|
321
|
+
updated_at?: string | null;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Response for a classify job.
|
|
326
|
+
*/
|
|
327
|
+
export interface ClassifyGetResponse {
|
|
328
|
+
/**
|
|
329
|
+
* Unique identifier
|
|
330
|
+
*/
|
|
331
|
+
id: string;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Classify configuration used for this job
|
|
335
|
+
*/
|
|
336
|
+
configuration: ClassifyConfiguration;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Whether the input was a file or parse job (FILE or PARSE_JOB)
|
|
340
|
+
*/
|
|
341
|
+
document_input_type: 'url' | 'file_id' | 'parse_job_id';
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* ID of the input file or parse job
|
|
345
|
+
*/
|
|
346
|
+
document_input_value: string;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Project this job belongs to
|
|
350
|
+
*/
|
|
351
|
+
project_id: string;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Current job status: PENDING, RUNNING, COMPLETED, or FAILED
|
|
355
|
+
*/
|
|
356
|
+
status: 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED';
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* User who created this job
|
|
360
|
+
*/
|
|
361
|
+
user_id: string;
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Product configuration ID
|
|
365
|
+
*/
|
|
366
|
+
configuration_id?: string | null;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Creation datetime
|
|
370
|
+
*/
|
|
371
|
+
created_at?: string | null;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Error message if job failed
|
|
375
|
+
*/
|
|
376
|
+
error_message?: string | null;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Associated parse job ID
|
|
380
|
+
*/
|
|
381
|
+
parse_job_id?: string | null;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Result of classifying a document.
|
|
385
|
+
*/
|
|
386
|
+
result?: ClassifyResult | null;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Idempotency key
|
|
390
|
+
*/
|
|
391
|
+
transaction_id?: string | null;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Update datetime
|
|
395
|
+
*/
|
|
396
|
+
updated_at?: string | null;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export interface ClassifyCreateParams {
|
|
400
|
+
/**
|
|
401
|
+
* Query param
|
|
402
|
+
*/
|
|
403
|
+
organization_id?: string | null;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Query param
|
|
407
|
+
*/
|
|
408
|
+
project_id?: string | null;
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Body param: Configuration for a classify job.
|
|
412
|
+
*/
|
|
413
|
+
configuration?: ClassifyConfiguration | null;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Body param: Product configuration ID for reusable presets
|
|
417
|
+
*/
|
|
418
|
+
configuration_id?: string | null;
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Body param: File ID to classify
|
|
422
|
+
*/
|
|
423
|
+
file_id?: string | null;
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Body param: Parse job ID to classify
|
|
427
|
+
*/
|
|
428
|
+
parse_job_id?: string | null;
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Body param: Idempotency key scoped to the project
|
|
432
|
+
*/
|
|
433
|
+
transaction_id?: string | null;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export interface ClassifyListParams extends PaginatedCursorParams {
|
|
437
|
+
/**
|
|
438
|
+
* Filter by configuration ID
|
|
439
|
+
*/
|
|
440
|
+
configuration_id?: string | null;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Include jobs created at or after this timestamp (inclusive)
|
|
444
|
+
*/
|
|
445
|
+
created_at_on_or_after?: string | null;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Include jobs created at or before this timestamp (inclusive)
|
|
449
|
+
*/
|
|
450
|
+
created_at_on_or_before?: string | null;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Filter by specific job IDs
|
|
454
|
+
*/
|
|
455
|
+
job_ids?: Array<string> | null;
|
|
456
|
+
|
|
457
|
+
organization_id?: string | null;
|
|
458
|
+
|
|
459
|
+
project_id?: string | null;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Filter by job status
|
|
463
|
+
*/
|
|
464
|
+
status?: 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED' | null;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export interface ClassifyGetParams {
|
|
468
|
+
organization_id?: string | null;
|
|
469
|
+
|
|
470
|
+
project_id?: string | null;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export declare namespace Classify {
|
|
474
|
+
export {
|
|
475
|
+
type ClassifyConfiguration as ClassifyConfiguration,
|
|
476
|
+
type ClassifyCreateRequest as ClassifyCreateRequest,
|
|
477
|
+
type ClassifyResult as ClassifyResult,
|
|
478
|
+
type ClassifyCreateResponse as ClassifyCreateResponse,
|
|
479
|
+
type ClassifyListResponse as ClassifyListResponse,
|
|
480
|
+
type ClassifyGetResponse as ClassifyGetResponse,
|
|
481
|
+
type ClassifyListResponsesPaginatedCursor as ClassifyListResponsesPaginatedCursor,
|
|
482
|
+
type ClassifyCreateParams as ClassifyCreateParams,
|
|
483
|
+
type ClassifyListParams as ClassifyListParams,
|
|
484
|
+
type ClassifyGetParams as ClassifyGetParams,
|
|
485
|
+
};
|
|
486
|
+
}
|