Skip to content

Commit 1d47541

Browse files
Stainless Botstainless-app[bot]
Stainless Bot
authored andcommitted
feat(vector store): improve chunking strategy type names (#1041)
1 parent 0c0b6c9 commit 1d47541

File tree

10 files changed

+119
-287
lines changed

10 files changed

+119
-287
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 68
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-1dbac0e95bdb5a89a0dd3d93265475a378214551b7d8c22862928e0d87ace94b.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-85a85e0c08de456441431c0ae4e9c078cc8f9748c29430b9a9058340db6389ee.yml

api.md

+7
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,13 @@ Methods:
199199

200200
Types:
201201

202+
- <code><a href="./src/resources/beta/vector-stores/vector-stores.ts">AutoFileChunkingStrategyParam</a></code>
203+
- <code><a href="./src/resources/beta/vector-stores/vector-stores.ts">FileChunkingStrategy</a></code>
204+
- <code><a href="./src/resources/beta/vector-stores/vector-stores.ts">FileChunkingStrategyParam</a></code>
205+
- <code><a href="./src/resources/beta/vector-stores/vector-stores.ts">OtherFileChunkingStrategyObject</a></code>
206+
- <code><a href="./src/resources/beta/vector-stores/vector-stores.ts">StaticFileChunkingStrategy</a></code>
207+
- <code><a href="./src/resources/beta/vector-stores/vector-stores.ts">StaticFileChunkingStrategyObject</a></code>
208+
- <code><a href="./src/resources/beta/vector-stores/vector-stores.ts">StaticFileChunkingStrategyParam</a></code>
202209
- <code><a href="./src/resources/beta/vector-stores/vector-stores.ts">VectorStore</a></code>
203210
- <code><a href="./src/resources/beta/vector-stores/vector-stores.ts">VectorStoreDeleted</a></code>
204211

src/resources/beta/assistants.ts

+3-41
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as Shared from '../shared';
88
import * as ChatAPI from '../chat/chat';
99
import * as MessagesAPI from './threads/messages';
1010
import * as ThreadsAPI from './threads/threads';
11+
import * as VectorStoresAPI from './vector-stores/vector-stores';
1112
import * as RunsAPI from './threads/runs/runs';
1213
import * as StepsAPI from './threads/runs/steps';
1314
import { CursorPage, type CursorPageParams } from '../../pagination';
@@ -1218,9 +1219,9 @@ export namespace AssistantCreateParams {
12181219
export interface VectorStore {
12191220
/**
12201221
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
1221-
* strategy.
1222+
* strategy. Only applicable if `file_ids` is non-empty.
12221223
*/
1223-
chunking_strategy?: VectorStore.Auto | VectorStore.Static;
1224+
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
12241225

12251226
/**
12261227
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
@@ -1237,45 +1238,6 @@ export namespace AssistantCreateParams {
12371238
*/
12381239
metadata?: unknown;
12391240
}
1240-
1241-
export namespace VectorStore {
1242-
/**
1243-
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
1244-
* `800` and `chunk_overlap_tokens` of `400`.
1245-
*/
1246-
export interface Auto {
1247-
/**
1248-
* Always `auto`.
1249-
*/
1250-
type: 'auto';
1251-
}
1252-
1253-
export interface Static {
1254-
static: Static.Static;
1255-
1256-
/**
1257-
* Always `static`.
1258-
*/
1259-
type: 'static';
1260-
}
1261-
1262-
export namespace Static {
1263-
export interface Static {
1264-
/**
1265-
* The number of tokens that overlap between chunks. The default value is `400`.
1266-
*
1267-
* Note that the overlap must not exceed half of `max_chunk_size_tokens`.
1268-
*/
1269-
chunk_overlap_tokens: number;
1270-
1271-
/**
1272-
* The maximum number of tokens in each chunk. The default value is `800`. The
1273-
* minimum value is `100` and the maximum value is `4096`.
1274-
*/
1275-
max_chunk_size_tokens: number;
1276-
}
1277-
}
1278-
}
12791241
}
12801242
}
12811243
}

