@mixedbread/sdk 0.1.0-alpha.8
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 +210 -0
- package/LICENSE +201 -0
- package/README.md +360 -0
- package/_shims/MultipartBody.d.ts +9 -0
- package/_shims/MultipartBody.d.ts.map +1 -0
- package/_shims/MultipartBody.js +16 -0
- package/_shims/MultipartBody.js.map +1 -0
- package/_shims/MultipartBody.mjs +12 -0
- package/_shims/MultipartBody.mjs.map +1 -0
- package/_shims/README.md +46 -0
- package/_shims/auto/runtime-bun.d.ts +5 -0
- package/_shims/auto/runtime-bun.d.ts.map +1 -0
- package/_shims/auto/runtime-bun.js +21 -0
- package/_shims/auto/runtime-bun.js.map +1 -0
- package/_shims/auto/runtime-bun.mjs +2 -0
- package/_shims/auto/runtime-bun.mjs.map +1 -0
- package/_shims/auto/runtime-node.d.ts +5 -0
- package/_shims/auto/runtime-node.d.ts.map +1 -0
- package/_shims/auto/runtime-node.js +21 -0
- package/_shims/auto/runtime-node.js.map +1 -0
- package/_shims/auto/runtime-node.mjs +2 -0
- package/_shims/auto/runtime-node.mjs.map +1 -0
- package/_shims/auto/runtime.d.ts +5 -0
- package/_shims/auto/runtime.d.ts.map +1 -0
- package/_shims/auto/runtime.js +21 -0
- package/_shims/auto/runtime.js.map +1 -0
- package/_shims/auto/runtime.mjs +2 -0
- package/_shims/auto/runtime.mjs.map +1 -0
- package/_shims/auto/types-node.d.ts +5 -0
- package/_shims/auto/types-node.d.ts.map +1 -0
- package/_shims/auto/types-node.js +21 -0
- package/_shims/auto/types-node.js.map +1 -0
- package/_shims/auto/types-node.mjs +2 -0
- package/_shims/auto/types-node.mjs.map +1 -0
- package/_shims/auto/types.d.ts +101 -0
- package/_shims/auto/types.js +3 -0
- package/_shims/auto/types.mjs +3 -0
- package/_shims/bun-runtime.d.ts +6 -0
- package/_shims/bun-runtime.d.ts.map +1 -0
- package/_shims/bun-runtime.js +14 -0
- package/_shims/bun-runtime.js.map +1 -0
- package/_shims/bun-runtime.mjs +10 -0
- package/_shims/bun-runtime.mjs.map +1 -0
- package/_shims/index.d.ts +81 -0
- package/_shims/index.js +13 -0
- package/_shims/index.mjs +7 -0
- package/_shims/manual-types.d.ts +12 -0
- package/_shims/manual-types.js +3 -0
- package/_shims/manual-types.mjs +3 -0
- package/_shims/node-runtime.d.ts +3 -0
- package/_shims/node-runtime.d.ts.map +1 -0
- package/_shims/node-runtime.js +89 -0
- package/_shims/node-runtime.js.map +1 -0
- package/_shims/node-runtime.mjs +56 -0
- package/_shims/node-runtime.mjs.map +1 -0
- package/_shims/node-types.d.ts +42 -0
- package/_shims/node-types.js +3 -0
- package/_shims/node-types.mjs +3 -0
- package/_shims/registry.d.ts +37 -0
- package/_shims/registry.d.ts.map +1 -0
- package/_shims/registry.js +41 -0
- package/_shims/registry.js.map +1 -0
- package/_shims/registry.mjs +37 -0
- package/_shims/registry.mjs.map +1 -0
- package/_shims/web-runtime.d.ts +5 -0
- package/_shims/web-runtime.d.ts.map +1 -0
- package/_shims/web-runtime.js +78 -0
- package/_shims/web-runtime.js.map +1 -0
- package/_shims/web-runtime.mjs +71 -0
- package/_shims/web-runtime.mjs.map +1 -0
- package/_shims/web-types.d.ts +83 -0
- package/_shims/web-types.js +3 -0
- package/_shims/web-types.mjs +3 -0
- package/core.d.ts +241 -0
- package/core.d.ts.map +1 -0
- package/core.js +914 -0
- package/core.js.map +1 -0
- package/core.mjs +882 -0
- package/core.mjs.map +1 -0
- package/error.d.ts +47 -0
- package/error.d.ts.map +1 -0
- package/error.js +113 -0
- package/error.js.map +1 -0
- package/error.mjs +97 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +148 -0
- package/index.d.ts +148 -0
- package/index.d.ts.map +1 -0
- package/index.js +151 -0
- package/index.js.map +1 -0
- package/index.mjs +108 -0
- package/index.mjs.map +1 -0
- package/lib/polling.d.ts +48 -0
- package/lib/polling.d.ts.map +1 -0
- package/lib/polling.js +75 -0
- package/lib/polling.js.map +1 -0
- package/lib/polling.mjs +71 -0
- package/lib/polling.mjs.map +1 -0
- package/package.json +124 -0
- package/pagination.d.ts +30 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +45 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +41 -0
- package/pagination.mjs.map +1 -0
- package/resource.d.ts +6 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +11 -0
- package/resource.js.map +1 -0
- package/resource.mjs +7 -0
- package/resource.mjs.map +1 -0
- package/resources/extractions/content.d.ts +35 -0
- package/resources/extractions/content.d.ts.map +1 -0
- package/resources/extractions/content.js +19 -0
- package/resources/extractions/content.js.map +1 -0
- package/resources/extractions/content.mjs +15 -0
- package/resources/extractions/content.mjs.map +1 -0
- package/resources/extractions/extractions.d.ts +18 -0
- package/resources/extractions/extractions.d.ts.map +1 -0
- package/resources/extractions/extractions.js +47 -0
- package/resources/extractions/extractions.js.map +1 -0
- package/resources/extractions/extractions.mjs +20 -0
- package/resources/extractions/extractions.mjs.map +1 -0
- package/resources/extractions/index.d.ts +5 -0
- package/resources/extractions/index.d.ts.map +1 -0
- package/resources/extractions/index.js +13 -0
- package/resources/extractions/index.js.map +1 -0
- package/resources/extractions/index.mjs +6 -0
- package/resources/extractions/index.mjs.map +1 -0
- package/resources/extractions/jobs.d.ts +44 -0
- package/resources/extractions/jobs.d.ts.map +1 -0
- package/resources/extractions/jobs.js +29 -0
- package/resources/extractions/jobs.js.map +1 -0
- package/resources/extractions/jobs.mjs +25 -0
- package/resources/extractions/jobs.mjs.map +1 -0
- package/resources/extractions/schema.d.ts +85 -0
- package/resources/extractions/schema.d.ts.map +1 -0
- package/resources/extractions/schema.js +39 -0
- package/resources/extractions/schema.js.map +1 -0
- package/resources/extractions/schema.mjs +35 -0
- package/resources/extractions/schema.mjs.map +1 -0
- package/resources/files.d.ts +125 -0
- package/resources/files.d.ts.map +1 -0
- package/resources/files.js +99 -0
- package/resources/files.js.map +1 -0
- package/resources/files.mjs +71 -0
- package/resources/files.mjs.map +1 -0
- package/resources/index.d.ts +7 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +30 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +7 -0
- package/resources/index.mjs.map +1 -0
- package/resources/parsing/index.d.ts +3 -0
- package/resources/parsing/index.d.ts.map +1 -0
- package/resources/parsing/index.js +10 -0
- package/resources/parsing/index.js.map +1 -0
- package/resources/parsing/index.mjs +4 -0
- package/resources/parsing/index.mjs.map +1 -0
- package/resources/parsing/jobs.d.ts +278 -0
- package/resources/parsing/jobs.d.ts.map +1 -0
- package/resources/parsing/jobs.js +147 -0
- package/resources/parsing/jobs.js.map +1 -0
- package/resources/parsing/jobs.mjs +119 -0
- package/resources/parsing/jobs.mjs.map +1 -0
- package/resources/parsing/parsing.d.ts +10 -0
- package/resources/parsing/parsing.d.ts.map +1 -0
- package/resources/parsing/parsing.js +40 -0
- package/resources/parsing/parsing.js.map +1 -0
- package/resources/parsing/parsing.mjs +13 -0
- package/resources/parsing/parsing.mjs.map +1 -0
- package/resources/shared.d.ts +35 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/resources/top-level.d.ts +11 -0
- package/resources/top-level.d.ts.map +1 -0
- package/resources/top-level.js +4 -0
- package/resources/top-level.js.map +1 -0
- package/resources/top-level.mjs +3 -0
- package/resources/top-level.mjs.map +1 -0
- package/resources/vector-stores/files.d.ts +280 -0
- package/resources/vector-stores/files.d.ts.map +1 -0
- package/resources/vector-stores/files.js +167 -0
- package/resources/vector-stores/files.js.map +1 -0
- package/resources/vector-stores/files.mjs +139 -0
- package/resources/vector-stores/files.mjs.map +1 -0
- package/resources/vector-stores/index.d.ts +3 -0
- package/resources/vector-stores/index.d.ts.map +1 -0
- package/resources/vector-stores/index.js +11 -0
- package/resources/vector-stores/index.js.map +1 -0
- package/resources/vector-stores/index.mjs +4 -0
- package/resources/vector-stores/index.mjs.map +1 -0
- package/resources/vector-stores/vector-stores.d.ts +400 -0
- package/resources/vector-stores/vector-stores.d.ts.map +1 -0
- package/resources/vector-stores/vector-stores.js +121 -0
- package/resources/vector-stores/vector-stores.js.map +1 -0
- package/resources/vector-stores/vector-stores.mjs +93 -0
- package/resources/vector-stores/vector-stores.mjs.map +1 -0
- package/shims/node.d.ts +30 -0
- package/shims/node.d.ts.map +1 -0
- package/shims/node.js +31 -0
- package/shims/node.js.map +1 -0
- package/shims/node.mjs +5 -0
- package/shims/node.mjs.map +1 -0
- package/shims/web.d.ts +26 -0
- package/shims/web.d.ts.map +1 -0
- package/shims/web.js +31 -0
- package/shims/web.js.map +1 -0
- package/shims/web.mjs +5 -0
- package/shims/web.mjs.map +1 -0
- package/src/_shims/MultipartBody.ts +9 -0
- package/src/_shims/README.md +46 -0
- package/src/_shims/auto/runtime-bun.ts +4 -0
- package/src/_shims/auto/runtime-node.ts +4 -0
- package/src/_shims/auto/runtime.ts +4 -0
- package/src/_shims/auto/types-node.ts +4 -0
- package/src/_shims/auto/types.d.ts +101 -0
- package/src/_shims/auto/types.js +3 -0
- package/src/_shims/auto/types.mjs +3 -0
- package/src/_shims/bun-runtime.ts +14 -0
- package/src/_shims/index.d.ts +81 -0
- package/src/_shims/index.js +13 -0
- package/src/_shims/index.mjs +7 -0
- package/src/_shims/manual-types.d.ts +12 -0
- package/src/_shims/manual-types.js +3 -0
- package/src/_shims/manual-types.mjs +3 -0
- package/src/_shims/node-runtime.ts +81 -0
- package/src/_shims/node-types.d.ts +42 -0
- package/src/_shims/node-types.js +3 -0
- package/src/_shims/node-types.mjs +3 -0
- package/src/_shims/registry.ts +67 -0
- package/src/_shims/web-runtime.ts +103 -0
- package/src/_shims/web-types.d.ts +83 -0
- package/src/_shims/web-types.js +3 -0
- package/src/_shims/web-types.mjs +3 -0
- package/src/core.ts +1208 -0
- package/src/error.ts +130 -0
- package/src/index.ts +294 -0
- package/src/lib/.keep +4 -0
- package/src/lib/polling.ts +115 -0
- package/src/pagination.ts +82 -0
- package/src/resource.ts +11 -0
- package/src/resources/extractions/content.ts +43 -0
- package/src/resources/extractions/extractions.ts +47 -0
- package/src/resources/extractions/index.ts +14 -0
- package/src/resources/extractions/jobs.ts +55 -0
- package/src/resources/extractions/schema.ts +111 -0
- package/src/resources/files.ts +181 -0
- package/src/resources/index.ts +32 -0
- package/src/resources/parsing/index.ts +12 -0
- package/src/resources/parsing/jobs.ts +438 -0
- package/src/resources/parsing/parsing.ts +32 -0
- package/src/resources/shared.ts +41 -0
- package/src/resources/top-level.ts +14 -0
- package/src/resources/vector-stores/files.ts +434 -0
- package/src/resources/vector-stores/index.ts +30 -0
- package/src/resources/vector-stores/vector-stores.ts +561 -0
- package/src/shims/node.ts +50 -0
- package/src/shims/web.ts +50 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +255 -0
- package/src/version.ts +1 -0
- package/uploads.d.ts +75 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +171 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +158 -0
- package/uploads.mjs.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
@@ -0,0 +1,434 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
import { APIResource } from '../../resource';
|
4
|
+
import { isRequestOptions } from '../../core';
|
5
|
+
import * as Core from '../../core';
|
6
|
+
import * as Shared from '../shared';
|
7
|
+
import * as VectorStoresAPI from './vector-stores';
|
8
|
+
import { LimitOffset, type LimitOffsetParams } from '../../pagination';
|
9
|
+
import * as polling from '../../lib/polling';
|
10
|
+
import { Uploadable } from '../../uploads';
|
11
|
+
|
12
|
+
export class Files extends APIResource {
|
13
|
+
/**
|
14
|
+
* Upload a new file to a vector store for indexing.
|
15
|
+
*
|
16
|
+
* Args: vector_store_id: The ID of the vector store to upload to file: The file to
|
17
|
+
* upload and index
|
18
|
+
*
|
19
|
+
* Returns: VectorStoreFile: Details of the uploaded and indexed file
|
20
|
+
*/
|
21
|
+
create(
|
22
|
+
vectorStoreId: string,
|
23
|
+
body: FileCreateParams,
|
24
|
+
options?: Core.RequestOptions,
|
25
|
+
): Core.APIPromise<VectorStoreFile> {
|
26
|
+
return this._client.post(`/v1/vector_stores/${vectorStoreId}/files`, { body, ...options });
|
27
|
+
}
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Get details of a specific file in a vector store.
|
31
|
+
*
|
32
|
+
* Args: vector_store_id: The ID of the vector store file_id: The ID of the file
|
33
|
+
*
|
34
|
+
* Returns: VectorStoreFile: Details of the vector store file
|
35
|
+
*/
|
36
|
+
retrieve(
|
37
|
+
vectorStoreId: string,
|
38
|
+
fileId: string,
|
39
|
+
options?: Core.RequestOptions,
|
40
|
+
): Core.APIPromise<VectorStoreFile> {
|
41
|
+
return this._client.get(`/v1/vector_stores/${vectorStoreId}/files/${fileId}`, options);
|
42
|
+
}
|
43
|
+
|
44
|
+
/**
|
45
|
+
* List files indexed in a vector store with pagination.
|
46
|
+
*
|
47
|
+
* Args: vector_store_id: The ID of the vector store pagination: Pagination
|
48
|
+
* parameters
|
49
|
+
*
|
50
|
+
* Returns: VectorStoreFileListResponse: Paginated list of vector store files
|
51
|
+
*/
|
52
|
+
list(
|
53
|
+
vectorStoreId: string,
|
54
|
+
query?: FileListParams,
|
55
|
+
options?: Core.RequestOptions,
|
56
|
+
): Core.PagePromise<VectorStoreFilesLimitOffset, VectorStoreFile>;
|
57
|
+
list(
|
58
|
+
vectorStoreId: string,
|
59
|
+
options?: Core.RequestOptions,
|
60
|
+
): Core.PagePromise<VectorStoreFilesLimitOffset, VectorStoreFile>;
|
61
|
+
list(
|
62
|
+
vectorStoreId: string,
|
63
|
+
query: FileListParams | Core.RequestOptions = {},
|
64
|
+
options?: Core.RequestOptions,
|
65
|
+
): Core.PagePromise<VectorStoreFilesLimitOffset, VectorStoreFile> {
|
66
|
+
if (isRequestOptions(query)) {
|
67
|
+
return this.list(vectorStoreId, {}, query);
|
68
|
+
}
|
69
|
+
return this._client.getAPIList(`/v1/vector_stores/${vectorStoreId}/files`, VectorStoreFilesLimitOffset, {
|
70
|
+
query,
|
71
|
+
...options,
|
72
|
+
});
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Delete a file from a vector store.
|
77
|
+
*
|
78
|
+
* Args: vector_store_id: The ID of the vector store file_id: The ID of the file to
|
79
|
+
* delete
|
80
|
+
*
|
81
|
+
* Returns: VectorStoreFileDeleted: The deleted file
|
82
|
+
*/
|
83
|
+
delete(
|
84
|
+
vectorStoreId: string,
|
85
|
+
fileId: string,
|
86
|
+
options?: Core.RequestOptions,
|
87
|
+
): Core.APIPromise<FileDeleteResponse> {
|
88
|
+
return this._client.delete(`/v1/vector_stores/${vectorStoreId}/files/${fileId}`, options);
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Perform semantic search across complete vector store files.
|
93
|
+
*
|
94
|
+
* This endpoint searches through vector store files using semantic similarity
|
95
|
+
* matching. Unlike chunk search, it returns complete matching files rather than
|
96
|
+
* individual chunks. Supports complex search queries with filters and returns
|
97
|
+
* relevance-scored results.
|
98
|
+
*
|
99
|
+
* Args: search_params: Search configuration including: - query text or
|
100
|
+
* embeddings - metadata filters - pagination parameters - sorting preferences
|
101
|
+
* \_state: API state dependency \_ctx: Service context dependency
|
102
|
+
*
|
103
|
+
* Returns: VectorStoreSearchFileResponse containing: - List of matched files with
|
104
|
+
* relevance scores - Pagination details including total result count
|
105
|
+
*
|
106
|
+
* Raises: HTTPException (400): If search parameters are invalid HTTPException
|
107
|
+
* (404): If no vector stores are found to search
|
108
|
+
*/
|
109
|
+
search(body: FileSearchParams, options?: Core.RequestOptions): Core.APIPromise<FileSearchResponse> {
|
110
|
+
return this._client.post('/v1/vector_stores/files/search', { body, ...options });
|
111
|
+
}
|
112
|
+
|
113
|
+
/**
|
114
|
+
* Poll for a file's processing status until it reaches a terminal state.
|
115
|
+
*
|
116
|
+
* @param vectorStoreId - The ID of the vector store
|
117
|
+
* @param fileId - The ID of the file to poll
|
118
|
+
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
119
|
+
* @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
|
120
|
+
* @param options - Additional request options
|
121
|
+
* @returns The file object once it reaches a terminal state
|
122
|
+
*/
|
123
|
+
async poll(
|
124
|
+
vectorStoreId: string,
|
125
|
+
fileId: string,
|
126
|
+
pollIntervalMs?: number,
|
127
|
+
pollTimeoutMs?: number,
|
128
|
+
options?: Core.RequestOptions,
|
129
|
+
): Promise<VectorStoreFile> {
|
130
|
+
const pollingIntervalMs = pollIntervalMs || 500;
|
131
|
+
const pollingTimeoutMs = pollTimeoutMs;
|
132
|
+
|
133
|
+
return polling.poll({
|
134
|
+
fn: () => this.retrieve(vectorStoreId, fileId, options),
|
135
|
+
condition: (result) =>
|
136
|
+
result.status === 'completed' || result.status === 'failed' || result.status === 'error',
|
137
|
+
intervalSeconds: pollingIntervalMs / 1000,
|
138
|
+
...(pollingTimeoutMs && { timeoutSeconds: pollingTimeoutMs / 1000 }),
|
139
|
+
});
|
140
|
+
}
|
141
|
+
|
142
|
+
/**
|
143
|
+
* Create a file in a vector store and wait for it to be processed.
|
144
|
+
*
|
145
|
+
* @param vectorStoreId - The ID of the vector store to upload to
|
146
|
+
* @param body - The file creation parameters
|
147
|
+
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
148
|
+
* @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
|
149
|
+
* @param options - Additional request options
|
150
|
+
* @returns The file object once it reaches a terminal state
|
151
|
+
*/
|
152
|
+
async createAndPoll(
|
153
|
+
vectorStoreId: string,
|
154
|
+
body: FileCreateParams,
|
155
|
+
pollIntervalMs?: number,
|
156
|
+
pollTimeoutMs?: number,
|
157
|
+
options?: Core.RequestOptions,
|
158
|
+
): Promise<VectorStoreFile> {
|
159
|
+
const file = await this.create(vectorStoreId, body, options);
|
160
|
+
return this.poll(vectorStoreId, file.id, pollIntervalMs, pollTimeoutMs, options);
|
161
|
+
}
|
162
|
+
|
163
|
+
/**
|
164
|
+
* Upload a file to the files API and then create a file in a vector store.
|
165
|
+
* Note the file will be asynchronously processed.
|
166
|
+
*
|
167
|
+
* @param vectorStoreId - The ID of the vector store to add the file to
|
168
|
+
* @param file - The file to upload
|
169
|
+
* @param body - Additional parameters for the vector store file
|
170
|
+
* @param options - Additional request options
|
171
|
+
* @returns The created vector store file
|
172
|
+
*/
|
173
|
+
async upload(
|
174
|
+
vectorStoreId: string,
|
175
|
+
file: Uploadable,
|
176
|
+
body?: Omit<FileCreateParams, 'file_id'>,
|
177
|
+
options?: Core.RequestOptions,
|
178
|
+
): Promise<VectorStoreFile> {
|
179
|
+
const fileUploadResponse = await this._client.files.create({ file }, options);
|
180
|
+
|
181
|
+
return this.create(
|
182
|
+
vectorStoreId,
|
183
|
+
{
|
184
|
+
file_id: fileUploadResponse.id,
|
185
|
+
...body,
|
186
|
+
},
|
187
|
+
options,
|
188
|
+
);
|
189
|
+
}
|
190
|
+
|
191
|
+
/**
|
192
|
+
* Upload a file to files API, create a file in a vector store, and poll until processing is complete.
|
193
|
+
*
|
194
|
+
* @param vectorStoreId - The ID of the vector store to add the file to
|
195
|
+
* @param file - The file to upload
|
196
|
+
* @param body - Additional parameters for the vector store file
|
197
|
+
* @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
|
198
|
+
* @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
|
199
|
+
* @param options - Additional request options
|
200
|
+
* @returns The vector store file object once it reaches a terminal state
|
201
|
+
*/
|
202
|
+
async uploadAndPoll(
|
203
|
+
vectorStoreId: string,
|
204
|
+
file: Uploadable,
|
205
|
+
body?: Omit<FileCreateParams, 'file_id'>,
|
206
|
+
pollIntervalMs?: number,
|
207
|
+
pollTimeoutMs?: number,
|
208
|
+
options?: Core.RequestOptions,
|
209
|
+
): Promise<VectorStoreFile> {
|
210
|
+
const vectorStoreFile = await this.upload(vectorStoreId, file, body, options);
|
211
|
+
return this.poll(vectorStoreId, vectorStoreFile.id, pollIntervalMs, pollTimeoutMs, options);
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
215
|
+
export class VectorStoreFilesLimitOffset extends LimitOffset<VectorStoreFile> {}
|
216
|
+
|
217
|
+
/**
|
218
|
+
* Represents a scored file stored in a vector store.
|
219
|
+
*/
|
220
|
+
export interface ScoredVectorStoreFile {
|
221
|
+
/**
|
222
|
+
* Unique identifier for the file
|
223
|
+
*/
|
224
|
+
id: string;
|
225
|
+
|
226
|
+
/**
|
227
|
+
* Optional file metadata
|
228
|
+
*/
|
229
|
+
metadata?: unknown;
|
230
|
+
|
231
|
+
/**
|
232
|
+
* Processing status of the file
|
233
|
+
*/
|
234
|
+
status?: string;
|
235
|
+
|
236
|
+
/**
|
237
|
+
* Last error message if processing failed
|
238
|
+
*/
|
239
|
+
last_error?: unknown;
|
240
|
+
|
241
|
+
/**
|
242
|
+
* ID of the containing vector store
|
243
|
+
*/
|
244
|
+
vector_store_id: string;
|
245
|
+
|
246
|
+
/**
|
247
|
+
* Timestamp of vector store file creation
|
248
|
+
*/
|
249
|
+
created_at: string;
|
250
|
+
|
251
|
+
/**
|
252
|
+
* Version number of the file
|
253
|
+
*/
|
254
|
+
version?: number | null;
|
255
|
+
|
256
|
+
/**
|
257
|
+
* Storage usage in bytes
|
258
|
+
*/
|
259
|
+
usage_bytes?: number | null;
|
260
|
+
|
261
|
+
/**
|
262
|
+
* Type of the object
|
263
|
+
*/
|
264
|
+
object?: 'vector_store.file';
|
265
|
+
|
266
|
+
/**
|
267
|
+
* score of the file
|
268
|
+
*/
|
269
|
+
score: number;
|
270
|
+
|
271
|
+
/**
|
272
|
+
* chunks
|
273
|
+
*/
|
274
|
+
chunks: Array<VectorStoresAPI.ScoredVectorStoreChunk>;
|
275
|
+
}
|
276
|
+
|
277
|
+
/**
|
278
|
+
* Represents a file stored in a vector store.
|
279
|
+
*/
|
280
|
+
export interface VectorStoreFile {
|
281
|
+
/**
|
282
|
+
* Unique identifier for the file
|
283
|
+
*/
|
284
|
+
id: string;
|
285
|
+
|
286
|
+
/**
|
287
|
+
* Optional file metadata
|
288
|
+
*/
|
289
|
+
metadata?: unknown;
|
290
|
+
|
291
|
+
/**
|
292
|
+
* Processing status of the file
|
293
|
+
*/
|
294
|
+
status?: string;
|
295
|
+
|
296
|
+
/**
|
297
|
+
* Last error message if processing failed
|
298
|
+
*/
|
299
|
+
last_error?: unknown;
|
300
|
+
|
301
|
+
/**
|
302
|
+
* ID of the containing vector store
|
303
|
+
*/
|
304
|
+
vector_store_id: string;
|
305
|
+
|
306
|
+
/**
|
307
|
+
* Timestamp of vector store file creation
|
308
|
+
*/
|
309
|
+
created_at: string;
|
310
|
+
|
311
|
+
/**
|
312
|
+
* Version number of the file
|
313
|
+
*/
|
314
|
+
version?: number | null;
|
315
|
+
|
316
|
+
/**
|
317
|
+
* Storage usage in bytes
|
318
|
+
*/
|
319
|
+
usage_bytes?: number | null;
|
320
|
+
|
321
|
+
/**
|
322
|
+
* Type of the object
|
323
|
+
*/
|
324
|
+
object?: 'vector_store.file';
|
325
|
+
}
|
326
|
+
|
327
|
+
/**
|
328
|
+
* Response model for file deletion.
|
329
|
+
*/
|
330
|
+
export interface FileDeleteResponse {
|
331
|
+
/**
|
332
|
+
* ID of the deleted file
|
333
|
+
*/
|
334
|
+
id: string;
|
335
|
+
|
336
|
+
/**
|
337
|
+
* Whether the deletion was successful
|
338
|
+
*/
|
339
|
+
deleted?: boolean;
|
340
|
+
|
341
|
+
/**
|
342
|
+
* Type of the deleted object
|
343
|
+
*/
|
344
|
+
object?: 'vector_store.file';
|
345
|
+
}
|
346
|
+
|
347
|
+
export interface FileSearchResponse {
|
348
|
+
/**
|
349
|
+
* The object type of the response
|
350
|
+
*/
|
351
|
+
object?: 'list';
|
352
|
+
|
353
|
+
/**
|
354
|
+
* The list of scored vector store files
|
355
|
+
*/
|
356
|
+
data: Array<ScoredVectorStoreFile>;
|
357
|
+
}
|
358
|
+
|
359
|
+
export interface FileCreateParams {
|
360
|
+
/**
|
361
|
+
* ID of the file to add
|
362
|
+
*/
|
363
|
+
file_id: string;
|
364
|
+
|
365
|
+
/**
|
366
|
+
* Optional metadata for the file
|
367
|
+
*/
|
368
|
+
metadata?: unknown;
|
369
|
+
|
370
|
+
/**
|
371
|
+
* Strategy for adding the file
|
372
|
+
*/
|
373
|
+
experimental?: FileCreateParams.Experimental;
|
374
|
+
}
|
375
|
+
|
376
|
+
export namespace FileCreateParams {
|
377
|
+
/**
|
378
|
+
* Strategy for adding the file
|
379
|
+
*/
|
380
|
+
export interface Experimental {
|
381
|
+
/**
|
382
|
+
* Strategy for adding the file
|
383
|
+
*/
|
384
|
+
parsing_strategy?: 'fast' | 'high_quality';
|
385
|
+
}
|
386
|
+
}
|
387
|
+
|
388
|
+
export interface FileListParams extends LimitOffsetParams {}
|
389
|
+
|
390
|
+
export interface FileSearchParams {
|
391
|
+
/**
|
392
|
+
* Search query text
|
393
|
+
*/
|
394
|
+
query: string;
|
395
|
+
|
396
|
+
/**
|
397
|
+
* IDs of vector stores to search
|
398
|
+
*/
|
399
|
+
vector_store_ids: Array<string>;
|
400
|
+
|
401
|
+
/**
|
402
|
+
* Number of results to return
|
403
|
+
*/
|
404
|
+
top_k?: number;
|
405
|
+
|
406
|
+
/**
|
407
|
+
* Optional filter conditions
|
408
|
+
*/
|
409
|
+
filters?:
|
410
|
+
| Shared.SearchFilter
|
411
|
+
| Shared.SearchFilterCondition
|
412
|
+
| Array<Shared.SearchFilter | Shared.SearchFilterCondition>
|
413
|
+
| null;
|
414
|
+
|
415
|
+
/**
|
416
|
+
* Search configuration options
|
417
|
+
*/
|
418
|
+
search_options?: VectorStoresAPI.VectorStoreSearchOptions;
|
419
|
+
}
|
420
|
+
|
421
|
+
Files.VectorStoreFilesLimitOffset = VectorStoreFilesLimitOffset;
|
422
|
+
|
423
|
+
export declare namespace Files {
|
424
|
+
export {
|
425
|
+
type ScoredVectorStoreFile as ScoredVectorStoreFile,
|
426
|
+
type VectorStoreFile as VectorStoreFile,
|
427
|
+
type FileDeleteResponse as FileDeleteResponse,
|
428
|
+
type FileSearchResponse as FileSearchResponse,
|
429
|
+
VectorStoreFilesLimitOffset as VectorStoreFilesLimitOffset,
|
430
|
+
type FileCreateParams as FileCreateParams,
|
431
|
+
type FileListParams as FileListParams,
|
432
|
+
type FileSearchParams as FileSearchParams,
|
433
|
+
};
|
434
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
export {
|
4
|
+
VectorStoreFilesLimitOffset,
|
5
|
+
Files,
|
6
|
+
type ScoredVectorStoreFile,
|
7
|
+
type VectorStoreFile,
|
8
|
+
type FileDeleteResponse,
|
9
|
+
type FileSearchResponse,
|
10
|
+
type FileCreateParams,
|
11
|
+
type FileListParams,
|
12
|
+
type FileSearchParams,
|
13
|
+
} from './files';
|
14
|
+
export {
|
15
|
+
VectorStoresLimitOffset,
|
16
|
+
VectorStores,
|
17
|
+
type ExpiresAfter,
|
18
|
+
type FileCounts,
|
19
|
+
type ScoredVectorStoreChunk,
|
20
|
+
type VectorStore,
|
21
|
+
type VectorStoreSearchOptions,
|
22
|
+
type VectorStoreDeleteResponse,
|
23
|
+
type VectorStoreQuestionAnsweringResponse,
|
24
|
+
type VectorStoreSearchResponse,
|
25
|
+
type VectorStoreCreateParams,
|
26
|
+
type VectorStoreUpdateParams,
|
27
|
+
type VectorStoreListParams,
|
28
|
+
type VectorStoreQuestionAnsweringParams,
|
29
|
+
type VectorStoreSearchParams,
|
30
|
+
} from './vector-stores';
|