@mixedbread/sdk 0.29.0 → 0.31.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 (87) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +18 -18
  3. package/bin/cli +4 -10
  4. package/bin/migration-config.json +70 -0
  5. package/client.d.mts +3 -0
  6. package/client.d.mts.map +1 -1
  7. package/client.d.ts +3 -0
  8. package/client.d.ts.map +1 -1
  9. package/client.js +3 -0
  10. package/client.js.map +1 -1
  11. package/client.mjs +3 -0
  12. package/client.mjs.map +1 -1
  13. package/package.json +1 -1
  14. package/resources/data-sources/connectors.d.mts +4 -4
  15. package/resources/data-sources/connectors.d.mts.map +1 -1
  16. package/resources/data-sources/connectors.d.ts +4 -4
  17. package/resources/data-sources/connectors.d.ts.map +1 -1
  18. package/resources/index.d.mts +1 -0
  19. package/resources/index.d.mts.map +1 -1
  20. package/resources/index.d.ts +1 -0
  21. package/resources/index.d.ts.map +1 -1
  22. package/resources/index.js +3 -1
  23. package/resources/index.js.map +1 -1
  24. package/resources/index.mjs +1 -0
  25. package/resources/index.mjs.map +1 -1
  26. package/resources/stores/files.d.mts +547 -0
  27. package/resources/stores/files.d.mts.map +1 -0
  28. package/resources/stores/files.d.ts +547 -0
  29. package/resources/stores/files.d.ts.map +1 -0
  30. package/resources/stores/files.js +68 -0
  31. package/resources/stores/files.js.map +1 -0
  32. package/resources/stores/files.mjs +64 -0
  33. package/resources/stores/files.mjs.map +1 -0
  34. package/resources/stores/index.d.mts +3 -0
  35. package/resources/stores/index.d.mts.map +1 -0
  36. package/resources/stores/index.d.ts +3 -0
  37. package/resources/stores/index.d.ts.map +1 -0
  38. package/resources/stores/index.js +9 -0
  39. package/resources/stores/index.js.map +1 -0
  40. package/resources/stores/index.mjs +4 -0
  41. package/resources/stores/index.mjs.map +1 -0
  42. package/resources/stores/stores.d.mts +372 -0
  43. package/resources/stores/stores.d.mts.map +1 -0
  44. package/resources/stores/stores.d.ts +372 -0
  45. package/resources/stores/stores.d.ts.map +1 -0
  46. package/resources/stores/stores.js +100 -0
  47. package/resources/stores/stores.js.map +1 -0
  48. package/resources/stores/stores.mjs +95 -0
  49. package/resources/stores/stores.mjs.map +1 -0
  50. package/resources/stores.d.mts +2 -0
  51. package/resources/stores.d.mts.map +1 -0
  52. package/resources/stores.d.ts +2 -0
  53. package/resources/stores.d.ts.map +1 -0
  54. package/resources/stores.js +6 -0
  55. package/resources/stores.js.map +1 -0
  56. package/resources/stores.mjs +3 -0
  57. package/resources/stores.mjs.map +1 -0
  58. package/resources/vector-stores/files.d.mts +316 -266
  59. package/resources/vector-stores/files.d.mts.map +1 -1
  60. package/resources/vector-stores/files.d.ts +316 -266
  61. package/resources/vector-stores/files.d.ts.map +1 -1
  62. package/resources/vector-stores/files.js +10 -35
  63. package/resources/vector-stores/files.js.map +1 -1
  64. package/resources/vector-stores/files.mjs +10 -35
  65. package/resources/vector-stores/files.mjs.map +1 -1
  66. package/resources/vector-stores/vector-stores.d.mts +593 -275
  67. package/resources/vector-stores/vector-stores.d.mts.map +1 -1
  68. package/resources/vector-stores/vector-stores.d.ts +593 -275
  69. package/resources/vector-stores/vector-stores.d.ts.map +1 -1
  70. package/resources/vector-stores/vector-stores.js +15 -41
  71. package/resources/vector-stores/vector-stores.js.map +1 -1
  72. package/resources/vector-stores/vector-stores.mjs +15 -41
  73. package/resources/vector-stores/vector-stores.mjs.map +1 -1
  74. package/src/client.ts +31 -0
  75. package/src/resources/data-sources/connectors.ts +4 -4
  76. package/src/resources/index.ts +14 -0
  77. package/src/resources/stores/files.ts +692 -0
  78. package/src/resources/stores/index.ts +30 -0
  79. package/src/resources/stores/stores.ts +523 -0
  80. package/src/resources/stores.ts +3 -0
  81. package/src/resources/vector-stores/files.ts +359 -441
  82. package/src/resources/vector-stores/vector-stores.ts +693 -453
  83. package/src/version.ts +1 -1
  84. package/version.d.mts +1 -1
  85. package/version.d.ts +1 -1
  86. package/version.js +1 -1
  87. package/version.mjs +1 -1