src/resources/beta/beta.ts

+7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ export class Beta extends APIResource {
1515

1616
export namespace Beta {
1717
export import VectorStores = VectorStoresAPI.VectorStores;
18+
export import AutoFileChunkingStrategyParam = VectorStoresAPI.AutoFileChunkingStrategyParam;
19+
export import FileChunkingStrategy = VectorStoresAPI.FileChunkingStrategy;
20+
export import FileChunkingStrategyParam = VectorStoresAPI.FileChunkingStrategyParam;
21+
export import OtherFileChunkingStrategyObject = VectorStoresAPI.OtherFileChunkingStrategyObject;
22+
export import StaticFileChunkingStrategy = VectorStoresAPI.StaticFileChunkingStrategy;
23+
export import StaticFileChunkingStrategyObject = VectorStoresAPI.StaticFileChunkingStrategyObject;
24+
export import StaticFileChunkingStrategyParam = VectorStoresAPI.StaticFileChunkingStrategyParam;
1825
export import VectorStore = VectorStoresAPI.VectorStore;
1926
export import VectorStoreDeleted = VectorStoresAPI.VectorStoreDeleted;
2027
export import VectorStoresPage = VectorStoresAPI.VectorStoresPage;

src/resources/beta/index.ts

+7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ export {
3737
export { Beta } from './beta';
3838
export { Chat } from './chat/index';
3939
export {
40+
AutoFileChunkingStrategyParam,
41+
FileChunkingStrategy,
42+
FileChunkingStrategyParam,
43+
OtherFileChunkingStrategyObject,
44+
StaticFileChunkingStrategy,
45+
StaticFileChunkingStrategyObject,
46+
StaticFileChunkingStrategyParam,
4047
VectorStore,
4148
VectorStoreDeleted,
4249
VectorStoreCreateParams,

src/resources/beta/threads/threads.ts

+5-82
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as Shared from '../../shared';
1010
import * as AssistantsAPI from '../assistants';
1111
import * as ChatAPI from '../../chat/chat';
1212
import * as MessagesAPI from './messages';
13+
import * as VectorStoresAPI from '../vector-stores/vector-stores';
1314
import * as RunsAPI from './runs/runs';
1415
import { Stream } from '../../../streaming';
1516

@@ -379,9 +380,9 @@ export namespace ThreadCreateParams {
379380
export interface VectorStore {
380381
/**
381382
* 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.
383384
*/
384-
chunking_strategy?: VectorStore.Auto | VectorStore.Static;
385+
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
385386

386387
/**
387388
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
@@ -398,45 +399,6 @@ export namespace ThreadCreateParams {
398399
*/
399400
metadata?: unknown;
400401
}
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-
}
440402
}
441403
}
442404
}
@@ -765,9 +727,9 @@ export namespace ThreadCreateAndRunParams {
765727
export interface VectorStore {
766728
/**
767729
* 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.
769731
*/
770-
chunking_strategy?: VectorStore.Auto | VectorStore.Static;
732+
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
771733

772734
/**
773735
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
@@ -784,45 +746,6 @@ export namespace ThreadCreateAndRunParams {
784746
*/
785747
metadata?: unknown;
786748
}
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-
}
826749
}
827750
}
828751
}

src/resources/beta/vector-stores/file-batches.ts

+3-43
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as Core from '../../../core';
99
import * as FileBatchesAPI from './file-batches';
1010
import * as FilesAPI from './files';
1111
import { VectorStoreFilesPage } from './files';
12+
import * as VectorStoresAPI from './vector-stores';
1213
import { type CursorPageParams } from '../../../pagination';
1314

1415
export class FileBatches extends APIResource {
@@ -267,50 +268,9 @@ export interface FileBatchCreateParams {
267268

268269
/**
269270
* 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.
271272
*/
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;
314274
}
315275

316276
export interface FileBatchListFilesParams extends CursorPageParams {

0 commit comments

Comments
 (0)