@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,561 @@
|
|
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 FilesAPI from './files';
|
8
|
+
import {
|
9
|
+
FileCreateParams,
|
10
|
+
FileDeleteResponse,
|
11
|
+
FileListParams,
|
12
|
+
FileSearchParams,
|
13
|
+
FileSearchResponse,
|
14
|
+
Files,
|
15
|
+
ScoredVectorStoreFile,
|
16
|
+
VectorStoreFile,
|
17
|
+
VectorStoreFilesLimitOffset,
|
18
|
+
} from './files';
|
19
|
+
import { LimitOffset, type LimitOffsetParams } from '../../pagination';
|
20
|
+
|
21
|
+
export class VectorStores extends APIResource {
|
22
|
+
files: FilesAPI.Files = new FilesAPI.Files(this._client);
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Create a new vector store.
|
26
|
+
*
|
27
|
+
* Args: vector_store_create: VectorStoreCreate object containing the name,
|
28
|
+
* description, and metadata.
|
29
|
+
*
|
30
|
+
* Returns: VectorStore: The response containing the created vector store details.
|
31
|
+
*/
|
32
|
+
create(body: VectorStoreCreateParams, options?: Core.RequestOptions): Core.APIPromise<VectorStore> {
|
33
|
+
return this._client.post('/v1/vector_stores', { body, ...options });
|
34
|
+
}
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Get a vector store by ID.
|
38
|
+
*
|
39
|
+
* Args: vector_store_id: The ID of the vector store to retrieve.
|
40
|
+
*
|
41
|
+
* Returns: VectorStore: The response containing the vector store details.
|
42
|
+
*/
|
43
|
+
retrieve(vectorStoreId: string, options?: Core.RequestOptions): Core.APIPromise<VectorStore> {
|
44
|
+
return this._client.get(`/v1/vector_stores/${vectorStoreId}`, options);
|
45
|
+
}
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Update a vector store by ID.
|
49
|
+
*
|
50
|
+
* Args: vector_store_id: The ID of the vector store to update.
|
51
|
+
* vector_store_update: VectorStoreCreate object containing the name, description,
|
52
|
+
* and metadata.
|
53
|
+
*
|
54
|
+
* Returns: VectorStore: The response containing the updated vector store details.
|
55
|
+
*/
|
56
|
+
update(
|
57
|
+
vectorStoreId: string,
|
58
|
+
body: VectorStoreUpdateParams,
|
59
|
+
options?: Core.RequestOptions,
|
60
|
+
): Core.APIPromise<VectorStore> {
|
61
|
+
return this._client.put(`/v1/vector_stores/${vectorStoreId}`, { body, ...options });
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* List all vector stores.
|
66
|
+
*
|
67
|
+
* Args: pagination: The pagination options.
|
68
|
+
*
|
69
|
+
* Returns: VectorStoreListResponse: The list of vector stores.
|
70
|
+
*/
|
71
|
+
list(
|
72
|
+
query?: VectorStoreListParams,
|
73
|
+
options?: Core.RequestOptions,
|
74
|
+
): Core.PagePromise<VectorStoresLimitOffset, VectorStore>;
|
75
|
+
list(options?: Core.RequestOptions): Core.PagePromise<VectorStoresLimitOffset, VectorStore>;
|
76
|
+
list(
|
77
|
+
query: VectorStoreListParams | Core.RequestOptions = {},
|
78
|
+
options?: Core.RequestOptions,
|
79
|
+
): Core.PagePromise<VectorStoresLimitOffset, VectorStore> {
|
80
|
+
if (isRequestOptions(query)) {
|
81
|
+
return this.list({}, query);
|
82
|
+
}
|
83
|
+
return this._client.getAPIList('/v1/vector_stores', VectorStoresLimitOffset, { query, ...options });
|
84
|
+
}
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Delete a vector store by ID.
|
88
|
+
*
|
89
|
+
* Args: vector_store_id: The ID of the vector store to delete.
|
90
|
+
*
|
91
|
+
* Returns: VectorStore: The response containing the deleted vector store details.
|
92
|
+
*/
|
93
|
+
delete(vectorStoreId: string, options?: Core.RequestOptions): Core.APIPromise<VectorStoreDeleteResponse> {
|
94
|
+
return this._client.delete(`/v1/vector_stores/${vectorStoreId}`, options);
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Question answering
|
99
|
+
*/
|
100
|
+
questionAnswering(
|
101
|
+
body: VectorStoreQuestionAnsweringParams,
|
102
|
+
options?: Core.RequestOptions,
|
103
|
+
): Core.APIPromise<unknown> {
|
104
|
+
return this._client.post('/v1/vector_stores/question-answering', { body, ...options });
|
105
|
+
}
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Perform semantic search across vector store chunks.
|
109
|
+
*
|
110
|
+
* This endpoint searches through vector store chunks using semantic similarity
|
111
|
+
* matching. It supports complex search queries with filters and returns
|
112
|
+
* relevance-scored results.
|
113
|
+
*
|
114
|
+
* Args: search_params: Search configuration including: - query text or
|
115
|
+
* embeddings - metadata filters - pagination parameters - sorting preferences
|
116
|
+
* \_state: API state dependency \_ctx: Service context dependency
|
117
|
+
*
|
118
|
+
* Returns: VectorStoreSearchChunkResponse containing: - List of matched chunks
|
119
|
+
* with relevance scores - Pagination details including total result count
|
120
|
+
*
|
121
|
+
* Raises: HTTPException (400): If search parameters are invalid HTTPException
|
122
|
+
* (404): If no vector stores are found to search
|
123
|
+
*/
|
124
|
+
search(
|
125
|
+
body: VectorStoreSearchParams,
|
126
|
+
options?: Core.RequestOptions,
|
127
|
+
): Core.APIPromise<VectorStoreSearchResponse> {
|
128
|
+
return this._client.post('/v1/vector_stores/search', { body, ...options });
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
export class VectorStoresLimitOffset extends LimitOffset<VectorStore> {}
|
133
|
+
|
134
|
+
/**
|
135
|
+
* Represents an expiration policy for a vector store.
|
136
|
+
*/
|
137
|
+
export interface ExpiresAfter {
|
138
|
+
/**
|
139
|
+
* Anchor date for the expiration policy
|
140
|
+
*/
|
141
|
+
anchor?: 'last_active_at';
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Number of days after which the vector store expires
|
145
|
+
*/
|
146
|
+
days?: number;
|
147
|
+
}
|
148
|
+
|
149
|
+
/**
|
150
|
+
* Tracks counts of files in different states within a vector store.
|
151
|
+
*/
|
152
|
+
export interface FileCounts {
|
153
|
+
/**
|
154
|
+
* Number of files currently being processed
|
155
|
+
*/
|
156
|
+
in_progress?: number;
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Number of files whose processing was cancelled
|
160
|
+
*/
|
161
|
+
cancelled?: number;
|
162
|
+
|
163
|
+
/**
|
164
|
+
* Number of successfully processed files
|
165
|
+
*/
|
166
|
+
completed?: number;
|
167
|
+
|
168
|
+
/**
|
169
|
+
* Number of files that failed processing
|
170
|
+
*/
|
171
|
+
failed?: number;
|
172
|
+
|
173
|
+
/**
|
174
|
+
* Total number of files
|
175
|
+
*/
|
176
|
+
total?: number;
|
177
|
+
}
|
178
|
+
|
179
|
+
export interface ScoredVectorStoreChunk {
|
180
|
+
/**
|
181
|
+
* position of the chunk in a file
|
182
|
+
*/
|
183
|
+
position: number;
|
184
|
+
|
185
|
+
/**
|
186
|
+
* value of the chunk
|
187
|
+
*/
|
188
|
+
value?:
|
189
|
+
| string
|
190
|
+
| ScoredVectorStoreChunk.ImageURLInput
|
191
|
+
| ScoredVectorStoreChunk.TextInput
|
192
|
+
| Record<string, unknown>
|
193
|
+
| null;
|
194
|
+
|
195
|
+
/**
|
196
|
+
* content of the chunk
|
197
|
+
*/
|
198
|
+
content?: string | null;
|
199
|
+
|
200
|
+
/**
|
201
|
+
* score of the chunk
|
202
|
+
*/
|
203
|
+
score: number;
|
204
|
+
|
205
|
+
/**
|
206
|
+
* file id
|
207
|
+
*/
|
208
|
+
file_id: string;
|
209
|
+
|
210
|
+
/**
|
211
|
+
* vector store id
|
212
|
+
*/
|
213
|
+
vector_store_id: string;
|
214
|
+
|
215
|
+
/**
|
216
|
+
* file metadata
|
217
|
+
*/
|
218
|
+
metadata?: unknown;
|
219
|
+
}
|
220
|
+
|
221
|
+
export namespace ScoredVectorStoreChunk {
|
222
|
+
/**
|
223
|
+
* Model for image input validation.
|
224
|
+
*/
|
225
|
+
export interface ImageURLInput {
|
226
|
+
/**
|
227
|
+
* Input type identifier
|
228
|
+
*/
|
229
|
+
type?: 'image_url';
|
230
|
+
|
231
|
+
/**
|
232
|
+
* The image input specification.
|
233
|
+
*/
|
234
|
+
image: ImageURLInput.Image;
|
235
|
+
}
|
236
|
+
|
237
|
+
export namespace ImageURLInput {
|
238
|
+
/**
|
239
|
+
* The image input specification.
|
240
|
+
*/
|
241
|
+
export interface Image {
|
242
|
+
/**
|
243
|
+
* The image URL. Can be either a URL or a Data URI.
|
244
|
+
*/
|
245
|
+
url: string;
|
246
|
+
}
|
247
|
+
}
|
248
|
+
|
249
|
+
/**
|
250
|
+
* Model for text input validation.
|
251
|
+
*
|
252
|
+
* Attributes: type: Input type identifier, always "text" text: The actual text
|
253
|
+
* content, with length and whitespace constraints
|
254
|
+
*/
|
255
|
+
export interface TextInput {
|
256
|
+
/**
|
257
|
+
* Input type identifier
|
258
|
+
*/
|
259
|
+
type?: 'text';
|
260
|
+
|
261
|
+
/**
|
262
|
+
* Text content to process
|
263
|
+
*/
|
264
|
+
text: string;
|
265
|
+
}
|
266
|
+
}
|
267
|
+
|
268
|
+
/**
|
269
|
+
* Model representing a vector store with its metadata and timestamps.
|
270
|
+
*/
|
271
|
+
export interface VectorStore {
|
272
|
+
/**
|
273
|
+
* Unique identifier for the vector store
|
274
|
+
*/
|
275
|
+
id: string;
|
276
|
+
|
277
|
+
/**
|
278
|
+
* Name of the vector store
|
279
|
+
*/
|
280
|
+
name: string;
|
281
|
+
|
282
|
+
/**
|
283
|
+
* Detailed description of the vector store's purpose and contents
|
284
|
+
*/
|
285
|
+
description?: string | null;
|
286
|
+
|
287
|
+
/**
|
288
|
+
* Additional metadata associated with the vector store
|
289
|
+
*/
|
290
|
+
metadata?: unknown;
|
291
|
+
|
292
|
+
/**
|
293
|
+
* Counts of files in different states
|
294
|
+
*/
|
295
|
+
file_counts?: FileCounts;
|
296
|
+
|
297
|
+
/**
|
298
|
+
* Represents an expiration policy for a vector store.
|
299
|
+
*/
|
300
|
+
expires_after?: ExpiresAfter | null;
|
301
|
+
|
302
|
+
/**
|
303
|
+
* Processing status of the vector store
|
304
|
+
*/
|
305
|
+
status?: 'expired' | 'in_progress' | 'completed';
|
306
|
+
|
307
|
+
/**
|
308
|
+
* Timestamp when the vector store was created
|
309
|
+
*/
|
310
|
+
created_at: string;
|
311
|
+
|
312
|
+
/**
|
313
|
+
* Timestamp when the vector store was last updated
|
314
|
+
*/
|
315
|
+
updated_at: string;
|
316
|
+
|
317
|
+
/**
|
318
|
+
* Timestamp when the vector store was last used
|
319
|
+
*/
|
320
|
+
last_active_at?: string | null;
|
321
|
+
|
322
|
+
/**
|
323
|
+
* Optional expiration timestamp for the vector store
|
324
|
+
*/
|
325
|
+
expires_at?: string | null;
|
326
|
+
|
327
|
+
/**
|
328
|
+
* Type of the object
|
329
|
+
*/
|
330
|
+
object?: 'vector_store';
|
331
|
+
}
|
332
|
+
|
333
|
+
/**
|
334
|
+
* Options for configuring vector store searches.
|
335
|
+
*/
|
336
|
+
export interface VectorStoreSearchOptions {
|
337
|
+
/**
|
338
|
+
* Whether to return file metadata
|
339
|
+
*/
|
340
|
+
return_metadata?: boolean;
|
341
|
+
|
342
|
+
/**
|
343
|
+
* Whether to return matching text chunks
|
344
|
+
*/
|
345
|
+
return_chunks?: boolean;
|
346
|
+
|
347
|
+
/**
|
348
|
+
* Minimum similarity score threshold
|
349
|
+
*/
|
350
|
+
score_threshold?: number;
|
351
|
+
|
352
|
+
/**
|
353
|
+
* Whether to rewrite the query
|
354
|
+
*/
|
355
|
+
rewrite_query?: boolean;
|
356
|
+
}
|
357
|
+
|
358
|
+
/**
|
359
|
+
* Response model for vector store deletion.
|
360
|
+
*/
|
361
|
+
export interface VectorStoreDeleteResponse {
|
362
|
+
/**
|
363
|
+
* ID of the deleted vector store
|
364
|
+
*/
|
365
|
+
id: string;
|
366
|
+
|
367
|
+
/**
|
368
|
+
* Whether the deletion was successful
|
369
|
+
*/
|
370
|
+
deleted: boolean;
|
371
|
+
|
372
|
+
/**
|
373
|
+
* Type of the deleted object
|
374
|
+
*/
|
375
|
+
object?: 'vector_store';
|
376
|
+
}
|
377
|
+
|
378
|
+
export type VectorStoreQuestionAnsweringResponse = unknown;
|
379
|
+
|
380
|
+
export interface VectorStoreSearchResponse {
|
381
|
+
/**
|
382
|
+
* The object type of the response
|
383
|
+
*/
|
384
|
+
object?: 'list';
|
385
|
+
|
386
|
+
/**
|
387
|
+
* The list of scored vector store file chunks
|
388
|
+
*/
|
389
|
+
data: Array<ScoredVectorStoreChunk>;
|
390
|
+
}
|
391
|
+
|
392
|
+
export interface VectorStoreCreateParams {
|
393
|
+
/**
|
394
|
+
* Name for the new vector store
|
395
|
+
*/
|
396
|
+
name?: string | null;
|
397
|
+
|
398
|
+
/**
|
399
|
+
* Description of the vector store
|
400
|
+
*/
|
401
|
+
description?: string | null;
|
402
|
+
|
403
|
+
/**
|
404
|
+
* Represents an expiration policy for a vector store.
|
405
|
+
*/
|
406
|
+
expires_after?: ExpiresAfter | null;
|
407
|
+
|
408
|
+
/**
|
409
|
+
* Optional metadata key-value pairs
|
410
|
+
*/
|
411
|
+
metadata?: unknown;
|
412
|
+
|
413
|
+
/**
|
414
|
+
* Optional list of file IDs
|
415
|
+
*/
|
416
|
+
file_ids?: Array<string> | null;
|
417
|
+
}
|
418
|
+
|
419
|
+
export interface VectorStoreUpdateParams {
|
420
|
+
/**
|
421
|
+
* New name for the vector store
|
422
|
+
*/
|
423
|
+
name?: string | null;
|
424
|
+
|
425
|
+
/**
|
426
|
+
* New description
|
427
|
+
*/
|
428
|
+
description?: string | null;
|
429
|
+
|
430
|
+
/**
|
431
|
+
* Represents an expiration policy for a vector store.
|
432
|
+
*/
|
433
|
+
expires_after?: ExpiresAfter | null;
|
434
|
+
|
435
|
+
/**
|
436
|
+
* Optional metadata key-value pairs
|
437
|
+
*/
|
438
|
+
metadata?: unknown;
|
439
|
+
}
|
440
|
+
|
441
|
+
export interface VectorStoreListParams extends LimitOffsetParams {}
|
442
|
+
|
443
|
+
export interface VectorStoreQuestionAnsweringParams {
|
444
|
+
/**
|
445
|
+
* Question to answer. If not provided, the question will be extracted from the
|
446
|
+
* passed messages.
|
447
|
+
*/
|
448
|
+
query?: string;
|
449
|
+
|
450
|
+
/**
|
451
|
+
* IDs of vector stores to search
|
452
|
+
*/
|
453
|
+
vector_store_ids: Array<string>;
|
454
|
+
|
455
|
+
/**
|
456
|
+
* Number of results to return
|
457
|
+
*/
|
458
|
+
top_k?: number;
|
459
|
+
|
460
|
+
/**
|
461
|
+
* Optional filter conditions
|
462
|
+
*/
|
463
|
+
filters?:
|
464
|
+
| Shared.SearchFilter
|
465
|
+
| Shared.SearchFilterCondition
|
466
|
+
| Array<Shared.SearchFilter | Shared.SearchFilterCondition>
|
467
|
+
| null;
|
468
|
+
|
469
|
+
/**
|
470
|
+
* Search configuration options
|
471
|
+
*/
|
472
|
+
search_options?: VectorStoreSearchOptions;
|
473
|
+
|
474
|
+
/**
|
475
|
+
* Whether to stream the answer
|
476
|
+
*/
|
477
|
+
stream?: boolean;
|
478
|
+
|
479
|
+
/**
|
480
|
+
* Question answering configuration options
|
481
|
+
*/
|
482
|
+
qa_options?: VectorStoreQuestionAnsweringParams.QaOptions;
|
483
|
+
}
|
484
|
+
|
485
|
+
export namespace VectorStoreQuestionAnsweringParams {
|
486
|
+
/**
|
487
|
+
* Question answering configuration options
|
488
|
+
*/
|
489
|
+
export interface QaOptions {
|
490
|
+
/**
|
491
|
+
* Whether to use citations
|
492
|
+
*/
|
493
|
+
cite?: boolean;
|
494
|
+
}
|
495
|
+
}
|
496
|
+
|
497
|
+
export interface VectorStoreSearchParams {
|
498
|
+
/**
|
499
|
+
* Search query text
|
500
|
+
*/
|
501
|
+
query: string;
|
502
|
+
|
503
|
+
/**
|
504
|
+
* IDs of vector stores to search
|
505
|
+
*/
|
506
|
+
vector_store_ids: Array<string>;
|
507
|
+
|
508
|
+
/**
|
509
|
+
* Number of results to return
|
510
|
+
*/
|
511
|
+
top_k?: number;
|
512
|
+
|
513
|
+
/**
|
514
|
+
* Optional filter conditions
|
515
|
+
*/
|
516
|
+
filters?:
|
517
|
+
| Shared.SearchFilter
|
518
|
+
| Shared.SearchFilterCondition
|
519
|
+
| Array<Shared.SearchFilter | Shared.SearchFilterCondition>
|
520
|
+
| null;
|
521
|
+
|
522
|
+
/**
|
523
|
+
* Search configuration options
|
524
|
+
*/
|
525
|
+
search_options?: VectorStoreSearchOptions;
|
526
|
+
}
|
527
|
+
|
528
|
+
VectorStores.VectorStoresLimitOffset = VectorStoresLimitOffset;
|
529
|
+
VectorStores.Files = Files;
|
530
|
+
VectorStores.VectorStoreFilesLimitOffset = VectorStoreFilesLimitOffset;
|
531
|
+
|
532
|
+
export declare namespace VectorStores {
|
533
|
+
export {
|
534
|
+
type ExpiresAfter as ExpiresAfter,
|
535
|
+
type FileCounts as FileCounts,
|
536
|
+
type ScoredVectorStoreChunk as ScoredVectorStoreChunk,
|
537
|
+
type VectorStore as VectorStore,
|
538
|
+
type VectorStoreSearchOptions as VectorStoreSearchOptions,
|
539
|
+
type VectorStoreDeleteResponse as VectorStoreDeleteResponse,
|
540
|
+
type VectorStoreQuestionAnsweringResponse as VectorStoreQuestionAnsweringResponse,
|
541
|
+
type VectorStoreSearchResponse as VectorStoreSearchResponse,
|
542
|
+
VectorStoresLimitOffset as VectorStoresLimitOffset,
|
543
|
+
type VectorStoreCreateParams as VectorStoreCreateParams,
|
544
|
+
type VectorStoreUpdateParams as VectorStoreUpdateParams,
|
545
|
+
type VectorStoreListParams as VectorStoreListParams,
|
546
|
+
type VectorStoreQuestionAnsweringParams as VectorStoreQuestionAnsweringParams,
|
547
|
+
type VectorStoreSearchParams as VectorStoreSearchParams,
|
548
|
+
};
|
549
|
+
|
550
|
+
export {
|
551
|
+
Files as Files,
|
552
|
+
type ScoredVectorStoreFile as ScoredVectorStoreFile,
|
553
|
+
type VectorStoreFile as VectorStoreFile,
|
554
|
+
type FileDeleteResponse as FileDeleteResponse,
|
555
|
+
type FileSearchResponse as FileSearchResponse,
|
556
|
+
VectorStoreFilesLimitOffset as VectorStoreFilesLimitOffset,
|
557
|
+
type FileCreateParams as FileCreateParams,
|
558
|
+
type FileListParams as FileListParams,
|
559
|
+
type FileSearchParams as FileSearchParams,
|
560
|
+
};
|
561
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
// @ts-ignore
|
2
|
+
import * as types from '../_shims/node-types';
|
3
|
+
import { setShims } from '../_shims/registry';
|
4
|
+
import { getRuntime } from '../_shims/node-runtime';
|
5
|
+
setShims(getRuntime());
|
6
|
+
|
7
|
+
declare module '../_shims/manual-types' {
|
8
|
+
export namespace manual {
|
9
|
+
// @ts-ignore
|
10
|
+
export type Agent = types.Agent;
|
11
|
+
// @ts-ignore
|
12
|
+
export import fetch = types.fetch;
|
13
|
+
// @ts-ignore
|
14
|
+
export type Request = types.Request;
|
15
|
+
// @ts-ignore
|
16
|
+
export type RequestInfo = types.RequestInfo;
|
17
|
+
// @ts-ignore
|
18
|
+
export type RequestInit = types.RequestInit;
|
19
|
+
// @ts-ignore
|
20
|
+
export type Response = types.Response;
|
21
|
+
// @ts-ignore
|
22
|
+
export type ResponseInit = types.ResponseInit;
|
23
|
+
// @ts-ignore
|
24
|
+
export type ResponseType = types.ResponseType;
|
25
|
+
// @ts-ignore
|
26
|
+
export type BodyInit = types.BodyInit;
|
27
|
+
// @ts-ignore
|
28
|
+
export type Headers = types.Headers;
|
29
|
+
// @ts-ignore
|
30
|
+
export type HeadersInit = types.HeadersInit;
|
31
|
+
// @ts-ignore
|
32
|
+
export type BlobPropertyBag = types.BlobPropertyBag;
|
33
|
+
// @ts-ignore
|
34
|
+
export type FilePropertyBag = types.FilePropertyBag;
|
35
|
+
// @ts-ignore
|
36
|
+
export type FileFromPathOptions = types.FileFromPathOptions;
|
37
|
+
// @ts-ignore
|
38
|
+
export import FormData = types.FormData;
|
39
|
+
// @ts-ignore
|
40
|
+
export import File = types.File;
|
41
|
+
// @ts-ignore
|
42
|
+
export import Blob = types.Blob;
|
43
|
+
// @ts-ignore
|
44
|
+
export type Readable = types.Readable;
|
45
|
+
// @ts-ignore
|
46
|
+
export type FsReadStream = types.FsReadStream;
|
47
|
+
// @ts-ignore
|
48
|
+
export import ReadableStream = types.ReadableStream;
|
49
|
+
}
|
50
|
+
}
|
package/src/shims/web.ts
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
// @ts-ignore
|
2
|
+
import * as types from '../_shims/web-types';
|
3
|
+
import { setShims } from '../_shims/registry';
|
4
|
+
import { getRuntime } from '../_shims/web-runtime';
|
5
|
+
setShims(getRuntime({ manuallyImported: true }));
|
6
|
+
|
7
|
+
declare module '../_shims/manual-types' {
|
8
|
+
export namespace manual {
|
9
|
+
// @ts-ignore
|
10
|
+
export type Agent = types.Agent;
|
11
|
+
// @ts-ignore
|
12
|
+
export import fetch = types.fetch;
|
13
|
+
// @ts-ignore
|
14
|
+
export type Request = types.Request;
|
15
|
+
// @ts-ignore
|
16
|
+
export type RequestInfo = types.RequestInfo;
|
17
|
+
// @ts-ignore
|
18
|
+
export type RequestInit = types.RequestInit;
|
19
|
+
// @ts-ignore
|
20
|
+
export type Response = types.Response;
|
21
|
+
// @ts-ignore
|
22
|
+
export type ResponseInit = types.ResponseInit;
|
23
|
+
// @ts-ignore
|
24
|
+
export type ResponseType = types.ResponseType;
|
25
|
+
// @ts-ignore
|
26
|
+
export type BodyInit = types.BodyInit;
|
27
|
+
// @ts-ignore
|
28
|
+
export type Headers = types.Headers;
|
29
|
+
// @ts-ignore
|
30
|
+
export type HeadersInit = types.HeadersInit;
|
31
|
+
// @ts-ignore
|
32
|
+
export type BlobPropertyBag = types.BlobPropertyBag;
|
33
|
+
// @ts-ignore
|
34
|
+
export type FilePropertyBag = types.FilePropertyBag;
|
35
|
+
// @ts-ignore
|
36
|
+
export type FileFromPathOptions = types.FileFromPathOptions;
|
37
|
+
// @ts-ignore
|
38
|
+
export import FormData = types.FormData;
|
39
|
+
// @ts-ignore
|
40
|
+
export import File = types.File;
|
41
|
+
// @ts-ignore
|
42
|
+
export import Blob = types.Blob;
|
43
|
+
// @ts-ignore
|
44
|
+
export type Readable = types.Readable;
|
45
|
+
// @ts-ignore
|
46
|
+
export type FsReadStream = types.FsReadStream;
|
47
|
+
// @ts-ignore
|
48
|
+
export import ReadableStream = types.ReadableStream;
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
// this config is included in the published src directory to prevent TS errors
|
3
|
+
// from appearing when users go to source, and VSCode opens the source .ts file
|
4
|
+
// via declaration maps
|
5
|
+
"include": ["index.ts"],
|
6
|
+
"compilerOptions": {
|
7
|
+
"target": "es2015",
|
8
|
+
"lib": ["DOM"],
|
9
|
+
"moduleResolution": "node"
|
10
|
+
}
|
11
|
+
}
|