@mixedbread/sdk 0.1.0-alpha.10

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 (284) hide show
  1. package/CHANGELOG.md +230 -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 +915 -0
  77. package/core.js.map +1 -0
  78. package/core.mjs +883 -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 +169 -0
  87. package/index.d.ts +169 -0
  88. package/index.d.ts.map +1 -0
  89. package/index.js +175 -0
  90. package/index.js.map +1 -0
  91. package/index.mjs +132 -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/embeddings.d.ts +177 -0
  113. package/resources/embeddings.d.ts.map +1 -0
  114. package/resources/embeddings.js +20 -0
  115. package/resources/embeddings.js.map +1 -0
  116. package/resources/embeddings.mjs +16 -0
  117. package/resources/embeddings.mjs.map +1 -0
  118. package/resources/extractions/content.d.ts +33 -0
  119. package/resources/extractions/content.d.ts.map +1 -0
  120. package/resources/extractions/content.js +19 -0
  121. package/resources/extractions/content.js.map +1 -0
  122. package/resources/extractions/content.mjs +15 -0
  123. package/resources/extractions/content.mjs.map +1 -0
  124. package/resources/extractions/extractions.d.ts +18 -0
  125. package/resources/extractions/extractions.d.ts.map +1 -0
  126. package/resources/extractions/extractions.js +47 -0
  127. package/resources/extractions/extractions.js.map +1 -0
  128. package/resources/extractions/extractions.mjs +20 -0
  129. package/resources/extractions/extractions.mjs.map +1 -0
  130. package/resources/extractions/index.d.ts +5 -0
  131. package/resources/extractions/index.d.ts.map +1 -0
  132. package/resources/extractions/index.js +13 -0
  133. package/resources/extractions/index.js.map +1 -0
  134. package/resources/extractions/index.mjs +6 -0
  135. package/resources/extractions/index.mjs.map +1 -0
  136. package/resources/extractions/jobs.d.ts +84 -0
  137. package/resources/extractions/jobs.d.ts.map +1 -0
  138. package/resources/extractions/jobs.js +29 -0
  139. package/resources/extractions/jobs.js.map +1 -0
  140. package/resources/extractions/jobs.mjs +25 -0
  141. package/resources/extractions/jobs.mjs.map +1 -0
  142. package/resources/extractions/schema.d.ts +85 -0
  143. package/resources/extractions/schema.d.ts.map +1 -0
  144. package/resources/extractions/schema.js +39 -0
  145. package/resources/extractions/schema.js.map +1 -0
  146. package/resources/extractions/schema.mjs +35 -0
  147. package/resources/extractions/schema.mjs.map +1 -0
  148. package/resources/files.d.ts +125 -0
  149. package/resources/files.d.ts.map +1 -0
  150. package/resources/files.js +99 -0
  151. package/resources/files.js.map +1 -0
  152. package/resources/files.mjs +71 -0
  153. package/resources/files.mjs.map +1 -0
  154. package/resources/index.d.ts +8 -0
  155. package/resources/index.d.ts.map +1 -0
  156. package/resources/index.js +32 -0
  157. package/resources/index.js.map +1 -0
  158. package/resources/index.mjs +8 -0
  159. package/resources/index.mjs.map +1 -0
  160. package/resources/parsing/index.d.ts +3 -0
  161. package/resources/parsing/index.d.ts.map +1 -0
  162. package/resources/parsing/index.js +10 -0
  163. package/resources/parsing/index.js.map +1 -0
  164. package/resources/parsing/index.mjs +4 -0
  165. package/resources/parsing/index.mjs.map +1 -0
  166. package/resources/parsing/jobs.d.ts +290 -0
  167. package/resources/parsing/jobs.d.ts.map +1 -0
  168. package/resources/parsing/jobs.js +147 -0
  169. package/resources/parsing/jobs.js.map +1 -0
  170. package/resources/parsing/jobs.mjs +119 -0
  171. package/resources/parsing/jobs.mjs.map +1 -0
  172. package/resources/parsing/parsing.d.ts +10 -0
  173. package/resources/parsing/parsing.d.ts.map +1 -0
  174. package/resources/parsing/parsing.js +40 -0
  175. package/resources/parsing/parsing.js.map +1 -0
  176. package/resources/parsing/parsing.mjs +13 -0
  177. package/resources/parsing/parsing.mjs.map +1 -0
  178. package/resources/shared.d.ts +35 -0
  179. package/resources/shared.d.ts.map +1 -0
  180. package/resources/shared.js +4 -0
  181. package/resources/shared.js.map +1 -0
  182. package/resources/shared.mjs +3 -0
  183. package/resources/shared.mjs.map +1 -0
  184. package/resources/top-level.d.ts +165 -0
  185. package/resources/top-level.d.ts.map +1 -0
  186. package/resources/top-level.js +4 -0
  187. package/resources/top-level.js.map +1 -0
  188. package/resources/top-level.mjs +3 -0
  189. package/resources/top-level.mjs.map +1 -0
  190. package/resources/vector-stores/files.d.ts +284 -0
  191. package/resources/vector-stores/files.d.ts.map +1 -0
  192. package/resources/vector-stores/files.js +167 -0
  193. package/resources/vector-stores/files.js.map +1 -0
  194. package/resources/vector-stores/files.mjs +139 -0
  195. package/resources/vector-stores/files.mjs.map +1 -0
  196. package/resources/vector-stores/index.d.ts +3 -0
  197. package/resources/vector-stores/index.d.ts.map +1 -0
  198. package/resources/vector-stores/index.js +11 -0
  199. package/resources/vector-stores/index.js.map +1 -0
  200. package/resources/vector-stores/index.mjs +4 -0
  201. package/resources/vector-stores/index.mjs.map +1 -0
  202. package/resources/vector-stores/vector-stores.d.ts +425 -0
  203. package/resources/vector-stores/vector-stores.d.ts.map +1 -0
  204. package/resources/vector-stores/vector-stores.js +121 -0
  205. package/resources/vector-stores/vector-stores.js.map +1 -0
  206. package/resources/vector-stores/vector-stores.mjs +93 -0
  207. package/resources/vector-stores/vector-stores.mjs.map +1 -0
  208. package/shims/node.d.ts +30 -0
  209. package/shims/node.d.ts.map +1 -0
  210. package/shims/node.js +31 -0
  211. package/shims/node.js.map +1 -0
  212. package/shims/node.mjs +5 -0
  213. package/shims/node.mjs.map +1 -0
  214. package/shims/web.d.ts +26 -0
  215. package/shims/web.d.ts.map +1 -0
  216. package/shims/web.js +31 -0
  217. package/shims/web.js.map +1 -0
  218. package/shims/web.mjs +5 -0
  219. package/shims/web.mjs.map +1 -0
  220. package/src/_shims/MultipartBody.ts +9 -0
  221. package/src/_shims/README.md +46 -0
  222. package/src/_shims/auto/runtime-bun.ts +4 -0
  223. package/src/_shims/auto/runtime-node.ts +4 -0
  224. package/src/_shims/auto/runtime.ts +4 -0
  225. package/src/_shims/auto/types-node.ts +4 -0
  226. package/src/_shims/auto/types.d.ts +101 -0
  227. package/src/_shims/auto/types.js +3 -0
  228. package/src/_shims/auto/types.mjs +3 -0
  229. package/src/_shims/bun-runtime.ts +14 -0
  230. package/src/_shims/index.d.ts +81 -0
  231. package/src/_shims/index.js +13 -0
  232. package/src/_shims/index.mjs +7 -0
  233. package/src/_shims/manual-types.d.ts +12 -0
  234. package/src/_shims/manual-types.js +3 -0
  235. package/src/_shims/manual-types.mjs +3 -0
  236. package/src/_shims/node-runtime.ts +81 -0
  237. package/src/_shims/node-types.d.ts +42 -0
  238. package/src/_shims/node-types.js +3 -0
  239. package/src/_shims/node-types.mjs +3 -0
  240. package/src/_shims/registry.ts +67 -0
  241. package/src/_shims/web-runtime.ts +103 -0
  242. package/src/_shims/web-types.d.ts +83 -0
  243. package/src/_shims/web-types.js +3 -0
  244. package/src/_shims/web-types.mjs +3 -0
  245. package/src/core.ts +1208 -0
  246. package/src/error.ts +130 -0
  247. package/src/index.ts +346 -0
  248. package/src/lib/.keep +4 -0
  249. package/src/lib/polling.ts +115 -0
  250. package/src/pagination.ts +82 -0
  251. package/src/resource.ts +11 -0
  252. package/src/resources/embeddings.ts +248 -0
  253. package/src/resources/extractions/content.ts +42 -0
  254. package/src/resources/extractions/extractions.ts +47 -0
  255. package/src/resources/extractions/index.ts +14 -0
  256. package/src/resources/extractions/jobs.ts +105 -0
  257. package/src/resources/extractions/schema.ts +111 -0
  258. package/src/resources/files.ts +181 -0
  259. package/src/resources/index.ts +39 -0
  260. package/src/resources/parsing/index.ts +12 -0
  261. package/src/resources/parsing/jobs.ts +453 -0
  262. package/src/resources/parsing/parsing.ts +32 -0
  263. package/src/resources/shared.ts +41 -0
  264. package/src/resources/top-level.ts +231 -0
  265. package/src/resources/vector-stores/files.ts +439 -0
  266. package/src/resources/vector-stores/index.ts +31 -0
  267. package/src/resources/vector-stores/vector-stores.ts +592 -0
  268. package/src/shims/node.ts +50 -0
  269. package/src/shims/web.ts +50 -0
  270. package/src/tsconfig.json +11 -0
  271. package/src/uploads.ts +255 -0
  272. package/src/version.ts +1 -0
  273. package/uploads.d.ts +75 -0
  274. package/uploads.d.ts.map +1 -0
  275. package/uploads.js +171 -0
  276. package/uploads.js.map +1 -0
  277. package/uploads.mjs +158 -0
  278. package/uploads.mjs.map +1 -0
  279. package/version.d.ts +2 -0
  280. package/version.d.ts.map +1 -0
  281. package/version.js +5 -0
  282. package/version.js.map +1 -0
  283. package/version.mjs +2 -0
  284. package/version.mjs.map +1 -0
