diff --git a/.stats.yml b/.stats.yml index fd4f27136..903c15996 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-1dbac0e95bdb5a89a0dd3d93265475a378214551b7d8c22862928e0d87ace94b.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-85a85e0c08de456441431c0ae4e9c078cc8f9748c29430b9a9058340db6389ee.yml diff --git a/api.md b/api.md index 936f64196..7fb8f86a6 100644 --- a/api.md +++ b/api.md @@ -199,6 +199,13 @@ Methods: Types: +- AutoFileChunkingStrategyParam +- FileChunkingStrategy +- FileChunkingStrategyParam +- OtherFileChunkingStrategyObject +- StaticFileChunkingStrategy +- StaticFileChunkingStrategyObject +- StaticFileChunkingStrategyParam - VectorStore - VectorStoreDeleted diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 924d63d5c..0dbb076d5 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -8,6 +8,7 @@ import * as Shared from '../shared'; import * as ChatAPI from '../chat/chat'; import * as MessagesAPI from './threads/messages'; import * as ThreadsAPI from './threads/threads'; +import * as VectorStoresAPI from './vector-stores/vector-stores'; import * as RunsAPI from './threads/runs/runs'; import * as StepsAPI from './threads/runs/steps'; import { CursorPage, type CursorPageParams } from '../../pagination'; @@ -1218,9 +1219,9 @@ export namespace AssistantCreateParams { export interface VectorStore { /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` - * strategy. + * strategy. Only applicable if `file_ids` is non-empty. */ - chunking_strategy?: VectorStore.Auto | VectorStore.Static; + chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam; /** * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to @@ -1237,45 +1238,6 @@ export namespace AssistantCreateParams { */ metadata?: unknown; } - - export namespace VectorStore { - /** - * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of - * `800` and `chunk_overlap_tokens` of `400`. - */ - export interface Auto { - /** - * Always `auto`. - */ - type: 'auto'; - } - - export interface Static { - static: Static.Static; - - /** - * Always `static`. - */ - type: 'static'; - } - - export namespace Static { - export interface Static { - /** - * The number of tokens that overlap between chunks. The default value is `400`. - * - * Note that the overlap must not exceed half of `max_chunk_size_tokens`. - */ - chunk_overlap_tokens: number; - - /** - * The maximum number of tokens in each chunk. The default value is `800`. The - * minimum value is `100` and the maximum value is `4096`. - */ - max_chunk_size_tokens: number; - } - } - } } } } diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index 4993d02fb..0bcf217a8 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -15,6 +15,13 @@ export class Beta extends APIResource { export namespace Beta { export import VectorStores = VectorStoresAPI.VectorStores; + export import AutoFileChunkingStrategyParam = VectorStoresAPI.AutoFileChunkingStrategyParam; + export import FileChunkingStrategy = VectorStoresAPI.FileChunkingStrategy; + export import FileChunkingStrategyParam = VectorStoresAPI.FileChunkingStrategyParam; + export import OtherFileChunkingStrategyObject = VectorStoresAPI.OtherFileChunkingStrategyObject; + export import StaticFileChunkingStrategy = VectorStoresAPI.StaticFileChunkingStrategy; + export import StaticFileChunkingStrategyObject = VectorStoresAPI.StaticFileChunkingStrategyObject; + export import StaticFileChunkingStrategyParam = VectorStoresAPI.StaticFileChunkingStrategyParam; export import VectorStore = VectorStoresAPI.VectorStore; export import VectorStoreDeleted = VectorStoresAPI.VectorStoreDeleted; export import VectorStoresPage = VectorStoresAPI.VectorStoresPage; diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index 392be1f35..9fcf805a1 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -37,6 +37,13 @@ export { export { Beta } from './beta'; export { Chat } from './chat/index'; export { + AutoFileChunkingStrategyParam, + FileChunkingStrategy, + FileChunkingStrategyParam, + OtherFileChunkingStrategyObject, + StaticFileChunkingStrategy, + StaticFileChunkingStrategyObject, + StaticFileChunkingStrategyParam, VectorStore, VectorStoreDeleted, VectorStoreCreateParams, diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index b4551da76..c49618f0c 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -10,6 +10,7 @@ import * as Shared from '../../shared'; import * as AssistantsAPI from '../assistants'; import * as ChatAPI from '../../chat/chat'; import * as MessagesAPI from './messages'; +import * as VectorStoresAPI from '../vector-stores/vector-stores'; import * as RunsAPI from './runs/runs'; import { Stream } from '../../../streaming'; @@ -379,9 +380,9 @@ export namespace ThreadCreateParams { export interface VectorStore { /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` - * strategy. + * strategy. Only applicable if `file_ids` is non-empty. */ - chunking_strategy?: VectorStore.Auto | VectorStore.Static; + chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam; /** * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to @@ -398,45 +399,6 @@ export namespace ThreadCreateParams { */ metadata?: unknown; } - - export namespace VectorStore { - /** - * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of - * `800` and `chunk_overlap_tokens` of `400`. - */ - export interface Auto { - /** - * Always `auto`. - */ - type: 'auto'; - } - - export interface Static { - static: Static.Static; - - /** - * Always `static`. - */ - type: 'static'; - } - - export namespace Static { - export interface Static { - /** - * The number of tokens that overlap between chunks. The default value is `400`. - * - * Note that the overlap must not exceed half of `max_chunk_size_tokens`. - */ - chunk_overlap_tokens: number; - - /** - * The maximum number of tokens in each chunk. The default value is `800`. The - * minimum value is `100` and the maximum value is `4096`. - */ - max_chunk_size_tokens: number; - } - } - } } } } @@ -765,9 +727,9 @@ export namespace ThreadCreateAndRunParams { export interface VectorStore { /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` - * strategy. + * strategy. Only applicable if `file_ids` is non-empty. */ - chunking_strategy?: VectorStore.Auto | VectorStore.Static; + chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam; /** * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to @@ -784,45 +746,6 @@ export namespace ThreadCreateAndRunParams { */ metadata?: unknown; } - - export namespace VectorStore { - /** - * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of - * `800` and `chunk_overlap_tokens` of `400`. - */ - export interface Auto { - /** - * Always `auto`. - */ - type: 'auto'; - } - - export interface Static { - static: Static.Static; - - /** - * Always `static`. - */ - type: 'static'; - } - - export namespace Static { - export interface Static { - /** - * The number of tokens that overlap between chunks. The default value is `400`. - * - * Note that the overlap must not exceed half of `max_chunk_size_tokens`. - */ - chunk_overlap_tokens: number; - - /** - * The maximum number of tokens in each chunk. The default value is `800`. The - * minimum value is `100` and the maximum value is `4096`. - */ - max_chunk_size_tokens: number; - } - } - } } } } diff --git a/src/resources/beta/vector-stores/file-batches.ts b/src/resources/beta/vector-stores/file-batches.ts index e4a5c46fe..3436d7575 100644 --- a/src/resources/beta/vector-stores/file-batches.ts +++ b/src/resources/beta/vector-stores/file-batches.ts @@ -9,6 +9,7 @@ import * as Core from '../../../core'; import * as FileBatchesAPI from './file-batches'; import * as FilesAPI from './files'; import { VectorStoreFilesPage } from './files'; +import * as VectorStoresAPI from './vector-stores'; import { type CursorPageParams } from '../../../pagination'; export class FileBatches extends APIResource { @@ -267,50 +268,9 @@ export interface FileBatchCreateParams { /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` - * strategy. + * strategy. Only applicable if `file_ids` is non-empty. */ - chunking_strategy?: - | FileBatchCreateParams.AutoChunkingStrategyRequestParam - | FileBatchCreateParams.StaticChunkingStrategyRequestParam; -} - -export namespace FileBatchCreateParams { - /** - * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of - * `800` and `chunk_overlap_tokens` of `400`. - */ - export interface AutoChunkingStrategyRequestParam { - /** - * Always `auto`. - */ - type: 'auto'; - } - - export interface StaticChunkingStrategyRequestParam { - static: StaticChunkingStrategyRequestParam.Static; - - /** - * Always `static`. - */ - type: 'static'; - } - - export namespace StaticChunkingStrategyRequestParam { - export interface Static { - /** - * The number of tokens that overlap between chunks. The default value is `400`. - * - * Note that the overlap must not exceed half of `max_chunk_size_tokens`. - */ - chunk_overlap_tokens: number; - - /** - * The maximum number of tokens in each chunk. The default value is `800`. The - * minimum value is `100` and the maximum value is `4096`. - */ - max_chunk_size_tokens: number; - } - } + chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam; } export interface FileBatchListFilesParams extends CursorPageParams { diff --git a/src/resources/beta/vector-stores/files.ts b/src/resources/beta/vector-stores/files.ts index c0f695223..f82cd63df 100644 --- a/src/resources/beta/vector-stores/files.ts +++ b/src/resources/beta/vector-stores/files.ts @@ -4,6 +4,7 @@ import { APIResource } from '../../../resource'; import { sleep, Uploadable, isRequestOptions } from '../../../core'; import * as Core from '../../../core'; import * as FilesAPI from './files'; +import * as VectorStoresAPI from './vector-stores'; import { CursorPage, type CursorPageParams } from '../../../pagination'; export class Files extends APIResource { @@ -220,7 +221,7 @@ export interface VectorStoreFile { /** * The strategy used to chunk the file. */ - chunking_strategy?: VectorStoreFile.Static | VectorStoreFile.Other; + chunking_strategy?: VectorStoresAPI.FileChunkingStrategy; } export namespace VectorStoreFile { @@ -239,44 +240,6 @@ export namespace VectorStoreFile { */ message: string; } - - export interface Static { - static: Static.Static; - - /** - * Always `static`. - */ - type: 'static'; - } - - export namespace Static { - export interface Static { - /** - * The number of tokens that overlap between chunks. The default value is `400`. - * - * Note that the overlap must not exceed half of `max_chunk_size_tokens`. - */ - chunk_overlap_tokens: number; - - /** - * The maximum number of tokens in each chunk. The default value is `800`. The - * minimum value is `100` and the maximum value is `4096`. - */ - max_chunk_size_tokens: number; - } - } - - /** - * This is returned when the chunking strategy is unknown. Typically, this is - * because the file was indexed before the `chunking_strategy` concept was - * introduced in the API. - */ - export interface Other { - /** - * Always `other`. - */ - type: 'other'; - } } export interface VectorStoreFileDeleted { @@ -297,50 +260,9 @@ export interface FileCreateParams { /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` - * strategy. + * strategy. Only applicable if `file_ids` is non-empty. */ - chunking_strategy?: - | FileCreateParams.AutoChunkingStrategyRequestParam - | FileCreateParams.StaticChunkingStrategyRequestParam; -} - -export namespace FileCreateParams { - /** - * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of - * `800` and `chunk_overlap_tokens` of `400`. - */ - export interface AutoChunkingStrategyRequestParam { - /** - * Always `auto`. - */ - type: 'auto'; - } - - export interface StaticChunkingStrategyRequestParam { - static: StaticChunkingStrategyRequestParam.Static; - - /** - * Always `static`. - */ - type: 'static'; - } - - export namespace StaticChunkingStrategyRequestParam { - export interface Static { - /** - * The number of tokens that overlap between chunks. The default value is `400`. - * - * Note that the overlap must not exceed half of `max_chunk_size_tokens`. - */ - chunk_overlap_tokens: number; - - /** - * The maximum number of tokens in each chunk. The default value is `800`. The - * minimum value is `100` and the maximum value is `4096`. - */ - max_chunk_size_tokens: number; - } - } + chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam; } export interface FileListParams extends CursorPageParams { diff --git a/src/resources/beta/vector-stores/index.ts b/src/resources/beta/vector-stores/index.ts index 8fb787ccd..f70215f8f 100644 --- a/src/resources/beta/vector-stores/index.ts +++ b/src/resources/beta/vector-stores/index.ts @@ -1,6 +1,13 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { + AutoFileChunkingStrategyParam, + FileChunkingStrategy, + FileChunkingStrategyParam, + OtherFileChunkingStrategyObject, + StaticFileChunkingStrategy, + StaticFileChunkingStrategyObject, + StaticFileChunkingStrategyParam, VectorStore, VectorStoreDeleted, VectorStoreCreateParams, diff --git a/src/resources/beta/vector-stores/vector-stores.ts b/src/resources/beta/vector-stores/vector-stores.ts index 343f25953..3c9aa707d 100644 --- a/src/resources/beta/vector-stores/vector-stores.ts +++ b/src/resources/beta/vector-stores/vector-stores.ts @@ -83,6 +83,73 @@ export class VectorStores extends APIResource { export class VectorStoresPage extends CursorPage {} +/** + * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of + * `800` and `chunk_overlap_tokens` of `400`. + */ +export interface AutoFileChunkingStrategyParam { + /** + * Always `auto`. + */ + type: 'auto'; +} + +/** + * The strategy used to chunk the file. + */ +export type FileChunkingStrategy = StaticFileChunkingStrategyObject | OtherFileChunkingStrategyObject; + +/** + * The chunking strategy used to chunk the file(s). If not set, will use the `auto` + * strategy. Only applicable if `file_ids` is non-empty. + */ +export type FileChunkingStrategyParam = AutoFileChunkingStrategyParam | StaticFileChunkingStrategyParam; + +/** + * This is returned when the chunking strategy is unknown. Typically, this is + * because the file was indexed before the `chunking_strategy` concept was + * introduced in the API. + */ +export interface OtherFileChunkingStrategyObject { + /** + * Always `other`. + */ + type: 'other'; +} + +export interface StaticFileChunkingStrategy { + /** + * The number of tokens that overlap between chunks. The default value is `400`. + * + * Note that the overlap must not exceed half of `max_chunk_size_tokens`. + */ + chunk_overlap_tokens: number; + + /** + * The maximum number of tokens in each chunk. The default value is `800`. The + * minimum value is `100` and the maximum value is `4096`. + */ + max_chunk_size_tokens: number; +} + +export interface StaticFileChunkingStrategyObject { + static: StaticFileChunkingStrategy; + + /** + * Always `static`. + */ + type: 'static'; +} + +export interface StaticFileChunkingStrategyParam { + static: StaticFileChunkingStrategy; + + /** + * Always `static`. + */ + type: 'static'; +} + /** * A vector store is a collection of processed files can be used by the * `file_search` tool. @@ -204,7 +271,7 @@ export interface VectorStoreCreateParams { * The chunking strategy used to chunk the file(s). If not set, will use the `auto` * strategy. Only applicable if `file_ids` is non-empty. */ - chunking_strategy?: VectorStoreCreateParams.Auto | VectorStoreCreateParams.Static; + chunking_strategy?: FileChunkingStrategyParam; /** * The expiration policy for a vector store. @@ -233,43 +300,6 @@ export interface VectorStoreCreateParams { } export namespace VectorStoreCreateParams { - /** - * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of - * `800` and `chunk_overlap_tokens` of `400`. - */ - export interface Auto { - /** - * Always `auto`. - */ - type: 'auto'; - } - - export interface Static { - static: Static.Static; - - /** - * Always `static`. - */ - type: 'static'; - } - - export namespace Static { - export interface Static { - /** - * The number of tokens that overlap between chunks. The default value is `400`. - * - * Note that the overlap must not exceed half of `max_chunk_size_tokens`. - */ - chunk_overlap_tokens: number; - - /** - * The maximum number of tokens in each chunk. The default value is `800`. The - * minimum value is `100` and the maximum value is `4096`. - */ - max_chunk_size_tokens: number; - } - } - /** * The expiration policy for a vector store. */ @@ -342,6 +372,13 @@ export interface VectorStoreListParams extends CursorPageParams { } export namespace VectorStores { + export import AutoFileChunkingStrategyParam = VectorStoresAPI.AutoFileChunkingStrategyParam; + export import FileChunkingStrategy = VectorStoresAPI.FileChunkingStrategy; + export import FileChunkingStrategyParam = VectorStoresAPI.FileChunkingStrategyParam; + export import OtherFileChunkingStrategyObject = VectorStoresAPI.OtherFileChunkingStrategyObject; + export import StaticFileChunkingStrategy = VectorStoresAPI.StaticFileChunkingStrategy; + export import StaticFileChunkingStrategyObject = VectorStoresAPI.StaticFileChunkingStrategyObject; + export import StaticFileChunkingStrategyParam = VectorStoresAPI.StaticFileChunkingStrategyParam; export import VectorStore = VectorStoresAPI.VectorStore; export import VectorStoreDeleted = VectorStoresAPI.VectorStoreDeleted; export import VectorStoresPage = VectorStoresAPI.VectorStoresPage;