@mixedbread/sdk 0.6.0 → 0.8.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.
- package/CHANGELOG.md +63 -0
- package/README.md +12 -24
- package/bin/migration-config.json +2 -2
- package/client.d.mts +4 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +4 -4
- package/client.d.ts.map +1 -1
- package/client.js +2 -2
- package/client.js.map +1 -1
- package/client.mjs +2 -2
- package/client.mjs.map +1 -1
- package/core/pagination.d.mts +1 -1
- package/core/pagination.d.mts.map +1 -1
- package/core/pagination.d.ts +1 -1
- package/core/pagination.d.ts.map +1 -1
- package/core/resource.d.mts +1 -1
- package/core/resource.d.mts.map +1 -1
- package/core/resource.d.ts +1 -1
- package/core/resource.d.ts.map +1 -1
- package/core/resource.js.map +1 -1
- package/core/resource.mjs.map +1 -1
- package/internal/detect-platform.js +3 -3
- package/internal/detect-platform.js.map +1 -1
- package/internal/detect-platform.mjs +3 -3
- package/internal/detect-platform.mjs.map +1 -1
- package/internal/headers.d.mts.map +1 -1
- package/internal/headers.d.ts.map +1 -1
- package/internal/headers.js +4 -4
- package/internal/headers.js.map +1 -1
- package/internal/headers.mjs +4 -4
- package/internal/headers.mjs.map +1 -1
- package/internal/shim-types.d.mts +11 -22
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +11 -22
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.mjs.map +1 -0
- package/internal/shims.d.mts +2 -2
- package/internal/shims.d.mts.map +1 -1
- package/internal/shims.d.ts +2 -2
- package/internal/shims.d.ts.map +1 -1
- package/internal/uploads.js +1 -1
- package/internal/uploads.js.map +1 -1
- package/internal/uploads.mjs +1 -1
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/log.js +1 -1
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +1 -1
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/path.d.mts.map +1 -1
- package/internal/utils/path.d.ts.map +1 -1
- package/internal/utils/path.js.map +1 -1
- package/internal/utils/path.mjs +1 -1
- package/internal/utils/path.mjs.map +1 -1
- package/internal/utils/values.d.mts +2 -0
- package/internal/utils/values.d.mts.map +1 -1
- package/internal/utils/values.d.ts +2 -0
- package/internal/utils/values.d.ts.map +1 -1
- package/internal/utils/values.js +4 -1
- package/internal/utils/values.js.map +1 -1
- package/internal/utils/values.mjs +2 -0
- package/internal/utils/values.mjs.map +1 -1
- package/package.json +1 -4
- package/resources/data-sources/connectors.d.mts +14 -4
- package/resources/data-sources/connectors.d.mts.map +1 -1
- package/resources/data-sources/connectors.d.ts +14 -4
- package/resources/data-sources/connectors.d.ts.map +1 -1
- package/resources/data-sources/data-sources.d.mts +172 -35
- package/resources/data-sources/data-sources.d.mts.map +1 -1
- package/resources/data-sources/data-sources.d.ts +172 -35
- package/resources/data-sources/data-sources.d.ts.map +1 -1
- package/resources/data-sources/data-sources.js.map +1 -1
- package/resources/data-sources/data-sources.mjs.map +1 -1
- package/resources/data-sources/index.d.mts +1 -1
- package/resources/data-sources/index.d.mts.map +1 -1
- package/resources/data-sources/index.d.ts +1 -1
- package/resources/data-sources/index.d.ts.map +1 -1
- package/resources/data-sources/index.js.map +1 -1
- package/resources/data-sources/index.mjs.map +1 -1
- package/resources/extractions/content.d.mts +4 -0
- package/resources/extractions/content.d.mts.map +1 -1
- package/resources/extractions/content.d.ts +4 -0
- package/resources/extractions/content.d.ts.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/vector-stores/files.d.mts +59 -26
- package/resources/vector-stores/files.d.mts.map +1 -1
- package/resources/vector-stores/files.d.ts +59 -26
- package/resources/vector-stores/files.d.ts.map +1 -1
- package/resources/vector-stores/files.js +32 -31
- package/resources/vector-stores/files.js.map +1 -1
- package/resources/vector-stores/files.mjs +32 -31
- package/resources/vector-stores/files.mjs.map +1 -1
- package/resources/vector-stores/index.d.mts +1 -1
- package/resources/vector-stores/index.d.mts.map +1 -1
- package/resources/vector-stores/index.d.ts +1 -1
- package/resources/vector-stores/index.d.ts.map +1 -1
- package/resources/vector-stores/index.js.map +1 -1
- package/resources/vector-stores/index.mjs.map +1 -1
- package/resources/vector-stores/vector-stores.d.mts +53 -18
- package/resources/vector-stores/vector-stores.d.mts.map +1 -1
- package/resources/vector-stores/vector-stores.d.ts +53 -18
- package/resources/vector-stores/vector-stores.d.ts.map +1 -1
- package/resources/vector-stores/vector-stores.js +18 -15
- package/resources/vector-stores/vector-stores.js.map +1 -1
- package/resources/vector-stores/vector-stores.mjs +18 -15
- package/resources/vector-stores/vector-stores.mjs.map +1 -1
- package/src/client.ts +10 -4
- package/src/core/pagination.ts +1 -1
- package/src/core/resource.ts +1 -1
- package/src/internal/detect-platform.ts +3 -3
- package/src/internal/headers.ts +5 -5
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +2 -2
- package/src/internal/uploads.ts +2 -2
- package/src/internal/utils/log.ts +1 -1
- package/src/internal/utils/path.ts +1 -1
- package/src/internal/utils/values.ts +3 -0
- package/src/resources/data-sources/connectors.ts +14 -4
- package/src/resources/data-sources/data-sources.ts +207 -37
- package/src/resources/data-sources/index.ts +3 -0
- package/src/resources/extractions/content.ts +5 -0
- package/src/resources/index.ts +3 -0
- package/src/resources/vector-stores/files.ts +81 -39
- package/src/resources/vector-stores/index.ts +2 -0
- package/src/resources/vector-stores/vector-stores.ts +67 -20
- 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
- package/src/internal/shim-types.d.ts +0 -28
@@ -1,4 +1,5 @@
|
|
1
1
|
import { APIResource } from "../../core/resource.mjs";
|
2
|
+
import * as FilesAPI from "./files.mjs";
|
2
3
|
import * as Shared from "../shared.mjs";
|
3
4
|
import * as VectorStoresAPI from "./vector-stores.mjs";
|
4
5
|
import { APIPromise } from "../../core/api-promise.mjs";
|
@@ -9,16 +10,17 @@ export declare class Files extends APIResource {
|
|
9
10
|
/**
|
10
11
|
* Upload a new file to a vector store for indexing.
|
11
12
|
*
|
12
|
-
* Args:
|
13
|
-
* upload and index
|
13
|
+
* Args: vector_store_identifier: The ID or name of the vector store to upload to
|
14
|
+
* file: The file to upload and index
|
14
15
|
*
|
15
16
|
* Returns: VectorStoreFile: Details of the uploaded and indexed file
|
16
17
|
*/
|
17
|
-
create(
|
18
|
+
create(vectorStoreIdentifier: string, body: FileCreateParams, options?: RequestOptions): APIPromise<VectorStoreFile>;
|
18
19
|
/**
|
19
20
|
* Get details of a specific file in a vector store.
|
20
21
|
*
|
21
|
-
* Args:
|
22
|
+
* Args: vector_store_identifier: The ID or name of the vector store file_id: The
|
23
|
+
* ID of the file
|
22
24
|
*
|
23
25
|
* Returns: VectorStoreFile: Details of the vector store file
|
24
26
|
*/
|
@@ -26,17 +28,17 @@ export declare class Files extends APIResource {
|
|
26
28
|
/**
|
27
29
|
* List files indexed in a vector store with pagination.
|
28
30
|
*
|
29
|
-
* Args:
|
30
|
-
* parameters
|
31
|
+
* Args: vector_store_identifier: The ID or name of the vector store pagination:
|
32
|
+
* Pagination parameters
|
31
33
|
*
|
32
34
|
* Returns: VectorStoreFileListResponse: Paginated list of vector store files
|
33
35
|
*/
|
34
|
-
list(
|
36
|
+
list(vectorStoreIdentifier: string, query?: FileListParams | null | undefined, options?: RequestOptions): PagePromise<VectorStoreFilesLimitOffset, VectorStoreFile>;
|
35
37
|
/**
|
36
38
|
* Delete a file from a vector store.
|
37
39
|
*
|
38
|
-
* Args:
|
39
|
-
* delete
|
40
|
+
* Args: vector_store_identifier: The ID or name of the vector store file_id: The
|
41
|
+
* ID of the file to delete
|
40
42
|
*
|
41
43
|
* Returns: VectorStoreFileDeleted: The deleted file
|
42
44
|
*/
|
@@ -63,40 +65,40 @@ export declare class Files extends APIResource {
|
|
63
65
|
/**
|
64
66
|
* Poll for a file's processing status until it reaches a terminal state.
|
65
67
|
*
|
66
|
-
* @param
|
68
|
+
* @param vectorStoreIdentifier - The identifier of the vector store
|
67
69
|
* @param fileId - The ID of the file to poll
|
68
70
|
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
69
71
|
* @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
|
70
72
|
* @param options - Additional request options
|
71
73
|
* @returns The file object once it reaches a terminal state
|
72
74
|
*/
|
73
|
-
poll(
|
75
|
+
poll(vectorStoreIdentifier: string, fileId: string, pollIntervalMs?: number, pollTimeoutMs?: number, options?: RequestOptions): Promise<VectorStoreFile>;
|
74
76
|
/**
|
75
77
|
* Create a file in a vector store and wait for it to be processed.
|
76
78
|
*
|
77
|
-
* @param
|
79
|
+
* @param vectorStoreIdentifier - The identifier of the vector store to upload to
|
78
80
|
* @param body - The file creation parameters
|
79
81
|
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
80
82
|
* @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
|
81
83
|
* @param options - Additional request options
|
82
84
|
* @returns The file object once it reaches a terminal state
|
83
85
|
*/
|
84
|
-
createAndPoll(
|
86
|
+
createAndPoll(vectorStoreIdentifier: string, body: FileCreateParams, pollIntervalMs?: number, pollTimeoutMs?: number, options?: RequestOptions): Promise<VectorStoreFile>;
|
85
87
|
/**
|
86
88
|
* Upload a file to the files API and then create a file in a vector store.
|
87
89
|
* Note the file will be asynchronously processed.
|
88
90
|
*
|
89
|
-
* @param
|
91
|
+
* @param vectorStoreIdentifier - The identifier of the vector store to add the file to
|
90
92
|
* @param file - The file to upload
|
91
93
|
* @param body - Additional parameters for the vector store file
|
92
94
|
* @param options - Additional request options
|
93
95
|
* @returns The created vector store file
|
94
96
|
*/
|
95
|
-
upload(
|
97
|
+
upload(vectorStoreIdentifier: string, file: Uploadable, body?: Omit<FileCreateParams, 'file_id'>, options?: RequestOptions): Promise<VectorStoreFile>;
|
96
98
|
/**
|
97
99
|
* Upload a file to files API, create a file in a vector store, and poll until processing is complete.
|
98
100
|
*
|
99
|
-
* @param
|
101
|
+
* @param vectorStoreIdentifier - The identifier of the vector store to add the file to
|
100
102
|
* @param file - The file to upload
|
101
103
|
* @param body - Additional parameters for the vector store file
|
102
104
|
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
@@ -104,9 +106,27 @@ export declare class Files extends APIResource {
|
|
104
106
|
* @param options - Additional request options
|
105
107
|
* @returns The vector store file object once it reaches a terminal state
|
106
108
|
*/
|
107
|
-
uploadAndPoll(
|
109
|
+
uploadAndPoll(vectorStoreIdentifier: string, file: Uploadable, body?: Omit<FileCreateParams, 'file_id'>, pollIntervalMs?: number, pollTimeoutMs?: number, options?: RequestOptions): Promise<VectorStoreFile>;
|
108
110
|
}
|
109
111
|
export type VectorStoreFilesLimitOffset = LimitOffset<VectorStoreFile>;
|
112
|
+
/**
|
113
|
+
* Represents a reranking configuration.
|
114
|
+
*/
|
115
|
+
export interface RerankConfig {
|
116
|
+
/**
|
117
|
+
* The name of the reranking model
|
118
|
+
*/
|
119
|
+
model?: string;
|
120
|
+
/**
|
121
|
+
* Whether to include metadata in the reranked results
|
122
|
+
*/
|
123
|
+
with_metadata?: boolean | Array<string>;
|
124
|
+
/**
|
125
|
+
* Maximum number of results to return after reranking. If None, returns all
|
126
|
+
* reranked results.
|
127
|
+
*/
|
128
|
+
top_k?: number | null;
|
129
|
+
}
|
110
130
|
/**
|
111
131
|
* Represents a scored file stored in a vector store.
|
112
132
|
*/
|
@@ -126,7 +146,7 @@ export interface ScoredVectorStoreFile {
|
|
126
146
|
/**
|
127
147
|
* Processing status of the file
|
128
148
|
*/
|
129
|
-
status?:
|
149
|
+
status?: VectorStoreFileStatus;
|
130
150
|
/**
|
131
151
|
* Last error message if processing failed
|
132
152
|
*/
|
@@ -160,6 +180,7 @@ export interface ScoredVectorStoreFile {
|
|
160
180
|
*/
|
161
181
|
chunks: Array<VectorStoresAPI.ScoredTextInputChunk | VectorStoresAPI.ScoredImageURLInputChunk | VectorStoresAPI.ScoredAudioURLInputChunk | VectorStoresAPI.ScoredVideoURLInputChunk> | null;
|
162
182
|
}
|
183
|
+
export type VectorStoreFileStatus = 'pending' | 'in_progress' | 'cancelled' | 'completed' | 'failed';
|
163
184
|
/**
|
164
185
|
* Represents a file stored in a vector store.
|
165
186
|
*/
|
@@ -179,7 +200,7 @@ export interface VectorStoreFile {
|
|
179
200
|
/**
|
180
201
|
* Processing status of the file
|
181
202
|
*/
|
182
|
-
status?:
|
203
|
+
status?: VectorStoreFileStatus;
|
183
204
|
/**
|
184
205
|
* Last error message if processing failed
|
185
206
|
*/
|
@@ -263,17 +284,17 @@ export declare namespace FileCreateParams {
|
|
263
284
|
}
|
264
285
|
export interface FileRetrieveParams {
|
265
286
|
/**
|
266
|
-
* The ID of the vector store
|
287
|
+
* The ID or name of the vector store
|
267
288
|
*/
|
268
|
-
|
289
|
+
vector_store_identifier: string;
|
269
290
|
}
|
270
291
|
export interface FileListParams extends LimitOffsetParams {
|
271
292
|
}
|
272
293
|
export interface FileDeleteParams {
|
273
294
|
/**
|
274
|
-
* The ID of the vector store
|
295
|
+
* The ID or name of the vector store
|
275
296
|
*/
|
276
|
-
|
297
|
+
vector_store_identifier: string;
|
277
298
|
}
|
278
299
|
export interface FileSearchParams {
|
279
300
|
/**
|
@@ -281,9 +302,13 @@ export interface FileSearchParams {
|
|
281
302
|
*/
|
282
303
|
query: string;
|
283
304
|
/**
|
284
|
-
* IDs of vector stores to search
|
305
|
+
* IDs or names of vector stores to search
|
306
|
+
*/
|
307
|
+
vector_store_identifiers?: Array<string> | null;
|
308
|
+
/**
|
309
|
+
* @deprecated
|
285
310
|
*/
|
286
|
-
vector_store_ids
|
311
|
+
vector_store_ids?: Array<string> | null;
|
287
312
|
/**
|
288
313
|
* Number of results to return
|
289
314
|
*/
|
@@ -292,6 +317,10 @@ export interface FileSearchParams {
|
|
292
317
|
* Optional filter conditions
|
293
318
|
*/
|
294
319
|
filters?: Shared.SearchFilter | Shared.SearchFilterCondition | Array<Shared.SearchFilter | Shared.SearchFilterCondition> | null;
|
320
|
+
/**
|
321
|
+
* Optional list of file IDs to filter chunks by (inclusion filter)
|
322
|
+
*/
|
323
|
+
file_ids?: Array<unknown> | Array<string> | null;
|
295
324
|
/**
|
296
325
|
* Search configuration options
|
297
326
|
*/
|
@@ -310,6 +339,10 @@ export declare namespace FileSearchParams {
|
|
310
339
|
* Whether to rewrite the query
|
311
340
|
*/
|
312
341
|
rewrite_query?: boolean;
|
342
|
+
/**
|
343
|
+
* Whether to rerank results and optional reranking configuration
|
344
|
+
*/
|
345
|
+
rerank?: boolean | FilesAPI.RerankConfig | null;
|
313
346
|
/**
|
314
347
|
* Whether to return file metadata
|
315
348
|
*/
|
@@ -325,6 +358,6 @@ export declare namespace FileSearchParams {
|
|
325
358
|
}
|
326
359
|
}
|
327
360
|
export declare namespace Files {
|
328
|
-
export { type ScoredVectorStoreFile as ScoredVectorStoreFile, type VectorStoreFile as VectorStoreFile, type FileDeleteResponse as FileDeleteResponse, type FileSearchResponse as FileSearchResponse, type VectorStoreFilesLimitOffset as VectorStoreFilesLimitOffset, type FileCreateParams as FileCreateParams, type FileRetrieveParams as FileRetrieveParams, type FileListParams as FileListParams, type FileDeleteParams as FileDeleteParams, type FileSearchParams as FileSearchParams, };
|
361
|
+
export { type RerankConfig as RerankConfig, type ScoredVectorStoreFile as ScoredVectorStoreFile, type VectorStoreFileStatus as VectorStoreFileStatus, type VectorStoreFile as VectorStoreFile, type FileDeleteResponse as FileDeleteResponse, type FileSearchResponse as FileSearchResponse, type VectorStoreFilesLimitOffset as VectorStoreFilesLimitOffset, type FileCreateParams as FileCreateParams, type FileRetrieveParams as FileRetrieveParams, type FileListParams as FileListParams, type FileDeleteParams as FileDeleteParams, type FileSearchParams as FileSearchParams, };
|
329
362
|
}
|
330
363
|
//# sourceMappingURL=files.d.mts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"files.d.mts","sourceRoot":"","sources":["../../src/resources/vector-stores/files.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,KAAK,eAAe;OACpB,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,WAAW,EAAE;OACpD,EAAE,cAAc,EAAE;
|
1
|
+
{"version":3,"file":"files.d.mts","sourceRoot":"","sources":["../../src/resources/vector-stores/files.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,QAAQ;OACb,KAAK,MAAM;OACX,KAAK,eAAe;OACpB,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,WAAW,EAAE;OACpD,EAAE,cAAc,EAAE;OAElB,EAAE,UAAU,EAAE;AAGrB,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;OAOG;IACH,MAAM,CACJ,qBAAqB,EAAE,MAAM,EAC7B,IAAI,EAAE,gBAAgB,EACtB,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,eAAe,CAAC;IAI9B;;;;;;;OAOG;IACH,QAAQ,CACN,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,eAAe,CAAC;IAK9B;;;;;;;OAOG;IACH,IAAI,CACF,qBAAqB,EAAE,MAAM,EAC7B,KAAK,GAAE,cAAc,GAAG,IAAI,GAAG,SAAc,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,2BAA2B,EAAE,eAAe,CAAC;IAQ5D;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAA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B,IAAI,2BAA2B,EAC/D,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { APIResource } from "../../core/resource.js";
|
2
|
+
import * as FilesAPI from "./files.js";
|
2
3
|
import * as Shared from "../shared.js";
|
3
4
|
import * as VectorStoresAPI from "./vector-stores.js";
|
4
5
|
import { APIPromise } from "../../core/api-promise.js";
|
@@ -9,16 +10,17 @@ export declare class Files extends APIResource {
|
|
9
10
|
/**
|
10
11
|
* Upload a new file to a vector store for indexing.
|
11
12
|
*
|
12
|
-
* Args:
|
13
|
-
* upload and index
|
13
|
+
* Args: vector_store_identifier: The ID or name of the vector store to upload to
|
14
|
+
* file: The file to upload and index
|
14
15
|
*
|
15
16
|
* Returns: VectorStoreFile: Details of the uploaded and indexed file
|
16
17
|
*/
|
17
|
-
create(
|
18
|
+
create(vectorStoreIdentifier: string, body: FileCreateParams, options?: RequestOptions): APIPromise<VectorStoreFile>;
|
18
19
|
/**
|
19
20
|
* Get details of a specific file in a vector store.
|
20
21
|
*
|
21
|
-
* Args:
|
22
|
+
* Args: vector_store_identifier: The ID or name of the vector store file_id: The
|
23
|
+
* ID of the file
|
22
24
|
*
|
23
25
|
* Returns: VectorStoreFile: Details of the vector store file
|
24
26
|
*/
|
@@ -26,17 +28,17 @@ export declare class Files extends APIResource {
|
|
26
28
|
/**
|
27
29
|
* List files indexed in a vector store with pagination.
|
28
30
|
*
|
29
|
-
* Args:
|
30
|
-
* parameters
|
31
|
+
* Args: vector_store_identifier: The ID or name of the vector store pagination:
|
32
|
+
* Pagination parameters
|
31
33
|
*
|
32
34
|
* Returns: VectorStoreFileListResponse: Paginated list of vector store files
|
33
35
|
*/
|
34
|
-
list(
|
36
|
+
list(vectorStoreIdentifier: string, query?: FileListParams | null | undefined, options?: RequestOptions): PagePromise<VectorStoreFilesLimitOffset, VectorStoreFile>;
|
35
37
|
/**
|
36
38
|
* Delete a file from a vector store.
|
37
39
|
*
|
38
|
-
* Args:
|
39
|
-
* delete
|
40
|
+
* Args: vector_store_identifier: The ID or name of the vector store file_id: The
|
41
|
+
* ID of the file to delete
|
40
42
|
*
|
41
43
|
* Returns: VectorStoreFileDeleted: The deleted file
|
42
44
|
*/
|
@@ -63,40 +65,40 @@ export declare class Files extends APIResource {
|
|
63
65
|
/**
|
64
66
|
* Poll for a file's processing status until it reaches a terminal state.
|
65
67
|
*
|
66
|
-
* @param
|
68
|
+
* @param vectorStoreIdentifier - The identifier of the vector store
|
67
69
|
* @param fileId - The ID of the file to poll
|
68
70
|
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
69
71
|
* @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
|
70
72
|
* @param options - Additional request options
|
71
73
|
* @returns The file object once it reaches a terminal state
|
72
74
|
*/
|
73
|
-
poll(
|
75
|
+
poll(vectorStoreIdentifier: string, fileId: string, pollIntervalMs?: number, pollTimeoutMs?: number, options?: RequestOptions): Promise<VectorStoreFile>;
|
74
76
|
/**
|
75
77
|
* Create a file in a vector store and wait for it to be processed.
|
76
78
|
*
|
77
|
-
* @param
|
79
|
+
* @param vectorStoreIdentifier - The identifier of the vector store to upload to
|
78
80
|
* @param body - The file creation parameters
|
79
81
|
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
80
82
|
* @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
|
81
83
|
* @param options - Additional request options
|
82
84
|
* @returns The file object once it reaches a terminal state
|
83
85
|
*/
|
84
|
-
createAndPoll(
|
86
|
+
createAndPoll(vectorStoreIdentifier: string, body: FileCreateParams, pollIntervalMs?: number, pollTimeoutMs?: number, options?: RequestOptions): Promise<VectorStoreFile>;
|
85
87
|
/**
|
86
88
|
* Upload a file to the files API and then create a file in a vector store.
|
87
89
|
* Note the file will be asynchronously processed.
|
88
90
|
*
|
89
|
-
* @param
|
91
|
+
* @param vectorStoreIdentifier - The identifier of the vector store to add the file to
|
90
92
|
* @param file - The file to upload
|
91
93
|
* @param body - Additional parameters for the vector store file
|
92
94
|
* @param options - Additional request options
|
93
95
|
* @returns The created vector store file
|
94
96
|
*/
|
95
|
-
upload(
|
97
|
+
upload(vectorStoreIdentifier: string, file: Uploadable, body?: Omit<FileCreateParams, 'file_id'>, options?: RequestOptions): Promise<VectorStoreFile>;
|
96
98
|
/**
|
97
99
|
* Upload a file to files API, create a file in a vector store, and poll until processing is complete.
|
98
100
|
*
|
99
|
-
* @param
|
101
|
+
* @param vectorStoreIdentifier - The identifier of the vector store to add the file to
|
100
102
|
* @param file - The file to upload
|
101
103
|
* @param body - Additional parameters for the vector store file
|
102
104
|
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
@@ -104,9 +106,27 @@ export declare class Files extends APIResource {
|
|
104
106
|
* @param options - Additional request options
|
105
107
|
* @returns The vector store file object once it reaches a terminal state
|
106
108
|
*/
|
107
|
-
uploadAndPoll(
|
109
|
+
uploadAndPoll(vectorStoreIdentifier: string, file: Uploadable, body?: Omit<FileCreateParams, 'file_id'>, pollIntervalMs?: number, pollTimeoutMs?: number, options?: RequestOptions): Promise<VectorStoreFile>;
|
108
110
|
}
|
109
111
|
export type VectorStoreFilesLimitOffset = LimitOffset<VectorStoreFile>;
|
112
|
+
/**
|
113
|
+
* Represents a reranking configuration.
|
114
|
+
*/
|
115
|
+
export interface RerankConfig {
|
116
|
+
/**
|
117
|
+
* The name of the reranking model
|
118
|
+
*/
|
119
|
+
model?: string;
|
120
|
+
/**
|
121
|
+
* Whether to include metadata in the reranked results
|
122
|
+
*/
|
123
|
+
with_metadata?: boolean | Array<string>;
|
124
|
+
/**
|
125
|
+
* Maximum number of results to return after reranking. If None, returns all
|
126
|
+
* reranked results.
|
127
|
+
*/
|
128
|
+
top_k?: number | null;
|
129
|
+
}
|
110
130
|
/**
|
111
131
|
* Represents a scored file stored in a vector store.
|
112
132
|
*/
|
@@ -126,7 +146,7 @@ export interface ScoredVectorStoreFile {
|
|
126
146
|
/**
|
127
147
|
* Processing status of the file
|
128
148
|
*/
|
129
|
-
status?:
|
149
|
+
status?: VectorStoreFileStatus;
|
130
150
|
/**
|
131
151
|
* Last error message if processing failed
|
132
152
|
*/
|
@@ -160,6 +180,7 @@ export interface ScoredVectorStoreFile {
|
|
160
180
|
*/
|
161
181
|
chunks: Array<VectorStoresAPI.ScoredTextInputChunk | VectorStoresAPI.ScoredImageURLInputChunk | VectorStoresAPI.ScoredAudioURLInputChunk | VectorStoresAPI.ScoredVideoURLInputChunk> | null;
|
162
182
|
}
|
183
|
+
export type VectorStoreFileStatus = 'pending' | 'in_progress' | 'cancelled' | 'completed' | 'failed';
|
163
184
|
/**
|
164
185
|
* Represents a file stored in a vector store.
|
165
186
|
*/
|
@@ -179,7 +200,7 @@ export interface VectorStoreFile {
|
|
179
200
|
/**
|
180
201
|
* Processing status of the file
|
181
202
|
*/
|
182
|
-
status?:
|
203
|
+
status?: VectorStoreFileStatus;
|
183
204
|
/**
|
184
205
|
* Last error message if processing failed
|
185
206
|
*/
|
@@ -263,17 +284,17 @@ export declare namespace FileCreateParams {
|
|
263
284
|
}
|
264
285
|
export interface FileRetrieveParams {
|
265
286
|
/**
|
266
|
-
* The ID of the vector store
|
287
|
+
* The ID or name of the vector store
|
267
288
|
*/
|
268
|
-
|
289
|
+
vector_store_identifier: string;
|
269
290
|
}
|
270
291
|
export interface FileListParams extends LimitOffsetParams {
|
271
292
|
}
|
272
293
|
export interface FileDeleteParams {
|
273
294
|
/**
|
274
|
-
* The ID of the vector store
|
295
|
+
* The ID or name of the vector store
|
275
296
|
*/
|
276
|
-
|
297
|
+
vector_store_identifier: string;
|
277
298
|
}
|
278
299
|
export interface FileSearchParams {
|
279
300
|
/**
|
@@ -281,9 +302,13 @@ export interface FileSearchParams {
|
|
281
302
|
*/
|
282
303
|
query: string;
|
283
304
|
/**
|
284
|
-
* IDs of vector stores to search
|
305
|
+
* IDs or names of vector stores to search
|
306
|
+
*/
|
307
|
+
vector_store_identifiers?: Array<string> | null;
|
308
|
+
/**
|
309
|
+
* @deprecated
|
285
310
|
*/
|
286
|
-
vector_store_ids
|
311
|
+
vector_store_ids?: Array<string> | null;
|
287
312
|
/**
|
288
313
|
* Number of results to return
|
289
314
|
*/
|
@@ -292,6 +317,10 @@ export interface FileSearchParams {
|
|
292
317
|
* Optional filter conditions
|
293
318
|
*/
|
294
319
|
filters?: Shared.SearchFilter | Shared.SearchFilterCondition | Array<Shared.SearchFilter | Shared.SearchFilterCondition> | null;
|
320
|
+
/**
|
321
|
+
* Optional list of file IDs to filter chunks by (inclusion filter)
|
322
|
+
*/
|
323
|
+
file_ids?: Array<unknown> | Array<string> | null;
|
295
324
|
/**
|
296
325
|
* Search configuration options
|
297
326
|
*/
|
@@ -310,6 +339,10 @@ export declare namespace FileSearchParams {
|
|
310
339
|
* Whether to rewrite the query
|
311
340
|
*/
|
312
341
|
rewrite_query?: boolean;
|
342
|
+
/**
|
343
|
+
* Whether to rerank results and optional reranking configuration
|
344
|
+
*/
|
345
|
+
rerank?: boolean | FilesAPI.RerankConfig | null;
|
313
346
|
/**
|
314
347
|
* Whether to return file metadata
|
315
348
|
*/
|
@@ -325,6 +358,6 @@ export declare namespace FileSearchParams {
|
|
325
358
|
}
|
326
359
|
}
|
327
360
|
export declare namespace Files {
|
328
|
-
export { type ScoredVectorStoreFile as ScoredVectorStoreFile, type VectorStoreFile as VectorStoreFile, type FileDeleteResponse as FileDeleteResponse, type FileSearchResponse as FileSearchResponse, type VectorStoreFilesLimitOffset as VectorStoreFilesLimitOffset, type FileCreateParams as FileCreateParams, type FileRetrieveParams as FileRetrieveParams, type FileListParams as FileListParams, type FileDeleteParams as FileDeleteParams, type FileSearchParams as FileSearchParams, };
|
361
|
+
export { type RerankConfig as RerankConfig, type ScoredVectorStoreFile as ScoredVectorStoreFile, type VectorStoreFileStatus as VectorStoreFileStatus, type VectorStoreFile as VectorStoreFile, type FileDeleteResponse as FileDeleteResponse, type FileSearchResponse as FileSearchResponse, type VectorStoreFilesLimitOffset as VectorStoreFilesLimitOffset, type FileCreateParams as FileCreateParams, type FileRetrieveParams as FileRetrieveParams, type FileListParams as FileListParams, type FileDeleteParams as FileDeleteParams, type FileSearchParams as FileSearchParams, };
|
329
362
|
}
|
330
363
|
//# sourceMappingURL=files.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/resources/vector-stores/files.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,KAAK,eAAe;OACpB,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,WAAW,EAAE;OACpD,EAAE,cAAc,EAAE;
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/resources/vector-stores/files.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,QAAQ;OACb,KAAK,MAAM;OACX,KAAK,eAAe;OACpB,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,WAAW,EAAE;OACpD,EAAE,cAAc,EAAE;OAElB,EAAE,UAAU,EAAE;AAGrB,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;OAOG;IACH,MAAM,CACJ,qBAAqB,EAAE,MAAM,EAC7B,IAAI,EAAE,gBAAgB,EACtB,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,eAAe,CAAC;IAI9B;;;;;;;OAOG;IACH,QAAQ,CACN,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,eAAe,CAAC;IAK9B;;;;;;;OAOG;IACH,IAAI,CACF,qBAAqB,E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M,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
|
@@ -5,53 +5,54 @@ exports.Files = void 0;
|
|
5
5
|
const tslib_1 = require("../../internal/tslib.js");
|
6
6
|
const resource_1 = require("../../core/resource.js");
|
7
7
|
const pagination_1 = require("../../core/pagination.js");
|
8
|
-
const path_1 = require("../../internal/utils/path.js");
|
9
8
|
const polling = tslib_1.__importStar(require("../../lib/polling.js"));
|
9
|
+
const path_1 = require("../../internal/utils/path.js");
|
10
10
|
class Files extends resource_1.APIResource {
|
11
11
|
/**
|
12
12
|
* Upload a new file to a vector store for indexing.
|
13
13
|
*
|
14
|
-
* Args:
|
15
|
-
* upload and index
|
14
|
+
* Args: vector_store_identifier: The ID or name of the vector store to upload to
|
15
|
+
* file: The file to upload and index
|
16
16
|
*
|
17
17
|
* Returns: VectorStoreFile: Details of the uploaded and indexed file
|
18
18
|
*/
|
19
|
-
create(
|
20
|
-
return this._client.post((0, path_1.path) `/v1/vector_stores/${
|
19
|
+
create(vectorStoreIdentifier, body, options) {
|
20
|
+
return this._client.post((0, path_1.path) `/v1/vector_stores/${vectorStoreIdentifier}/files`, { body, ...options });
|
21
21
|
}
|
22
22
|
/**
|
23
23
|
* Get details of a specific file in a vector store.
|
24
24
|
*
|
25
|
-
* Args:
|
25
|
+
* Args: vector_store_identifier: The ID or name of the vector store file_id: The
|
26
|
+
* ID of the file
|
26
27
|
*
|
27
28
|
* Returns: VectorStoreFile: Details of the vector store file
|
28
29
|
*/
|
29
30
|
retrieve(fileID, params, options) {
|
30
|
-
const {
|
31
|
-
return this._client.get((0, path_1.path) `/v1/vector_stores/${
|
31
|
+
const { vector_store_identifier } = params;
|
32
|
+
return this._client.get((0, path_1.path) `/v1/vector_stores/${vector_store_identifier}/files/${fileID}`, options);
|
32
33
|
}
|
33
34
|
/**
|
34
35
|
* List files indexed in a vector store with pagination.
|
35
36
|
*
|
36
|
-
* Args:
|
37
|
-
* parameters
|
37
|
+
* Args: vector_store_identifier: The ID or name of the vector store pagination:
|
38
|
+
* Pagination parameters
|
38
39
|
*
|
39
40
|
* Returns: VectorStoreFileListResponse: Paginated list of vector store files
|
40
41
|
*/
|
41
|
-
list(
|
42
|
-
return this._client.getAPIList((0, path_1.path) `/v1/vector_stores/${
|
42
|
+
list(vectorStoreIdentifier, query = {}, options) {
|
43
|
+
return this._client.getAPIList((0, path_1.path) `/v1/vector_stores/${vectorStoreIdentifier}/files`, (pagination_1.LimitOffset), { query, ...options });
|
43
44
|
}
|
44
45
|
/**
|
45
46
|
* Delete a file from a vector store.
|
46
47
|
*
|
47
|
-
* Args:
|
48
|
-
* delete
|
48
|
+
* Args: vector_store_identifier: The ID or name of the vector store file_id: The
|
49
|
+
* ID of the file to delete
|
49
50
|
*
|
50
51
|
* Returns: VectorStoreFileDeleted: The deleted file
|
51
52
|
*/
|
52
53
|
delete(fileID, params, options) {
|
53
|
-
const {
|
54
|
-
return this._client.delete((0, path_1.path) `/v1/vector_stores/${
|
54
|
+
const { vector_store_identifier } = params;
|
55
|
+
return this._client.delete((0, path_1.path) `/v1/vector_stores/${vector_store_identifier}/files/${fileID}`, options);
|
55
56
|
}
|
56
57
|
/**
|
57
58
|
* Perform semantic search across complete vector store files.
|
@@ -77,19 +78,19 @@ class Files extends resource_1.APIResource {
|
|
77
78
|
/**
|
78
79
|
* Poll for a file's processing status until it reaches a terminal state.
|
79
80
|
*
|
80
|
-
* @param
|
81
|
+
* @param vectorStoreIdentifier - The identifier of the vector store
|
81
82
|
* @param fileId - The ID of the file to poll
|
82
83
|
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
83
84
|
* @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
|
84
85
|
* @param options - Additional request options
|
85
86
|
* @returns The file object once it reaches a terminal state
|
86
87
|
*/
|
87
|
-
async poll(
|
88
|
+
async poll(vectorStoreIdentifier, fileId, pollIntervalMs, pollTimeoutMs, options) {
|
88
89
|
const pollingIntervalMs = pollIntervalMs || 500;
|
89
90
|
const pollingTimeoutMs = pollTimeoutMs;
|
90
91
|
return polling.poll({
|
91
|
-
fn: () => this.retrieve(fileId, {
|
92
|
-
condition: (result) => result.status === 'completed' || result.status === 'failed' || result.status === '
|
92
|
+
fn: () => this.retrieve(fileId, { vector_store_identifier: vectorStoreIdentifier, ...options }),
|
93
|
+
condition: (result) => result.status === 'completed' || result.status === 'failed' || result.status === 'cancelled',
|
93
94
|
intervalSeconds: pollingIntervalMs / 1000,
|
94
95
|
...(pollingTimeoutMs && { timeoutSeconds: pollingTimeoutMs / 1000 }),
|
95
96
|
});
|
@@ -97,30 +98,30 @@ class Files extends resource_1.APIResource {
|
|
97
98
|
/**
|
98
99
|
* Create a file in a vector store and wait for it to be processed.
|
99
100
|
*
|
100
|
-
* @param
|
101
|
+
* @param vectorStoreIdentifier - The identifier of the vector store to upload to
|
101
102
|
* @param body - The file creation parameters
|
102
103
|
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
103
104
|
* @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
|
104
105
|
* @param options - Additional request options
|
105
106
|
* @returns The file object once it reaches a terminal state
|
106
107
|
*/
|
107
|
-
async createAndPoll(
|
108
|
-
const file = await this.create(
|
109
|
-
return this.poll(
|
108
|
+
async createAndPoll(vectorStoreIdentifier, body, pollIntervalMs, pollTimeoutMs, options) {
|
109
|
+
const file = await this.create(vectorStoreIdentifier, body, options);
|
110
|
+
return this.poll(vectorStoreIdentifier, file.id, pollIntervalMs, pollTimeoutMs, options);
|
110
111
|
}
|
111
112
|
/**
|
112
113
|
* Upload a file to the files API and then create a file in a vector store.
|
113
114
|
* Note the file will be asynchronously processed.
|
114
115
|
*
|
115
|
-
* @param
|
116
|
+
* @param vectorStoreIdentifier - The identifier of the vector store to add the file to
|
116
117
|
* @param file - The file to upload
|
117
118
|
* @param body - Additional parameters for the vector store file
|
118
119
|
* @param options - Additional request options
|
119
120
|
* @returns The created vector store file
|
120
121
|
*/
|
121
|
-
async upload(
|
122
|
+
async upload(vectorStoreIdentifier, file, body, options) {
|
122
123
|
const fileUploadResponse = await this._client.files.create({ file }, options);
|
123
|
-
return this.create(
|
124
|
+
return this.create(vectorStoreIdentifier, {
|
124
125
|
file_id: fileUploadResponse.id,
|
125
126
|
...body,
|
126
127
|
}, options);
|
@@ -128,7 +129,7 @@ class Files extends resource_1.APIResource {
|
|
128
129
|
/**
|
129
130
|
* Upload a file to files API, create a file in a vector store, and poll until processing is complete.
|
130
131
|
*
|
131
|
-
* @param
|
132
|
+
* @param vectorStoreIdentifier - The identifier of the vector store to add the file to
|
132
133
|
* @param file - The file to upload
|
133
134
|
* @param body - Additional parameters for the vector store file
|
134
135
|
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
@@ -136,9 +137,9 @@ class Files extends resource_1.APIResource {
|
|
136
137
|
* @param options - Additional request options
|
137
138
|
* @returns The vector store file object once it reaches a terminal state
|
138
139
|
*/
|
139
|
-
async uploadAndPoll(
|
140
|
-
const vectorStoreFile = await this.upload(
|
141
|
-
return this.poll(
|
140
|
+
async uploadAndPoll(vectorStoreIdentifier, file, body, pollIntervalMs, pollTimeoutMs, options) {
|
141
|
+
const vectorStoreFile = await this.upload(vectorStoreIdentifier, file, body, options);
|
142
|
+
return this.poll(vectorStoreIdentifier, vectorStoreFile.id, pollIntervalMs, pollTimeoutMs, options);
|
142
143
|
}
|
143
144
|
}
|
144
145
|
exports.Files = Files;
|