@mixedbread/sdk 0.1.0-alpha.8 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/CHANGELOG.md +392 -0
  2. package/README.md +4 -4
  3. package/_shims/index.d.ts +2 -0
  4. package/_shims/index.js +5 -1
  5. package/_shims/index.mjs +5 -1
  6. package/core.d.ts +11 -0
  7. package/core.d.ts.map +1 -1
  8. package/core.js +5 -2
  9. package/core.js.map +1 -1
  10. package/core.mjs +6 -3
  11. package/core.mjs.map +1 -1
  12. package/index.d.mts +29 -8
  13. package/index.d.ts +29 -8
  14. package/index.d.ts.map +1 -1
  15. package/index.js +32 -8
  16. package/index.js.map +1 -1
  17. package/index.mjs +32 -8
  18. package/index.mjs.map +1 -1
  19. package/package.json +8 -29
  20. package/resources/embeddings.d.ts +45 -0
  21. package/resources/embeddings.d.ts.map +1 -0
  22. package/resources/embeddings.js +20 -0
  23. package/resources/embeddings.js.map +1 -0
  24. package/resources/embeddings.mjs +16 -0
  25. package/resources/embeddings.mjs.map +1 -0
  26. package/resources/extractions/content.d.ts +4 -6
  27. package/resources/extractions/content.d.ts.map +1 -1
  28. package/resources/extractions/jobs.d.ts +42 -2
  29. package/resources/extractions/jobs.d.ts.map +1 -1
  30. package/resources/extractions/schema.d.ts +5 -5
  31. package/resources/extractions/schema.d.ts.map +1 -1
  32. package/resources/extractions.d.ts +2 -0
  33. package/resources/extractions.d.ts.map +1 -0
  34. package/resources/extractions.js +19 -0
  35. package/resources/extractions.js.map +1 -0
  36. package/resources/extractions.mjs +3 -0
  37. package/resources/extractions.mjs.map +1 -0
  38. package/resources/index.d.ts +3 -2
  39. package/resources/index.d.ts.map +1 -1
  40. package/resources/index.js +3 -1
  41. package/resources/index.js.map +1 -1
  42. package/resources/index.mjs +1 -0
  43. package/resources/index.mjs.map +1 -1
  44. package/resources/parsing/jobs.d.ts +12 -0
  45. package/resources/parsing/jobs.d.ts.map +1 -1
  46. package/resources/parsing/jobs.js.map +1 -1
  47. package/resources/parsing/jobs.mjs.map +1 -1
  48. package/resources/parsing.d.ts +2 -0
  49. package/resources/parsing.d.ts.map +1 -0
  50. package/resources/parsing.js +19 -0
  51. package/resources/parsing.js.map +1 -0
  52. package/resources/parsing.mjs +3 -0
  53. package/resources/parsing.mjs.map +1 -0
  54. package/resources/shared.d.ts +14 -0
  55. package/resources/shared.d.ts.map +1 -1
  56. package/resources/top-level.d.ts +174 -1
  57. package/resources/top-level.d.ts.map +1 -1
  58. package/resources/vector-stores/files.d.ts +14 -2
  59. package/resources/vector-stores/files.d.ts.map +1 -1
  60. package/resources/vector-stores/files.js.map +1 -1
  61. package/resources/vector-stores/files.mjs.map +1 -1
  62. package/resources/vector-stores/index.d.ts +1 -1
  63. package/resources/vector-stores/index.d.ts.map +1 -1
  64. package/resources/vector-stores/index.js.map +1 -1
  65. package/resources/vector-stores/index.mjs.map +1 -1
  66. package/resources/vector-stores/vector-stores.d.ts +38 -9
  67. package/resources/vector-stores/vector-stores.d.ts.map +1 -1
  68. package/resources/vector-stores/vector-stores.js.map +1 -1
  69. package/resources/vector-stores/vector-stores.mjs.map +1 -1
  70. package/resources/vector-stores.d.ts +2 -0
  71. package/resources/vector-stores.d.ts.map +1 -0
  72. package/resources/vector-stores.js +19 -0
  73. package/resources/vector-stores.js.map +1 -0
  74. package/resources/vector-stores.mjs +3 -0
  75. package/resources/vector-stores.mjs.map +1 -0
  76. package/resources.d.ts +2 -0
  77. package/resources.d.ts.map +1 -0
  78. package/resources.js +18 -0
  79. package/resources.js.map +1 -0
  80. package/resources.mjs +2 -0
  81. package/resources.mjs.map +1 -0
  82. package/src/_shims/index.d.ts +2 -0
  83. package/src/_shims/index.js +5 -1
  84. package/src/_shims/index.mjs +5 -1
  85. package/src/core.ts +23 -4
  86. package/src/index.ts +76 -23
  87. package/src/resources/embeddings.ts +67 -0
  88. package/src/resources/extractions/content.ts +5 -6
  89. package/src/resources/extractions/jobs.ts +52 -2
  90. package/src/resources/extractions/schema.ts +5 -5
  91. package/src/resources/extractions.ts +3 -0
  92. package/src/resources/index.ts +12 -2
  93. package/src/resources/parsing/jobs.ts +15 -0
  94. package/src/resources/parsing.ts +3 -0
  95. package/src/resources/shared.ts +17 -0
  96. package/src/resources/top-level.ts +260 -1
  97. package/src/resources/vector-stores/files.ts +17 -2
  98. package/src/resources/vector-stores/index.ts +2 -1
  99. package/src/resources/vector-stores/vector-stores.ts +45 -9
  100. package/src/resources/vector-stores.ts +3 -0
  101. package/src/resources.ts +1 -0
  102. package/src/version.ts +1 -1
  103. package/version.d.ts +1 -1
  104. package/version.d.ts.map +1 -1
  105. package/version.js +1 -1
  106. package/version.js.map +1 -1
  107. package/version.mjs +1 -1
  108. package/version.mjs.map +1 -1
