@mixedbread/sdk 0.5.0 → 0.7.2

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 (228) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +12 -24
  3. package/bin/migration-config.json +105 -2
  4. package/client.d.mts +12 -28
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +12 -28
  7. package/client.d.ts.map +1 -1
  8. package/client.js +6 -22
  9. package/client.js.map +1 -1
  10. package/client.mjs +6 -22
  11. package/client.mjs.map +1 -1
  12. package/core/pagination.d.mts +1 -1
  13. package/core/pagination.d.mts.map +1 -1
  14. package/core/pagination.d.ts +1 -1
  15. package/core/pagination.d.ts.map +1 -1
  16. package/core/resource.d.mts +1 -1
  17. package/core/resource.d.mts.map +1 -1
  18. package/core/resource.d.ts +1 -1
  19. package/core/resource.d.ts.map +1 -1
  20. package/core/resource.js.map +1 -1
  21. package/core/resource.mjs.map +1 -1
  22. package/internal/detect-platform.js +3 -3
  23. package/internal/detect-platform.js.map +1 -1
  24. package/internal/detect-platform.mjs +3 -3
  25. package/internal/detect-platform.mjs.map +1 -1
  26. package/internal/headers.d.mts.map +1 -1
  27. package/internal/headers.d.ts.map +1 -1
  28. package/internal/headers.js +5 -5
  29. package/internal/headers.js.map +1 -1
  30. package/internal/headers.mjs +5 -5
  31. package/internal/headers.mjs.map +1 -1
  32. package/internal/shim-types.d.mts +11 -22
  33. package/internal/shim-types.d.mts.map +1 -0
  34. package/internal/shim-types.d.ts +11 -22
  35. package/internal/shim-types.d.ts.map +1 -0
  36. package/internal/shim-types.js +4 -0
  37. package/internal/shim-types.js.map +1 -0
  38. package/internal/shim-types.mjs +3 -0
  39. package/internal/shim-types.mjs.map +1 -0
  40. package/internal/shims.d.mts +2 -2
  41. package/internal/shims.d.mts.map +1 -1
  42. package/internal/shims.d.ts +2 -2
  43. package/internal/shims.d.ts.map +1 -1
  44. package/internal/uploads.js +1 -1
  45. package/internal/uploads.js.map +1 -1
  46. package/internal/uploads.mjs +1 -1
  47. package/internal/uploads.mjs.map +1 -1
  48. package/internal/utils/log.js +1 -1
  49. package/internal/utils/log.js.map +1 -1
  50. package/internal/utils/log.mjs +1 -1
  51. package/internal/utils/log.mjs.map +1 -1
  52. package/internal/utils/path.d.mts.map +1 -1
  53. package/internal/utils/path.d.ts.map +1 -1
  54. package/internal/utils/path.js.map +1 -1
  55. package/internal/utils/path.mjs +1 -1
  56. package/internal/utils/path.mjs.map +1 -1
  57. package/internal/utils/values.d.mts +2 -0
  58. package/internal/utils/values.d.mts.map +1 -1
  59. package/internal/utils/values.d.ts +2 -0
  60. package/internal/utils/values.d.ts.map +1 -1
  61. package/internal/utils/values.js +4 -1
  62. package/internal/utils/values.js.map +1 -1
  63. package/internal/utils/values.mjs +2 -0
  64. package/internal/utils/values.mjs.map +1 -1
  65. package/package.json +1 -7
  66. package/resources/api-keys.d.mts +171 -0
  67. package/resources/api-keys.d.mts.map +1 -0
  68. package/resources/api-keys.d.ts +171 -0
  69. package/resources/api-keys.d.ts.map +1 -0
  70. package/resources/api-keys.js +76 -0
  71. package/resources/api-keys.js.map +1 -0
  72. package/resources/api-keys.mjs +72 -0
  73. package/resources/api-keys.mjs.map +1 -0
  74. package/resources/data-sources/connectors.d.mts +203 -0
  75. package/resources/data-sources/connectors.d.mts.map +1 -0
  76. package/resources/data-sources/connectors.d.ts +203 -0
  77. package/resources/data-sources/connectors.d.ts.map +1 -0
  78. package/resources/data-sources/connectors.js +73 -0
  79. package/resources/data-sources/connectors.js.map +1 -0
  80. package/resources/data-sources/connectors.mjs +69 -0
  81. package/resources/data-sources/connectors.mjs.map +1 -0
  82. package/resources/data-sources/data-sources.d.mts +287 -0
  83. package/resources/data-sources/data-sources.d.mts.map +1 -0
  84. package/resources/data-sources/data-sources.d.ts +287 -0
  85. package/resources/data-sources/data-sources.d.ts.map +1 -0
  86. package/resources/data-sources/data-sources.js +66 -0
  87. package/resources/data-sources/data-sources.js.map +1 -0
  88. package/resources/data-sources/data-sources.mjs +61 -0
  89. package/resources/data-sources/data-sources.mjs.map +1 -0
  90. package/resources/data-sources/index.d.mts +3 -0
  91. package/resources/data-sources/index.d.mts.map +1 -0
  92. package/resources/data-sources/index.d.ts +3 -0
  93. package/resources/data-sources/index.d.ts.map +1 -0
  94. package/resources/data-sources/index.js +9 -0
  95. package/resources/data-sources/index.js.map +1 -0
  96. package/resources/data-sources/index.mjs +4 -0
  97. package/resources/data-sources/index.mjs.map +1 -0
  98. package/resources/data-sources.d.mts +2 -0
  99. package/resources/data-sources.d.mts.map +1 -0
  100. package/resources/data-sources.d.ts +2 -0
  101. package/resources/data-sources.d.ts.map +1 -0
  102. package/resources/data-sources.js +6 -0
  103. package/resources/data-sources.js.map +1 -0
  104. package/resources/data-sources.mjs +3 -0
  105. package/resources/data-sources.mjs.map +1 -0
  106. package/resources/embeddings.d.mts +7 -11
  107. package/resources/embeddings.d.mts.map +1 -1
  108. package/resources/embeddings.d.ts +7 -11
  109. package/resources/embeddings.d.ts.map +1 -1
  110. package/resources/embeddings.js +0 -9
  111. package/resources/embeddings.js.map +1 -1
  112. package/resources/embeddings.mjs +0 -9
  113. package/resources/embeddings.mjs.map +1 -1
  114. package/resources/extractions/content.d.mts +44 -42
  115. package/resources/extractions/content.d.mts.map +1 -1
  116. package/resources/extractions/content.d.ts +44 -42
  117. package/resources/extractions/content.d.ts.map +1 -1
  118. package/resources/extractions/extractions.d.mts +2 -2
  119. package/resources/extractions/extractions.d.mts.map +1 -1
  120. package/resources/extractions/extractions.d.ts +2 -2
  121. package/resources/extractions/extractions.d.ts.map +1 -1
  122. package/resources/extractions/extractions.js.map +1 -1
  123. package/resources/extractions/extractions.mjs.map +1 -1
  124. package/resources/extractions/index.d.mts +1 -1
  125. package/resources/extractions/index.d.mts.map +1 -1
  126. package/resources/extractions/index.d.ts +1 -1
  127. package/resources/extractions/index.d.ts.map +1 -1
  128. package/resources/extractions/index.js.map +1 -1
  129. package/resources/extractions/index.mjs +1 -1
  130. package/resources/extractions/index.mjs.map +1 -1
  131. package/resources/extractions/jobs.d.mts +2 -1
  132. package/resources/extractions/jobs.d.mts.map +1 -1
  133. package/resources/extractions/jobs.d.ts +2 -1
  134. package/resources/extractions/jobs.d.ts.map +1 -1
  135. package/resources/extractions/jobs.js.map +1 -1
  136. package/resources/extractions/jobs.mjs.map +1 -1
  137. package/resources/files.d.mts +18 -1
  138. package/resources/files.d.mts.map +1 -1
  139. package/resources/files.d.ts +18 -1
  140. package/resources/files.d.ts.map +1 -1
  141. package/resources/index.d.mts +5 -3
  142. package/resources/index.d.mts.map +1 -1
  143. package/resources/index.d.ts +5 -3
  144. package/resources/index.d.ts.map +1 -1
  145. package/resources/index.js +5 -1
  146. package/resources/index.js.map +1 -1
  147. package/resources/index.mjs +2 -0
  148. package/resources/index.mjs.map +1 -1
  149. package/resources/parsing/index.d.mts +1 -1
  150. package/resources/parsing/index.d.mts.map +1 -1
  151. package/resources/parsing/index.d.ts +1 -1
  152. package/resources/parsing/index.d.ts.map +1 -1
  153. package/resources/parsing/index.js.map +1 -1
  154. package/resources/parsing/index.mjs.map +1 -1
  155. package/resources/parsing/jobs.d.mts +24 -10
  156. package/resources/parsing/jobs.d.mts.map +1 -1
  157. package/resources/parsing/jobs.d.ts +24 -10
  158. package/resources/parsing/jobs.d.ts.map +1 -1
  159. package/resources/parsing/jobs.js.map +1 -1
  160. package/resources/parsing/jobs.mjs.map +1 -1
  161. package/resources/parsing/parsing.d.mts +2 -2
  162. package/resources/parsing/parsing.d.mts.map +1 -1
  163. package/resources/parsing/parsing.d.ts +2 -2
  164. package/resources/parsing/parsing.d.ts.map +1 -1
  165. package/resources/parsing/parsing.js.map +1 -1
  166. package/resources/parsing/parsing.mjs.map +1 -1
  167. package/resources/top-level.d.mts +5 -4
  168. package/resources/top-level.d.mts.map +1 -1
  169. package/resources/top-level.d.ts +5 -4
  170. package/resources/top-level.d.ts.map +1 -1
  171. package/resources/vector-stores/files.d.mts +79 -19
  172. package/resources/vector-stores/files.d.mts.map +1 -1
  173. package/resources/vector-stores/files.d.ts +79 -19
  174. package/resources/vector-stores/files.d.ts.map +1 -1
  175. package/resources/vector-stores/files.js +19 -18
  176. package/resources/vector-stores/files.js.map +1 -1
  177. package/resources/vector-stores/files.mjs +19 -18
  178. package/resources/vector-stores/files.mjs.map +1 -1
  179. package/resources/vector-stores/index.d.mts +1 -1
  180. package/resources/vector-stores/index.d.mts.map +1 -1
  181. package/resources/vector-stores/index.d.ts +1 -1
  182. package/resources/vector-stores/index.d.ts.map +1 -1
  183. package/resources/vector-stores/index.js.map +1 -1
  184. package/resources/vector-stores/index.mjs.map +1 -1
  185. package/resources/vector-stores/vector-stores.d.mts +275 -90
  186. package/resources/vector-stores/vector-stores.d.mts.map +1 -1
  187. package/resources/vector-stores/vector-stores.d.ts +275 -90
  188. package/resources/vector-stores/vector-stores.d.ts.map +1 -1
  189. package/resources/vector-stores/vector-stores.js +18 -15
  190. package/resources/vector-stores/vector-stores.js.map +1 -1
  191. package/resources/vector-stores/vector-stores.mjs +18 -15
  192. package/resources/vector-stores/vector-stores.mjs.map +1 -1
  193. package/src/client.ts +63 -30
  194. package/src/core/pagination.ts +1 -1
  195. package/src/core/resource.ts +1 -1
  196. package/src/internal/detect-platform.ts +3 -3
  197. package/src/internal/headers.ts +6 -6
  198. package/src/internal/shim-types.ts +26 -0
  199. package/src/internal/shims.ts +2 -2
  200. package/src/internal/uploads.ts +2 -2
  201. package/src/internal/utils/log.ts +1 -1
  202. package/src/internal/utils/path.ts +1 -1
  203. package/src/internal/utils/values.ts +3 -0
  204. package/src/resources/api-keys.ts +225 -0
  205. package/src/resources/data-sources/connectors.ts +290 -0
  206. package/src/resources/data-sources/data-sources.ts +404 -0
  207. package/src/resources/data-sources/index.ts +24 -0
  208. package/src/resources/data-sources.ts +3 -0
  209. package/src/resources/embeddings.ts +25 -19
  210. package/src/resources/extractions/content.ts +51 -43
  211. package/src/resources/extractions/extractions.ts +3 -1
  212. package/src/resources/extractions/index.ts +7 -1
  213. package/src/resources/extractions/jobs.ts +2 -1
  214. package/src/resources/files.ts +21 -0
  215. package/src/resources/index.ts +26 -4
  216. package/src/resources/parsing/index.ts +4 -0
  217. package/src/resources/parsing/jobs.ts +42 -44
  218. package/src/resources/parsing/parsing.ts +8 -0
  219. package/src/resources/top-level.ts +5 -44
  220. package/src/resources/vector-stores/files.ts +104 -28
  221. package/src/resources/vector-stores/index.ts +4 -3
  222. package/src/resources/vector-stores/vector-stores.ts +330 -102
  223. package/src/version.ts +1 -1
  224. package/version.d.mts +1 -1
  225. package/version.d.ts +1 -1
  226. package/version.js +1 -1
  227. package/version.mjs +1 -1
  228. package/src/internal/shim-types.d.ts +0 -28
