openai 4.57.2 → 4.58.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 +26 -0
- package/README.md +1 -1
- package/helpers/zod.d.ts +6 -6
- package/helpers/zod.d.ts.map +1 -1
- package/helpers/zod.js.map +1 -1
- package/helpers/zod.mjs.map +1 -1
- package/package.json +2 -2
- package/resources/beta/assistants.d.ts +3 -36
- package/resources/beta/assistants.d.ts.map +1 -1
- package/resources/beta/assistants.js.map +1 -1
- package/resources/beta/assistants.mjs.map +1 -1
- package/resources/beta/beta.d.ts +7 -0
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/index.d.ts +1 -1
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/threads/threads.d.ts +5 -72
- package/resources/beta/threads/threads.d.ts.map +1 -1
- package/resources/beta/threads/threads.js.map +1 -1
- package/resources/beta/threads/threads.mjs.map +1 -1
- package/resources/beta/vector-stores/file-batches.d.ts +3 -36
- package/resources/beta/vector-stores/file-batches.d.ts.map +1 -1
- package/resources/beta/vector-stores/file-batches.js.map +1 -1
- package/resources/beta/vector-stores/file-batches.mjs.map +1 -1
- package/resources/beta/vector-stores/files.d.ts +4 -70
- package/resources/beta/vector-stores/files.d.ts.map +1 -1
- package/resources/beta/vector-stores/files.js.map +1 -1
- package/resources/beta/vector-stores/files.mjs.map +1 -1
- package/resources/beta/vector-stores/index.d.ts +1 -1
- package/resources/beta/vector-stores/index.d.ts.map +1 -1
- package/resources/beta/vector-stores/index.js.map +1 -1
- package/resources/beta/vector-stores/index.mjs.map +1 -1
- package/resources/beta/vector-stores/vector-stores.d.ts +65 -33
- package/resources/beta/vector-stores/vector-stores.d.ts.map +1 -1
- package/resources/beta/vector-stores/vector-stores.js.map +1 -1
- package/resources/beta/vector-stores/vector-stores.mjs.map +1 -1
- package/src/helpers/zod.ts +8 -8
- package/src/resources/beta/assistants.ts +3 -41
- package/src/resources/beta/beta.ts +7 -0
- package/src/resources/beta/index.ts +7 -0
- package/src/resources/beta/threads/threads.ts +5 -82
- package/src/resources/beta/vector-stores/file-batches.ts +3 -43
- package/src/resources/beta/vector-stores/files.ts +4 -82
- package/src/resources/beta/vector-stores/index.ts +7 -0
- package/src/resources/beta/vector-stores/vector-stores.ts +75 -38
- package/src/uploads.ts +5 -3
- package/src/version.ts +1 -1
- package/uploads.d.ts.map +1 -1
- package/uploads.js +5 -3
- package/uploads.js.map +1 -1
- package/uploads.mjs +5 -3
- package/uploads.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -10,6 +10,7 @@ import * as Shared from '../../shared';
|
|
|
10
10
|
import * as AssistantsAPI from '../assistants';
|
|
11
11
|
import * as ChatAPI from '../../chat/chat';
|
|
12
12
|
import * as MessagesAPI from './messages';
|
|
13
|
+
import * as VectorStoresAPI from '../vector-stores/vector-stores';
|
|
13
14
|
import * as RunsAPI from './runs/runs';
|
|
14
15
|
import { Stream } from '../../../streaming';
|
|
15
16
|
|
|
@@ -379,9 +380,9 @@ export namespace ThreadCreateParams {
|
|
|
379
380
|
export interface VectorStore {
|
|
380
381
|
/**
|
|
381
382
|
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
|
|
382
|
-
* strategy.
|
|
383
|
+
* strategy. Only applicable if `file_ids` is non-empty.
|
|
383
384
|
*/
|
|
384
|
-
chunking_strategy?:
|
|
385
|
+
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
|
|
385
386
|
|
|
386
387
|
/**
|
|
387
388
|
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
|
|
@@ -398,45 +399,6 @@ export namespace ThreadCreateParams {
|
|
|
398
399
|
*/
|
|
399
400
|
metadata?: unknown;
|
|
400
401
|
}
|
|
401
|
-
|
|
402
|
-
export namespace VectorStore {
|
|
403
|
-
/**
|
|
404
|
-
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
|
|
405
|
-
* `800` and `chunk_overlap_tokens` of `400`.
|
|
406
|
-
*/
|
|
407
|
-
export interface Auto {
|
|
408
|
-
/**
|
|
409
|
-
* Always `auto`.
|
|
410
|
-
*/
|
|
411
|
-
type: 'auto';
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
export interface Static {
|
|
415
|
-
static: Static.Static;
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Always `static`.
|
|
419
|
-
*/
|
|
420
|
-
type: 'static';
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
export namespace Static {
|
|
424
|
-
export interface Static {
|
|
425
|
-
/**
|
|
426
|
-
* The number of tokens that overlap between chunks. The default value is `400`.
|
|
427
|
-
*
|
|
428
|
-
* Note that the overlap must not exceed half of `max_chunk_size_tokens`.
|
|
429
|
-
*/
|
|
430
|
-
chunk_overlap_tokens: number;
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* The maximum number of tokens in each chunk. The default value is `800`. The
|
|
434
|
-
* minimum value is `100` and the maximum value is `4096`.
|
|
435
|
-
*/
|
|
436
|
-
max_chunk_size_tokens: number;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
402
|
}
|
|
441
403
|
}
|
|
442
404
|
}
|
|
@@ -765,9 +727,9 @@ export namespace ThreadCreateAndRunParams {
|
|
|
765
727
|
export interface VectorStore {
|
|
766
728
|
/**
|
|
767
729
|
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
|
|
768
|
-
* strategy.
|
|
730
|
+
* strategy. Only applicable if `file_ids` is non-empty.
|
|
769
731
|
*/
|
|
770
|
-
chunking_strategy?:
|
|
732
|
+
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
|
|
771
733
|
|
|
772
734
|
/**
|
|
773
735
|
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
|
|
@@ -784,45 +746,6 @@ export namespace ThreadCreateAndRunParams {
|
|
|
784
746
|
*/
|
|
785
747
|
metadata?: unknown;
|
|
786
748
|
}
|
|
787
|
-
|
|
788
|
-
export namespace VectorStore {
|
|
789
|
-
/**
|
|
790
|
-
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
|
|
791
|
-
* `800` and `chunk_overlap_tokens` of `400`.
|
|
792
|
-
*/
|
|
793
|
-
export interface Auto {
|
|
794
|
-
/**
|
|
795
|
-
* Always `auto`.
|
|
796
|
-
*/
|
|
797
|
-
type: 'auto';
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
export interface Static {
|
|
801
|
-
static: Static.Static;
|
|
802
|
-
|
|
803
|
-
/**
|
|
804
|
-
* Always `static`.
|
|
805
|
-
*/
|
|
806
|
-
type: 'static';
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
export namespace Static {
|
|
810
|
-
export interface Static {
|
|
811
|
-
/**
|
|
812
|
-
* The number of tokens that overlap between chunks. The default value is `400`.
|
|
813
|
-
*
|
|
814
|
-
* Note that the overlap must not exceed half of `max_chunk_size_tokens`.
|
|
815
|
-
*/
|
|
816
|
-
chunk_overlap_tokens: number;
|
|
817
|
-
|
|
818
|
-
/**
|
|
819
|
-
* The maximum number of tokens in each chunk. The default value is `800`. The
|
|
820
|
-
* minimum value is `100` and the maximum value is `4096`.
|
|
821
|
-
*/
|
|
822
|
-
max_chunk_size_tokens: number;
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
749
|
}
|
|
827
750
|
}
|
|
828
751
|
}
|
|
@@ -9,6 +9,7 @@ import * as Core from '../../../core';
|
|
|
9
9
|
import * as FileBatchesAPI from './file-batches';
|
|
10
10
|
import * as FilesAPI from './files';
|
|
11
11
|
import { VectorStoreFilesPage } from './files';
|
|
12
|
+
import * as VectorStoresAPI from './vector-stores';
|
|
12
13
|
import { type CursorPageParams } from '../../../pagination';
|
|
13
14
|
|
|
14
15
|
export class FileBatches extends APIResource {
|
|
@@ -267,50 +268,9 @@ export interface FileBatchCreateParams {
|
|
|
267
268
|
|
|
268
269
|
/**
|
|
269
270
|
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
|
|
270
|
-
* strategy.
|
|
271
|
+
* strategy. Only applicable if `file_ids` is non-empty.
|
|
271
272
|
*/
|
|
272
|
-
chunking_strategy?:
|
|
273
|
-
| FileBatchCreateParams.AutoChunkingStrategyRequestParam
|
|
274
|
-
| FileBatchCreateParams.StaticChunkingStrategyRequestParam;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
export namespace FileBatchCreateParams {
|
|
278
|
-
/**
|
|
279
|
-
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
|
|
280
|
-
* `800` and `chunk_overlap_tokens` of `400`.
|
|
281
|
-
*/
|
|
282
|
-
export interface AutoChunkingStrategyRequestParam {
|
|
283
|
-
/**
|
|
284
|
-
* Always `auto`.
|
|
285
|
-
*/
|
|
286
|
-
type: 'auto';
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
export interface StaticChunkingStrategyRequestParam {
|
|
290
|
-
static: StaticChunkingStrategyRequestParam.Static;
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Always `static`.
|
|
294
|
-
*/
|
|
295
|
-
type: 'static';
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
export namespace StaticChunkingStrategyRequestParam {
|
|
299
|
-
export interface Static {
|
|
300
|
-
/**
|
|
301
|
-
* The number of tokens that overlap between chunks. The default value is `400`.
|
|
302
|
-
*
|
|
303
|
-
* Note that the overlap must not exceed half of `max_chunk_size_tokens`.
|
|
304
|
-
*/
|
|
305
|
-
chunk_overlap_tokens: number;
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* The maximum number of tokens in each chunk. The default value is `800`. The
|
|
309
|
-
* minimum value is `100` and the maximum value is `4096`.
|
|
310
|
-
*/
|
|
311
|
-
max_chunk_size_tokens: number;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
273
|
+
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
|
|
314
274
|
}
|
|
315
275
|
|
|
316
276
|
export interface FileBatchListFilesParams extends CursorPageParams {
|
|
@@ -4,6 +4,7 @@ import { APIResource } from '../../../resource';
|
|
|
4
4
|
import { sleep, Uploadable, isRequestOptions } from '../../../core';
|
|
5
5
|
import * as Core from '../../../core';
|
|
6
6
|
import * as FilesAPI from './files';
|
|
7
|
+
import * as VectorStoresAPI from './vector-stores';
|
|
7
8
|
import { CursorPage, type CursorPageParams } from '../../../pagination';
|
|
8
9
|
|
|
9
10
|
export class Files extends APIResource {
|
|
@@ -220,7 +221,7 @@ export interface VectorStoreFile {
|
|
|
220
221
|
/**
|
|
221
222
|
* The strategy used to chunk the file.
|
|
222
223
|
*/
|
|
223
|
-
chunking_strategy?:
|
|
224
|
+
chunking_strategy?: VectorStoresAPI.FileChunkingStrategy;
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
export namespace VectorStoreFile {
|
|
@@ -239,44 +240,6 @@ export namespace VectorStoreFile {
|
|
|
239
240
|
*/
|
|
240
241
|
message: string;
|
|
241
242
|
}
|
|
242
|
-
|
|
243
|
-
export interface Static {
|
|
244
|
-
static: Static.Static;
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Always `static`.
|
|
248
|
-
*/
|
|
249
|
-
type: 'static';
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export namespace Static {
|
|
253
|
-
export interface Static {
|
|
254
|
-
/**
|
|
255
|
-
* The number of tokens that overlap between chunks. The default value is `400`.
|
|
256
|
-
*
|
|
257
|
-
* Note that the overlap must not exceed half of `max_chunk_size_tokens`.
|
|
258
|
-
*/
|
|
259
|
-
chunk_overlap_tokens: number;
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* The maximum number of tokens in each chunk. The default value is `800`. The
|
|
263
|
-
* minimum value is `100` and the maximum value is `4096`.
|
|
264
|
-
*/
|
|
265
|
-
max_chunk_size_tokens: number;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* This is returned when the chunking strategy is unknown. Typically, this is
|
|
271
|
-
* because the file was indexed before the `chunking_strategy` concept was
|
|
272
|
-
* introduced in the API.
|
|
273
|
-
*/
|
|
274
|
-
export interface Other {
|
|
275
|
-
/**
|
|
276
|
-
* Always `other`.
|
|
277
|
-
*/
|
|
278
|
-
type: 'other';
|
|
279
|
-
}
|
|
280
243
|
}
|
|
281
244
|
|
|
282
245
|
export interface VectorStoreFileDeleted {
|
|
@@ -297,50 +260,9 @@ export interface FileCreateParams {
|
|
|
297
260
|
|
|
298
261
|
/**
|
|
299
262
|
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
|
|
300
|
-
* strategy.
|
|
263
|
+
* strategy. Only applicable if `file_ids` is non-empty.
|
|
301
264
|
*/
|
|
302
|
-
chunking_strategy?:
|
|
303
|
-
| FileCreateParams.AutoChunkingStrategyRequestParam
|
|
304
|
-
| FileCreateParams.StaticChunkingStrategyRequestParam;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
export namespace FileCreateParams {
|
|
308
|
-
/**
|
|
309
|
-
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
|
|
310
|
-
* `800` and `chunk_overlap_tokens` of `400`.
|
|
311
|
-
*/
|
|
312
|
-
export interface AutoChunkingStrategyRequestParam {
|
|
313
|
-
/**
|
|
314
|
-
* Always `auto`.
|
|
315
|
-
*/
|
|
316
|
-
type: 'auto';
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
export interface StaticChunkingStrategyRequestParam {
|
|
320
|
-
static: StaticChunkingStrategyRequestParam.Static;
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Always `static`.
|
|
324
|
-
*/
|
|
325
|
-
type: 'static';
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
export namespace StaticChunkingStrategyRequestParam {
|
|
329
|
-
export interface Static {
|
|
330
|
-
/**
|
|
331
|
-
* The number of tokens that overlap between chunks. The default value is `400`.
|
|
332
|
-
*
|
|
333
|
-
* Note that the overlap must not exceed half of `max_chunk_size_tokens`.
|
|
334
|
-
*/
|
|
335
|
-
chunk_overlap_tokens: number;
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* The maximum number of tokens in each chunk. The default value is `800`. The
|
|
339
|
-
* minimum value is `100` and the maximum value is `4096`.
|
|
340
|
-
*/
|
|
341
|
-
max_chunk_size_tokens: number;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
265
|
+
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
|
|
344
266
|
}
|
|
345
267
|
|
|
346
268
|
export interface FileListParams extends CursorPageParams {
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
|
+
AutoFileChunkingStrategyParam,
|
|
5
|
+
FileChunkingStrategy,
|
|
6
|
+
FileChunkingStrategyParam,
|
|
7
|
+
OtherFileChunkingStrategyObject,
|
|
8
|
+
StaticFileChunkingStrategy,
|
|
9
|
+
StaticFileChunkingStrategyObject,
|
|
10
|
+
StaticFileChunkingStrategyParam,
|
|
4
11
|
VectorStore,
|
|
5
12
|
VectorStoreDeleted,
|
|
6
13
|
VectorStoreCreateParams,
|
|
@@ -83,6 +83,73 @@ export class VectorStores extends APIResource {
|
|
|
83
83
|
|
|
84
84
|
export class VectorStoresPage extends CursorPage<VectorStore> {}
|
|
85
85
|
|
|
86
|
+
/**
|
|
87
|
+
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
|
|
88
|
+
* `800` and `chunk_overlap_tokens` of `400`.
|
|
89
|
+
*/
|
|
90
|
+
export interface AutoFileChunkingStrategyParam {
|
|
91
|
+
/**
|
|
92
|
+
* Always `auto`.
|
|
93
|
+
*/
|
|
94
|
+
type: 'auto';
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The strategy used to chunk the file.
|
|
99
|
+
*/
|
|
100
|
+
export type FileChunkingStrategy = StaticFileChunkingStrategyObject | OtherFileChunkingStrategyObject;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
|
|
104
|
+
* strategy. Only applicable if `file_ids` is non-empty.
|
|
105
|
+
*/
|
|
106
|
+
export type FileChunkingStrategyParam = AutoFileChunkingStrategyParam | StaticFileChunkingStrategyParam;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* This is returned when the chunking strategy is unknown. Typically, this is
|
|
110
|
+
* because the file was indexed before the `chunking_strategy` concept was
|
|
111
|
+
* introduced in the API.
|
|
112
|
+
*/
|
|
113
|
+
export interface OtherFileChunkingStrategyObject {
|
|
114
|
+
/**
|
|
115
|
+
* Always `other`.
|
|
116
|
+
*/
|
|
117
|
+
type: 'other';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface StaticFileChunkingStrategy {
|
|
121
|
+
/**
|
|
122
|
+
* The number of tokens that overlap between chunks. The default value is `400`.
|
|
123
|
+
*
|
|
124
|
+
* Note that the overlap must not exceed half of `max_chunk_size_tokens`.
|
|
125
|
+
*/
|
|
126
|
+
chunk_overlap_tokens: number;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The maximum number of tokens in each chunk. The default value is `800`. The
|
|
130
|
+
* minimum value is `100` and the maximum value is `4096`.
|
|
131
|
+
*/
|
|
132
|
+
max_chunk_size_tokens: number;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface StaticFileChunkingStrategyObject {
|
|
136
|
+
static: StaticFileChunkingStrategy;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Always `static`.
|
|
140
|
+
*/
|
|
141
|
+
type: 'static';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface StaticFileChunkingStrategyParam {
|
|
145
|
+
static: StaticFileChunkingStrategy;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Always `static`.
|
|
149
|
+
*/
|
|
150
|
+
type: 'static';
|
|
151
|
+
}
|
|
152
|
+
|
|
86
153
|
/**
|
|
87
154
|
* A vector store is a collection of processed files can be used by the
|
|
88
155
|
* `file_search` tool.
|
|
@@ -204,7 +271,7 @@ export interface VectorStoreCreateParams {
|
|
|
204
271
|
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
|
|
205
272
|
* strategy. Only applicable if `file_ids` is non-empty.
|
|
206
273
|
*/
|
|
207
|
-
chunking_strategy?:
|
|
274
|
+
chunking_strategy?: FileChunkingStrategyParam;
|
|
208
275
|
|
|
209
276
|
/**
|
|
210
277
|
* The expiration policy for a vector store.
|
|
@@ -233,43 +300,6 @@ export interface VectorStoreCreateParams {
|
|
|
233
300
|
}
|
|
234
301
|
|
|
235
302
|
export namespace VectorStoreCreateParams {
|
|
236
|
-
/**
|
|
237
|
-
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
|
|
238
|
-
* `800` and `chunk_overlap_tokens` of `400`.
|
|
239
|
-
*/
|
|
240
|
-
export interface Auto {
|
|
241
|
-
/**
|
|
242
|
-
* Always `auto`.
|
|
243
|
-
*/
|
|
244
|
-
type: 'auto';
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
export interface Static {
|
|
248
|
-
static: Static.Static;
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Always `static`.
|
|
252
|
-
*/
|
|
253
|
-
type: 'static';
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
export namespace Static {
|
|
257
|
-
export interface Static {
|
|
258
|
-
/**
|
|
259
|
-
* The number of tokens that overlap between chunks. The default value is `400`.
|
|
260
|
-
*
|
|
261
|
-
* Note that the overlap must not exceed half of `max_chunk_size_tokens`.
|
|
262
|
-
*/
|
|
263
|
-
chunk_overlap_tokens: number;
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* The maximum number of tokens in each chunk. The default value is `800`. The
|
|
267
|
-
* minimum value is `100` and the maximum value is `4096`.
|
|
268
|
-
*/
|
|
269
|
-
max_chunk_size_tokens: number;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
303
|
/**
|
|
274
304
|
* The expiration policy for a vector store.
|
|
275
305
|
*/
|
|
@@ -342,6 +372,13 @@ export interface VectorStoreListParams extends CursorPageParams {
|
|
|
342
372
|
}
|
|
343
373
|
|
|
344
374
|
export namespace VectorStores {
|
|
375
|
+
export import AutoFileChunkingStrategyParam = VectorStoresAPI.AutoFileChunkingStrategyParam;
|
|
376
|
+
export import FileChunkingStrategy = VectorStoresAPI.FileChunkingStrategy;
|
|
377
|
+
export import FileChunkingStrategyParam = VectorStoresAPI.FileChunkingStrategyParam;
|
|
378
|
+
export import OtherFileChunkingStrategyObject = VectorStoresAPI.OtherFileChunkingStrategyObject;
|
|
379
|
+
export import StaticFileChunkingStrategy = VectorStoresAPI.StaticFileChunkingStrategy;
|
|
380
|
+
export import StaticFileChunkingStrategyObject = VectorStoresAPI.StaticFileChunkingStrategyObject;
|
|
381
|
+
export import StaticFileChunkingStrategyParam = VectorStoresAPI.StaticFileChunkingStrategyParam;
|
|
345
382
|
export import VectorStore = VectorStoresAPI.VectorStore;
|
|
346
383
|
export import VectorStoreDeleted = VectorStoresAPI.VectorStoreDeleted;
|
|
347
384
|
export import VectorStoresPage = VectorStoresAPI.VectorStoresPage;
|
package/src/uploads.ts
CHANGED
|
@@ -107,8 +107,10 @@ export async function toFile(
|
|
|
107
107
|
// If it's a promise, resolve it.
|
|
108
108
|
value = await value;
|
|
109
109
|
|
|
110
|
-
//
|
|
111
|
-
|
|
110
|
+
// If we've been given a `File` we don't need to do anything
|
|
111
|
+
if (isFileLike(value)) {
|
|
112
|
+
return value;
|
|
113
|
+
}
|
|
112
114
|
|
|
113
115
|
if (isResponseLike(value)) {
|
|
114
116
|
const blob = await value.blob();
|
|
@@ -126,7 +128,7 @@ export async function toFile(
|
|
|
126
128
|
|
|
127
129
|
name ||= getName(value) ?? 'unknown_file';
|
|
128
130
|
|
|
129
|
-
if (!options
|
|
131
|
+
if (!options?.type) {
|
|
130
132
|
const type = (bits[0] as any)?.type;
|
|
131
133
|
if (typeof type === 'string') {
|
|
132
134
|
options = { ...options, type };
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.58.0'; // x-release-please-version
|
package/uploads.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EACL,QAAQ,EAER,KAAK,IAAI,EACT,KAAK,eAAe,EAEpB,KAAK,YAAY,EAElB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,KAAK,YAAY,GAAG,MAAM,GAAG,WAAW,GAAG,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;AAC9F,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,eAAe,GAAG,IAAI,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE7F;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,6EAA6E;IAC7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wBAEtC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;AAEnG;;;;;;;;GAQG;AACH,wBAAsB,MAAM,CAC1B,KAAK,EAAE,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,EAC7C,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,GACpC,OAAO,CAAC,QAAQ,CAAC,CAiCnB;AAmDD,eAAO,MAAM,eAAe,SAAU,GAAG,0BACsD,CAAC;AAEhG;;;GAGG;AACH,eAAO,MAAM,gCAAgC,sGAO5C,CAAC;AAEF,eAAO,MAAM,2BAA2B,sGAKvC,CAAC;AAEF,eAAO,MAAM,UAAU,wDAA6D,QAAQ,QAAQ,CAInG,CAAC"}
|
package/uploads.js
CHANGED
|
@@ -43,8 +43,10 @@ exports.isUploadable = isUploadable;
|
|
|
43
43
|
async function toFile(value, name, options) {
|
|
44
44
|
// If it's a promise, resolve it.
|
|
45
45
|
value = await value;
|
|
46
|
-
//
|
|
47
|
-
|
|
46
|
+
// If we've been given a `File` we don't need to do anything
|
|
47
|
+
if ((0, exports.isFileLike)(value)) {
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
48
50
|
if ((0, exports.isResponseLike)(value)) {
|
|
49
51
|
const blob = await value.blob();
|
|
50
52
|
name || (name = new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file');
|
|
@@ -56,7 +58,7 @@ async function toFile(value, name, options) {
|
|
|
56
58
|
}
|
|
57
59
|
const bits = await getBytes(value);
|
|
58
60
|
name || (name = getName(value) ?? 'unknown_file');
|
|
59
|
-
if (!options
|
|
61
|
+
if (!options?.type) {
|
|
60
62
|
const type = bits[0]?.type;
|
|
61
63
|
if (typeof type === 'string') {
|
|
62
64
|
options = { ...options, type };
|
package/uploads.js.map
CHANGED
|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ACzC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;QACxF,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;KACjC;SAAM,IAAI,IAAA,oBAAY,EAAC,KAAK,CAAC,EAAE;QAC9B,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,IAAY,CAAC,CAAC;KAChC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAC/B,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;KAChF;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACpC,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,GAAG,EAAE,IAAI,CAAC,CAAC,CACzF,CAAC;KACH;SAAM;QACL,MAAM,IAAI,SAAS,CACjB,wGAAwG,KAAK,UAAU,CACxH,CAAC;KACH;AACH,CAAC,CAAC"}
|
package/uploads.mjs
CHANGED
|
@@ -35,8 +35,10 @@ export const isUploadable = (value) => {
|
|
|
35
35
|
export async function toFile(value, name, options) {
|
|
36
36
|
// If it's a promise, resolve it.
|
|
37
37
|
value = await value;
|
|
38
|
-
//
|
|
39
|
-
|
|
38
|
+
// If we've been given a `File` we don't need to do anything
|
|
39
|
+
if (isFileLike(value)) {
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
40
42
|
if (isResponseLike(value)) {
|
|
41
43
|
const blob = await value.blob();
|
|
42
44
|
name || (name = new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file');
|
|
@@ -48,7 +50,7 @@ export async function toFile(value, name, options) {
|
|
|
48
50
|
}
|
|
49
51
|
const bits = await getBytes(value);
|
|
50
52
|
name || (name = getName(value) ?? 'unknown_file');
|
|
51
|
-
if (!options
|
|
53
|
+
if (!options?.type) {
|
|
52
54
|
const type = bits[0]?.type;
|
|
53
55
|
if (typeof type === 'string') {
|
|
54
56
|
options = { ...options, type };
|
package/uploads.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"OACO,EACL,QAAQ,EACR,IAAI,EAGJ,0BAA0B,EAE1B,cAAc,GACf;OAEM,EAAE,YAAY,EAAE;AAiDvB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAU,EAAyB,EAAE,CAClE,KAAK,IAAI,IAAI;IACb,OAAO,KAAK,KAAK,QAAQ;IACzB,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ;IAC7B,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAU,EAAqB,EAAE,CAC1D,KAAK,IAAI,IAAI;IACb,OAAO,KAAK,KAAK,QAAQ;IACzB,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;IAC9B,OAAO,KAAK,CAAC,YAAY,KAAK,QAAQ;IACtC,UAAU,CAAC,KAAK,CAAC,CAAC;AAEpB;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAU,EAA+D,EAAE,CACpG,KAAK,IAAI,IAAI;IACb,OAAO,KAAK,KAAK,QAAQ;IACzB,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;IAC9B,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ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";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.58.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|