@mixedbread/sdk 0.1.0-alpha.8

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 (277) hide show
  1. package/CHANGELOG.md +210 -0
  2. package/LICENSE +201 -0
  3. package/README.md +360 -0
  4. package/_shims/MultipartBody.d.ts +9 -0
  5. package/_shims/MultipartBody.d.ts.map +1 -0
  6. package/_shims/MultipartBody.js +16 -0
  7. package/_shims/MultipartBody.js.map +1 -0
  8. package/_shims/MultipartBody.mjs +12 -0
  9. package/_shims/MultipartBody.mjs.map +1 -0
  10. package/_shims/README.md +46 -0
  11. package/_shims/auto/runtime-bun.d.ts +5 -0
  12. package/_shims/auto/runtime-bun.d.ts.map +1 -0
  13. package/_shims/auto/runtime-bun.js +21 -0
  14. package/_shims/auto/runtime-bun.js.map +1 -0
  15. package/_shims/auto/runtime-bun.mjs +2 -0
  16. package/_shims/auto/runtime-bun.mjs.map +1 -0
  17. package/_shims/auto/runtime-node.d.ts +5 -0
  18. package/_shims/auto/runtime-node.d.ts.map +1 -0
  19. package/_shims/auto/runtime-node.js +21 -0
  20. package/_shims/auto/runtime-node.js.map +1 -0
  21. package/_shims/auto/runtime-node.mjs +2 -0
  22. package/_shims/auto/runtime-node.mjs.map +1 -0
  23. package/_shims/auto/runtime.d.ts +5 -0
  24. package/_shims/auto/runtime.d.ts.map +1 -0
  25. package/_shims/auto/runtime.js +21 -0
  26. package/_shims/auto/runtime.js.map +1 -0
  27. package/_shims/auto/runtime.mjs +2 -0
  28. package/_shims/auto/runtime.mjs.map +1 -0
  29. package/_shims/auto/types-node.d.ts +5 -0
  30. package/_shims/auto/types-node.d.ts.map +1 -0
  31. package/_shims/auto/types-node.js +21 -0
  32. package/_shims/auto/types-node.js.map +1 -0
  33. package/_shims/auto/types-node.mjs +2 -0
  34. package/_shims/auto/types-node.mjs.map +1 -0
  35. package/_shims/auto/types.d.ts +101 -0
  36. package/_shims/auto/types.js +3 -0
  37. package/_shims/auto/types.mjs +3 -0
  38. package/_shims/bun-runtime.d.ts +6 -0
  39. package/_shims/bun-runtime.d.ts.map +1 -0
  40. package/_shims/bun-runtime.js +14 -0
  41. package/_shims/bun-runtime.js.map +1 -0
  42. package/_shims/bun-runtime.mjs +10 -0
  43. package/_shims/bun-runtime.mjs.map +1 -0
  44. package/_shims/index.d.ts +81 -0
  45. package/_shims/index.js +13 -0
  46. package/_shims/index.mjs +7 -0
  47. package/_shims/manual-types.d.ts +12 -0
  48. package/_shims/manual-types.js +3 -0
  49. package/_shims/manual-types.mjs +3 -0
  50. package/_shims/node-runtime.d.ts +3 -0
  51. package/_shims/node-runtime.d.ts.map +1 -0
  52. package/_shims/node-runtime.js +89 -0
  53. package/_shims/node-runtime.js.map +1 -0
  54. package/_shims/node-runtime.mjs +56 -0
  55. package/_shims/node-runtime.mjs.map +1 -0
  56. package/_shims/node-types.d.ts +42 -0
  57. package/_shims/node-types.js +3 -0
  58. package/_shims/node-types.mjs +3 -0
  59. package/_shims/registry.d.ts +37 -0
  60. package/_shims/registry.d.ts.map +1 -0
  61. package/_shims/registry.js +41 -0
  62. package/_shims/registry.js.map +1 -0
  63. package/_shims/registry.mjs +37 -0
  64. package/_shims/registry.mjs.map +1 -0
  65. package/_shims/web-runtime.d.ts +5 -0
  66. package/_shims/web-runtime.d.ts.map +1 -0
  67. package/_shims/web-runtime.js +78 -0
  68. package/_shims/web-runtime.js.map +1 -0
  69. package/_shims/web-runtime.mjs +71 -0
  70. package/_shims/web-runtime.mjs.map +1 -0
  71. package/_shims/web-types.d.ts +83 -0
  72. package/_shims/web-types.js +3 -0
  73. package/_shims/web-types.mjs +3 -0
  74. package/core.d.ts +241 -0
  75. package/core.d.ts.map +1 -0
  76. package/core.js +914 -0
  77. package/core.js.map +1 -0
  78. package/core.mjs +882 -0
  79. package/core.mjs.map +1 -0
  80. package/error.d.ts +47 -0
  81. package/error.d.ts.map +1 -0
  82. package/error.js +113 -0
  83. package/error.js.map +1 -0
  84. package/error.mjs +97 -0
  85. package/error.mjs.map +1 -0
  86. package/index.d.mts +148 -0
  87. package/index.d.ts +148 -0
  88. package/index.d.ts.map +1 -0
  89. package/index.js +151 -0
  90. package/index.js.map +1 -0
  91. package/index.mjs +108 -0
  92. package/index.mjs.map +1 -0
  93. package/lib/polling.d.ts +48 -0
  94. package/lib/polling.d.ts.map +1 -0
  95. package/lib/polling.js +75 -0
  96. package/lib/polling.js.map +1 -0
  97. package/lib/polling.mjs +71 -0
  98. package/lib/polling.mjs.map +1 -0
  99. package/package.json +124 -0
  100. package/pagination.d.ts +30 -0
  101. package/pagination.d.ts.map +1 -0
  102. package/pagination.js +45 -0
  103. package/pagination.js.map +1 -0
  104. package/pagination.mjs +41 -0
  105. package/pagination.mjs.map +1 -0
  106. package/resource.d.ts +6 -0
  107. package/resource.d.ts.map +1 -0
  108. package/resource.js +11 -0
  109. package/resource.js.map +1 -0
  110. package/resource.mjs +7 -0
  111. package/resource.mjs.map +1 -0
  112. package/resources/extractions/content.d.ts +35 -0
  113. package/resources/extractions/content.d.ts.map +1 -0
  114. package/resources/extractions/content.js +19 -0
  115. package/resources/extractions/content.js.map +1 -0
  116. package/resources/extractions/content.mjs +15 -0
  117. package/resources/extractions/content.mjs.map +1 -0
  118. package/resources/extractions/extractions.d.ts +18 -0
  119. package/resources/extractions/extractions.d.ts.map +1 -0
  120. package/resources/extractions/extractions.js +47 -0
  121. package/resources/extractions/extractions.js.map +1 -0
  122. package/resources/extractions/extractions.mjs +20 -0
  123. package/resources/extractions/extractions.mjs.map +1 -0
  124. package/resources/extractions/index.d.ts +5 -0
  125. package/resources/extractions/index.d.ts.map +1 -0
  126. package/resources/extractions/index.js +13 -0
  127. package/resources/extractions/index.js.map +1 -0
  128. package/resources/extractions/index.mjs +6 -0
  129. package/resources/extractions/index.mjs.map +1 -0
  130. package/resources/extractions/jobs.d.ts +44 -0
  131. package/resources/extractions/jobs.d.ts.map +1 -0
  132. package/resources/extractions/jobs.js +29 -0
  133. package/resources/extractions/jobs.js.map +1 -0
  134. package/resources/extractions/jobs.mjs +25 -0
  135. package/resources/extractions/jobs.mjs.map +1 -0
  136. package/resources/extractions/schema.d.ts +85 -0
  137. package/resources/extractions/schema.d.ts.map +1 -0
  138. package/resources/extractions/schema.js +39 -0
  139. package/resources/extractions/schema.js.map +1 -0
  140. package/resources/extractions/schema.mjs +35 -0
  141. package/resources/extractions/schema.mjs.map +1 -0
  142. package/resources/files.d.ts +125 -0
  143. package/resources/files.d.ts.map +1 -0
  144. package/resources/files.js +99 -0
  145. package/resources/files.js.map +1 -0
  146. package/resources/files.mjs +71 -0
  147. package/resources/files.mjs.map +1 -0
  148. package/resources/index.d.ts +7 -0
  149. package/resources/index.d.ts.map +1 -0
  150. package/resources/index.js +30 -0
  151. package/resources/index.js.map +1 -0
  152. package/resources/index.mjs +7 -0
  153. package/resources/index.mjs.map +1 -0
  154. package/resources/parsing/index.d.ts +3 -0
  155. package/resources/parsing/index.d.ts.map +1 -0
  156. package/resources/parsing/index.js +10 -0
  157. package/resources/parsing/index.js.map +1 -0
  158. package/resources/parsing/index.mjs +4 -0
  159. package/resources/parsing/index.mjs.map +1 -0
  160. package/resources/parsing/jobs.d.ts +278 -0
  161. package/resources/parsing/jobs.d.ts.map +1 -0
  162. package/resources/parsing/jobs.js +147 -0
  163. package/resources/parsing/jobs.js.map +1 -0
  164. package/resources/parsing/jobs.mjs +119 -0
  165. package/resources/parsing/jobs.mjs.map +1 -0
  166. package/resources/parsing/parsing.d.ts +10 -0
  167. package/resources/parsing/parsing.d.ts.map +1 -0
  168. package/resources/parsing/parsing.js +40 -0
  169. package/resources/parsing/parsing.js.map +1 -0
  170. package/resources/parsing/parsing.mjs +13 -0
  171. package/resources/parsing/parsing.mjs.map +1 -0
  172. package/resources/shared.d.ts +35 -0
  173. package/resources/shared.d.ts.map +1 -0
  174. package/resources/shared.js +4 -0
  175. package/resources/shared.js.map +1 -0
  176. package/resources/shared.mjs +3 -0
  177. package/resources/shared.mjs.map +1 -0
  178. package/resources/top-level.d.ts +11 -0
  179. package/resources/top-level.d.ts.map +1 -0
  180. package/resources/top-level.js +4 -0
  181. package/resources/top-level.js.map +1 -0
  182. package/resources/top-level.mjs +3 -0
  183. package/resources/top-level.mjs.map +1 -0
  184. package/resources/vector-stores/files.d.ts +280 -0
  185. package/resources/vector-stores/files.d.ts.map +1 -0
  186. package/resources/vector-stores/files.js +167 -0
  187. package/resources/vector-stores/files.js.map +1 -0
  188. package/resources/vector-stores/files.mjs +139 -0
  189. package/resources/vector-stores/files.mjs.map +1 -0
  190. package/resources/vector-stores/index.d.ts +3 -0
  191. package/resources/vector-stores/index.d.ts.map +1 -0
  192. package/resources/vector-stores/index.js +11 -0
  193. package/resources/vector-stores/index.js.map +1 -0
  194. package/resources/vector-stores/index.mjs +4 -0
  195. package/resources/vector-stores/index.mjs.map +1 -0
  196. package/resources/vector-stores/vector-stores.d.ts +400 -0
  197. package/resources/vector-stores/vector-stores.d.ts.map +1 -0
  198. package/resources/vector-stores/vector-stores.js +121 -0
  199. package/resources/vector-stores/vector-stores.js.map +1 -0
  200. package/resources/vector-stores/vector-stores.mjs +93 -0
  201. package/resources/vector-stores/vector-stores.mjs.map +1 -0
  202. package/shims/node.d.ts +30 -0
  203. package/shims/node.d.ts.map +1 -0
  204. package/shims/node.js +31 -0
  205. package/shims/node.js.map +1 -0
  206. package/shims/node.mjs +5 -0
  207. package/shims/node.mjs.map +1 -0
  208. package/shims/web.d.ts +26 -0
  209. package/shims/web.d.ts.map +1 -0
  210. package/shims/web.js +31 -0
  211. package/shims/web.js.map +1 -0
  212. package/shims/web.mjs +5 -0
  213. package/shims/web.mjs.map +1 -0
  214. package/src/_shims/MultipartBody.ts +9 -0
  215. package/src/_shims/README.md +46 -0
  216. package/src/_shims/auto/runtime-bun.ts +4 -0
  217. package/src/_shims/auto/runtime-node.ts +4 -0
  218. package/src/_shims/auto/runtime.ts +4 -0
  219. package/src/_shims/auto/types-node.ts +4 -0
  220. package/src/_shims/auto/types.d.ts +101 -0
  221. package/src/_shims/auto/types.js +3 -0
  222. package/src/_shims/auto/types.mjs +3 -0
  223. package/src/_shims/bun-runtime.ts +14 -0
  224. package/src/_shims/index.d.ts +81 -0
  225. package/src/_shims/index.js +13 -0
  226. package/src/_shims/index.mjs +7 -0
  227. package/src/_shims/manual-types.d.ts +12 -0
  228. package/src/_shims/manual-types.js +3 -0
  229. package/src/_shims/manual-types.mjs +3 -0
  230. package/src/_shims/node-runtime.ts +81 -0
  231. package/src/_shims/node-types.d.ts +42 -0
  232. package/src/_shims/node-types.js +3 -0
  233. package/src/_shims/node-types.mjs +3 -0
  234. package/src/_shims/registry.ts +67 -0
  235. package/src/_shims/web-runtime.ts +103 -0
  236. package/src/_shims/web-types.d.ts +83 -0
  237. package/src/_shims/web-types.js +3 -0
  238. package/src/_shims/web-types.mjs +3 -0
  239. package/src/core.ts +1208 -0
  240. package/src/error.ts +130 -0
  241. package/src/index.ts +294 -0
  242. package/src/lib/.keep +4 -0
  243. package/src/lib/polling.ts +115 -0
  244. package/src/pagination.ts +82 -0
  245. package/src/resource.ts +11 -0
  246. package/src/resources/extractions/content.ts +43 -0
  247. package/src/resources/extractions/extractions.ts +47 -0
  248. package/src/resources/extractions/index.ts +14 -0
  249. package/src/resources/extractions/jobs.ts +55 -0
  250. package/src/resources/extractions/schema.ts +111 -0
  251. package/src/resources/files.ts +181 -0
  252. package/src/resources/index.ts +32 -0
  253. package/src/resources/parsing/index.ts +12 -0
  254. package/src/resources/parsing/jobs.ts +438 -0
  255. package/src/resources/parsing/parsing.ts +32 -0
  256. package/src/resources/shared.ts +41 -0
  257. package/src/resources/top-level.ts +14 -0
  258. package/src/resources/vector-stores/files.ts +434 -0
  259. package/src/resources/vector-stores/index.ts +30 -0
  260. package/src/resources/vector-stores/vector-stores.ts +561 -0
  261. package/src/shims/node.ts +50 -0
  262. package/src/shims/web.ts +50 -0
  263. package/src/tsconfig.json +11 -0
  264. package/src/uploads.ts +255 -0
  265. package/src/version.ts +1 -0
  266. package/uploads.d.ts +75 -0
  267. package/uploads.d.ts.map +1 -0
  268. package/uploads.js +171 -0
  269. package/uploads.js.map +1 -0
  270. package/uploads.mjs +158 -0
  271. package/uploads.mjs.map +1 -0
  272. package/version.d.ts +2 -0
  273. package/version.d.ts.map +1 -0
  274. package/version.js +5 -0
  275. package/version.js.map +1 -0
  276. package/version.mjs +2 -0
  277. package/version.mjs.map +1 -0
