@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.
Files changed (209) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +10 -8
  3. package/client.d.mts +9 -8
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +9 -8
  6. package/client.d.ts.map +1 -1
  7. package/client.js +16 -12
  8. package/client.js.map +1 -1
  9. package/client.mjs +16 -12
  10. package/client.mjs.map +1 -1
  11. package/core/pagination.d.mts +0 -23
  12. package/core/pagination.d.mts.map +1 -1
  13. package/core/pagination.d.ts +0 -23
  14. package/core/pagination.d.ts.map +1 -1
  15. package/core/pagination.js +1 -32
  16. package/core/pagination.js.map +1 -1
  17. package/core/pagination.mjs +0 -30
  18. package/core/pagination.mjs.map +1 -1
  19. package/package.json +12 -1
  20. package/resources/beta/batch/batch.d.mts +55 -30
  21. package/resources/beta/batch/batch.d.mts.map +1 -1
  22. package/resources/beta/batch/batch.d.ts +55 -30
  23. package/resources/beta/batch/batch.d.ts.map +1 -1
  24. package/resources/beta/batch/batch.js +14 -11
  25. package/resources/beta/batch/batch.js.map +1 -1
  26. package/resources/beta/batch/batch.mjs +14 -11
  27. package/resources/beta/batch/batch.mjs.map +1 -1
  28. package/resources/beta/batch/job-items.d.mts +36 -13
  29. package/resources/beta/batch/job-items.d.mts.map +1 -1
  30. package/resources/beta/batch/job-items.d.ts +36 -13
  31. package/resources/beta/batch/job-items.d.ts.map +1 -1
  32. package/resources/beta/batch/job-items.js +6 -8
  33. package/resources/beta/batch/job-items.js.map +1 -1
  34. package/resources/beta/batch/job-items.mjs +6 -8
  35. package/resources/beta/batch/job-items.mjs.map +1 -1
  36. package/resources/beta/sheets.d.mts +16 -0
  37. package/resources/beta/sheets.d.mts.map +1 -1
  38. package/resources/beta/sheets.d.ts +16 -0
  39. package/resources/beta/sheets.d.ts.map +1 -1
  40. package/resources/beta/split.d.mts +60 -16
  41. package/resources/beta/split.d.mts.map +1 -1
  42. package/resources/beta/split.d.ts +60 -16
  43. package/resources/beta/split.d.ts.map +1 -1
  44. package/resources/beta/split.js.map +1 -1
  45. package/resources/beta/split.mjs.map +1 -1
  46. package/resources/classifier/jobs.d.mts +20 -3
  47. package/resources/classifier/jobs.d.mts.map +1 -1
  48. package/resources/classifier/jobs.d.ts +20 -3
  49. package/resources/classifier/jobs.d.ts.map +1 -1
  50. package/resources/classifier/jobs.js +8 -0
  51. package/resources/classifier/jobs.js.map +1 -1
  52. package/resources/classifier/jobs.mjs +8 -0
  53. package/resources/classifier/jobs.mjs.map +1 -1
  54. package/resources/classify.d.mts +373 -0
  55. package/resources/classify.d.mts.map +1 -0
  56. package/resources/classify.d.ts +373 -0
  57. package/resources/classify.d.ts.map +1 -0
  58. package/resources/classify.js +54 -0
  59. package/resources/classify.js.map +1 -0
  60. package/resources/classify.mjs +50 -0
  61. package/resources/classify.mjs.map +1 -0
  62. package/resources/extract.d.mts +1588 -0
  63. package/resources/extract.d.mts.map +1 -0
  64. package/resources/extract.d.ts +1588 -0
  65. package/resources/extract.d.ts.map +1 -0
  66. package/resources/extract.js +217 -0
  67. package/resources/extract.js.map +1 -0
  68. package/resources/extract.mjs +213 -0
  69. package/resources/extract.mjs.map +1 -0
  70. package/resources/files.d.mts +52 -38
  71. package/resources/files.d.mts.map +1 -1
  72. package/resources/files.d.ts +52 -38
  73. package/resources/files.d.ts.map +1 -1
  74. package/resources/files.js +10 -9
  75. package/resources/files.js.map +1 -1
  76. package/resources/files.mjs +10 -9
  77. package/resources/files.mjs.map +1 -1
  78. package/resources/index.d.mts +2 -1
  79. package/resources/index.d.mts.map +1 -1
  80. package/resources/index.d.ts +2 -1
  81. package/resources/index.d.ts.map +1 -1
  82. package/resources/index.js +5 -3
  83. package/resources/index.js.map +1 -1
  84. package/resources/index.mjs +2 -1
  85. package/resources/index.mjs.map +1 -1
  86. package/resources/parsing.d.mts +324 -138
  87. package/resources/parsing.d.mts.map +1 -1
  88. package/resources/parsing.d.ts +324 -138
  89. package/resources/parsing.d.ts.map +1 -1
  90. package/resources/parsing.js +30 -4
  91. package/resources/parsing.js.map +1 -1
  92. package/resources/parsing.mjs +30 -4
  93. package/resources/parsing.mjs.map +1 -1
  94. package/resources/pipelines/pipelines.d.mts +59 -13
  95. package/resources/pipelines/pipelines.d.mts.map +1 -1
  96. package/resources/pipelines/pipelines.d.ts +59 -13
  97. package/resources/pipelines/pipelines.d.ts.map +1 -1
  98. package/resources/pipelines/pipelines.js +24 -9
  99. package/resources/pipelines/pipelines.js.map +1 -1
  100. package/resources/pipelines/pipelines.mjs +24 -9
  101. package/resources/pipelines/pipelines.mjs.map +1 -1
  102. package/resources/pipelines/sync.d.mts +5 -3
  103. package/resources/pipelines/sync.d.mts.map +1 -1
  104. package/resources/pipelines/sync.d.ts +5 -3
  105. package/resources/pipelines/sync.d.ts.map +1 -1
  106. package/resources/pipelines/sync.js +5 -3
  107. package/resources/pipelines/sync.js.map +1 -1
  108. package/resources/pipelines/sync.mjs +5 -3
  109. package/resources/pipelines/sync.mjs.map +1 -1
  110. package/src/client.ts +86 -22
  111. package/src/core/pagination.ts +0 -71
  112. package/src/resources/beta/batch/batch.ts +75 -30
  113. package/src/resources/beta/batch/job-items.ts +56 -13
  114. package/src/resources/beta/sheets.ts +20 -0
  115. package/src/resources/beta/split.ts +70 -17
  116. package/src/resources/classifier/jobs.ts +20 -3
  117. package/src/resources/classify.ts +486 -0
  118. package/src/resources/extract.ts +2045 -0
  119. package/src/resources/files.ts +52 -38
  120. package/src/resources/index.ts +35 -1
  121. package/src/resources/parsing.ts +367 -136
  122. package/src/resources/pipelines/pipelines.ts +80 -14
  123. package/src/resources/pipelines/sync.ts +5 -3
  124. package/src/version.ts +1 -1
  125. package/version.d.mts +1 -1
  126. package/version.d.ts +1 -1
  127. package/version.js +1 -1
  128. package/version.mjs +1 -1
  129. package/resources/extraction/extraction-agents/extraction-agents.d.mts +0 -126
  130. package/resources/extraction/extraction-agents/extraction-agents.d.mts.map +0 -1
  131. package/resources/extraction/extraction-agents/extraction-agents.d.ts +0 -126
  132. package/resources/extraction/extraction-agents/extraction-agents.d.ts.map +0 -1
  133. package/resources/extraction/extraction-agents/extraction-agents.js +0 -56
  134. package/resources/extraction/extraction-agents/extraction-agents.js.map +0 -1
  135. package/resources/extraction/extraction-agents/extraction-agents.mjs +0 -51
  136. package/resources/extraction/extraction-agents/extraction-agents.mjs.map +0 -1
  137. package/resources/extraction/extraction-agents/index.d.mts +0 -3
  138. package/resources/extraction/extraction-agents/index.d.mts.map +0 -1
  139. package/resources/extraction/extraction-agents/index.d.ts +0 -3
  140. package/resources/extraction/extraction-agents/index.d.ts.map +0 -1
  141. package/resources/extraction/extraction-agents/index.js +0 -9
  142. package/resources/extraction/extraction-agents/index.js.map +0 -1
  143. package/resources/extraction/extraction-agents/index.mjs +0 -4
  144. package/resources/extraction/extraction-agents/index.mjs.map +0 -1
  145. package/resources/extraction/extraction-agents/schema.d.mts +0 -75
  146. package/resources/extraction/extraction-agents/schema.d.mts.map +0 -1
  147. package/resources/extraction/extraction-agents/schema.d.ts +0 -75
  148. package/resources/extraction/extraction-agents/schema.d.ts.map +0 -1
  149. package/resources/extraction/extraction-agents/schema.js +0 -28
  150. package/resources/extraction/extraction-agents/schema.js.map +0 -1
  151. package/resources/extraction/extraction-agents/schema.mjs +0 -24
  152. package/resources/extraction/extraction-agents/schema.mjs.map +0 -1
  153. package/resources/extraction/extraction-agents.d.mts +0 -2
  154. package/resources/extraction/extraction-agents.d.mts.map +0 -1
  155. package/resources/extraction/extraction-agents.d.ts +0 -2
  156. package/resources/extraction/extraction-agents.d.ts.map +0 -1
  157. package/resources/extraction/extraction-agents.js +0 -6
  158. package/resources/extraction/extraction-agents.js.map +0 -1
  159. package/resources/extraction/extraction-agents.mjs +0 -3
  160. package/resources/extraction/extraction-agents.mjs.map +0 -1
  161. package/resources/extraction/extraction.d.mts +0 -118
  162. package/resources/extraction/extraction.d.mts.map +0 -1
  163. package/resources/extraction/extraction.d.ts +0 -118
  164. package/resources/extraction/extraction.d.ts.map +0 -1
  165. package/resources/extraction/extraction.js +0 -91
  166. package/resources/extraction/extraction.js.map +0 -1
  167. package/resources/extraction/extraction.mjs +0 -86
  168. package/resources/extraction/extraction.mjs.map +0 -1
  169. package/resources/extraction/index.d.mts +0 -5
  170. package/resources/extraction/index.d.mts.map +0 -1
  171. package/resources/extraction/index.d.ts +0 -5
  172. package/resources/extraction/index.d.ts.map +0 -1
  173. package/resources/extraction/index.js +0 -13
  174. package/resources/extraction/index.js.map +0 -1
  175. package/resources/extraction/index.mjs +0 -6
  176. package/resources/extraction/index.mjs.map +0 -1
  177. package/resources/extraction/jobs.d.mts +0 -280
  178. package/resources/extraction/jobs.d.mts.map +0 -1
  179. package/resources/extraction/jobs.d.ts +0 -280
  180. package/resources/extraction/jobs.d.ts.map +0 -1
  181. package/resources/extraction/jobs.js +0 -179
  182. package/resources/extraction/jobs.js.map +0 -1
  183. package/resources/extraction/jobs.mjs +0 -175
  184. package/resources/extraction/jobs.mjs.map +0 -1
  185. package/resources/extraction/runs.d.mts +0 -198
  186. package/resources/extraction/runs.d.mts.map +0 -1
  187. package/resources/extraction/runs.d.ts +0 -198
  188. package/resources/extraction/runs.d.ts.map +0 -1
  189. package/resources/extraction/runs.js +0 -42
  190. package/resources/extraction/runs.js.map +0 -1
  191. package/resources/extraction/runs.mjs +0 -38
  192. package/resources/extraction/runs.mjs.map +0 -1
  193. package/resources/extraction.d.mts +0 -2
  194. package/resources/extraction.d.mts.map +0 -1
  195. package/resources/extraction.d.ts +0 -2
  196. package/resources/extraction.d.ts.map +0 -1
  197. package/resources/extraction.js +0 -6
  198. package/resources/extraction.js.map +0 -1
  199. package/resources/extraction.mjs +0 -3
  200. package/resources/extraction.mjs.map +0 -1
  201. package/src/resources/extraction/extraction-agents/extraction-agents.ts +0 -196
  202. package/src/resources/extraction/extraction-agents/index.ts +0 -18
  203. package/src/resources/extraction/extraction-agents/schema.ts +0 -100
  204. package/src/resources/extraction/extraction-agents.ts +0 -3
  205. package/src/resources/extraction/extraction.ts +0 -224
  206. package/src/resources/extraction/index.ts +0 -34
  207. package/src/resources/extraction/jobs.ts +0 -414
  208. package/src/resources/extraction/runs.ts +0 -315
  209. 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,