@@ -0,0 +1,248 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import * as Core from '../core';
5
+
6
+ export class Embeddings extends APIResource {
7
+ /**
8
+ * Create embeddings for text or images using the specified model, encoding format,
9
+ * and normalization.
10
+ *
11
+ * Args: params: The parameters for creating embeddings.
12
+ *
13
+ * Returns: EmbeddingCreateResponse: The response containing the embeddings.
14
+ */
15
+ create(
16
+ body: EmbeddingCreateParams,
17
+ options?: Core.RequestOptions,
18
+ ): Core.APIPromise<EmbeddingCreateResponse> {
19
+ return this._client.post('/v1/embeddings', { body, ...options });
20
+ }
21
+ }
22
+
23
+ export interface Embedding {
24
+ /**
25
+ * The encoded embedding.
26
+ */
27
+ embedding: Array<number> | Array<number> | string;
28
+
29
+ /**
30
+ * The index of the embedding.
31
+ */
32
+ index: number;
33
+
34
+ /**
35
+ * The object type of the embedding.
36
+ */
37
+ object: 'embedding';
38
+ }
39
+
40
+ export interface EmbeddingCreateResponse {
41
+ /**
42
+ * The usage of the model
43
+ */
44
+ usage: EmbeddingCreateResponse.Usage;
45
+
46
+ /**
47
+ * The model used
48
+ */
49
+ model: string;
50
+
51
+ /**
52
+ * The created embeddings.
53
+ */
54
+ data: Array<Embedding> | Array<EmbeddingCreateResponse.UnionMember1>;
55
+
56
+ /**
57
+ * The object type of the response
58
+ */
59
+ object?:
60
+ | 'list'
61
+ | 'parsing_job'
62
+ | 'job'
63
+ | 'embedding'
64
+ | 'embedding_dict'
65
+ | 'text_document'
66
+ | 'file'
67
+ | 'vector_store'
68
+ | 'vector_store.file'
69
+ | 'api_key';
70
+
71
+ /**
72
+ * Whether the embeddings are normalized.
73
+ */
74
+ normalized: boolean;
75
+
76
+ /**
77
+ * The encoding format of the embeddings.
78
+ */
79
+ encoding_format:
80
+ | 'float'
81
+ | 'float16'
82
+ | 'base64'
83
+ | 'binary'
84
+ | 'ubinary'
85
+ | 'int8'
86
+ | 'uint8'
87
+ | Array<'float' | 'float16' | 'base64' | 'binary' | 'ubinary' | 'int8' | 'uint8'>;
88
+
89
+ /**
90
+ * The number of dimensions used for the embeddings.
91
+ */
92
+ dimensions: number | null;
93
+ }
94
+
95
+ export namespace EmbeddingCreateResponse {
96
+ /**
97
+ * The usage of the model
98
+ */
99
+ export interface Usage {
100
+ /**
101
+ * The number of tokens used for the prompt
102
+ */
103
+ prompt_tokens: number;
104
+
105
+ /**
106
+ * The total number of tokens used
107
+ */
108
+ total_tokens: number;
109
+
110
+ /**
111
+ * The number of tokens used for the completion
112
+ */
113
+ completion_tokens?: number | null;
114
+ }
115
+
116
+ export interface UnionMember1 {
117
+ /**
118
+ * The encoded embedding data by encoding format.Returned, if more than one
119
+ * encoding format is used.
120
+ */
121
+ embedding: UnionMember1.Embedding;
122
+
123
+ /**
124
+ * The index of the embedding.
125
+ */
126
+ index: number;
127
+
128
+ /**
129
+ * The object type of the embedding.
130
+ */
131
+ object: 'embedding_dict';
132
+ }
133
+
134
+ export namespace UnionMember1 {
135
+ /**
136
+ * The encoded embedding data by encoding format.Returned, if more than one
137
+ * encoding format is used.
138
+ */
139
+ export interface Embedding {
140
+ float?: Array<number>;
141
+
142
+ int8?: Array<number>;
143
+
144
+ uint8?: Array<number>;
145
+
146
+ binary?: Array<number>;
147
+
148
+ ubinary?: Array<number>;
149
+
150
+ base64?: Array<string>;
151
+ }
152
+ }
153
+ }
154
+
155
+ export interface EmbeddingCreateParams {
156
+ /**
157
+ * The model to use for creating embeddings.
158
+ */
159
+ model: string;
160
+
161
+ /**
162
+ * The input to create embeddings for.
163
+ */
164
+ input: string | EmbeddingCreateParams.ImageURLInput | EmbeddingCreateParams.TextInput;
165
+
166
+ /**
167
+ * The number of dimensions to use for the embeddings.
168
+ */
169
+ dimensions?: number | null;
170
+
171
+ /**
172
+ * The prompt to use for the embedding creation.
173
+ */
174
+ prompt?: string | null;
175
+
176
+ /**
177
+ * Whether to normalize the embeddings.
178
+ */
179
+ normalized?: boolean;
180
+
181
+ /**
182
+ * The encoding format of the embeddings.
183
+ */
184
+ encoding_format?:
185
+ | 'float'
186
+ | 'float16'
187
+ | 'base64'
188
+ | 'binary'
189
+ | 'ubinary'
190
+ | 'int8'
191
+ | 'uint8'
192
+ | Array<'float' | 'float16' | 'base64' | 'binary' | 'ubinary' | 'int8' | 'uint8'>;
193
+ }
194
+
195
+ export namespace EmbeddingCreateParams {
196
+ /**
197
+ * Model for image input validation.
198
+ */
199
+ export interface ImageURLInput {
200
+ /**
201
+ * Input type identifier
202
+ */
203
+ type?: 'image_url';
204
+
205
+ /**
206
+ * The image input specification.
207
+ */
208
+ image: ImageURLInput.Image;
209
+ }
210
+
211
+ export namespace ImageURLInput {
212
+ /**
213
+ * The image input specification.
214
+ */
215
+ export interface Image {
216
+ /**
217
+ * The image URL. Can be either a URL or a Data URI.
218
+ */
219
+ url: string;
220
+ }
221
+ }
222
+
223
+ /**
224
+ * Model for text input validation.
225
+ *
226
+ * Attributes: type: Input type identifier, always "text" text: The actual text
227
+ * content, with length and whitespace constraints
228
+ */
229
+ export interface TextInput {
230
+ /**
231
+ * Input type identifier
232
+ */
233
+ type?: 'text';
234
+
235
+ /**
236
+ * Text content to process
237
+ */
238
+ text: string;
239
+ }
240
+ }
241
+
242
+ export declare namespace Embeddings {
243
+ export {
244
+ type Embedding as Embedding,
245
+ type EmbeddingCreateResponse as EmbeddingCreateResponse,
246
+ type EmbeddingCreateParams as EmbeddingCreateParams,
247
+ };
248
+ }
@@ -0,0 +1,42 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../resource';
4
+ import * as Core from '../../core';
5
+
6
+ export class Content extends APIResource {
7
+ /**
8
+ * Extract content from a string using the provided schema.
9
+ *
10
+ * Args: params: The parameters for extracting content from a string.
11
+ *
12
+ * Returns: The extracted content.
13
+ */
14
+ create(body: ContentCreateParams, options?: Core.RequestOptions): Core.APIPromise<ExtractionResult> {
15
+ return this._client.post('/v1/extractions/content', { body, ...options });
16
+ }
17
+ }
18
+
19
+ /**
20
+ * The result of an extraction job.
21
+ */
22
+ export interface ExtractionResult {
23
+ data: unknown;
24
+
25
+ warnings: Array<string>;
26
+ }
27
+
28
+ export interface ContentCreateParams {
29
+ /**
30
+ * The content to extract from
31
+ */
32
+ content: string;
33
+
34
+ /**
35
+ * The JSON schema to use for extraction
36
+ */
37
+ json_schema: unknown;
38
+ }
39
+
40
+ export declare namespace Content {
41
+ export { type ExtractionResult as ExtractionResult, type ContentCreateParams as ContentCreateParams };
42
+ }
@@ -0,0 +1,47 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../resource';
4
+ import * as ContentAPI from './content';
5
+ import { Content, ContentCreateParams, ExtractionResult } from './content';
6
+ import * as JobsAPI from './jobs';
7
+ import { ExtractionJob, JobCreateParams, Jobs } from './jobs';
8
+ import * as SchemaAPI from './schema';
9
+ import {
10
+ CreatedJsonSchema,
11
+ EnhancedJsonSchema,
12
+ Schema,
13
+ SchemaCreateParams,
14
+ SchemaEnhanceParams,
15
+ SchemaValidateParams,
16
+ ValidatedJsonSchema,
17
+ } from './schema';
18
+
19
+ export class Extractions extends APIResource {
20
+ jobs: JobsAPI.Jobs = new JobsAPI.Jobs(this._client);
21
+ schema: SchemaAPI.Schema = new SchemaAPI.Schema(this._client);
22
+ content: ContentAPI.Content = new ContentAPI.Content(this._client);
23
+ }
24
+
25
+ Extractions.Jobs = Jobs;
26
+ Extractions.Schema = Schema;
27
+ Extractions.Content = Content;
28
+
29
+ export declare namespace Extractions {
30
+ export { Jobs as Jobs, type ExtractionJob as ExtractionJob, type JobCreateParams as JobCreateParams };
31
+
32
+ export {
33
+ Schema as Schema,
34
+ type CreatedJsonSchema as CreatedJsonSchema,
35
+ type EnhancedJsonSchema as EnhancedJsonSchema,
36
+ type ValidatedJsonSchema as ValidatedJsonSchema,
37
+ type SchemaCreateParams as SchemaCreateParams,
38
+ type SchemaEnhanceParams as SchemaEnhanceParams,
39
+ type SchemaValidateParams as SchemaValidateParams,
40
+ };
41
+
42
+ export {
43
+ Content as Content,
44
+ type ExtractionResult as ExtractionResult,
45
+ type ContentCreateParams as ContentCreateParams,
46
+ };
47
+ }
@@ -0,0 +1,14 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export { Content, type ExtractionResult, type ContentCreateParams } from './content';
4
+ export { Extractions } from './extractions';
5
+ export { Jobs, type ExtractionJob, type JobCreateParams } from './jobs';
6
+ export {
7
+ Schema,
8
+ type CreatedJsonSchema,
9
+ type EnhancedJsonSchema,
10
+ type ValidatedJsonSchema,
11
+ type SchemaCreateParams,
12
+ type SchemaEnhanceParams,
13
+ type SchemaValidateParams,
14
+ } from './schema';
@@ -0,0 +1,105 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../resource';
4
+ import * as Core from '../../core';
5
+ import * as ContentAPI from './content';
6
+
7
+ export class Jobs extends APIResource {
8
+ /**
9
+ * Start an extraction job for the provided file and schema.
10
+ *
11
+ * Args: params: The parameters for creating an extraction job.
12
+ *
13
+ * Returns: The created extraction job.
14
+ */
15
+ create(body: JobCreateParams, options?: Core.RequestOptions): Core.APIPromise<ExtractionJob> {
16
+ return this._client.post('/v1/extractions/jobs', { body, ...options });
17
+ }
18
+
19
+ /**
20
+ * Get detailed information about a specific extraction job.
21
+ *
22
+ * Args: job_id: The ID of the extraction job.
23
+ *
24
+ * Returns: Detailed information about the extraction job.
25
+ */
26
+ retrieve(jobId: string, options?: Core.RequestOptions): Core.APIPromise<ExtractionJob> {
27
+ return this._client.get(`/v1/extractions/jobs/${jobId}`, options);
28
+ }
29
+ }
30
+
31
+ /**
32
+ * A job for extracting structured data from documents.
33
+ */
34
+ export interface ExtractionJob {
35
+ /**
36
+ * Unique identifier for the extraction job
37
+ */
38
+ id: string;
39
+
40
+ /**
41
+ * ID of the organization that owns this job
42
+ */
43
+ organization_id: string;
44
+
45
+ /**
46
+ * ID of the file being extracted
47
+ */
48
+ file_id: string;
49
+
50
+ /**
51
+ * When the job was created
52
+ */
53
+ created_at: string;
54
+
55
+ /**
56
+ * When the job was last updated
57
+ */
58
+ updated_at: string;
59
+
60
+ /**
61
+ * When the job started processing
62
+ */
63
+ started_at: string | null;
64
+
65
+ /**
66
+ * When the job finished processing
67
+ */
68
+ finished_at: string | null;
69
+
70
+ /**
71
+ * Current status of the job
72
+ */
73
+ status: 'pending' | 'in_progress' | 'cancelled' | 'completed' | 'failed';
74
+
75
+ /**
76
+ * The result of an extraction job.
77
+ */
78
+ result: ContentAPI.ExtractionResult | null;
79
+
80
+ /**
81
+ * Error information if failed
82
+ */
83
+ error: unknown | null;
84
+
85
+ /**
86
+ * The JSON schema used for extraction
87
+ */
88
+ json_schema: unknown;
89
+ }
90
+
91
+ export interface JobCreateParams {
92
+ /**
93
+ * The ID of the file to extract from
94
+ */
95
+ file_id: string;
96
+
97
+ /**
98
+ * The JSON schema to use for extraction
99
+ */
100
+ json_schema: unknown;
101
+ }
102
+
103
+ export declare namespace Jobs {
104
+ export { type ExtractionJob as ExtractionJob, type JobCreateParams as JobCreateParams };
105
+ }
@@ -0,0 +1,111 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../resource';
4
+ import * as Core from '../../core';
5
+
6
+ export class Schema extends APIResource {
7
+ /**
8
+ * Create a schema with the provided parameters.
9
+ *
10
+ * Args: params: The parameters for creating a schema.
11
+ *
12
+ * Returns: The created schema.
13
+ */
14
+ create(body: SchemaCreateParams, options?: Core.RequestOptions): Core.APIPromise<CreatedJsonSchema> {
15
+ return this._client.post('/v1/extractions/schema', { body, ...options });
16
+ }
17
+
18
+ /**
19
+ * Enhance a schema by enriching the descriptions to aid extraction.
20
+ *
21
+ * Args: params: The parameters for enhancing a schema.
22
+ *
23
+ * Returns: The enhanced schema.
24
+ */
25
+ enhance(body: SchemaEnhanceParams, options?: Core.RequestOptions): Core.APIPromise<EnhancedJsonSchema> {
26
+ return this._client.post('/v1/extractions/schema/enhance', { body, ...options });
27
+ }
28
+
29
+ /**
30
+ * Validate a schema.
31
+ *
32
+ * Args: params: The parameters for validating a schema.
33
+ *
34
+ * Returns: The validation result.
35
+ */
36
+ validate(body: SchemaValidateParams, options?: Core.RequestOptions): Core.APIPromise<ValidatedJsonSchema> {
37
+ return this._client.post('/v1/extractions/schema/validate', { body, ...options });
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Result of creating a JSON schema.
43
+ */
44
+ export interface CreatedJsonSchema {
45
+ /**
46
+ * The created JSON schema
47
+ */
48
+ json_schema: unknown;
49
+ }
50
+
51
+ /**
52
+ * Result of enhancing a JSON schema.
53
+ */
54
+ export interface EnhancedJsonSchema {
55
+ /**
56
+ * The enhanced JSON schema
57
+ */
58
+ json_schema: unknown;
59
+ }
60
+
61
+ /**
62
+ * Result of validating a JSON schema.
63
+ */
64
+ export interface ValidatedJsonSchema {
65
+ /**
66
+ * Whether the schema is valid
67
+ */
68
+ is_valid: boolean;
69
+
70
+ /**
71
+ * List of validation errors
72
+ */
73
+ errors: Array<string>;
74
+
75
+ /**
76
+ * The validated JSON schema
77
+ */
78
+ json_schema: unknown;
79
+ }
80
+
81
+ export interface SchemaCreateParams {
82
+ /**
83
+ * Description of the data to extract
84
+ */
85
+ description: string;
86
+ }
87
+
88
+ export interface SchemaEnhanceParams {
89
+ /**
90
+ * The JSON schema to enhance
91
+ */
92
+ json_schema: unknown;
93
+ }
94
+
95
+ export interface SchemaValidateParams {
96
+ /**
97
+ * The JSON schema to validate
98
+ */
99
+ json_schema: unknown;
100
+ }
101
+
102
+ export declare namespace Schema {
103
+ export {
104
+ type CreatedJsonSchema as CreatedJsonSchema,
105
+ type EnhancedJsonSchema as EnhancedJsonSchema,
106
+ type ValidatedJsonSchema as ValidatedJsonSchema,
107
+ type SchemaCreateParams as SchemaCreateParams,
108
+ type SchemaEnhanceParams as SchemaEnhanceParams,
109
+ type SchemaValidateParams as SchemaValidateParams,
110
+ };
111
+ }