@@ -0,0 +1,2 @@
1
+ export * from "./vector-stores/index.js";
2
+ //# sourceMappingURL=vector-stores.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector-stores.d.ts","sourceRoot":"","sources":["../src/resources/vector-stores.ts"],"names":[],"mappings":"AAEA,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ __exportStar(require("./vector-stores/index.js"), exports);
19
+ //# sourceMappingURL=vector-stores.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector-stores.js","sourceRoot":"","sources":["../src/resources/vector-stores.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;AAEtF,2DAAsC"}
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ export * from "./vector-stores/index.mjs";
3
+ //# sourceMappingURL=vector-stores.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector-stores.mjs","sourceRoot":"","sources":["../src/resources/vector-stores.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
package/resources.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./resources/index.js";
2
+ //# sourceMappingURL=resources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
package/resources.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./resources/index.js"), exports);
18
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAkC"}
package/resources.mjs ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./resources/index.mjs";
2
+ //# sourceMappingURL=resources.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.mjs","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":""}
@@ -79,3 +79,5 @@ export function fileFromPath(path: string, options?: FileFromPathOptions): Promi
79
79
  export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise<File>;
80
80
 
81
81
  export function isFsReadStream(value: any): value is FsReadStream;
82
+
83
+ export const init: () => void;
@@ -3,7 +3,9 @@
3
3
  */
4
4
  const shims = require('./registry');
5
5
  const auto = require('@mixedbread/sdk/_shims/auto/runtime');
