@mixedbread/sdk 0.1.0-alpha.10
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 +230 -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 +915 -0
- package/core.js.map +1 -0
- package/core.mjs +883 -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 +169 -0
- package/index.d.ts +169 -0
- package/index.d.ts.map +1 -0
- package/index.js +175 -0
- package/index.js.map +1 -0
- package/index.mjs +132 -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/embeddings.d.ts +177 -0
- package/resources/embeddings.d.ts.map +1 -0
- package/resources/embeddings.js +20 -0
- package/resources/embeddings.js.map +1 -0
- package/resources/embeddings.mjs +16 -0
- package/resources/embeddings.mjs.map +1 -0
- package/resources/extractions/content.d.ts +33 -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 +84 -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 +8 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +32 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +8 -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 +290 -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 +165 -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 +284 -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 +425 -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 +346 -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/embeddings.ts +248 -0
- package/src/resources/extractions/content.ts +42 -0
- package/src/resources/extractions/extractions.ts +47 -0
- package/src/resources/extractions/index.ts +14 -0
- package/src/resources/extractions/jobs.ts +105 -0
- package/src/resources/extractions/schema.ts +111 -0
- package/src/resources/files.ts +181 -0
- package/src/resources/index.ts +39 -0
- package/src/resources/parsing/index.ts +12 -0
- package/src/resources/parsing/jobs.ts +453 -0
- package/src/resources/parsing/parsing.ts +32 -0
- package/src/resources/shared.ts +41 -0
- package/src/resources/top-level.ts +231 -0
- package/src/resources/vector-stores/files.ts +439 -0
- package/src/resources/vector-stores/index.ts +31 -0
- package/src/resources/vector-stores/vector-stores.ts +592 -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,41 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Represents a filter with AND, OR, and NOT conditions.
|
5
|
+
*/
|
6
|
+
export interface SearchFilter {
|
7
|
+
/**
|
8
|
+
* List of conditions or filters to be ANDed together
|
9
|
+
*/
|
10
|
+
all?: Array<SearchFilter | SearchFilterCondition> | null;
|
11
|
+
|
12
|
+
/**
|
13
|
+
* List of conditions or filters to be ORed together
|
14
|
+
*/
|
15
|
+
any?: Array<SearchFilter | SearchFilterCondition> | null;
|
16
|
+
|
17
|
+
/**
|
18
|
+
* List of conditions or filters to be NOTed
|
19
|
+
*/
|
20
|
+
none?: Array<SearchFilter | SearchFilterCondition> | null;
|
21
|
+
}
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Represents a condition with a field, operator, and value.
|
25
|
+
*/
|
26
|
+
export interface SearchFilterCondition {
|
27
|
+
/**
|
28
|
+
* The field to apply the condition on
|
29
|
+
*/
|
30
|
+
key: string;
|
31
|
+
|
32
|
+
/**
|
33
|
+
* The value to compare against
|
34
|
+
*/
|
35
|
+
value: unknown;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* The operator for the condition
|
39
|
+
*/
|
40
|
+
operator: 'eq' | 'not_eq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'not_in' | 'like' | 'not_like';
|
41
|
+
}
|
@@ -0,0 +1,231 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Info Pydantic Response Service Message
|
5
|
+
*/
|
6
|
+
export interface InfoResponse {
|
7
|
+
name: string;
|
8
|
+
|
9
|
+
version: string;
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface RerankResponse {
|
13
|
+
/**
|
14
|
+
* The usage of the model
|
15
|
+
*/
|
16
|
+
usage: RerankResponse.Usage;
|
17
|
+
|
18
|
+
/**
|
19
|
+
* The model used
|
20
|
+
*/
|
21
|
+
model: string;
|
22
|
+
|
23
|
+
/**
|
24
|
+
* The ranked documents.
|
25
|
+
*/
|
26
|
+
data: Array<RerankResponse.Data>;
|
27
|
+
|
28
|
+
/**
|
29
|
+
* The object type of the response
|
30
|
+
*/
|
31
|
+
object?:
|
32
|
+
| 'list'
|
33
|
+
| 'parsing_job'
|
34
|
+
| 'job'
|
35
|
+
| 'embedding'
|
36
|
+
| 'embedding_dict'
|
37
|
+
| 'text_document'
|
38
|
+
| 'file'
|
39
|
+
| 'vector_store'
|
40
|
+
| 'vector_store.file'
|
41
|
+
| 'api_key';
|
42
|
+
|
43
|
+
/**
|
44
|
+
* The number of documents to return.
|
45
|
+
*/
|
46
|
+
top_k: number;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Whether to return the documents.
|
50
|
+
*/
|
51
|
+
return_input: boolean;
|
52
|
+
}
|
53
|
+
|
54
|
+
export namespace RerankResponse {
|
55
|
+
/**
|
56
|
+
* The usage of the model
|
57
|
+
*/
|
58
|
+
export interface Usage {
|
59
|
+
/**
|
60
|
+
* The number of tokens used for the prompt
|
61
|
+
*/
|
62
|
+
prompt_tokens: number;
|
63
|
+
|
64
|
+
/**
|
65
|
+
* The total number of tokens used
|
66
|
+
*/
|
67
|
+
total_tokens: number;
|
68
|
+
|
69
|
+
/**
|
70
|
+
* The number of tokens used for the completion
|
71
|
+
*/
|
72
|
+
completion_tokens?: number | null;
|
73
|
+
}
|
74
|
+
|
75
|
+
export interface Data {
|
76
|
+
index: number;
|
77
|
+
|
78
|
+
/**
|
79
|
+
* The score of the document.
|
80
|
+
*/
|
81
|
+
score: number;
|
82
|
+
|
83
|
+
/**
|
84
|
+
* The input document.
|
85
|
+
*/
|
86
|
+
input: unknown;
|
87
|
+
|
88
|
+
/**
|
89
|
+
* The object type.
|
90
|
+
*/
|
91
|
+
object?:
|
92
|
+
| 'list'
|
93
|
+
| 'parsing_job'
|
94
|
+
| 'job'
|
95
|
+
| 'embedding'
|
96
|
+
| 'embedding_dict'
|
97
|
+
| 'text_document'
|
98
|
+
| 'file'
|
99
|
+
| 'vector_store'
|
100
|
+
| 'vector_store.file'
|
101
|
+
| 'api_key';
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
export interface EmbedParams {
|
106
|
+
/**
|
107
|
+
* The model to use for creating embeddings.
|
108
|
+
*/
|
109
|
+
model: string;
|
110
|
+
|
111
|
+
/**
|
112
|
+
* The input to create embeddings for.
|
113
|
+
*/
|
114
|
+
input: string | EmbedParams.ImageURLInput | EmbedParams.TextInput;
|
115
|
+
|
116
|
+
/**
|
117
|
+
* The number of dimensions to use for the embeddings.
|
118
|
+
*/
|
119
|
+
dimensions?: number | null;
|
120
|
+
|
121
|
+
/**
|
122
|
+
* The prompt to use for the embedding creation.
|
123
|
+
*/
|
124
|
+
prompt?: string | null;
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Whether to normalize the embeddings.
|
128
|
+
*/
|
129
|
+
normalized?: boolean;
|
130
|
+
|
131
|
+
/**
|
132
|
+
* The encoding format of the embeddings.
|
133
|
+
*/
|
134
|
+
encoding_format?:
|
135
|
+
| 'float'
|
136
|
+
| 'float16'
|
137
|
+
| 'base64'
|
138
|
+
| 'binary'
|
139
|
+
| 'ubinary'
|
140
|
+
| 'int8'
|
141
|
+
| 'uint8'
|
142
|
+
| Array<'float' | 'float16' | 'base64' | 'binary' | 'ubinary' | 'int8' | 'uint8'>;
|
143
|
+
}
|
144
|
+
|
145
|
+
export namespace EmbedParams {
|
146
|
+
/**
|
147
|
+
* Model for image input validation.
|
148
|
+
*/
|
149
|
+
export interface ImageURLInput {
|
150
|
+
/**
|
151
|
+
* Input type identifier
|
152
|
+
*/
|
153
|
+
type?: 'image_url';
|
154
|
+
|
155
|
+
/**
|
156
|
+
* The image input specification.
|
157
|
+
*/
|
158
|
+
image: ImageURLInput.Image;
|
159
|
+
}
|
160
|
+
|
161
|
+
export namespace ImageURLInput {
|
162
|
+
/**
|
163
|
+
* The image input specification.
|
164
|
+
*/
|
165
|
+
export interface Image {
|
166
|
+
/**
|
167
|
+
* The image URL. Can be either a URL or a Data URI.
|
168
|
+
*/
|
169
|
+
url: string;
|
170
|
+
}
|
171
|
+
}
|
172
|
+
|
173
|
+
/**
|
174
|
+
* Model for text input validation.
|
175
|
+
*
|
176
|
+
* Attributes: type: Input type identifier, always "text" text: The actual text
|
177
|
+
* content, with length and whitespace constraints
|
178
|
+
*/
|
179
|
+
export interface TextInput {
|
180
|
+
/**
|
181
|
+
* Input type identifier
|
182
|
+
*/
|
183
|
+
type?: 'text';
|
184
|
+
|
185
|
+
/**
|
186
|
+
* Text content to process
|
187
|
+
*/
|
188
|
+
text: string;
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
export interface RerankParams {
|
193
|
+
/**
|
194
|
+
* The model to use for reranking documents.
|
195
|
+
*/
|
196
|
+
model?: string;
|
197
|
+
|
198
|
+
/**
|
199
|
+
* The query to rerank the documents.
|
200
|
+
*/
|
201
|
+
query: string;
|
202
|
+
|
203
|
+
/**
|
204
|
+
* The input documents to rerank.
|
205
|
+
*/
|
206
|
+
input: Array<string | unknown>;
|
207
|
+
|
208
|
+
/**
|
209
|
+
* The fields of the documents to rank.
|
210
|
+
*/
|
211
|
+
rank_fields?: Array<string> | null;
|
212
|
+
|
213
|
+
/**
|
214
|
+
* The number of documents to return.
|
215
|
+
*/
|
216
|
+
top_k?: number;
|
217
|
+
|
218
|
+
/**
|
219
|
+
* Whether to return the documents.
|
220
|
+
*/
|
221
|
+
return_input?: boolean;
|
222
|
+
}
|
223
|
+
|
224
|
+
export declare namespace TopLevel {
|
225
|
+
export {
|
226
|
+
type InfoResponse as InfoResponse,
|
227
|
+
type RerankResponse as RerankResponse,
|
228
|
+
type EmbedParams as EmbedParams,
|
229
|
+
type RerankParams as RerankParams,
|
230
|
+
};
|
231
|
+
}
|
@@ -0,0 +1,439 @@
|
|
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> | null;
|
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
|
+
* Whether to contextualize the file
|
388
|
+
*/
|
389
|
+
contextualization?: boolean;
|
390
|
+
}
|
391
|
+
}
|
392
|
+
|
393
|
+
export interface FileListParams extends LimitOffsetParams {}
|
394
|
+
|
395
|
+
export interface FileSearchParams {
|
396
|
+
/**
|
397
|
+
* Search query text
|
398
|
+
*/
|
399
|
+
query: string;
|
400
|
+
|
401
|
+
/**
|
402
|
+
* IDs of vector stores to search
|
403
|
+
*/
|
404
|
+
vector_store_ids: Array<string>;
|
405
|
+
|
406
|
+
/**
|
407
|
+
* Number of results to return
|
408
|
+
*/
|
409
|
+
top_k?: number;
|
410
|
+
|
411
|
+
/**
|
412
|
+
* Optional filter conditions
|
413
|
+
*/
|
414
|
+
filters?:
|
415
|
+
| Shared.SearchFilter
|
416
|
+
| Shared.SearchFilterCondition
|
417
|
+
| Array<Shared.SearchFilter | Shared.SearchFilterCondition>
|
418
|
+
| null;
|
419
|
+
|
420
|
+
/**
|
421
|
+
* Search configuration options
|
422
|
+
*/
|
423
|
+
search_options?: VectorStoresAPI.VectorStoreFileSearchOptions;
|
424
|
+
}
|
425
|
+
|
426
|
+
Files.VectorStoreFilesLimitOffset = VectorStoreFilesLimitOffset;
|
427
|
+
|
428
|
+
export declare namespace Files {
|
429
|
+
export {
|
430
|
+
type ScoredVectorStoreFile as ScoredVectorStoreFile,
|
431
|
+
type VectorStoreFile as VectorStoreFile,
|
432
|
+
type FileDeleteResponse as FileDeleteResponse,
|
433
|
+
type FileSearchResponse as FileSearchResponse,
|
434
|
+
VectorStoreFilesLimitOffset as VectorStoreFilesLimitOffset,
|
435
|
+
type FileCreateParams as FileCreateParams,
|
436
|
+
type FileListParams as FileListParams,
|
437
|
+
type FileSearchParams as FileSearchParams,
|
438
|
+
};
|
439
|
+
}
|