@mixedbread/sdk 0.60.0 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/client.d.mts +28 -6
- package/client.d.mts.map +1 -1
- package/client.d.ts +28 -6
- package/client.d.ts.map +1 -1
- package/client.js +22 -0
- package/client.js.map +1 -1
- package/client.mjs +22 -0
- package/client.mjs.map +1 -1
- package/internal/utils/env.js +2 -2
- package/internal/utils/env.js.map +1 -1
- package/internal/utils/env.mjs +2 -2
- package/internal/utils/env.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/api-keys.d.mts +8 -24
- package/resources/api-keys.d.mts.map +1 -1
- package/resources/api-keys.d.ts +8 -24
- package/resources/api-keys.d.ts.map +1 -1
- package/resources/data-sources/connectors.d.mts +55 -0
- package/resources/data-sources/connectors.d.mts.map +1 -1
- package/resources/data-sources/connectors.d.ts +55 -0
- package/resources/data-sources/connectors.d.ts.map +1 -1
- package/resources/data-sources/connectors.js +55 -0
- package/resources/data-sources/connectors.js.map +1 -1
- package/resources/data-sources/connectors.mjs +55 -0
- package/resources/data-sources/connectors.mjs.map +1 -1
- package/resources/data-sources/data-sources.d.mts +59 -50
- package/resources/data-sources/data-sources.d.mts.map +1 -1
- package/resources/data-sources/data-sources.d.ts +59 -50
- package/resources/data-sources/data-sources.d.ts.map +1 -1
- package/resources/data-sources/data-sources.js +37 -0
- package/resources/data-sources/data-sources.js.map +1 -1
- package/resources/data-sources/data-sources.mjs +37 -0
- package/resources/data-sources/data-sources.mjs.map +1 -1
- package/resources/data-sources/index.d.mts +1 -1
- package/resources/data-sources/index.d.mts.map +1 -1
- package/resources/data-sources/index.d.ts +1 -1
- package/resources/data-sources/index.d.ts.map +1 -1
- package/resources/data-sources/index.js.map +1 -1
- package/resources/data-sources/index.mjs.map +1 -1
- package/resources/embeddings.d.mts +9 -0
- package/resources/embeddings.d.mts.map +1 -1
- package/resources/embeddings.d.ts +9 -0
- package/resources/embeddings.d.ts.map +1 -1
- package/resources/embeddings.js +9 -0
- package/resources/embeddings.js.map +1 -1
- package/resources/embeddings.mjs +9 -0
- package/resources/embeddings.mjs.map +1 -1
- package/resources/files/files.d.mts +47 -0
- package/resources/files/files.d.mts.map +1 -1
- package/resources/files/files.d.ts +47 -0
- package/resources/files/files.d.ts.map +1 -1
- package/resources/files/files.js +47 -0
- package/resources/files/files.js.map +1 -1
- package/resources/files/files.mjs +47 -0
- package/resources/files/files.mjs.map +1 -1
- package/resources/files/uploads.d.mts +36 -0
- package/resources/files/uploads.d.mts.map +1 -1
- package/resources/files/uploads.d.ts +36 -0
- package/resources/files/uploads.d.ts.map +1 -1
- package/resources/files/uploads.js +36 -0
- package/resources/files/uploads.js.map +1 -1
- package/resources/files/uploads.mjs +36 -0
- package/resources/files/uploads.mjs.map +1 -1
- package/resources/index.d.mts +3 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/parsing/index.d.mts +1 -1
- package/resources/parsing/index.d.mts.map +1 -1
- package/resources/parsing/index.d.ts +1 -1
- package/resources/parsing/index.d.ts.map +1 -1
- package/resources/parsing/index.js.map +1 -1
- package/resources/parsing/index.mjs.map +1 -1
- package/resources/parsing/jobs.d.mts +78 -85
- package/resources/parsing/jobs.d.mts.map +1 -1
- package/resources/parsing/jobs.d.ts +78 -85
- package/resources/parsing/jobs.d.ts.map +1 -1
- package/resources/parsing/jobs.js.map +1 -1
- package/resources/parsing/jobs.mjs.map +1 -1
- package/resources/parsing/parsing.d.mts +2 -2
- package/resources/parsing/parsing.d.mts.map +1 -1
- package/resources/parsing/parsing.d.ts +2 -2
- package/resources/parsing/parsing.d.ts.map +1 -1
- package/resources/parsing/parsing.js.map +1 -1
- package/resources/parsing/parsing.mjs.map +1 -1
- package/resources/stores/files.d.mts +159 -744
- package/resources/stores/files.d.mts.map +1 -1
- package/resources/stores/files.d.ts +159 -744
- package/resources/stores/files.d.ts.map +1 -1
- package/resources/stores/files.js +39 -12
- package/resources/stores/files.js.map +1 -1
- package/resources/stores/files.mjs +39 -12
- package/resources/stores/files.mjs.map +1 -1
- package/resources/stores/index.d.mts +2 -2
- package/resources/stores/index.d.mts.map +1 -1
- package/resources/stores/index.d.ts +2 -2
- package/resources/stores/index.d.ts.map +1 -1
- package/resources/stores/index.js.map +1 -1
- package/resources/stores/index.mjs.map +1 -1
- package/resources/stores/stores.d.mts +292 -538
- package/resources/stores/stores.d.mts.map +1 -1
- package/resources/stores/stores.d.ts +292 -538
- package/resources/stores/stores.d.ts.map +1 -1
- package/resources/stores/stores.js +56 -0
- package/resources/stores/stores.js.map +1 -1
- package/resources/stores/stores.mjs +56 -0
- package/resources/stores/stores.mjs.map +1 -1
- package/src/client.ts +60 -0
- package/src/internal/utils/env.ts +2 -2
- package/src/resources/api-keys.ts +8 -29
- package/src/resources/data-sources/connectors.ts +55 -0
- package/src/resources/data-sources/data-sources.ts +63 -56
- package/src/resources/data-sources/index.ts +2 -0
- package/src/resources/embeddings.ts +9 -0
- package/src/resources/files/files.ts +47 -0
- package/src/resources/files/uploads.ts +36 -0
- package/src/resources/index.ts +19 -0
- package/src/resources/parsing/index.ts +4 -1
- package/src/resources/parsing/jobs.ts +96 -100
- package/src/resources/parsing/parsing.ts +7 -1
- package/src/resources/stores/files.ts +343 -1254
- package/src/resources/stores/index.ts +22 -4
- package/src/resources/stores/stores.ts +429 -857
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -27,6 +27,13 @@ export class DataSources extends APIResource {
|
|
|
27
27
|
* Args: params: The data source to create.
|
|
28
28
|
*
|
|
29
29
|
* Returns: The created data source.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const dataSource = await client.dataSources.create({
|
|
34
|
+
* name: 'name',
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
30
37
|
*/
|
|
31
38
|
create(body: DataSourceCreateParams, options?: RequestOptions): APIPromise<DataSource> {
|
|
32
39
|
return this._client.post('/v1/data_sources/', { body, ...options });
|
|
@@ -38,6 +45,13 @@ export class DataSources extends APIResource {
|
|
|
38
45
|
* Args: data_source_id: The ID of the data source to fetch.
|
|
39
46
|
*
|
|
40
47
|
* Returns: The data source.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const dataSource = await client.dataSources.retrieve(
|
|
52
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
53
|
+
* );
|
|
54
|
+
* ```
|
|
41
55
|
*/
|
|
42
56
|
retrieve(dataSourceID: string, options?: RequestOptions): APIPromise<DataSource> {
|
|
43
57
|
return this._client.get(path`/v1/data_sources/${dataSourceID}`, options);
|
|
@@ -50,6 +64,14 @@ export class DataSources extends APIResource {
|
|
|
50
64
|
* source to update.
|
|
51
65
|
*
|
|
52
66
|
* Returns: The updated data source.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* const dataSource = await client.dataSources.update(
|
|
71
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
72
|
+
* { name: 'name' },
|
|
73
|
+
* );
|
|
74
|
+
* ```
|
|
53
75
|
*/
|
|
54
76
|
update(
|
|
55
77
|
dataSourceID: string,
|
|
@@ -63,6 +85,14 @@ export class DataSources extends APIResource {
|
|
|
63
85
|
* Get all data sources.
|
|
64
86
|
*
|
|
65
87
|
* Returns: The list of data sources.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* // Automatically fetches more pages as needed.
|
|
92
|
+
* for await (const dataSource of client.dataSources.list()) {
|
|
93
|
+
* // ...
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
66
96
|
*/
|
|
67
97
|
list(
|
|
68
98
|
query: DataSourceListParams | null | undefined = {},
|
|
@@ -75,6 +105,13 @@ export class DataSources extends APIResource {
|
|
|
75
105
|
* Delete a data source.
|
|
76
106
|
*
|
|
77
107
|
* Args: data_source_id: The ID of the data source to delete.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* const dataSource = await client.dataSources.delete(
|
|
112
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
113
|
+
* );
|
|
114
|
+
* ```
|
|
78
115
|
*/
|
|
79
116
|
delete(dataSourceID: string, options?: RequestOptions): APIPromise<DataSourceDeleteResponse> {
|
|
80
117
|
return this._client.delete(path`/v1/data_sources/${dataSourceID}`, options);
|
|
@@ -83,6 +120,18 @@ export class DataSources extends APIResource {
|
|
|
83
120
|
|
|
84
121
|
export type DataSourcesCursor = Cursor<DataSource>;
|
|
85
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Base class for API key create or update parameters.
|
|
125
|
+
*/
|
|
126
|
+
export interface APIKeyCreateOrUpdateParams {
|
|
127
|
+
type?: 'api_key';
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The API key
|
|
131
|
+
*/
|
|
132
|
+
api_key: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
86
135
|
/**
|
|
87
136
|
* Service-level representation of a data source.
|
|
88
137
|
*/
|
|
@@ -120,7 +169,7 @@ export interface DataSource {
|
|
|
120
169
|
/**
|
|
121
170
|
* Authentication parameters
|
|
122
171
|
*/
|
|
123
|
-
auth_params: DataSourceOauth2Params |
|
|
172
|
+
auth_params: DataSourceOauth2Params | DataSourceAPIKeyParams | null;
|
|
124
173
|
|
|
125
174
|
/**
|
|
126
175
|
* The type of the object
|
|
@@ -128,18 +177,16 @@ export interface DataSource {
|
|
|
128
177
|
object?: 'data_source';
|
|
129
178
|
}
|
|
130
179
|
|
|
131
|
-
|
|
180
|
+
/**
|
|
181
|
+
* Authentication parameters for a API key data source.
|
|
182
|
+
*/
|
|
183
|
+
export interface DataSourceAPIKeyParams {
|
|
184
|
+
type?: 'api_key';
|
|
185
|
+
|
|
132
186
|
/**
|
|
133
|
-
*
|
|
187
|
+
* The API key
|
|
134
188
|
*/
|
|
135
|
-
|
|
136
|
-
type?: 'api_key';
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* The API key
|
|
140
|
-
*/
|
|
141
|
-
api_key: string;
|
|
142
|
-
}
|
|
189
|
+
api_key: string;
|
|
143
190
|
}
|
|
144
191
|
|
|
145
192
|
/**
|
|
@@ -234,21 +281,7 @@ export interface NotionDataSource {
|
|
|
234
281
|
* The authentication parameters of the data source. Notion supports OAuth2 and API
|
|
235
282
|
* key.
|
|
236
283
|
*/
|
|
237
|
-
auth_params?: Oauth2Params |
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export namespace NotionDataSource {
|
|
241
|
-
/**
|
|
242
|
-
* Base class for API key create or update parameters.
|
|
243
|
-
*/
|
|
244
|
-
export interface APIKeyCreateOrUpdateParams {
|
|
245
|
-
type?: 'api_key';
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* The API key
|
|
249
|
-
*/
|
|
250
|
-
api_key: string;
|
|
251
|
-
}
|
|
284
|
+
auth_params?: Oauth2Params | APIKeyCreateOrUpdateParams | null;
|
|
252
285
|
}
|
|
253
286
|
|
|
254
287
|
/**
|
|
@@ -303,21 +336,7 @@ export declare namespace DataSourceCreateParams {
|
|
|
303
336
|
* The authentication parameters of the data source. Notion supports OAuth2 and API
|
|
304
337
|
* key.
|
|
305
338
|
*/
|
|
306
|
-
auth_params?: Oauth2Params |
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
export namespace NotionDataSource {
|
|
310
|
-
/**
|
|
311
|
-
* Base class for API key create or update parameters.
|
|
312
|
-
*/
|
|
313
|
-
export interface APIKeyCreateOrUpdateParams {
|
|
314
|
-
type?: 'api_key';
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* The API key
|
|
318
|
-
*/
|
|
319
|
-
api_key: string;
|
|
320
|
-
}
|
|
339
|
+
auth_params?: Oauth2Params | APIKeyCreateOrUpdateParams | null;
|
|
321
340
|
}
|
|
322
341
|
|
|
323
342
|
export interface LinearDataSource {
|
|
@@ -368,21 +387,7 @@ export declare namespace DataSourceUpdateParams {
|
|
|
368
387
|
* The authentication parameters of the data source. Notion supports OAuth2 and API
|
|
369
388
|
* key.
|
|
370
389
|
*/
|
|
371
|
-
auth_params?: Oauth2Params |
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
export namespace NotionDataSource {
|
|
375
|
-
/**
|
|
376
|
-
* Base class for API key create or update parameters.
|
|
377
|
-
*/
|
|
378
|
-
export interface APIKeyCreateOrUpdateParams {
|
|
379
|
-
type?: 'api_key';
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* The API key
|
|
383
|
-
*/
|
|
384
|
-
api_key: string;
|
|
385
|
-
}
|
|
390
|
+
auth_params?: Oauth2Params | APIKeyCreateOrUpdateParams | null;
|
|
386
391
|
}
|
|
387
392
|
|
|
388
393
|
export interface LinearDataSource {
|
|
@@ -414,7 +419,9 @@ DataSources.Connectors = Connectors;
|
|
|
414
419
|
|
|
415
420
|
export declare namespace DataSources {
|
|
416
421
|
export {
|
|
422
|
+
type APIKeyCreateOrUpdateParams as APIKeyCreateOrUpdateParams,
|
|
417
423
|
type DataSource as DataSource,
|
|
424
|
+
type DataSourceAPIKeyParams as DataSourceAPIKeyParams,
|
|
418
425
|
type DataSourceOauth2Params as DataSourceOauth2Params,
|
|
419
426
|
type DataSourceType as DataSourceType,
|
|
420
427
|
type LinearDataSource as LinearDataSource,
|
|
@@ -13,6 +13,15 @@ export class Embeddings extends APIResource {
|
|
|
13
13
|
* Args: params: The parameters for creating embeddings.
|
|
14
14
|
*
|
|
15
15
|
* Returns: EmbeddingCreateResponse: The response containing the embeddings.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const embeddingCreateResponse =
|
|
20
|
+
* await client.embeddings.create({
|
|
21
|
+
* model: 'mixedbread-ai/mxbai-embed-large-v1',
|
|
22
|
+
* input: 'x',
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
16
25
|
*/
|
|
17
26
|
create(
|
|
18
27
|
body: EmbeddingCreateParams,
|
|
@@ -31,6 +31,13 @@ export class Files extends APIResource {
|
|
|
31
31
|
* Args: file: The file to upload.
|
|
32
32
|
*
|
|
33
33
|
* Returns: FileResponse: The response containing the details of the uploaded file.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const fileObject = await client.files.create({
|
|
38
|
+
* file: fs.createReadStream('path/to/file'),
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
34
41
|
*/
|
|
35
42
|
create(body: FileCreateParams, options?: RequestOptions): APIPromise<FileObject> {
|
|
36
43
|
return handleFileCreate(this._client, body, options);
|
|
@@ -42,6 +49,13 @@ export class Files extends APIResource {
|
|
|
42
49
|
* Args: file_id: The ID of the file to retrieve.
|
|
43
50
|
*
|
|
44
51
|
* Returns: FileResponse: The response containing the file details.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const fileObject = await client.files.retrieve(
|
|
56
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
57
|
+
* );
|
|
58
|
+
* ```
|
|
45
59
|
*/
|
|
46
60
|
retrieve(fileID: string, options?: RequestOptions): APIPromise<FileObject> {
|
|
47
61
|
return this._client.get(path`/v1/files/${fileID}`, options);
|
|
@@ -53,6 +67,14 @@ export class Files extends APIResource {
|
|
|
53
67
|
* Args: file_id: The ID of the file to update. file: The new details for the file.
|
|
54
68
|
*
|
|
55
69
|
* Returns: FileObject: The updated file details.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* const fileObject = await client.files.update(
|
|
74
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
75
|
+
* { file: fs.createReadStream('path/to/file') },
|
|
76
|
+
* );
|
|
77
|
+
* ```
|
|
56
78
|
*/
|
|
57
79
|
update(fileID: string, body: FileUpdateParams, options?: RequestOptions): APIPromise<FileObject> {
|
|
58
80
|
return this._client.post(
|
|
@@ -67,6 +89,14 @@ export class Files extends APIResource {
|
|
|
67
89
|
* Args: pagination: The pagination options
|
|
68
90
|
*
|
|
69
91
|
* Returns: A list of files belonging to the user.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* // Automatically fetches more pages as needed.
|
|
96
|
+
* for await (const fileObject of client.files.list()) {
|
|
97
|
+
* // ...
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
70
100
|
*/
|
|
71
101
|
list(
|
|
72
102
|
query: FileListParams | null | undefined = {},
|
|
@@ -81,6 +111,13 @@ export class Files extends APIResource {
|
|
|
81
111
|
* Args: file_id: The ID of the file to delete.
|
|
82
112
|
*
|
|
83
113
|
* Returns: FileDeleted: The response containing the details of the deleted file.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* const file = await client.files.delete(
|
|
118
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
119
|
+
* );
|
|
120
|
+
* ```
|
|
84
121
|
*/
|
|
85
122
|
delete(fileID: string, options?: RequestOptions): APIPromise<FileDeleteResponse> {
|
|
86
123
|
return this._client.delete(path`/v1/files/${fileID}`, options);
|
|
@@ -92,6 +129,16 @@ export class Files extends APIResource {
|
|
|
92
129
|
* Args: file_id: The ID of the file to download.
|
|
93
130
|
*
|
|
94
131
|
* Returns: FileStreamResponse: The response containing the file to be downloaded.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```ts
|
|
135
|
+
* const response = await client.files.content(
|
|
136
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
137
|
+
* );
|
|
138
|
+
*
|
|
139
|
+
* const content = await response.blob();
|
|
140
|
+
* console.log(content);
|
|
141
|
+
* ```
|
|
95
142
|
*/
|
|
96
143
|
content(fileID: string, options?: RequestOptions): APIPromise<Response> {
|
|
97
144
|
return this._client.get(path`/v1/files/${fileID}/content`, {
|
|
@@ -10,6 +10,15 @@ export class Uploads extends APIResource {
|
|
|
10
10
|
/**
|
|
11
11
|
* Initiate a multipart upload and receive presigned URLs for uploading parts
|
|
12
12
|
* directly to storage.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const upload = await client.files.uploads.create({
|
|
17
|
+
* filename: 'document.pdf',
|
|
18
|
+
* file_size: 10485760,
|
|
19
|
+
* mime_type: 'application/pdf',
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
13
22
|
*/
|
|
14
23
|
create(body: UploadCreateParams, options?: RequestOptions): APIPromise<UploadCreateResponse> {
|
|
15
24
|
return this._client.post('/v1/files/uploads', { body, ...options });
|
|
@@ -18,6 +27,13 @@ export class Uploads extends APIResource {
|
|
|
18
27
|
/**
|
|
19
28
|
* Get a multipart upload's details with fresh presigned URLs for any parts not yet
|
|
20
29
|
* uploaded.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const upload = await client.files.uploads.retrieve(
|
|
34
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
35
|
+
* );
|
|
36
|
+
* ```
|
|
21
37
|
*/
|
|
22
38
|
retrieve(uploadID: string, options?: RequestOptions): APIPromise<UploadRetrieveResponse> {
|
|
23
39
|
return this._client.get(path`/v1/files/uploads/${uploadID}`, options);
|
|
@@ -25,6 +41,11 @@ export class Uploads extends APIResource {
|
|
|
25
41
|
|
|
26
42
|
/**
|
|
27
43
|
* List all in-progress multipart uploads for the authenticated organization.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const uploads = await client.files.uploads.list();
|
|
48
|
+
* ```
|
|
28
49
|
*/
|
|
29
50
|
list(options?: RequestOptions): APIPromise<UploadListResponse> {
|
|
30
51
|
return this._client.get('/v1/files/uploads', options);
|
|
@@ -32,6 +53,13 @@ export class Uploads extends APIResource {
|
|
|
32
53
|
|
|
33
54
|
/**
|
|
34
55
|
* Abort a multipart upload and clean up any uploaded parts.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* const response = await client.files.uploads.abort(
|
|
60
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
61
|
+
* );
|
|
62
|
+
* ```
|
|
35
63
|
*/
|
|
36
64
|
abort(uploadID: string, options?: RequestOptions): APIPromise<UploadAbortResponse> {
|
|
37
65
|
return this._client.post(path`/v1/files/uploads/${uploadID}/abort`, options);
|
|
@@ -40,6 +68,14 @@ export class Uploads extends APIResource {
|
|
|
40
68
|
/**
|
|
41
69
|
* Complete a multipart upload after all parts have been uploaded. Creates the file
|
|
42
70
|
* object and returns it.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const fileObject = await client.files.uploads.complete(
|
|
75
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
76
|
+
* { parts: [{ part_number: 1, etag: 'etag' }] },
|
|
77
|
+
* );
|
|
78
|
+
* ```
|
|
43
79
|
*/
|
|
44
80
|
complete(
|
|
45
81
|
uploadID: string,
|
package/src/resources/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export {
|
|
|
5
5
|
APIKeys,
|
|
6
6
|
type APIKey,
|
|
7
7
|
type APIKeyCreated,
|
|
8
|
+
type Scope,
|
|
8
9
|
type APIKeyDeleteResponse,
|
|
9
10
|
type APIKeyCreateParams,
|
|
10
11
|
type APIKeyListParams,
|
|
@@ -13,7 +14,9 @@ export {
|
|
|
13
14
|
export { Chat, type ChatCreateCompletionResponse } from './chat';
|
|
14
15
|
export {
|
|
15
16
|
DataSources,
|
|
17
|
+
type APIKeyCreateOrUpdateParams,
|
|
16
18
|
type DataSource,
|
|
19
|
+
type DataSourceAPIKeyParams,
|
|
17
20
|
type DataSourceOauth2Params,
|
|
18
21
|
type DataSourceType,
|
|
19
22
|
type LinearDataSource,
|
|
@@ -40,13 +43,29 @@ export {
|
|
|
40
43
|
export { Parsing } from './parsing/parsing';
|
|
41
44
|
export {
|
|
42
45
|
Stores,
|
|
46
|
+
type AgenticSearchConfig,
|
|
47
|
+
type AudioChunkGeneratedMetadata,
|
|
48
|
+
type AudioURL,
|
|
49
|
+
type CodeChunkGeneratedMetadata,
|
|
50
|
+
type ContextualizationConfig,
|
|
43
51
|
type ExpiresAfter,
|
|
52
|
+
type FileCounts,
|
|
53
|
+
type ImageChunkGeneratedMetadata,
|
|
54
|
+
type ImageURLOutput,
|
|
55
|
+
type MarkdownChunkGeneratedMetadata,
|
|
56
|
+
type MarkdownHeading,
|
|
57
|
+
type PdfChunkGeneratedMetadata,
|
|
58
|
+
type RerankConfig,
|
|
44
59
|
type ScoredAudioURLInputChunk,
|
|
45
60
|
type ScoredImageURLInputChunk,
|
|
46
61
|
type ScoredTextInputChunk,
|
|
47
62
|
type ScoredVideoURLInputChunk,
|
|
48
63
|
type Store,
|
|
49
64
|
type StoreChunkSearchOptions,
|
|
65
|
+
type StoreConfig,
|
|
66
|
+
type TextChunkGeneratedMetadata,
|
|
67
|
+
type VideoChunkGeneratedMetadata,
|
|
68
|
+
type VideoURL,
|
|
50
69
|
type StoreDeleteResponse,
|
|
51
70
|
type StoreMetadataFacetsResponse,
|
|
52
71
|
type StoreQuestionAnsweringResponse,
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
4
|
Jobs,
|
|
5
|
+
type Chunk,
|
|
6
|
+
type ChunkElement,
|
|
5
7
|
type ChunkingStrategy,
|
|
8
|
+
type DocumentParserResult,
|
|
6
9
|
type ElementType,
|
|
7
|
-
type ParsingJobStatus,
|
|
8
10
|
type ParsingJob,
|
|
11
|
+
type ParsingJobStatus,
|
|
9
12
|
type ReturnFormat,
|
|
10
13
|
type JobListResponse,
|
|
11
14
|
type JobDeleteResponse,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
|
-
import * as JobsAPI from './jobs';
|
|
5
4
|
import { APIPromise } from '../../core/api-promise';
|
|
6
5
|
import { Cursor, type CursorParams, PagePromise } from '../../core/pagination';
|
|
7
6
|
import { RequestOptions } from '../../internal/request-options';
|
|
@@ -163,11 +162,101 @@ export class Jobs extends APIResource {
|
|
|
163
162
|
|
|
164
163
|
export type JobListResponsesCursor = Cursor<JobListResponse>;
|
|
165
164
|
|
|
165
|
+
/**
|
|
166
|
+
* A chunk of text extracted from a document page.
|
|
167
|
+
*/
|
|
168
|
+
export interface Chunk {
|
|
169
|
+
/**
|
|
170
|
+
* The full content of the chunk
|
|
171
|
+
*/
|
|
172
|
+
content?: string | null;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The content of the chunk to embed
|
|
176
|
+
*/
|
|
177
|
+
content_to_embed: string;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* List of elements contained in this chunk
|
|
181
|
+
*/
|
|
182
|
+
elements: Array<ChunkElement>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Represents an extracted element from a document with its content and metadata.
|
|
187
|
+
*/
|
|
188
|
+
export interface ChunkElement {
|
|
189
|
+
/**
|
|
190
|
+
* The type of the extracted element
|
|
191
|
+
*/
|
|
192
|
+
type: ElementType;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The confidence score of the extraction
|
|
196
|
+
*/
|
|
197
|
+
confidence: number;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The bounding box coordinates [x1, y1, x2, y2]
|
|
201
|
+
*/
|
|
202
|
+
bbox: Array<unknown>;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The page number where the element was found
|
|
206
|
+
*/
|
|
207
|
+
page: number;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The extracted text content of the element
|
|
211
|
+
*/
|
|
212
|
+
content: string;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* A brief summary of the element's content
|
|
216
|
+
*/
|
|
217
|
+
summary?: string | null;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* The base64-encoded image data for figure elements
|
|
221
|
+
*/
|
|
222
|
+
image?: string | null;
|
|
223
|
+
}
|
|
224
|
+
|
|
166
225
|
/**
|
|
167
226
|
* Strategy used for chunking document content.
|
|
168
227
|
*/
|
|
169
228
|
export type ChunkingStrategy = 'page';
|
|
170
229
|
|
|
230
|
+
/**
|
|
231
|
+
* Result of document parsing operation.
|
|
232
|
+
*/
|
|
233
|
+
export interface DocumentParserResult {
|
|
234
|
+
/**
|
|
235
|
+
* The strategy used for chunking the document
|
|
236
|
+
*/
|
|
237
|
+
chunking_strategy: ChunkingStrategy;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* The format of the returned content
|
|
241
|
+
*/
|
|
242
|
+
return_format: ReturnFormat;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* The types of elements extracted
|
|
246
|
+
*/
|
|
247
|
+
element_types: Array<ElementType>;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* List of extracted chunks from the document
|
|
251
|
+
*/
|
|
252
|
+
chunks: Array<Chunk>;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* List of (width, height) tuples for each page
|
|
256
|
+
*/
|
|
257
|
+
page_sizes?: Array<Array<unknown>>;
|
|
258
|
+
}
|
|
259
|
+
|
|
171
260
|
/**
|
|
172
261
|
* Types of elements that can be extracted from a document.
|
|
173
262
|
*/
|
|
@@ -184,8 +273,6 @@ export type ElementType =
|
|
|
184
273
|
| 'text'
|
|
185
274
|
| 'footnote';
|
|
186
275
|
|
|
187
|
-
export type ParsingJobStatus = 'pending' | 'in_progress' | 'cancelled' | 'completed' | 'failed';
|
|
188
|
-
|
|
189
276
|
/**
|
|
190
277
|
* A job for parsing documents with its current state and result.
|
|
191
278
|
*/
|
|
@@ -218,7 +305,7 @@ export interface ParsingJob {
|
|
|
218
305
|
/**
|
|
219
306
|
* Result of document parsing operation.
|
|
220
307
|
*/
|
|
221
|
-
result?:
|
|
308
|
+
result?: DocumentParserResult | null;
|
|
222
309
|
|
|
223
310
|
/**
|
|
224
311
|
* The started time of the job
|
|
@@ -246,101 +333,7 @@ export interface ParsingJob {
|
|
|
246
333
|
object?: 'parsing_job';
|
|
247
334
|
}
|
|
248
335
|
|
|
249
|
-
export
|
|
250
|
-
/**
|
|
251
|
-
* Result of document parsing operation.
|
|
252
|
-
*/
|
|
253
|
-
export interface Result {
|
|
254
|
-
/**
|
|
255
|
-
* The strategy used for chunking the document
|
|
256
|
-
*/
|
|
257
|
-
chunking_strategy: JobsAPI.ChunkingStrategy;
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* The format of the returned content
|
|
261
|
-
*/
|
|
262
|
-
return_format: JobsAPI.ReturnFormat;
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* The types of elements extracted
|
|
266
|
-
*/
|
|
267
|
-
element_types: Array<JobsAPI.ElementType>;
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* List of extracted chunks from the document
|
|
271
|
-
*/
|
|
272
|
-
chunks: Array<Result.Chunk>;
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* List of (width, height) tuples for each page
|
|
276
|
-
*/
|
|
277
|
-
page_sizes?: Array<Array<unknown>>;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
export namespace Result {
|
|
281
|
-
/**
|
|
282
|
-
* A chunk of text extracted from a document page.
|
|
283
|
-
*/
|
|
284
|
-
export interface Chunk {
|
|
285
|
-
/**
|
|
286
|
-
* The full content of the chunk
|
|
287
|
-
*/
|
|
288
|
-
content?: string | null;
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* The content of the chunk to embed
|
|
292
|
-
*/
|
|
293
|
-
content_to_embed: string;
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* List of elements contained in this chunk
|
|
297
|
-
*/
|
|
298
|
-
elements: Array<Chunk.Element>;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
export namespace Chunk {
|
|
302
|
-
/**
|
|
303
|
-
* Represents an extracted element from a document with its content and metadata.
|
|
304
|
-
*/
|
|
305
|
-
export interface Element {
|
|
306
|
-
/**
|
|
307
|
-
* The type of the extracted element
|
|
308
|
-
*/
|
|
309
|
-
type: JobsAPI.ElementType;
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* The confidence score of the extraction
|
|
313
|
-
*/
|
|
314
|
-
confidence: number;
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* The bounding box coordinates [x1, y1, x2, y2]
|
|
318
|
-
*/
|
|
319
|
-
bbox: Array<unknown>;
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* The page number where the element was found
|
|
323
|
-
*/
|
|
324
|
-
page: number;
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* The extracted text content of the element
|
|
328
|
-
*/
|
|
329
|
-
content: string;
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* A brief summary of the element's content
|
|
333
|
-
*/
|
|
334
|
-
summary?: string | null;
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* The base64-encoded image data for figure elements
|
|
338
|
-
*/
|
|
339
|
-
image?: string | null;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
336
|
+
export type ParsingJobStatus = 'pending' | 'in_progress' | 'cancelled' | 'completed' | 'failed';
|
|
344
337
|
|
|
345
338
|
/**
|
|
346
339
|
* Format options for the returned document content.
|
|
@@ -463,10 +456,13 @@ export interface JobListParams extends CursorParams {
|
|
|
463
456
|
|
|
464
457
|
export declare namespace Jobs {
|
|
465
458
|
export {
|
|
459
|
+
type Chunk as Chunk,
|
|
460
|
+
type ChunkElement as ChunkElement,
|
|
466
461
|
type ChunkingStrategy as ChunkingStrategy,
|
|
462
|
+
type DocumentParserResult as DocumentParserResult,
|
|
467
463
|
type ElementType as ElementType,
|
|
468
|
-
type ParsingJobStatus as ParsingJobStatus,
|
|
469
464
|
type ParsingJob as ParsingJob,
|
|
465
|
+
type ParsingJobStatus as ParsingJobStatus,
|
|
470
466
|
type ReturnFormat as ReturnFormat,
|
|
471
467
|
type JobListResponse as JobListResponse,
|
|
472
468
|
type JobDeleteResponse as JobDeleteResponse,
|