@mixedbread/sdk 0.30.0 → 0.31.1
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.
- package/CHANGELOG.md +16 -0
- package/README.md +18 -18
- package/bin/migration-config.json +70 -0
- package/client.d.mts +3 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +3 -0
- package/client.d.ts.map +1 -1
- package/client.js +3 -0
- package/client.js.map +1 -1
- package/client.mjs +3 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/stores/files.d.mts +593 -0
- package/resources/stores/files.d.mts.map +1 -0
- package/resources/stores/files.d.ts +593 -0
- package/resources/stores/files.d.ts.map +1 -0
- package/resources/stores/files.js +136 -0
- package/resources/stores/files.js.map +1 -0
- package/resources/stores/files.mjs +131 -0
- package/resources/stores/files.mjs.map +1 -0
- package/resources/stores/index.d.mts +3 -0
- package/resources/stores/index.d.mts.map +1 -0
- package/resources/stores/index.d.ts +3 -0
- package/resources/stores/index.d.ts.map +1 -0
- package/resources/stores/index.js +9 -0
- package/resources/stores/index.js.map +1 -0
- package/resources/stores/index.mjs +4 -0
- package/resources/stores/index.mjs.map +1 -0
- package/resources/stores/stores.d.mts +372 -0
- package/resources/stores/stores.d.mts.map +1 -0
- package/resources/stores/stores.d.ts +372 -0
- package/resources/stores/stores.d.ts.map +1 -0
- package/resources/stores/stores.js +100 -0
- package/resources/stores/stores.js.map +1 -0
- package/resources/stores/stores.mjs +95 -0
- package/resources/stores/stores.mjs.map +1 -0
- package/resources/stores.d.mts +2 -0
- package/resources/stores.d.mts.map +1 -0
- package/resources/stores.d.ts +2 -0
- package/resources/stores.d.ts.map +1 -0
- package/resources/stores.js +6 -0
- package/resources/stores.js.map +1 -0
- package/resources/stores.mjs +3 -0
- package/resources/stores.mjs.map +1 -0
- package/resources/vector-stores/files.d.mts +11 -10
- package/resources/vector-stores/files.d.mts.map +1 -1
- package/resources/vector-stores/files.d.ts +11 -10
- package/resources/vector-stores/files.d.ts.map +1 -1
- package/resources/vector-stores/files.js +5 -5
- package/resources/vector-stores/files.js.map +1 -1
- package/resources/vector-stores/files.mjs +5 -5
- package/resources/vector-stores/files.mjs.map +1 -1
- package/resources/vector-stores/vector-stores.d.mts +7 -7
- package/resources/vector-stores/vector-stores.d.ts +7 -7
- package/resources/vector-stores/vector-stores.js +7 -7
- package/resources/vector-stores/vector-stores.mjs +7 -7
- package/src/client.ts +31 -0
- package/src/resources/index.ts +14 -0
- package/src/resources/stores/files.ts +796 -0
- package/src/resources/stores/index.ts +30 -0
- package/src/resources/stores/stores.ts +523 -0
- package/src/resources/stores.ts +3 -0
- package/src/resources/vector-stores/files.ts +11 -10
- package/src/resources/vector-stores/vector-stores.ts +7 -7
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,796 @@
|
|
|
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 VectorStoresFilesAPI from '../vector-stores/files';
|
|
6
|
+
import * as VectorStoresAPI from '../vector-stores/vector-stores';
|
|
7
|
+
import { APIPromise } from '../../core/api-promise';
|
|
8
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
9
|
+
import * as polling from '../../lib/polling';
|
|
10
|
+
import { Uploadable } from '../../uploads';
|
|
11
|
+
import { path } from '../../internal/utils/path';
|
|
12
|
+
|
|
13
|
+
export class Files extends APIResource {
|
|
14
|
+
/**
|
|
15
|
+
* Upload a file to a store.
|
|
16
|
+
*
|
|
17
|
+
* Args: store_identifier: The ID or name of the store. file_add_params: The file
|
|
18
|
+
* to add to the store.
|
|
19
|
+
*
|
|
20
|
+
* Returns: VectorStoreFile: The uploaded file details.
|
|
21
|
+
*/
|
|
22
|
+
create(storeIdentifier: string, body: FileCreateParams, options?: RequestOptions): APIPromise<StoreFile> {
|
|
23
|
+
return this._client.post(path`/v1/stores/${storeIdentifier}/files`, { body, ...options });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get a file from a store.
|
|
28
|
+
*
|
|
29
|
+
* Args: store_identifier: The ID or name of the store. file_id: The ID or name of
|
|
30
|
+
* the file. options: Get file options.
|
|
31
|
+
*
|
|
32
|
+
* Returns: VectorStoreFile: The file details.
|
|
33
|
+
*/
|
|
34
|
+
retrieve(fileID: string, params: FileRetrieveParams, options?: RequestOptions): APIPromise<StoreFile> {
|
|
35
|
+
const { store_identifier, ...query } = params;
|
|
36
|
+
return this._client.get(path`/v1/stores/${store_identifier}/files/${fileID}`, { query, ...options });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* List files indexed in a vector store with pagination and metadata filter.
|
|
41
|
+
*
|
|
42
|
+
* Args: vector_store_identifier: The ID or name of the vector store pagination:
|
|
43
|
+
* Pagination parameters and metadata filter
|
|
44
|
+
*
|
|
45
|
+
* Returns: VectorStoreFileListResponse: Paginated list of vector store files
|
|
46
|
+
*/
|
|
47
|
+
list(
|
|
48
|
+
storeIdentifier: string,
|
|
49
|
+
body: FileListParams,
|
|
50
|
+
options?: RequestOptions,
|
|
51
|
+
): APIPromise<FileListResponse> {
|
|
52
|
+
return this._client.post(path`/v1/stores/${storeIdentifier}/files/list`, { body, ...options });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Delete a file from a store.
|
|
57
|
+
*
|
|
58
|
+
* Args: store_identifier: The ID or name of the store. file_id: The ID or name of
|
|
59
|
+
* the file to delete.
|
|
60
|
+
*
|
|
61
|
+
* Returns: VectorStoreFileDeleted: The deleted file details.
|
|
62
|
+
*/
|
|
63
|
+
delete(fileID: string, params: FileDeleteParams, options?: RequestOptions): APIPromise<FileDeleteResponse> {
|
|
64
|
+
const { store_identifier } = params;
|
|
65
|
+
return this._client.delete(path`/v1/stores/${store_identifier}/files/${fileID}`, options);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Search for files within a store based on semantic similarity.
|
|
70
|
+
*
|
|
71
|
+
* Args: store_identifier: The ID or name of the store to search within
|
|
72
|
+
* search_params: Search configuration including query text, pagination, and
|
|
73
|
+
* filters
|
|
74
|
+
*
|
|
75
|
+
* Returns: StoreFileSearchResponse: List of matching files with relevance scores
|
|
76
|
+
*/
|
|
77
|
+
search(body: FileSearchParams, options?: RequestOptions): APIPromise<FileSearchResponse> {
|
|
78
|
+
return this._client.post('/v1/stores/files/search', { body, ...options });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Poll for a file's processing status until it reaches a terminal state.
|
|
84
|
+
*
|
|
85
|
+
* @param storeIdentifier - The identifier of the store
|
|
86
|
+
* @param fileId - The ID of the file to poll
|
|
87
|
+
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
|
88
|
+
* @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
|
|
89
|
+
* @param options - Additional request options
|
|
90
|
+
* @returns The file object once it reaches a terminal state
|
|
91
|
+
*/
|
|
92
|
+
async poll(
|
|
93
|
+
storeIdentifier: string,
|
|
94
|
+
fileId: string,
|
|
95
|
+
pollIntervalMs?: number,
|
|
96
|
+
pollTimeoutMs?: number,
|
|
97
|
+
options?: RequestOptions,
|
|
98
|
+
): Promise<StoreFile> {
|
|
99
|
+
const pollingIntervalMs = pollIntervalMs || 500;
|
|
100
|
+
const pollingTimeoutMs = pollTimeoutMs;
|
|
101
|
+
|
|
102
|
+
return polling.poll({
|
|
103
|
+
fn: () => this.retrieve(fileId, { store_identifier: storeIdentifier, ...options }),
|
|
104
|
+
condition: (result) =>
|
|
105
|
+
result.status === 'completed' || result.status === 'failed' || result.status === 'cancelled',
|
|
106
|
+
intervalSeconds: pollingIntervalMs / 1000,
|
|
107
|
+
...(pollingTimeoutMs && { timeoutSeconds: pollingTimeoutMs / 1000 }),
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Create a file in a vector store and wait for it to be processed.
|
|
113
|
+
*
|
|
114
|
+
* @param storeIdentifier - The identifier of the store to upload to
|
|
115
|
+
* @param body - The file creation parameters
|
|
116
|
+
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
|
117
|
+
* @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
|
|
118
|
+
* @param options - Additional request options
|
|
119
|
+
* @returns The file object once it reaches a terminal state
|
|
120
|
+
*/
|
|
121
|
+
async createAndPoll(
|
|
122
|
+
storeIdentifier: string,
|
|
123
|
+
body: FileCreateParams,
|
|
124
|
+
pollIntervalMs?: number,
|
|
125
|
+
pollTimeoutMs?: number,
|
|
126
|
+
options?: RequestOptions,
|
|
127
|
+
): Promise<StoreFile> {
|
|
128
|
+
const file = await this.create(storeIdentifier, body, options);
|
|
129
|
+
return this.poll(storeIdentifier, file.id, pollIntervalMs, pollTimeoutMs, options);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Upload a file to the files API and then create a file in a vector store.
|
|
134
|
+
* Note the file will be asynchronously processed.
|
|
135
|
+
*
|
|
136
|
+
* @param storeIdentifier - The identifier of the store to add the file to
|
|
137
|
+
* @param file - The file to upload
|
|
138
|
+
* @param body - Additional parameters for the vector store file
|
|
139
|
+
* @param options - Additional request options
|
|
140
|
+
* @returns The created vector store file
|
|
141
|
+
*/
|
|
142
|
+
async upload(
|
|
143
|
+
storeIdentifier: string,
|
|
144
|
+
file: Uploadable,
|
|
145
|
+
body?: Omit<FileCreateParams, 'file_id'>,
|
|
146
|
+
options?: RequestOptions,
|
|
147
|
+
): Promise<StoreFile> {
|
|
148
|
+
const fileUploadResponse = await this._client.files.create({ file }, options);
|
|
149
|
+
|
|
150
|
+
return this.create(
|
|
151
|
+
storeIdentifier,
|
|
152
|
+
{
|
|
153
|
+
file_id: fileUploadResponse.id,
|
|
154
|
+
...body,
|
|
155
|
+
},
|
|
156
|
+
options,
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Upload a file to files API, create a file in a vector store, and poll until processing is complete.
|
|
162
|
+
*
|
|
163
|
+
* @param storeIdentifier - The identifier of the store to add the file to
|
|
164
|
+
* @param file - The file to upload
|
|
165
|
+
* @param body - Additional parameters for the vector store file
|
|
166
|
+
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
|
167
|
+
* @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
|
|
168
|
+
* @param options - Additional request options
|
|
169
|
+
* @returns The vector store file object once it reaches a terminal state
|
|
170
|
+
*/
|
|
171
|
+
async uploadAndPoll(
|
|
172
|
+
storeIdentifier: string,
|
|
173
|
+
file: Uploadable,
|
|
174
|
+
body?: Omit<FileCreateParams, 'file_id'>,
|
|
175
|
+
pollIntervalMs?: number,
|
|
176
|
+
pollTimeoutMs?: number,
|
|
177
|
+
options?: RequestOptions,
|
|
178
|
+
): Promise<StoreFile> {
|
|
179
|
+
const vectorStoreFile = await this.upload(storeIdentifier, file, body, options);
|
|
180
|
+
return this.poll(storeIdentifier, vectorStoreFile.id, pollIntervalMs, pollTimeoutMs, options);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Represents a scored store file.
|
|
186
|
+
*/
|
|
187
|
+
export interface ScoredStoreFile {
|
|
188
|
+
/**
|
|
189
|
+
* Unique identifier for the file
|
|
190
|
+
*/
|
|
191
|
+
id: string;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Name of the file
|
|
195
|
+
*/
|
|
196
|
+
filename?: string;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Optional file metadata
|
|
200
|
+
*/
|
|
201
|
+
metadata?: unknown;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Processing status of the file
|
|
205
|
+
*/
|
|
206
|
+
status?: StoreFileStatus;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Last error message if processing failed
|
|
210
|
+
*/
|
|
211
|
+
last_error?: unknown;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* ID of the containing store
|
|
215
|
+
*/
|
|
216
|
+
store_id: string;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Timestamp of store file creation
|
|
220
|
+
*/
|
|
221
|
+
created_at: string;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Version number of the file
|
|
225
|
+
*/
|
|
226
|
+
version?: number | null;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Storage usage in bytes
|
|
230
|
+
*/
|
|
231
|
+
usage_bytes?: number | null;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Type of the object
|
|
235
|
+
*/
|
|
236
|
+
object?: 'store.file';
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Array of scored file chunks
|
|
240
|
+
*/
|
|
241
|
+
chunks: Array<
|
|
242
|
+
| VectorStoresAPI.ScoredTextInputChunk
|
|
243
|
+
| VectorStoresAPI.ScoredImageURLInputChunk
|
|
244
|
+
| VectorStoresAPI.ScoredAudioURLInputChunk
|
|
245
|
+
| VectorStoresAPI.ScoredVideoURLInputChunk
|
|
246
|
+
> | null;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* score of the file
|
|
250
|
+
*/
|
|
251
|
+
score: number;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export type StoreFileStatus = 'pending' | 'in_progress' | 'cancelled' | 'completed' | 'failed';
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Represents a file stored in a store.
|
|
258
|
+
*/
|
|
259
|
+
export interface StoreFile {
|
|
260
|
+
/**
|
|
261
|
+
* Unique identifier for the file
|
|
262
|
+
*/
|
|
263
|
+
id: string;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Name of the file
|
|
267
|
+
*/
|
|
268
|
+
filename?: string;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Optional file metadata
|
|
272
|
+
*/
|
|
273
|
+
metadata?: unknown;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Processing status of the file
|
|
277
|
+
*/
|
|
278
|
+
status?: StoreFileStatus;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Last error message if processing failed
|
|
282
|
+
*/
|
|
283
|
+
last_error?: unknown;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* ID of the containing store
|
|
287
|
+
*/
|
|
288
|
+
store_id: string;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Timestamp of store file creation
|
|
292
|
+
*/
|
|
293
|
+
created_at: string;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Version number of the file
|
|
297
|
+
*/
|
|
298
|
+
version?: number | null;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Storage usage in bytes
|
|
302
|
+
*/
|
|
303
|
+
usage_bytes?: number | null;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Type of the object
|
|
307
|
+
*/
|
|
308
|
+
object?: 'store.file';
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* chunks
|
|
312
|
+
*/
|
|
313
|
+
chunks?: Array<
|
|
314
|
+
| StoreFile.TextInputChunk
|
|
315
|
+
| StoreFile.ImageURLInputChunk
|
|
316
|
+
| StoreFile.AudioURLInputChunk
|
|
317
|
+
| StoreFile.VideoURLInputChunk
|
|
318
|
+
> | null;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export namespace StoreFile {
|
|
322
|
+
export interface TextInputChunk {
|
|
323
|
+
/**
|
|
324
|
+
* position of the chunk in a file
|
|
325
|
+
*/
|
|
326
|
+
chunk_index: number;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* mime type of the chunk
|
|
330
|
+
*/
|
|
331
|
+
mime_type?: string;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* metadata of the chunk
|
|
335
|
+
*/
|
|
336
|
+
generated_metadata?: { [key: string]: unknown } | null;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* model used for this chunk
|
|
340
|
+
*/
|
|
341
|
+
model?: string | null;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Input type identifier
|
|
345
|
+
*/
|
|
346
|
+
type?: 'text';
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* The offset of the text in the file relative to the start of the file.
|
|
350
|
+
*/
|
|
351
|
+
offset?: number;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Text content to process
|
|
355
|
+
*/
|
|
356
|
+
text: string;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export interface ImageURLInputChunk {
|
|
360
|
+
/**
|
|
361
|
+
* position of the chunk in a file
|
|
362
|
+
*/
|
|
363
|
+
chunk_index: number;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* mime type of the chunk
|
|
367
|
+
*/
|
|
368
|
+
mime_type?: string;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* metadata of the chunk
|
|
372
|
+
*/
|
|
373
|
+
generated_metadata?: { [key: string]: unknown } | null;
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* model used for this chunk
|
|
377
|
+
*/
|
|
378
|
+
model?: string | null;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Input type identifier
|
|
382
|
+
*/
|
|
383
|
+
type?: 'image_url';
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* ocr text of the image
|
|
387
|
+
*/
|
|
388
|
+
ocr_text?: string | null;
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* summary of the image
|
|
392
|
+
*/
|
|
393
|
+
summary?: string | null;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* The image input specification.
|
|
397
|
+
*/
|
|
398
|
+
image_url: ImageURLInputChunk.ImageURL;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export namespace ImageURLInputChunk {
|
|
402
|
+
/**
|
|
403
|
+
* The image input specification.
|
|
404
|
+
*/
|
|
405
|
+
export interface ImageURL {
|
|
406
|
+
/**
|
|
407
|
+
* The image URL. Can be either a URL or a Data URI.
|
|
408
|
+
*/
|
|
409
|
+
url: string;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* The image format/mimetype
|
|
413
|
+
*/
|
|
414
|
+
format?: string;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export interface AudioURLInputChunk {
|
|
419
|
+
/**
|
|
420
|
+
* position of the chunk in a file
|
|
421
|
+
*/
|
|
422
|
+
chunk_index: number;
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* mime type of the chunk
|
|
426
|
+
*/
|
|
427
|
+
mime_type?: string;
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* metadata of the chunk
|
|
431
|
+
*/
|
|
432
|
+
generated_metadata?: { [key: string]: unknown } | null;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* model used for this chunk
|
|
436
|
+
*/
|
|
437
|
+
model?: string | null;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Input type identifier
|
|
441
|
+
*/
|
|
442
|
+
type?: 'audio_url';
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* speech recognition (sr) text of the audio
|
|
446
|
+
*/
|
|
447
|
+
transcription?: string | null;
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* summary of the audio
|
|
451
|
+
*/
|
|
452
|
+
summary?: string | null;
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* The audio input specification.
|
|
456
|
+
*/
|
|
457
|
+
audio_url: AudioURLInputChunk.AudioURL;
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* The sampling rate of the audio.
|
|
461
|
+
*/
|
|
462
|
+
sampling_rate: number;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export namespace AudioURLInputChunk {
|
|
466
|
+
/**
|
|
467
|
+
* The audio input specification.
|
|
468
|
+
*/
|
|
469
|
+
export interface AudioURL {
|
|
470
|
+
/**
|
|
471
|
+
* The audio URL. Can be either a URL or a Data URI.
|
|
472
|
+
*/
|
|
473
|
+
url: string;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export interface VideoURLInputChunk {
|
|
478
|
+
/**
|
|
479
|
+
* position of the chunk in a file
|
|
480
|
+
*/
|
|
481
|
+
chunk_index: number;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* mime type of the chunk
|
|
485
|
+
*/
|
|
486
|
+
mime_type?: string;
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* metadata of the chunk
|
|
490
|
+
*/
|
|
491
|
+
generated_metadata?: { [key: string]: unknown } | null;
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* model used for this chunk
|
|
495
|
+
*/
|
|
496
|
+
model?: string | null;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Input type identifier
|
|
500
|
+
*/
|
|
501
|
+
type?: 'video_url';
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* speech recognition (sr) text of the video
|
|
505
|
+
*/
|
|
506
|
+
transcription?: string | null;
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* summary of the video
|
|
510
|
+
*/
|
|
511
|
+
summary?: string | null;
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* The video input specification.
|
|
515
|
+
*/
|
|
516
|
+
video_url: VideoURLInputChunk.VideoURL;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
export namespace VideoURLInputChunk {
|
|
520
|
+
/**
|
|
521
|
+
* The video input specification.
|
|
522
|
+
*/
|
|
523
|
+
export interface VideoURL {
|
|
524
|
+
/**
|
|
525
|
+
* The video URL. Can be either a URL or a Data URI.
|
|
526
|
+
*/
|
|
527
|
+
url: string;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export interface FileListResponse {
|
|
533
|
+
/**
|
|
534
|
+
* Response model for cursor-based pagination.
|
|
535
|
+
*/
|
|
536
|
+
pagination: FileListResponse.Pagination;
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* The object type of the response
|
|
540
|
+
*/
|
|
541
|
+
object?: 'list';
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* The list of store files
|
|
545
|
+
*/
|
|
546
|
+
data: Array<StoreFile>;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export namespace FileListResponse {
|
|
550
|
+
/**
|
|
551
|
+
* Response model for cursor-based pagination.
|
|
552
|
+
*/
|
|
553
|
+
export interface Pagination {
|
|
554
|
+
/**
|
|
555
|
+
* Contextual direction-aware flag: True if more items exist in the requested
|
|
556
|
+
* pagination direction. For 'after': more items after this page. For 'before':
|
|
557
|
+
* more items before this page.
|
|
558
|
+
*/
|
|
559
|
+
has_more: boolean;
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Cursor of the first item in this page. Use for backward pagination. None if page
|
|
563
|
+
* is empty.
|
|
564
|
+
*/
|
|
565
|
+
first_cursor: string | null;
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Cursor of the last item in this page. Use for forward pagination. None if page
|
|
569
|
+
* is empty.
|
|
570
|
+
*/
|
|
571
|
+
last_cursor: string | null;
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Total number of items available across all pages. Only included when
|
|
575
|
+
* include_total=true was requested. Expensive operation - use sparingly.
|
|
576
|
+
*/
|
|
577
|
+
total?: number | null;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Response model for file deletion.
|
|
583
|
+
*/
|
|
584
|
+
export interface FileDeleteResponse {
|
|
585
|
+
/**
|
|
586
|
+
* ID of the deleted file
|
|
587
|
+
*/
|
|
588
|
+
id: string;
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Whether the deletion was successful
|
|
592
|
+
*/
|
|
593
|
+
deleted?: boolean;
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Type of the deleted object
|
|
597
|
+
*/
|
|
598
|
+
object?: 'store.file';
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
export interface FileSearchResponse {
|
|
602
|
+
/**
|
|
603
|
+
* The object type of the response
|
|
604
|
+
*/
|
|
605
|
+
object?: 'list';
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* The list of scored store files
|
|
609
|
+
*/
|
|
610
|
+
data: Array<ScoredStoreFile>;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
export interface FileCreateParams {
|
|
614
|
+
/**
|
|
615
|
+
* Optional metadata for the file
|
|
616
|
+
*/
|
|
617
|
+
metadata?: unknown;
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Strategy for adding the file
|
|
621
|
+
*/
|
|
622
|
+
experimental?: FileCreateParams.Experimental;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* ID of the file to add
|
|
626
|
+
*/
|
|
627
|
+
file_id: string;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
export namespace FileCreateParams {
|
|
631
|
+
/**
|
|
632
|
+
* Strategy for adding the file
|
|
633
|
+
*/
|
|
634
|
+
export interface Experimental {
|
|
635
|
+
/**
|
|
636
|
+
* Strategy for adding the file
|
|
637
|
+
*/
|
|
638
|
+
parsing_strategy?: 'fast' | 'high_quality';
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Whether to contextualize the file
|
|
642
|
+
*/
|
|
643
|
+
contextualization?: boolean;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
export interface FileRetrieveParams {
|
|
648
|
+
/**
|
|
649
|
+
* Path param: The ID or name of the store
|
|
650
|
+
*/
|
|
651
|
+
store_identifier: string;
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Query param: Whether to return the chunks for the file
|
|
655
|
+
*/
|
|
656
|
+
return_chunks?: boolean;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
export interface FileListParams {
|
|
660
|
+
/**
|
|
661
|
+
* Maximum number of items to return per page (1-100)
|
|
662
|
+
*/
|
|
663
|
+
limit?: number;
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Cursor for forward pagination - get items after this position. Use last_cursor
|
|
667
|
+
* from previous response.
|
|
668
|
+
*/
|
|
669
|
+
after?: string | null;
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Cursor for backward pagination - get items before this position. Use
|
|
673
|
+
* first_cursor from previous response.
|
|
674
|
+
*/
|
|
675
|
+
before?: string | null;
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Whether to include total count in response (expensive operation)
|
|
679
|
+
*/
|
|
680
|
+
include_total?: boolean;
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Status to filter by
|
|
684
|
+
*/
|
|
685
|
+
statuses?: Array<StoreFileStatus> | null;
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Metadata filter to apply to the query
|
|
689
|
+
*/
|
|
690
|
+
metadata_filter?:
|
|
691
|
+
| Shared.SearchFilter
|
|
692
|
+
| Shared.SearchFilterCondition
|
|
693
|
+
| Array<Shared.SearchFilter | Shared.SearchFilterCondition>
|
|
694
|
+
| null;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
export interface FileDeleteParams {
|
|
698
|
+
/**
|
|
699
|
+
* The ID or name of the store
|
|
700
|
+
*/
|
|
701
|
+
store_identifier: string;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
export interface FileSearchParams {
|
|
705
|
+
/**
|
|
706
|
+
* Search query text
|
|
707
|
+
*/
|
|
708
|
+
query: string;
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* IDs or names of stores to search
|
|
712
|
+
*/
|
|
713
|
+
store_identifiers: Array<string>;
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Number of results to return
|
|
717
|
+
*/
|
|
718
|
+
top_k?: number;
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Optional filter conditions
|
|
722
|
+
*/
|
|
723
|
+
filters?:
|
|
724
|
+
| Shared.SearchFilter
|
|
725
|
+
| Shared.SearchFilterCondition
|
|
726
|
+
| Array<Shared.SearchFilter | Shared.SearchFilterCondition>
|
|
727
|
+
| null;
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Optional list of file IDs to filter chunks by (inclusion filter)
|
|
731
|
+
*/
|
|
732
|
+
file_ids?: Array<unknown> | Array<string> | null;
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Search configuration options
|
|
736
|
+
*/
|
|
737
|
+
search_options?: FileSearchParams.SearchOptions;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
export namespace FileSearchParams {
|
|
741
|
+
/**
|
|
742
|
+
* Search configuration options
|
|
743
|
+
*/
|
|
744
|
+
export interface SearchOptions {
|
|
745
|
+
/**
|
|
746
|
+
* Minimum similarity score threshold
|
|
747
|
+
*/
|
|
748
|
+
score_threshold?: number;
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Whether to rewrite the query
|
|
752
|
+
*/
|
|
753
|
+
rewrite_query?: boolean;
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Whether to rerank results and optional reranking configuration
|
|
757
|
+
*/
|
|
758
|
+
rerank?: boolean | VectorStoresFilesAPI.RerankConfig | null;
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Whether to return file metadata
|
|
762
|
+
*/
|
|
763
|
+
return_metadata?: boolean;
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Whether to return matching text chunks
|
|
767
|
+
*/
|
|
768
|
+
return_chunks?: boolean;
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Number of chunks to return for each file
|
|
772
|
+
*/
|
|
773
|
+
chunks_per_file?: number;
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* Whether to apply search rules
|
|
777
|
+
*/
|
|
778
|
+
apply_search_rules?: boolean;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
export declare namespace Files {
|
|
783
|
+
export {
|
|
784
|
+
type ScoredStoreFile as ScoredStoreFile,
|
|
785
|
+
type StoreFileStatus as StoreFileStatus,
|
|
786
|
+
type StoreFile as StoreFile,
|
|
787
|
+
type FileListResponse as FileListResponse,
|
|
788
|
+
type FileDeleteResponse as FileDeleteResponse,
|
|
789
|
+
type FileSearchResponse as FileSearchResponse,
|
|
790
|
+
type FileCreateParams as FileCreateParams,
|
|
791
|
+
type FileRetrieveParams as FileRetrieveParams,
|
|
792
|
+
type FileListParams as FileListParams,
|
|
793
|
+
type FileDeleteParams as FileDeleteParams,
|
|
794
|
+
type FileSearchParams as FileSearchParams,
|
|
795
|
+
};
|
|
796
|
+
}
|