@@ -6,31 +6,32 @@ import * as VectorStoresAPI from './vector-stores';
6
6
  import { APIPromise } from '../../core/api-promise';
7
7
  import { LimitOffset, type LimitOffsetParams, PagePromise } from '../../core/pagination';
8
8
  import { RequestOptions } from '../../internal/request-options';
9
- import { path } from '../../internal/utils/path';
10
9
  import * as polling from '../../lib/polling';
11
10
  import { Uploadable } from '../../uploads';
11
+ import { path } from '../../internal/utils/path';
12
12
 
13
13
  export class Files extends APIResource {
14
14
  /**
15
15
  * Upload a new file to a vector store for indexing.
16
16
  *
17
- * Args: vector_store_id: The ID of the vector store to upload to file: The file to
18
- * upload and index
17
+ * Args: vector_store_identifier: The ID or name of the vector store to upload to
18
+ * file: The file to upload and index
19
19
  *
20
20
  * Returns: VectorStoreFile: Details of the uploaded and indexed file
21
21
  */
22
22
  create(
23
- vectorStoreID: string,
23
+ vectorStoreIdentifier: string,
24
24
  body: FileCreateParams,
25
25
  options?: RequestOptions,
26
26
  ): APIPromise<VectorStoreFile> {
27
- return this._client.post(path`/v1/vector_stores/${vectorStoreID}/files`, { body, ...options });
27
+ return this._client.post(path`/v1/vector_stores/${vectorStoreIdentifier}/files`, { body, ...options });
28
28
  }
29
29
 
30
30
  /**
31
31
  * Get details of a specific file in a vector store.
32
32
  *
33
- * Args: vector_store_id: The ID of the vector store file_id: The ID of the file
33
+ * Args: vector_store_identifier: The ID or name of the vector store file_id: The
34
+ * ID of the file
34
35
  *
35
36
  * Returns: VectorStoreFile: Details of the vector store file
36
37
  */
@@ -39,25 +40,25 @@ export class Files extends APIResource {
39
40
  params: FileRetrieveParams,
40
41
  options?: RequestOptions,
41
42
  ): APIPromise<VectorStoreFile> {
42
- const { vector_store_id } = params;
43
- return this._client.get(path`/v1/vector_stores/${vector_store_id}/files/${fileID}`, options);
43
+ const { vector_store_identifier } = params;
44
+ return this._client.get(path`/v1/vector_stores/${vector_store_identifier}/files/${fileID}`, options);
44
45
  }
45
46
 
46
47
  /**
47
48
  * List files indexed in a vector store with pagination.
48
49
  *
49
- * Args: vector_store_id: The ID of the vector store pagination: Pagination
50
- * parameters
50
+ * Args: vector_store_identifier: The ID or name of the vector store pagination:
51
+ * Pagination parameters
51
52
  *
52
53
  * Returns: VectorStoreFileListResponse: Paginated list of vector store files
53
54
  */
54
55
  list(
55
- vectorStoreID: string,
56
+ vectorStoreIdentifier: string,
56
57
  query: FileListParams | null | undefined = {},
57
58
  options?: RequestOptions,
58
59
  ): PagePromise<VectorStoreFilesLimitOffset, VectorStoreFile> {
59
60
  return this._client.getAPIList(
60
- path`/v1/vector_stores/${vectorStoreID}/files`,
61
+ path`/v1/vector_stores/${vectorStoreIdentifier}/files`,
61
62
  LimitOffset<VectorStoreFile>,
62
63
  { query, ...options },
63
64
  );
@@ -66,14 +67,14 @@ export class Files extends APIResource {
66
67
  /**
67
68
  * Delete a file from a vector store.
68
69
  *
69
- * Args: vector_store_id: The ID of the vector store file_id: The ID of the file to
70
- * delete
70
+ * Args: vector_store_identifier: The ID or name of the vector store file_id: The
71
+ * ID of the file to delete
71
72
  *
72
73
  * Returns: VectorStoreFileDeleted: The deleted file
73
74
  */
74
75
  delete(fileID: string, params: FileDeleteParams, options?: RequestOptions): APIPromise<FileDeleteResponse> {
75
- const { vector_store_id } = params;
76
- return this._client.delete(path`/v1/vector_stores/${vector_store_id}/files/${fileID}`, options);
76
+ const { vector_store_identifier } = params;
77
+ return this._client.delete(path`/v1/vector_stores/${vector_store_identifier}/files/${fileID}`, options);
77
78
  }
78
79
 
79
80
  /**
@@ -119,9 +120,9 @@ export class Files extends APIResource {
119
120
  const pollingTimeoutMs = pollTimeoutMs;
120
121
 
121
122
  return polling.poll({
122
- fn: () => this.retrieve(fileId, { vector_store_id: vectorStoreId, ...options }),
123
+ fn: () => this.retrieve(fileId, { vector_store_identifier: vectorStoreId, ...options }),
123
124
  condition: (result) =>
124
- result.status === 'completed' || result.status === 'failed' || result.status === 'error',
125
+ result.status === 'completed' || result.status === 'failed' || result.status === 'cancelled',
125
126
  intervalSeconds: pollingIntervalMs / 1000,
126
127
  ...(pollingTimeoutMs && { timeoutSeconds: pollingTimeoutMs / 1000 }),
127
128
  });
@@ -224,7 +225,7 @@ export interface ScoredVectorStoreFile {
224
225
  /**
225
226
  * Processing status of the file
226
227
  */
227
- status?: string;
228
+ status?: 'pending' | 'in_progress' | 'cancelled' | 'completed' | 'failed';
228
229
 
229
230
  /**
230
231
  * Last error message if processing failed
@@ -264,7 +265,12 @@ export interface ScoredVectorStoreFile {
264
265
  /**
265
266
  * chunks
266
267
  */
267
- chunks: Array<VectorStoresAPI.ScoredVectorStoreChunk> | null;
268
+ chunks: Array<
269
+ | VectorStoresAPI.ScoredTextInputChunk
270
+ | VectorStoresAPI.ScoredImageURLInputChunk
271
+ | VectorStoresAPI.ScoredAudioURLInputChunk
272
+ | VectorStoresAPI.ScoredVideoURLInputChunk
273
+ > | null;
268
274
  }
269
275
 
270
276
  /**
@@ -289,7 +295,7 @@ export interface VectorStoreFile {
289
295
  /**
290
296
  * Processing status of the file
291
297
  */
292
- status?: string;
298
+ status?: 'pending' | 'in_progress' | 'cancelled' | 'completed' | 'failed';
293
299
 
294
300
  /**
295
301
  * Last error message if processing failed
@@ -390,18 +396,18 @@ export namespace FileCreateParams {
390
396
 
391
397
  export interface FileRetrieveParams {
392
398
  /**
393
- * The ID of the vector store
399
+ * The ID or name of the vector store
394
400
  */
395
- vector_store_id: string;
401
+ vector_store_identifier: string;
396
402
  }
397
403
 
398
404
  export interface FileListParams extends LimitOffsetParams {}
399
405
 
400
406
  export interface FileDeleteParams {
401
407
  /**
402
- * The ID of the vector store
408
+ * The ID or name of the vector store
403
409
  */
404
- vector_store_id: string;
410
+ vector_store_identifier: string;
405
411
  }
406
412
 
407
413
  export interface FileSearchParams {
@@ -411,9 +417,14 @@ export interface FileSearchParams {
411
417
  query: string;
412
418
 
413
419
  /**
414
- * IDs of vector stores to search
420
+ * IDs or names of vector stores to search
421
+ */
422
+ vector_store_identifiers?: Array<string> | null;
423
+
424
+ /**
425
+ * @deprecated
415
426
  */
416
- vector_store_ids: Array<string>;
427
+ vector_store_ids?: Array<string> | null;
417
428
 
418
429
  /**
419
430
  * Number of results to return
@@ -429,10 +440,75 @@ export interface FileSearchParams {
429
440
  | Array<Shared.SearchFilter | Shared.SearchFilterCondition>
430
441
  | null;
431
442
 
443
+ /**
444
+ * Optional list of file IDs to filter chunks by (inclusion filter)
445
+ */
446
+ file_ids?: Array<unknown> | Array<string> | null;
447
+
432
448
  /**
433
449
  * Search configuration options
434
450
  */
435
- search_options?: VectorStoresAPI.VectorStoreFileSearchOptions;
451
+ search_options?: FileSearchParams.SearchOptions;
452
+ }
453
+
454
+ export namespace FileSearchParams {
455
+ /**
456
+ * Search configuration options
457
+ */
458
+ export interface SearchOptions {
459
+ /**
460
+ * Minimum similarity score threshold
461
+ */
462
+ score_threshold?: number;
463
+
464
+ /**
465
+ * Whether to rewrite the query
466
+ */
467
+ rewrite_query?: boolean;
468
+
469
+ /**
470
+ * Whether to rerank results and optional reranking configuration
471
+ */
472
+ rerank?: boolean | SearchOptions.RerankConfig | null;
473
+
474
+ /**
475
+ * Whether to return file metadata
476
+ */
477
+ return_metadata?: boolean;
478
+
479
+ /**
480
+ * Whether to return matching text chunks
481
+ */
482
+ return_chunks?: boolean;
483
+
484
+ /**
485
+ * Number of chunks to return for each file
486
+ */
487
+ chunks_per_file?: number;
488
+ }
489
+
490
+ export namespace SearchOptions {
491
+ /**
492
+ * Represents a reranking configuration.
493
+ */
494
+ export interface RerankConfig {
495
+ /**
496
+ * The name of the reranking model
497
+ */
498
+ model?: string;
499
+
500
+ /**
501
+ * Whether to include metadata in the reranked results
502
+ */
503
+ with_metadata?: boolean | Array<string>;
504
+
505
+ /**
506
+ * Maximum number of results to return after reranking. If None, returns all
507
+ * reranked results.
508
+ */
509
+ top_k?: number | null;
510
+ }
511
+ }
436
512
  }
437
513
 
438
514
  export declare namespace Files {
@@ -16,11 +16,12 @@ export {
16
16
  export {
17
17
  VectorStores,
18
18
  type ExpiresAfter,
19
- type FileCounts,
20
- type ScoredVectorStoreChunk,
19
+ type ScoredAudioURLInputChunk,
20
+ type ScoredImageURLInputChunk,
21
+ type ScoredTextInputChunk,
22
+ type ScoredVideoURLInputChunk,
21
23
  type VectorStore,
22
24
  type VectorStoreChunkSearchOptions,
23
- type VectorStoreFileSearchOptions,
24
25
  type VectorStoreDeleteResponse,
25
26
  type VectorStoreQuestionAnsweringResponse,
26
27
  type VectorStoreSearchResponse,