@@ -0,0 +1,438 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../resource';
4
+ import { isRequestOptions } from '../../core';
5
+ import * as Core from '../../core';
6
+ import { LimitOffset, type LimitOffsetParams } from '../../pagination';
7
+ import * as polling from '../../lib/polling';
8
+ import { Uploadable } from '../../uploads';
9
+
10
+ export class Jobs extends APIResource {
11
+ /**
12
+ * Start a parse job for the provided file.
13
+ *
14
+ * Args: params: The parameters for creating a parse job.
15
+ *
16
+ * Returns: The created parsing job.
17
+ */
18
+ create(body: JobCreateParams, options?: Core.RequestOptions): Core.APIPromise<ParsingJob> {
19
+ return this._client.post('/v1/parsing/jobs', { body, ...options });
20
+ }
21
+
22
+ /**
23
+ * Get detailed information about a specific parse job.
24
+ *
25
+ * Args: job_id: The ID of the parse job.
26
+ *
27
+ * Returns: Detailed information about the parse job.
28
+ */
29
+ retrieve(jobId: string, options?: Core.RequestOptions): Core.APIPromise<ParsingJob> {
30
+ return this._client.get(`/v1/parsing/jobs/${jobId}`, options);
31
+ }
32
+
33
+ /**
34
+ * List parsing jobs with pagination.
35
+ *
36
+ * Args: limit: The number of items to return. offset: The number of items to skip.
37
+ *
38
+ * Returns: List of parsing jobs with pagination.
39
+ */
40
+ list(
41
+ query?: JobListParams,
42
+ options?: Core.RequestOptions,
43
+ ): Core.PagePromise<JobListResponsesLimitOffset, JobListResponse>;
44
+ list(options?: Core.RequestOptions): Core.PagePromise<JobListResponsesLimitOffset, JobListResponse>;
45
+ list(
46
+ query: JobListParams | Core.RequestOptions = {},
47
+ options?: Core.RequestOptions,
48
+ ): Core.PagePromise<JobListResponsesLimitOffset, JobListResponse> {
49
+ if (isRequestOptions(query)) {
50
+ return this.list({}, query);
51
+ }
52
+ return this._client.getAPIList('/v1/parsing/jobs', JobListResponsesLimitOffset, { query, ...options });
53
+ }
54
+
55
+ /**
56
+ * Delete a specific parse job.
57
+ *
58
+ * Args: job_id: The ID of the parse job to delete.
59
+ *
60
+ * Returns: The deleted parsing job.
61
+ */
62
+ delete(jobId: string, options?: Core.RequestOptions): Core.APIPromise<JobDeleteResponse> {
63
+ return this._client.delete(`/v1/parsing/jobs/${jobId}`, options);
64
+ }
65
+
66
+ /**
67
+ * Cancel a specific parse job.
68
+ *
69
+ * Args: job_id: The ID of the parse job to cancel.
70
+ *
71
+ * Returns: The cancelled parsing job.
72
+ */
73
+ cancel(jobId: string, options?: Core.RequestOptions): Core.APIPromise<ParsingJob> {
74
+ return this._client.patch(`/v1/parsing/jobs/${jobId}`, options);
75
+ }
76
+
77
+ /**
78
+ * Poll for a job's status until it reaches a terminal state.
79
+ *
80
+ * @param jobId - The ID of the job to poll
81
+ * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
82
+ * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
83
+ * @param options - Additional request options
84
+ * @returns The job object once it reaches a terminal state
85
+ */
86
+ async poll(
87
+ jobId: string,
88
+ pollIntervalMs?: number,
89
+ pollTimeoutMs?: number,
90
+ options?: Core.RequestOptions,
91
+ ): Promise<ParsingJob> {
92
+ const pollingIntervalMs = pollIntervalMs || 500;
93
+ const pollingTimeoutMs = pollTimeoutMs;
94
+
95
+ return polling.poll({
96
+ fn: () => this.retrieve(jobId, options),
97
+ condition: (result) =>
98
+ result.status === 'completed' || result.status === 'failed' || result.status === 'cancelled',
99
+ intervalSeconds: pollingIntervalMs / 1000,
100
+ ...(pollingTimeoutMs && { timeoutSeconds: pollingTimeoutMs / 1000 }),
101
+ });
102
+ }
103
+
104
+ /**
105
+ * Create a parsing job and wait for it to complete.
106
+ *
107
+ * @param body - Parameters for creating a parse job
108
+ * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
109
+ * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
110
+ * @param options - Additional request options
111
+ * @returns The job object once it reaches a terminal state
112
+ */
113
+ async createAndPoll(
114
+ body: JobCreateParams,
115
+ pollIntervalMs?: number,
116
+ pollTimeoutMs?: number,
117
+ options?: Core.RequestOptions,
118
+ ): Promise<ParsingJob> {
119
+ const job = await this.create(body, options);
120
+ return this.poll(job.id, pollIntervalMs, pollTimeoutMs, options);
121
+ }
122
+
123
+ /**
124
+ * Upload a file to the files API and then create a parsing job for it.
125
+ * Note the job will be asynchronously processed.
126
+ *
127
+ * @param file - The file to upload
128
+ * @param body - Additional parameters for creating a parse job
129
+ * @param options - Additional request options
130
+ * @returns The created parsing job
131
+ */
132
+ async upload(
133
+ file: Uploadable,
134
+ body?: Omit<JobCreateParams, 'file_id'>,
135
+ options?: Core.RequestOptions,
136
+ ): Promise<ParsingJob> {
137
+ const fileUploadResponse = await this._client.files.create({ file }, options);
138
+
139
+ return this.create(
140
+ {
141
+ file_id: fileUploadResponse.id,
142
+ ...body,
143
+ },
144
+ options,
145
+ );
146
+ }
147
+
148
+ /**
149
+ * Upload a file and create a parsing job, then poll until processing is complete.
150
+ *
151
+ * @param file - The file to upload
152
+ * @param body - Additional parameters for creating a parse job
153
+ * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
154
+ * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
155
+ * @param options - Additional request options
156
+ * @returns The job object once it reaches a terminal state
157
+ */
158
+ async uploadAndPoll(
159
+ file: Uploadable,
160
+ body?: Omit<JobCreateParams, 'file_id'>,
161
+ pollIntervalMs?: number,
162
+ pollTimeoutMs?: number,
163
+ options?: Core.RequestOptions,
164
+ ): Promise<ParsingJob> {
165
+ const job = await this.upload(file, body, options);
166
+ return this.poll(job.id, pollIntervalMs, pollTimeoutMs, options);
167
+ }
168
+ }
169
+
170
+ export class JobListResponsesLimitOffset extends LimitOffset<JobListResponse> {}
171
+
172
+ /**
173
+ * A job for parsing documents with its current state and result.
174
+ */
175
+ export interface ParsingJob {
176
+ /**
177
+ * The ID of the job
178
+ */
179
+ id: string;
180
+
181
+ /**
182
+ * The status of the job
183
+ */
184
+ status: 'pending' | 'in_progress' | 'cancelled' | 'completed' | 'failed';
185
+
186
+ /**
187
+ * The error of the job
188
+ */
189
+ error?: unknown;
190
+
191
+ /**
192
+ * Result of document parsing operation.
193
+ */
194
+ result?: ParsingJob.Result | null;
195
+
196
+ /**
197
+ * The started time of the job
198
+ */
199
+ started_at?: string | null;
200
+
201
+ /**
202
+ * The finished time of the job
203
+ */
204
+ finished_at?: string | null;
205
+
206
+ /**
207
+ * The creation time of the job
208
+ */
209
+ created_at?: string;
210
+
211
+ /**
212
+ * The updated time of the job
213
+ */
214
+ updated_at?: string | null;
215
+
216
+ /**
217
+ * The type of the object
218
+ */
219
+ object?: 'parsing_job';
220
+ }
221
+
222
+ export namespace ParsingJob {
223
+ /**
224
+ * Result of document parsing operation.
225
+ */
226
+ export interface Result {
227
+ /**
228
+ * The strategy used for chunking the document
229
+ */
230
+ chunking_strategy: 'page';
231
+
232
+ /**
233
+ * The format of the returned content
234
+ */
235
+ return_format: 'html' | 'markdown' | 'plain';
236
+
237
+ /**
238
+ * The types of elements extracted
239
+ */
240
+ element_types: Array<
241
+ | 'caption'
242
+ | 'footnote'
243
+ | 'formula'
244
+ | 'list-item'
245
+ | 'page-footer'
246
+ | 'page-header'
247
+ | 'picture'
248
+ | 'section-header'
249
+ | 'table'
250
+ | 'text'
251
+ | 'title'
252
+ >;
253
+
254
+ /**
255
+ * List of extracted chunks from the document
256
+ */
257
+ chunks: Array<Result.Chunk>;
258
+ }
259
+
260
+ export namespace Result {
261
+ /**
262
+ * A chunk of text extracted from a document page.
263
+ */
264
+ export interface Chunk {
265
+ /**
266
+ * The full content of the chunk
267
+ */
268
+ content: string;
269
+
270
+ /**
271
+ * The content to be used for embedding
272
+ */
273
+ content_to_embed: string;
274
+
275
+ /**
276
+ * List of elements contained in this chunk
277
+ */
278
+ elements: Array<Chunk.Element>;
279
+ }
280
+
281
+ export namespace Chunk {
282
+ /**
283
+ * Represents an extracted element from a document with its content and metadata.
284
+ */
285
+ export interface Element {
286
+ /**
287
+ * The type of the extracted element
288
+ */
289
+ type:
290
+ | 'caption'
291
+ | 'footnote'
292
+ | 'formula'
293
+ | 'list-item'
294
+ | 'page-footer'
295
+ | 'page-header'
296
+ | 'picture'
297
+ | 'section-header'
298
+ | 'table'
299
+ | 'text'
300
+ | 'title';
301
+
302
+ /**
303
+ * The confidence score of the extraction
304
+ */
305
+ confidence: number;
306
+
307
+ /**
308
+ * The bounding box coordinates [x1, y1, x2, y2]
309
+ */
310
+ bbox: Array<unknown>;
311
+
312
+ /**
313
+ * The page number where the element was found
314
+ */
315
+ page: number;
316
+
317
+ /**
318
+ * The full content of the extracted element
319
+ */
320
+ content: string;
321
+
322
+ /**
323
+ * A brief summary of the element's content
324
+ */
325
+ summary?: string | null;
326
+ }
327
+ }
328
+ }
329
+ }
330
+
331
+ /**
332
+ * A parsing job item for list responses, omitting result and error fields.
333
+ */
334
+ export interface JobListResponse {
335
+ /**
336
+ * The ID of the job
337
+ */
338
+ id: string;
339
+
340
+ /**
341
+ * The status of the job
342
+ */
343
+ status: 'pending' | 'in_progress' | 'cancelled' | 'completed' | 'failed';
344
+
345
+ /**
346
+ * The started time of the job
347
+ */
348
+ started_at?: string | null;
349
+
350
+ /**
351
+ * The finished time of the job
352
+ */
353
+ finished_at?: string | null;
354
+
355
+ /**
356
+ * The creation time of the job
357
+ */
358
+ created_at?: string;
359
+
360
+ /**
361
+ * The updated time of the job
362
+ */
363
+ updated_at?: string | null;
364
+
365
+ /**
366
+ * The type of the object
367
+ */
368
+ object?: 'parsing_job';
369
+ }
370
+
371
+ /**
372
+ * A deleted parsing job.
373
+ */
374
+ export interface JobDeleteResponse {
375
+ /**
376
+ * The ID of the deleted job
377
+ */
378
+ id: string;
379
+
380
+ /**
381
+ * Whether the job was deleted
382
+ */
383
+ deleted?: boolean;
384
+
385
+ /**
386
+ * The type of the object
387
+ */
388
+ object?: 'parsing_job';
389
+ }
390
+
391
+ export interface JobCreateParams {
392
+ /**
393
+ * The ID of the file to parse
394
+ */
395
+ file_id: string;
396
+
397
+ /**
398
+ * The elements to extract from the document
399
+ */
400
+ element_types?: Array<
401
+ | 'caption'
402
+ | 'footnote'
403
+ | 'formula'
404
+ | 'list-item'
405
+ | 'page-footer'
406
+ | 'page-header'
407
+ | 'picture'
408
+ | 'section-header'
409
+ | 'table'
410
+ | 'text'
411
+ | 'title'
412
+ > | null;
413
+
414
+ /**
415
+ * The strategy to use for chunking the content
416
+ */
417
+ chunking_strategy?: 'page';
418
+
419
+ /**
420
+ * The format of the returned content
421
+ */
422
+ return_format?: 'html' | 'markdown' | 'plain';
423
+ }
424
+
425
+ export interface JobListParams extends LimitOffsetParams {}
426
+
427
+ Jobs.JobListResponsesLimitOffset = JobListResponsesLimitOffset;
428
+
429
+ export declare namespace Jobs {
430
+ export {
431
+ type ParsingJob as ParsingJob,
432
+ type JobListResponse as JobListResponse,
433
+ type JobDeleteResponse as JobDeleteResponse,
434
+ JobListResponsesLimitOffset as JobListResponsesLimitOffset,
435
+ type JobCreateParams as JobCreateParams,
436
+ type JobListParams as JobListParams,
437
+ };
438
+ }
@@ -0,0 +1,32 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../resource';
4
+ import * as JobsAPI from './jobs';
5
+ import {
6
+ JobCreateParams,
7
+ JobDeleteResponse,
8
+ JobListParams,
9
+ JobListResponse,
10
+ JobListResponsesLimitOffset,
11
+ Jobs,
12
+ ParsingJob,
13
+ } from './jobs';
14
+
15
+ export class Parsing extends APIResource {
16
+ jobs: JobsAPI.Jobs = new JobsAPI.Jobs(this._client);
17
+ }
18
+
19
+ Parsing.Jobs = Jobs;
20
+ Parsing.JobListResponsesLimitOffset = JobListResponsesLimitOffset;
21
+
22
+ export declare namespace Parsing {
23
+ export {
24
+ Jobs as Jobs,
25
+ type ParsingJob as ParsingJob,
26
+ type JobListResponse as JobListResponse,
27
+ type JobDeleteResponse as JobDeleteResponse,
28
+ JobListResponsesLimitOffset as JobListResponsesLimitOffset,
29
+ type JobCreateParams as JobCreateParams,
30
+ type JobListParams as JobListParams,
31
+ };
32
+ }
@@ -0,0 +1,41 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ /**
4
+ * Represents a filter with AND, OR, and NOT conditions.
5
+ */
6
+ export interface SearchFilter {
7
+ /**
8
+ * List of conditions or filters to be ANDed together
9
+ */
10
+ all?: Array<SearchFilter | SearchFilterCondition> | null;
11
+
12
+ /**
13
+ * List of conditions or filters to be ORed together
14
+ */
15
+ any?: Array<SearchFilter | SearchFilterCondition> | null;
16
+
17
+ /**
18
+ * List of conditions or filters to be NOTed
19
+ */
20
+ none?: Array<SearchFilter | SearchFilterCondition> | null;
21
+ }
22
+
23
+ /**
24
+ * Represents a condition with a field, operator, and value.
25
+ */
26
+ export interface SearchFilterCondition {
27
+ /**
28
+ * The field to apply the condition on
29
+ */
30
+ key: string;
31
+
32
+ /**
33
+ * The value to compare against
34
+ */
35
+ value: unknown;
36
+
37
+ /**
38
+ * The operator for the condition
39
+ */
40
+ operator: 'eq' | 'not_eq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'not_in' | 'like' | 'not_like';
41
+ }
@@ -0,0 +1,14 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ /**
4
+ * Info Pydantic Response Service Message
5
+ */
6
+ export interface InfoResponse {
7
+ name: string;
8
+
9
+ version: string;
10
+ }
11
+
12
+ export declare namespace TopLevel {
13
+ export { type InfoResponse as InfoResponse };
14
+ }