6
- if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
6
+ exports.init = () => {
7
+ if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
8
+ };
7
9
  for (const property of Object.keys(shims)) {
8
10
  Object.defineProperty(exports, property, {
9
11
  get() {
@@ -11,3 +13,5 @@ for (const property of Object.keys(shims)) {
11
13
  },
12
14
  });
13
15
  }
16
+
17
+ exports.init();
@@ -3,5 +3,9 @@
3
3
  */
4
4
  import * as shims from './registry.mjs';
5
5
  import * as auto from "./auto/runtime";
6
- if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
6
+ export const init = () => {
7
+ if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
8
+ };
7
9
  export * from './registry.mjs';
10
+
11
+ init();
package/src/core.ts CHANGED
@@ -16,7 +16,12 @@ import {
16
16
  type RequestInit,
17
17
  type Response,
18
18
  type HeadersInit,
19
+ init,
19
20
  } from './_shims/index';
21
+
22
+ // try running side effects outside of _shims/index to workaround https://github.com/vercel/next.js/issues/76881
23
+ init();
24
+
20
25
  export { type Response };
21
26
  import { BlobLike, isBlobLike, isMultipartBody } from './uploads';
22
27
  export {
@@ -28,6 +33,20 @@ export {
28
33
 
29
34
  export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
30
35
 
36
+ /**
37
+ * An alias to the builtin `Array` type so we can
38
+ * easily alias it in import statements if there are name clashes.
39
+ */
40
+ type _Array<T> = Array<T>;
41
+
42
+ /**
43
+ * An alias to the builtin `Record` type so we can
44
+ * easily alias it in import statements if there are name clashes.
45
+ */
46
+ type _Record<K extends keyof any, T> = Record<K, T>;
47
+
48
+ export type { _Array as Array, _Record as Record };
49
+
31
50
  type PromiseOrValue<T> = T | Promise<T>;
32
51
 
33
52
  type APIResponseProps = {
@@ -48,8 +67,8 @@ async function defaultParseResponse<T>(props: APIResponseProps): Promise<T> {
48
67
  }
49
68
 
50
69
  const contentType = response.headers.get('content-type');
51
- const isJSON =
52
- contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json');
70
+ const mediaType = contentType?.split(';')[0]?.trim();
71
+ const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
53
72
  if (isJSON) {
54
73
  const json = await response.json();
55
74
 
@@ -366,7 +385,7 @@ export abstract class APIClient {
366
385
  getHeader(headers, 'x-stainless-timeout') === undefined &&
367
386
  options.timeout
368
387
  ) {
369
- reqHeaders['x-stainless-timeout'] = String(options.timeout);
388
+ reqHeaders['x-stainless-timeout'] = String(Math.trunc(options.timeout / 1000));
370
389
  }
371
390
 
372
391
  this.validateHeaders(reqHeaders, headers);
@@ -395,7 +414,7 @@ export abstract class APIClient {
395
414
  !headers ? {}
396
415
  : Symbol.iterator in headers ?
397
416
  Object.fromEntries(Array.from(headers as Iterable<string[]>).map((header) => [...header]))
398
- : { ...headers }
417
+ : { ...(headers as any as Record<string, string>) }
399
418
  );
400
419
  }
401
420
 
package/src/index.ts CHANGED
@@ -8,7 +8,16 @@ import { type LimitOffsetParams, LimitOffsetResponse } from './pagination';
8
8
  import * as Uploads from './uploads';
9
9
  import * as API from './resources/index';
10
10
  import * as TopLevelAPI from './resources/top-level';
11
- import { InfoResponse } from './resources/top-level';
11
+ import {
12
+ EmbedParams,
13
+ Embedding,
14
+ EmbeddingCreateResponse,
15
+ InfoResponse,
16
+ MultiEncodingEmbedding,
17
+ RerankParams,
18
+ RerankResponse,
19
+ } from './resources/top-level';
20
+ import { EmbeddingCreateParams, Embeddings } from './resources/embeddings';
12
21
  import {
13
22
  FileCreateParams,
14
23
  FileDeleteResponse,
@@ -25,12 +34,13 @@ import {
25
34
  FileCounts,
26
35
  ScoredVectorStoreChunk,
27
36
  VectorStore,
37
+ VectorStoreChunkSearchOptions,
28
38
  VectorStoreCreateParams,
29
39
  VectorStoreDeleteResponse,
40
+ VectorStoreFileSearchOptions,
30
41
  VectorStoreListParams,
31
42
  VectorStoreQuestionAnsweringParams,
32
43
  VectorStoreQuestionAnsweringResponse,
33
- VectorStoreSearchOptions,
34
44
  VectorStoreSearchParams,
35
45
  VectorStoreSearchResponse,
36
46
  VectorStoreUpdateParams,
@@ -39,7 +49,7 @@ import {
39
49
  } from './resources/vector-stores/vector-stores';
40
50
 
41
51
  const environments = {
42
- production: 'https://api.mixedbread.ai',
52
+ production: 'https://api.mixedbread.com',
43
53
  local: 'http://127.0.0.1:8000',
44
54
  };
45
55
  type Environment = keyof typeof environments;
@@ -54,7 +64,7 @@ export interface ClientOptions {
54
64
  * Specifies the environment to use for the API.
55
65
  *
56
66
  * Each environment maps to a different base URL:
57
- * - `production` corresponds to `https://api.mixedbread.ai`
67
+ * - `production` corresponds to `https://api.mixedbread.com`
58
68
  * - `local` corresponds to `http://127.0.0.1:8000`
59
69
  */
60
70
  environment?: Environment | undefined;
@@ -127,9 +137,9 @@ export class Mixedbread extends Core.APIClient {
127
137
  /**
128
138
  * API Client for interfacing with the Mixedbread API.
129
139
  *
130
- * @param {string | undefined} [opts.apiKey=process.env['MXBAI_API_KEY'] ?? undefined]
140
+ * @param {string | undefined} [opts.apiKey=process.env['MIXEDBREAD_API_KEY'] ?? undefined]
131
141
  * @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
132
- * @param {string} [opts.baseURL=process.env['MIXEDBREAD_BASE_URL'] ?? https://api.mixedbread.ai] - Override the default base URL for the API.
142
+ * @param {string} [opts.baseURL=process.env['MIXEDBREAD_BASE_URL'] ?? https://api.mixedbread.com] - Override the default base URL for the API.
133
143
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
134
144
  * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
135
145
  * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
@@ -139,12 +149,12 @@ export class Mixedbread extends Core.APIClient {
139
149
  */
140
150
  constructor({
141
151
  baseURL = Core.readEnv('MIXEDBREAD_BASE_URL'),
142
- apiKey = Core.readEnv('MXBAI_API_KEY'),
152
+ apiKey = Core.readEnv('MIXEDBREAD_API_KEY'),
143
153
  ...opts
144
154
  }: ClientOptions = {}) {
145
155
  if (apiKey === undefined) {
146
156
  throw new Errors.MixedbreadError(
147
- "The MXBAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the Mixedbread client with an apiKey option, like new Mixedbread({ apiKey: 'My API Key' }).",
157
+ "The MIXEDBREAD_API_KEY environment variable is missing or empty; either provide it, or instantiate the Mixedbread client with an apiKey option, like new Mixedbread({ apiKey: 'My API Key' }).",
148
158
  );
149
159
  }
150
160
 
@@ -174,10 +184,26 @@ export class Mixedbread extends Core.APIClient {
174
184
  this.apiKey = apiKey;
175
185
  }
176
186
 
187
+ vectorStores: API.VectorStores = new API.VectorStores(this);
177
188
  parsing: API.Parsing = new API.Parsing(this);
178
189
  files: API.Files = new API.Files(this);
179
- vectorStores: API.VectorStores = new API.VectorStores(this);
180
190
  extractions: API.Extractions = new API.Extractions(this);
191
+ embeddings: API.Embeddings = new API.Embeddings(this);
192
+
193
+ /**
194
+ * Create embeddings for text or images using the specified model, encoding format,
195
+ * and normalization.
196
+ *
197
+ * Args: params: The parameters for creating embeddings.
198
+ *
199
+ * Returns: EmbeddingCreateResponse: The response containing the embeddings.
200
+ */
201
+ embed(
202
+ body: TopLevelAPI.EmbedParams,
203
+ options?: Core.RequestOptions,
204
+ ): Core.APIPromise<TopLevelAPI.EmbeddingCreateResponse> {
205
+ return this.post('/v1/embeddings', { body, ...options });
206
+ }
181
207
 
182
208
  /**
183
209
  * Returns service information, including name and version.
@@ -188,6 +214,20 @@ export class Mixedbread extends Core.APIClient {
188
214
  return this.get('/', options);
189
215
  }
190
216
 
217
+ /**
218
+ * Rerank different kind of documents for a given query.
219
+ *
220
+ * Args: params: RerankParams: The parameters for reranking.
221
+ *
222
+ * Returns: RerankResponse: The reranked documents for the input query.
223
+ */
224
+ rerank(
225
+ body: TopLevelAPI.RerankParams,
226
+ options?: Core.RequestOptions,
227
+ ): Core.APIPromise<TopLevelAPI.RerankResponse> {
228
+ return this.post('/v1/reranking', { body, ...options });
229
+ }
230
+
191
231
  protected override defaultQuery(): Core.DefaultQuery | undefined {
192
232
  return this._options.defaultQuery;
193
233
  }
@@ -224,30 +264,27 @@ export class Mixedbread extends Core.APIClient {
224
264
  static fileFromPath = Uploads.fileFromPath;
225
265
  }
226
266
 
267
+ Mixedbread.VectorStores = VectorStores;
268
+ Mixedbread.VectorStoresLimitOffset = VectorStoresLimitOffset;
227
269
  Mixedbread.Parsing = Parsing;
228
270
  Mixedbread.Files = Files;
229
271
  Mixedbread.FileObjectsLimitOffset = FileObjectsLimitOffset;
230
- Mixedbread.VectorStores = VectorStores;
231
- Mixedbread.VectorStoresLimitOffset = VectorStoresLimitOffset;
232
272
  Mixedbread.Extractions = Extractions;
273
+ Mixedbread.Embeddings = Embeddings;
233
274
  export declare namespace Mixedbread {
234
275
  export type RequestOptions = Core.RequestOptions;
235
276
 
236
277
  export import LimitOffset = Pagination.LimitOffset;
237
278
  export { type LimitOffsetParams as LimitOffsetParams, type LimitOffsetResponse as LimitOffsetResponse };
238
279
 
239
- export { type InfoResponse as InfoResponse };
240
-
241
- export { Parsing as Parsing };
242
-
243
280
  export {
244
- Files as Files,
245
- type FileObject as FileObject,
246
- type FileDeleteResponse as FileDeleteResponse,
247
- FileObjectsLimitOffset as FileObjectsLimitOffset,
248
- type FileCreateParams as FileCreateParams,
249
- type FileUpdateParams as FileUpdateParams,
250
- type FileListParams as FileListParams,
281
+ type Embedding as Embedding,
282
+ type EmbeddingCreateResponse as EmbeddingCreateResponse,
283
+ type MultiEncodingEmbedding as MultiEncodingEmbedding,
284
+ type InfoResponse as InfoResponse,
285
+ type RerankResponse as RerankResponse,
286
+ type EmbedParams as EmbedParams,
287
+ type RerankParams as RerankParams,
251
288
  };
252
289
 
253
290
  export {
@@ -256,7 +293,8 @@ export declare namespace Mixedbread {
256
293
  type FileCounts as FileCounts,
257
294
  type ScoredVectorStoreChunk as ScoredVectorStoreChunk,
258
295
  type VectorStore as VectorStore,
259
- type VectorStoreSearchOptions as VectorStoreSearchOptions,
296
+ type VectorStoreChunkSearchOptions as VectorStoreChunkSearchOptions,
297
+ type VectorStoreFileSearchOptions as VectorStoreFileSearchOptions,
260
298
  type VectorStoreDeleteResponse as VectorStoreDeleteResponse,
261
299
  type VectorStoreQuestionAnsweringResponse as VectorStoreQuestionAnsweringResponse,
262
300
  type VectorStoreSearchResponse as VectorStoreSearchResponse,
@@ -268,10 +306,25 @@ export declare namespace Mixedbread {
268
306
  type VectorStoreSearchParams as VectorStoreSearchParams,
269
307
  };
270
308
 
309
+ export { Parsing as Parsing };
310
+
311
+ export {
312
+ Files as Files,
313
+ type FileObject as FileObject,
314
+ type FileDeleteResponse as FileDeleteResponse,
315
+ FileObjectsLimitOffset as FileObjectsLimitOffset,
316
+ type FileCreateParams as FileCreateParams,
317
+ type FileUpdateParams as FileUpdateParams,
318
+ type FileListParams as FileListParams,
319
+ };
320
+
271
321
  export { Extractions as Extractions };
272
322
 
323
+ export { Embeddings as Embeddings, type EmbeddingCreateParams as EmbeddingCreateParams };
324
+
273
325
  export type SearchFilter = API.SearchFilter;
274
326
  export type SearchFilterCondition = API.SearchFilterCondition;
327
+ export type Usage = API.Usage;
275
328
  }
276
329
 
277
330
  export { toFile, fileFromPath } from './uploads';
@@ -0,0 +1,67 @@
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 TopLevelAPI from './top-level';
6
+
7
+ export class Embeddings extends APIResource {
8
+ /**
9
+ * Create embeddings for text or images using the specified model, encoding format,
10
+ * and normalization.
11
+ *
12
+ * Args: params: The parameters for creating embeddings.
13
+ *
14
+ * Returns: EmbeddingCreateResponse: The response containing the embeddings.
15
+ */
16
+ create(
17
+ body: EmbeddingCreateParams,
18
+ options?: Core.RequestOptions,
19
+ ): Core.APIPromise<TopLevelAPI.EmbeddingCreateResponse> {
20
+ return this._client.post('/v1/embeddings', { body, ...options });
21
+ }
22
+ }
23
+
24
+ export interface EmbeddingCreateParams {
25
+ /**
26
+ * The model to use for creating embeddings.
27
+ */
28
+ model: string;
29
+
30
+ /**
31
+ * The input to create embeddings for.
32
+ */
33
+ input: Array<string>;
34
+
35
+ /**
36
+ * The number of dimensions to use for the embeddings.
37
+ */
38
+ dimensions?: number | null;
39
+
40
+ /**
41
+ * The prompt to use for the embedding creation.
42
+ */
43
+ prompt?: string | null;
44
+
45
+ /**
46
+ * Whether to normalize the embeddings.
47
+ */
48
+ normalized?: boolean;
49
+
50
+ /**
51
+ * The encoding format(s) of the embeddings. Can be a single format or a list of
52
+ * formats.
53
+ */
54
+ encoding_format?:
55
+ | 'float'
56
+ | 'float16'
57
+ | 'base64'
58
+ | 'binary'
59
+ | 'ubinary'
60
+ | 'int8'
61
+ | 'uint8'
62
+ | Array<'float' | 'float16' | 'base64' | 'binary' | 'ubinary' | 'int8' | 'uint8'>;
63
+ }
64
+
65
+ export declare namespace Embeddings {
66
+ export { type EmbeddingCreateParams as EmbeddingCreateParams };
67
+ }
@@ -17,13 +17,12 @@ export class Content extends APIResource {
17
17
  }
18
18
 
19
19
  /**
20
- * Result of an extraction operation.
20
+ * The result of an extraction job.
21
21
  */
22
22
  export interface ExtractionResult {
23
- /**
24
- * The extracted data
25
- */
26
- data: unknown;
23
+ data: Record<string, unknown>;
24
+
25
+ warnings: Array<string>;
27
26
  }
28
27
 
29
28
  export interface ContentCreateParams {
@@ -35,7 +34,7 @@ export interface ContentCreateParams {
35
34
  /**
36
35
  * The JSON schema to use for extraction
37
36
  */
38
- json_schema: unknown;
37
+ json_schema: Record<string, unknown>;
39
38
  }
40
39
 
41
40
  export declare namespace Content {
@@ -33,9 +33,59 @@ export class Jobs extends APIResource {
33
33
  */
34
34
  export interface ExtractionJob {
35
35
  /**
36
- * Result of an extraction operation.
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.
37
77
  */
38
78
  result: ContentAPI.ExtractionResult | null;
79
+
80
+ /**
81
+ * Error information if failed
82
+ */
83
+ error: Record<string, unknown> | null;
84
+
85
+ /**
86
+ * The JSON schema used for extraction
87
+ */
88
+ json_schema: Record<string, unknown>;
39
89
  }
40
90
 
41
91
  export interface JobCreateParams {
@@ -47,7 +97,7 @@ export interface JobCreateParams {
47
97
  /**
48
98
  * The JSON schema to use for extraction
49
99
  */
50
- json_schema: unknown;
100
+ json_schema: Record<string, unknown>;
51
101
  }
52
102
 
53
103
  export declare namespace Jobs {
@@ -45,7 +45,7 @@ export interface CreatedJsonSchema {
45
45
  /**
46
46
  * The created JSON schema
47
47
  */
48
- json_schema: unknown;
48
+ json_schema: Record<string, unknown>;
49
49
  }
50
50
 
51
51
  /**
@@ -55,7 +55,7 @@ export interface EnhancedJsonSchema {
55
55
  /**
56
56
  * The enhanced JSON schema
57
57
  */
58
- json_schema: unknown;
58
+ json_schema: Record<string, unknown>;
59
59
  }
60
60
 
61
61
  /**
@@ -75,7 +75,7 @@ export interface ValidatedJsonSchema {
75
75
  /**
76
76
  * The validated JSON schema
77
77
  */
78
- json_schema: unknown;
78
+ json_schema: Record<string, unknown>;
79
79
  }
80
80
 
81
81
  export interface SchemaCreateParams {
@@ -89,14 +89,14 @@ export interface SchemaEnhanceParams {
89
89
  /**
90
90
  * The JSON schema to enhance
91
91
  */
92
- json_schema: unknown;
92
+ json_schema: Record<string, unknown>;
93
93
  }
94
94
 
95
95
  export interface SchemaValidateParams {
96
96
  /**
97
97
  * The JSON schema to validate
98
98
  */
99
- json_schema: unknown;
99
+ json_schema: Record<string, unknown>;
100
100
  }
101
101
 
102
102
  export declare namespace Schema {
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './extractions/index';
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  export * from './shared';
4
+ export { Embeddings, type EmbeddingCreateParams } from './embeddings';
4
5
  export { Extractions } from './extractions/extractions';
5
6
  export {
6
7
  FileObjectsLimitOffset,
@@ -19,7 +20,8 @@ export {
19
20
  type FileCounts,
20
21
  type ScoredVectorStoreChunk,
21
22
  type VectorStore,
22
- type VectorStoreSearchOptions,
23
+ type VectorStoreChunkSearchOptions,
24
+ type VectorStoreFileSearchOptions,
23
25
  type VectorStoreDeleteResponse,
24
26
  type VectorStoreQuestionAnsweringResponse,
25
27
  type VectorStoreSearchResponse,
@@ -29,4 +31,12 @@ export {
29
31
  type VectorStoreQuestionAnsweringParams,
30
32
  type VectorStoreSearchParams,
31
33
  } from './vector-stores/vector-stores';
32
- export { type InfoResponse } from './top-level';
34
+ export {
35
+ type Embedding,
36
+ type EmbeddingCreateResponse,
37
+ type MultiEncodingEmbedding,
38
+ type InfoResponse,
39
+ type RerankResponse,
40
+ type EmbedParams,
41
+ type RerankParams,
42
+ } from './top-level';
@@ -178,6 +178,11 @@ export interface ParsingJob {
178
178
  */
179
179
  id: string;
180
180
 
181
+ /**
182
+ * The ID of the file to parse
183
+ */
184
+ file_id: string;
185
+
181
186
  /**
182
187
  * The status of the job
183
188
  */
@@ -255,6 +260,11 @@ export namespace ParsingJob {
255
260
  * List of extracted chunks from the document
256
261
  */
257
262
  chunks: Array<Result.Chunk>;
263
+
264
+ /**
265
+ * List of (width, height) tuples for each page
266
+ */
267
+ page_sizes?: Array<Array<unknown>>;
258
268
  }
259
269
 
260
270
  export namespace Result {
@@ -337,6 +347,11 @@ export interface JobListResponse {
337
347
  */
338
348
  id: string;
339
349
 
350
+ /**
351
+ * The ID of the file to parse
352
+ */
353
+ file_id: string;
354
+
340
355
  /**
341
356
  * The status of the job
342
357
  */
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './parsing/index';