@@ -37,6 +35,19 @@ import {
37
35
  import * as Uploads from './core/uploads';
38
36
  import * as API from './resources/index';
39
37
  import { APIPromise } from './core/api-promise';
38
+ import {
39
+ Classify,
40
+ ClassifyConfiguration,
41
+ ClassifyCreateParams,
42
+ ClassifyCreateRequest,
43
+ ClassifyCreateResponse,
44
+ ClassifyGetParams,
45
+ ClassifyGetResponse,
46
+ ClassifyListParams,
47
+ ClassifyListResponse,
48
+ ClassifyListResponsesPaginatedCursor,
49
+ ClassifyResult,
50
+ } from './resources/classify';
40
51
  import {
41
52
  DataSink,
42
53
  DataSinkCreateParams,
@@ -54,6 +65,28 @@ import {
54
65
  DataSourceUpdateParams,
55
66
  DataSources,
56
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';
57
90
  import {
58
91
  File,
59
92
  FileCreate,
@@ -104,7 +137,6 @@ import {
104
137
  } from './resources/projects';
105
138
  import { Beta } from './resources/beta/beta';
106
139
  import { Classifier } from './resources/classifier/classifier';
107
- import { Extraction, ExtractionRunParams } from './resources/extraction/extraction';
108
140
  import {
109
141
  AdvancedModeTransformConfig,
110
142
  AutoTransformConfig,
@@ -178,7 +210,7 @@ import { isEmptyObj } from './internal/utils/values';
178
210
 
179
211
  export interface ClientOptions {
180
212
  /**
181
- * Defaults to process.env['LLAMA_CLOUD_API_KEY'].
213
+ * Defaults to process.env['LLAMA_CLOUD_API_KEY'] or process.env['LLAMA_PARSE_API_KEY'].
182
214
  */
183
215
  apiKey?: string | undefined;
184
216
 
@@ -272,7 +304,7 @@ export class LlamaCloud {
272
304
  /**
273
305
  * API Client for interfacing with the Llama Cloud API.
274
306
  *
275
- * @param {string | undefined} [opts.apiKey=process.env['LLAMA_CLOUD_API_KEY'] ?? undefined]
307
+ * @param {string | undefined} [opts.apiKey=process.env['LLAMA_CLOUD_API_KEY'] ?? process.env['LLAMA_PARSE_API_KEY'] ?? undefined]
276
308
  * @param {string} [opts.baseURL=process.env['LLAMA_CLOUD_BASE_URL'] ?? https://api.cloud.llamaindex.ai] - Override the default base URL for the API.
277
309
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
278
310
  * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
@@ -283,12 +315,12 @@ export class LlamaCloud {
283
315
  */
284
316
  constructor({
285
317
  baseURL = readEnv('LLAMA_CLOUD_BASE_URL'),
286
- apiKey = readEnv('LLAMA_CLOUD_API_KEY'),
318
+ apiKey = readEnv('LLAMA_CLOUD_API_KEY') ?? readEnv('LLAMA_PARSE_API_KEY'),
287
319
  ...opts
288
320
  }: ClientOptions = {}) {
289
321
  if (apiKey === undefined && !isRunningInBrowser()) {
290
322
  throw new Errors.LlamaCloudError(
291
- "The LLAMA_CLOUD_API_KEY environment variable is missing or empty; either provide it, or instantiate the LlamaCloud client with an apiKey option, like new LlamaCloud({ apiKey: 'My API Key' }).",
323
+ "The LLAMA_CLOUD_API_KEY or LLAMA_PARSE_API_KEY environment variable is missing or empty; either provide it, or instantiate the LlamaCloud client with an apiKey option, like new LlamaCloud({ apiKey: 'My API Key' }).",
292
324
  );
293
325
  }
294
326
 
@@ -313,7 +345,7 @@ export class LlamaCloud {
313
345
  parseLogLevel(readEnv('LLAMA_CLOUD_LOG'), "process.env['LLAMA_CLOUD_LOG']", this) ??
314
346
  defaultLogLevel;
315
347
  this.fetchOptions = options.fetchOptions;
316
- this.maxRetries = options.maxRetries ?? 2;
348
+ this.maxRetries = options.maxRetries ?? 5;
317
349
  this.fetch = options.fetch ?? Shims.getDefaultFetch();
318
350
  this.#encoder = Opts.FallbackEncoder;
319
351
 
@@ -396,8 +428,9 @@ export class LlamaCloud {
396
428
  : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
397
429
 
398
430
  const defaultQuery = this.defaultQuery();
399
- if (!isEmptyObj(defaultQuery)) {
400
- query = { ...defaultQuery, ...query };
431
+ const pathQuery = Object.fromEntries(url.searchParams);
432
+ if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
433
+ query = { ...pathQuery, ...defaultQuery, ...query };
401
434
  }
402
435
 
403
436
  if (typeof query === 'object' && query && !Array.isArray(query)) {
@@ -730,9 +763,9 @@ export class LlamaCloud {
730
763
  }
731
764
  }
732
765
 
733
- // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
734
- // just do what it says, but otherwise calculate a default
735
- if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
766
+ // If the API asks us to wait a certain amount of time, just do what it
767
+ // says, but otherwise calculate a default
768
+ if (timeoutMillis === undefined) {
736
769
  const maxRetries = options.maxRetries ?? this.maxRetries;
737
770
  timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
738
771
  }
@@ -892,8 +925,9 @@ export class LlamaCloud {
892
925
 
893
926
  files: API.Files = new API.Files(this);
894
927
  parsing: API.Parsing = new API.Parsing(this);
895
- extraction: API.Extraction = new API.Extraction(this);
928
+ extract: API.Extract = new API.Extract(this);
896
929
  classifier: API.Classifier = new API.Classifier(this);
930
+ classify: API.Classify = new API.Classify(this);
897
931
  projects: API.Projects = new API.Projects(this);
898
932
  dataSinks: API.DataSinks = new API.DataSinks(this);
899
933
  dataSources: API.DataSources = new API.DataSources(this);
@@ -904,8 +938,9 @@ export class LlamaCloud {
904
938
 
905
939
  LlamaCloud.Files = Files;
906
940
  LlamaCloud.Parsing = Parsing;
907
- LlamaCloud.Extraction = Extraction;
941
+ LlamaCloud.Extract = Extract;
908
942
  LlamaCloud.Classifier = Classifier;
943
+ LlamaCloud.Classify = Classify;
909
944
  LlamaCloud.Projects = Projects;
910
945
  LlamaCloud.DataSinks = DataSinks;
911
946
  LlamaCloud.DataSources = DataSources;
@@ -934,12 +969,6 @@ export declare namespace LlamaCloud {
934
969
  type PaginatedBatchItemsResponse as PaginatedBatchItemsResponse,
935
970
  };
936
971
 
937
- export import PaginatedExtractRuns = Pagination.PaginatedExtractRuns;
938
- export {
939
- type PaginatedExtractRunsParams as PaginatedExtractRunsParams,
940
- type PaginatedExtractRunsResponse as PaginatedExtractRunsResponse,
941
- };
942
-
943
972
  export import PaginatedCloudDocuments = Pagination.PaginatedCloudDocuments;
944
973
  export {
945
974
  type PaginatedCloudDocumentsParams as PaginatedCloudDocumentsParams,
@@ -1007,10 +1036,45 @@ export declare namespace LlamaCloud {
1007
1036
  type ParsingGetParams as ParsingGetParams,
1008
1037
  };
1009
1038
 
1010
- export { Extraction as Extraction, type ExtractionRunParams as ExtractionRunParams };
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
+ };
1011
1061
 
1012
1062
  export { Classifier as Classifier };
1013
1063
 
1064
+ export {
1065
+ Classify as Classify,
1066
+ type ClassifyConfiguration as ClassifyConfiguration,
1067
+ type ClassifyCreateRequest as ClassifyCreateRequest,
1068
+ type ClassifyResult as ClassifyResult,
1069
+ type ClassifyCreateResponse as ClassifyCreateResponse,
1070
+ type ClassifyListResponse as ClassifyListResponse,
1071
+ type ClassifyGetResponse as ClassifyGetResponse,
1072
+ type ClassifyListResponsesPaginatedCursor as ClassifyListResponsesPaginatedCursor,
1073
+ type ClassifyCreateParams as ClassifyCreateParams,
1074
+ type ClassifyListParams as ClassifyListParams,
1075
+ type ClassifyGetParams as ClassifyGetParams,
1076
+ };
1077
+
1014
1078
  export {
1015
1079
  Projects as Projects,
1016
1080
  type Project as Project,
@@ -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 new batch processing job for a directory.
25
+ * Create a batch processing job.
27
26
  *
28
- * Processes all files in the specified directory according to the job
29
- * configuration. The job runs asynchronously and you can monitor progress using
30
- * the job status endpoint.
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 all batch processing jobs for a project with optional filtering.
48
+ * List batch processing jobs with optional filtering.
47
49
  *
48
- * Returns a paginated list of batch jobs with filters for directory, job type, and
49
- * status. Useful for viewing job history, monitoring progress, and finding
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 all pending items as cancelled. Items currently being
66
- * processed may complete depending on their state.
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, and estimated completion time.
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 of the job
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
- * Temporal workflow ID for this batch job
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 of the job
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
- * Temporal workflow ID for this batch job
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 of the job
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
- * Temporal workflow ID for this batch job
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 for batch processing. Can be
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 number of files to process before calling continue-as-new.
423
- * If None, continue-as-new is called after every batch. (only used in directory
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 fetch per batch from the directory (only used in
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
- * The outbound webhook configurations
815
+ * Outbound webhook endpoints to notify on job status changes
817
816
  */
818
- webhook_configurations?: Array<ExtractionJobsAPI.WebhookConfiguration> | null;
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 issues.
17
- * Results are paginated for performance with configurable limit and offset
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 (lineage query).
31
+ * Get all processing results for a specific item.
34
32
  *
35
- * Shows complete processing history including what operations have been performed,
36
- * with what parameters, and where outputs are stored. Useful for understanding
37
- * what processing has already been done to avoid redundant work. Optionally filter
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
- * S3 location of processing output
144
+ * Location of the processing output
148
145
  */
149
146
  output_s3_path: string;
150
147
 
151
148
  /**
152
- * Hash of parameters for deduplication
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
- * The outbound webhook configurations
537
+ * Outbound webhook endpoints to notify on job status changes
541
538
  */
542
- webhook_configurations?: Array<ExtractionJobsAPI.WebhookConfiguration> | null;
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
  }
@@ -417,11 +417,31 @@ export interface SheetCreateParams {
417
417
  }
418
418
 
419
419
  export interface SheetListParams extends PaginatedCursorParams {
420
+ /**
421
+ * Include jobs created at or after this timestamp (inclusive)
422
+ */
423
+ created_at_on_or_after?: string | null;
424
+
425
+ /**
426
+ * Include jobs 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 {