@@ -0,0 +1,523 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as Shared from '../shared';
5
+ import * as FilesAPI from './files';
6
+ import {
7
+ FileCreateParams,
8
+ FileDeleteParams,
9
+ FileDeleteResponse,
10
+ FileListParams,
11
+ FileListResponse,
12
+ FileRetrieveParams,
13
+ FileSearchParams,
14
+ FileSearchResponse,
15
+ Files,
16
+ ScoredStoreFile,
17
+ StoreFile,
18
+ StoreFileStatus,
19
+ } from './files';
20
+ import * as VectorStoresFilesAPI from '../vector-stores/files';
21
+ import * as VectorStoresAPI from '../vector-stores/vector-stores';
22
+ import { APIPromise } from '../../core/api-promise';
23
+ import { Cursor, type CursorParams, PagePromise } from '../../core/pagination';
24
+ import { RequestOptions } from '../../internal/request-options';
25
+ import { path } from '../../internal/utils/path';
26
+
27
+ export class Stores extends APIResource {
28
+ files: FilesAPI.Files = new FilesAPI.Files(this._client);
29
+
30
+ /**
31
+ * Create a new vector store.
32
+ *
33
+ * Args: vector_store_create: VectorStoreCreate object containing the name,
34
+ * description, and metadata.
35
+ *
36
+ * Returns: VectorStore: The response containing the created vector store details.
37
+ */
38
+ create(body: StoreCreateParams, options?: RequestOptions): APIPromise<Store> {
39
+ return this._client.post('/v1/stores', { body, ...options });
40
+ }
41
+
42
+ /**
43
+ * Get a store by ID or name.
44
+ *
45
+ * Args: store_identifier: The ID or name of the store to retrieve.
46
+ *
47
+ * Returns: Store: The response containing the store details.
48
+ */
49
+ retrieve(storeIdentifier: string, options?: RequestOptions): APIPromise<Store> {
50
+ return this._client.get(path`/v1/stores/${storeIdentifier}`, options);
51
+ }
52
+
53
+ /**
54
+ * Update a store by ID or name.
55
+ *
56
+ * Args: store_identifier: The ID or name of the store to update. store_update:
57
+ * StoreCreate object containing the name, description, and metadata.
58
+ *
59
+ * Returns: Store: The response containing the updated store details.
60
+ */
61
+ update(storeIdentifier: string, body: StoreUpdateParams, options?: RequestOptions): APIPromise<Store> {
62
+ return this._client.put(path`/v1/stores/${storeIdentifier}`, { body, ...options });
63
+ }
64
+
65
+ /**
66
+ * List all stores with optional search.
67
+ *
68
+ * Args: pagination: The pagination options. q: Optional search query to filter
69
+ * vector stores.
70
+ *
71
+ * Returns: StoreListResponse: The list of stores.
72
+ */
73
+ list(
74
+ query: StoreListParams | null | undefined = {},
75
+ options?: RequestOptions,
76
+ ): PagePromise<StoresCursor, Store> {
77
+ return this._client.getAPIList('/v1/stores', Cursor<Store>, { query, ...options });
78
+ }
79
+
80
+ /**
81
+ * Delete a store by ID or name.
82
+ *
83
+ * Args: store_identifier: The ID or name of the store to delete.
84
+ *
85
+ * Returns: Store: The response containing the deleted store details.
86
+ */
87
+ delete(storeIdentifier: string, options?: RequestOptions): APIPromise<StoreDeleteResponse> {
88
+ return this._client.delete(path`/v1/stores/${storeIdentifier}`, options);
89
+ }
90
+
91
+ /**
92
+ * Question answering
93
+ */
94
+ questionAnswering(
95
+ body: StoreQuestionAnsweringParams,
96
+ options?: RequestOptions,
97
+ ): APIPromise<StoreQuestionAnsweringResponse> {
98
+ return this._client.post('/v1/stores/question-answering', { body, ...options });
99
+ }
100
+
101
+ /**
102
+ * Perform semantic search across store chunks.
103
+ *
104
+ * This endpoint searches through store chunks using semantic similarity matching.
105
+ * It supports complex search queries with filters and returns relevance-scored
106
+ * results.
107
+ *
108
+ * Args: search_params: Search configuration including: - query text or
109
+ * embeddings - store_identifiers: List of store identifiers to search - file_ids:
110
+ * Optional list of file IDs to filter chunks by (or tuple of list and condition
111
+ * operator) - metadata filters - pagination parameters - sorting preferences
112
+ * \_state: API state dependency \_ctx: Service context dependency
113
+ *
114
+ * Returns: StoreSearchResponse containing: - List of matched chunks with relevance
115
+ * scores - Pagination details including total result count
116
+ *
117
+ * Raises: HTTPException (400): If search parameters are invalid HTTPException
118
+ * (404): If no vector stores are found to search
119
+ */
120
+ search(body: StoreSearchParams, options?: RequestOptions): APIPromise<StoreSearchResponse> {
121
+ return this._client.post('/v1/stores/search', { body, ...options });
122
+ }
123
+ }
124
+
125
+ export type StoresCursor = Cursor<Store>;
126
+
127
+ /**
128
+ * Model representing a store with its metadata and timestamps.
129
+ */
130
+ export interface Store {
131
+ /**
132
+ * Unique identifier for the store
133
+ */
134
+ id: string;
135
+
136
+ /**
137
+ * Name of the store
138
+ */
139
+ name: string;
140
+
141
+ /**
142
+ * Detailed description of the store's purpose and contents
143
+ */
144
+ description?: string | null;
145
+
146
+ /**
147
+ * Whether the store can be accessed by anyone with valid login credentials
148
+ */
149
+ is_public?: boolean;
150
+
151
+ /**
152
+ * Additional metadata associated with the store
153
+ */
154
+ metadata?: unknown;
155
+
156
+ /**
157
+ * Counts of files in different states
158
+ */
159
+ file_counts?: Store.FileCounts;
160
+
161
+ /**
162
+ * Represents an expiration policy for a store.
163
+ */
164
+ expires_after?: VectorStoresAPI.ExpiresAfter | null;
165
+
166
+ /**
167
+ * Processing status of the store
168
+ */
169
+ status?: 'expired' | 'in_progress' | 'completed';
170
+
171
+ /**
172
+ * Timestamp when the store was created
173
+ */
174
+ created_at: string;
175
+
176
+ /**
177
+ * Timestamp when the store was last updated
178
+ */
179
+ updated_at: string;
180
+
181
+ /**
182
+ * Timestamp when the store was last used
183
+ */
184
+ last_active_at?: string | null;
185
+
186
+ /**
187
+ * Total storage usage in bytes
188
+ */
189
+ usage_bytes?: number;
190
+
191
+ /**
192
+ * Optional expiration timestamp for the store
193
+ */
194
+ expires_at?: string | null;
195
+
196
+ /**
197
+ * Type of the object
198
+ */
199
+ object?: 'store';
200
+ }
201
+
202
+ export namespace Store {
203
+ /**
204
+ * Counts of files in different states
205
+ */
206
+ export interface FileCounts {
207
+ /**
208
+ * Number of files waiting to be processed
209
+ */
210
+ pending?: number;
211
+
212
+ /**
213
+ * Number of files currently being processed
214
+ */
215
+ in_progress?: number;
216
+
217
+ /**
218
+ * Number of files whose processing was cancelled
219
+ */
220
+ cancelled?: number;
221
+
222
+ /**
223
+ * Number of successfully processed files
224
+ */
225
+ completed?: number;
226
+
227
+ /**
228
+ * Number of files that failed processing
229
+ */
230
+ failed?: number;
231
+
232
+ /**
233
+ * Total number of files
234
+ */
235
+ total?: number;
236
+ }
237
+ }
238
+
239
+ /**
240
+ * Options for configuring store chunk searches.
241
+ */
242
+ export interface StoreChunkSearchOptions {
243
+ /**
244
+ * Minimum similarity score threshold
245
+ */
246
+ score_threshold?: number;
247
+
248
+ /**
249
+ * Whether to rewrite the query
250
+ */
251
+ rewrite_query?: boolean;
252
+
253
+ /**
254
+ * Whether to rerank results and optional reranking configuration
255
+ */
256
+ rerank?: boolean | VectorStoresFilesAPI.RerankConfig | null;
257
+
258
+ /**
259
+ * Whether to return file metadata
260
+ */
261
+ return_metadata?: boolean;
262
+
263
+ /**
264
+ * Whether to apply search rules
265
+ */
266
+ apply_search_rules?: boolean;
267
+ }
268
+
269
+ /**
270
+ * Response model for store deletion.
271
+ */
272
+ export interface StoreDeleteResponse {
273
+ /**
274
+ * ID of the deleted store
275
+ */
276
+ id: string;
277
+
278
+ /**
279
+ * Whether the deletion was successful
280
+ */
281
+ deleted: boolean;
282
+
283
+ /**
284
+ * Type of the deleted object
285
+ */
286
+ object?: 'store';
287
+ }
288
+
289
+ /**
290
+ * Results from a question answering operation.
291
+ */
292
+ export interface StoreQuestionAnsweringResponse {
293
+ /**
294
+ * The answer generated by the LLM
295
+ */
296
+ answer: string;
297
+
298
+ /**
299
+ * Source documents used to generate the answer
300
+ */
301
+ sources?: Array<
302
+ | VectorStoresAPI.ScoredTextInputChunk
303
+ | VectorStoresAPI.ScoredImageURLInputChunk
304
+ | VectorStoresAPI.ScoredAudioURLInputChunk
305
+ | VectorStoresAPI.ScoredVideoURLInputChunk
306
+ >;
307
+ }
308
+
309
+ export interface StoreSearchResponse {
310
+ /**
311
+ * The object type of the response
312
+ */
313
+ object?: 'list';
314
+
315
+ /**
316
+ * The list of scored store file chunks
317
+ */
318
+ data: Array<
319
+ | VectorStoresAPI.ScoredTextInputChunk
320
+ | VectorStoresAPI.ScoredImageURLInputChunk
321
+ | VectorStoresAPI.ScoredAudioURLInputChunk
322
+ | VectorStoresAPI.ScoredVideoURLInputChunk
323
+ >;
324
+ }
325
+
326
+ export interface StoreCreateParams {
327
+ /**
328
+ * Name for the new store
329
+ */
330
+ name?: string | null;
331
+
332
+ /**
333
+ * Description of the store
334
+ */
335
+ description?: string | null;
336
+
337
+ /**
338
+ * Whether the store can be accessed by anyone with valid login credentials
339
+ */
340
+ is_public?: boolean;
341
+
342
+ /**
343
+ * Represents an expiration policy for a store.
344
+ */
345
+ expires_after?: VectorStoresAPI.ExpiresAfter | null;
346
+
347
+ /**
348
+ * Optional metadata key-value pairs
349
+ */
350
+ metadata?: unknown;
351
+
352
+ /**
353
+ * Optional list of file IDs
354
+ */
355
+ file_ids?: Array<string> | null;
356
+ }
357
+
358
+ export interface StoreUpdateParams {
359
+ /**
360
+ * New name for the store
361
+ */
362
+ name?: string | null;
363
+
364
+ /**
365
+ * New description
366
+ */
367
+ description?: string | null;
368
+
369
+ /**
370
+ * Whether the store can be accessed by anyone with valid login credentials
371
+ */
372
+ is_public?: boolean | null;
373
+
374
+ /**
375
+ * Represents an expiration policy for a store.
376
+ */
377
+ expires_after?: VectorStoresAPI.ExpiresAfter | null;
378
+
379
+ /**
380
+ * Optional metadata key-value pairs
381
+ */
382
+ metadata?: unknown;
383
+ }
384
+
385
+ export interface StoreListParams extends CursorParams {
386
+ /**
387
+ * Search query for fuzzy matching over name and description fields
388
+ */
389
+ q?: string | null;
390
+ }
391
+
392
+ export interface StoreQuestionAnsweringParams {
393
+ /**
394
+ * Question to answer. If not provided, the question will be extracted from the
395
+ * passed messages.
396
+ */
397
+ query?: string;
398
+
399
+ /**
400
+ * IDs or names of stores to search
401
+ */
402
+ store_identifiers: Array<string>;
403
+
404
+ /**
405
+ * Number of results to return
406
+ */
407
+ top_k?: number;
408
+
409
+ /**
410
+ * Optional filter conditions
411
+ */
412
+ filters?:
413
+ | Shared.SearchFilter
414
+ | Shared.SearchFilterCondition
415
+ | Array<Shared.SearchFilter | Shared.SearchFilterCondition>
416
+ | null;
417
+
418
+ /**
419
+ * Optional list of file IDs to filter chunks by (inclusion filter)
420
+ */
421
+ file_ids?: Array<unknown> | Array<string> | null;
422
+
423
+ /**
424
+ * Search configuration options
425
+ */
426
+ search_options?: StoreChunkSearchOptions;
427
+
428
+ /**
429
+ * Whether to stream the answer
430
+ */
431
+ stream?: boolean;
432
+
433
+ /**
434
+ * Question answering configuration options
435
+ */
436
+ qa_options?: StoreQuestionAnsweringParams.QaOptions;
437
+ }
438
+
439
+ export namespace StoreQuestionAnsweringParams {
440
+ /**
441
+ * Question answering configuration options
442
+ */
443
+ export interface QaOptions {
444
+ /**
445
+ * Whether to use citations
446
+ */
447
+ cite?: boolean;
448
+
449
+ /**
450
+ * Whether to use multimodal context
451
+ */
452
+ multimodal?: boolean;
453
+ }
454
+ }
455
+
456
+ export interface StoreSearchParams {
457
+ /**
458
+ * Search query text
459
+ */
460
+ query: string;
461
+
462
+ /**
463
+ * IDs or names of stores to search
464
+ */
465
+ store_identifiers: Array<string>;
466
+
467
+ /**
468
+ * Number of results to return
469
+ */
470
+ top_k?: number;
471
+
472
+ /**
473
+ * Optional filter conditions
474
+ */
475
+ filters?:
476
+ | Shared.SearchFilter
477
+ | Shared.SearchFilterCondition
478
+ | Array<Shared.SearchFilter | Shared.SearchFilterCondition>
479
+ | null;
480
+
481
+ /**
482
+ * Optional list of file IDs to filter chunks by (inclusion filter)
483
+ */
484
+ file_ids?: Array<unknown> | Array<string> | null;
485
+
486
+ /**
487
+ * Search configuration options
488
+ */
489
+ search_options?: StoreChunkSearchOptions;
490
+ }
491
+
492
+ Stores.Files = Files;
493
+
494
+ export declare namespace Stores {
495
+ export {
496
+ type Store as Store,
497
+ type StoreChunkSearchOptions as StoreChunkSearchOptions,
498
+ type StoreDeleteResponse as StoreDeleteResponse,
499
+ type StoreQuestionAnsweringResponse as StoreQuestionAnsweringResponse,
500
+ type StoreSearchResponse as StoreSearchResponse,
501
+ type StoresCursor as StoresCursor,
502
+ type StoreCreateParams as StoreCreateParams,
503
+ type StoreUpdateParams as StoreUpdateParams,
504
+ type StoreListParams as StoreListParams,
505
+ type StoreQuestionAnsweringParams as StoreQuestionAnsweringParams,
506
+ type StoreSearchParams as StoreSearchParams,
507
+ };
508
+
509
+ export {
510
+ Files as Files,
511
+ type ScoredStoreFile as ScoredStoreFile,
512
+ type StoreFileStatus as StoreFileStatus,
513
+ type StoreFile as StoreFile,
514
+ type FileListResponse as FileListResponse,
515
+ type FileDeleteResponse as FileDeleteResponse,
516
+ type FileSearchResponse as FileSearchResponse,
517
+ type FileCreateParams as FileCreateParams,
518
+ type FileRetrieveParams as FileRetrieveParams,
519
+ type FileListParams as FileListParams,
520
+ type FileDeleteParams as FileDeleteParams,
521
+ type FileSearchParams as FileSearchParams,
522
+ };
523
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './stores/index';