Commit f161000f
Changed files (20)
src
openai
resources
beta
vector_stores
types
beta
src/openai/resources/beta/vector_stores/file_batches.py
@@ -22,11 +22,10 @@ from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ....pagination import SyncCursorPage, AsyncCursorPage
-from ...._base_client import (
- AsyncPaginator,
- make_request_options,
-)
+from ....types.beta import FileChunkingStrategyParam
+from ...._base_client import AsyncPaginator, make_request_options
from ....types.beta.vector_stores import file_batch_create_params, file_batch_list_files_params
+from ....types.beta.file_chunking_strategy_param import FileChunkingStrategyParam
from ....types.beta.vector_stores.vector_store_file import VectorStoreFile
from ....types.beta.vector_stores.vector_store_file_batch import VectorStoreFileBatch
@@ -47,7 +46,7 @@ class FileBatches(SyncAPIResource):
vector_store_id: str,
*,
file_ids: List[str],
- chunking_strategy: file_batch_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
@@ -64,7 +63,7 @@ class FileBatches(SyncAPIResource):
files.
chunking_strategy: 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.
extra_headers: Send extra headers
@@ -174,7 +173,7 @@ class FileBatches(SyncAPIResource):
*,
file_ids: List[str],
poll_interval_ms: int | NotGiven = NOT_GIVEN,
- chunking_strategy: file_batch_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
) -> VectorStoreFileBatch:
"""Create a vector store batch and poll until all files have been processed."""
batch = self.create(
@@ -308,7 +307,7 @@ class FileBatches(SyncAPIResource):
max_concurrency: int = 5,
file_ids: List[str] = [],
poll_interval_ms: int | NotGiven = NOT_GIVEN,
- chunking_strategy: file_batch_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
) -> VectorStoreFileBatch:
"""Uploads the given files concurrently and then creates a vector store file batch.
@@ -365,7 +364,7 @@ class AsyncFileBatches(AsyncAPIResource):
vector_store_id: str,
*,
file_ids: List[str],
- chunking_strategy: file_batch_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
@@ -382,7 +381,7 @@ class AsyncFileBatches(AsyncAPIResource):
files.
chunking_strategy: 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.
extra_headers: Send extra headers
@@ -492,7 +491,7 @@ class AsyncFileBatches(AsyncAPIResource):
*,
file_ids: List[str],
poll_interval_ms: int | NotGiven = NOT_GIVEN,
- chunking_strategy: file_batch_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
) -> VectorStoreFileBatch:
"""Create a vector store batch and poll until all files have been processed."""
batch = await self.create(
@@ -626,7 +625,7 @@ class AsyncFileBatches(AsyncAPIResource):
max_concurrency: int = 5,
file_ids: List[str] = [],
poll_interval_ms: int | NotGiven = NOT_GIVEN,
- chunking_strategy: file_batch_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
) -> VectorStoreFileBatch:
"""Uploads the given files concurrently and then creates a vector store file batch.
src/openai/resources/beta/vector_stores/files.py
@@ -18,11 +18,10 @@ from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ....pagination import SyncCursorPage, AsyncCursorPage
-from ...._base_client import (
- AsyncPaginator,
- make_request_options,
-)
+from ....types.beta import FileChunkingStrategyParam
+from ...._base_client import AsyncPaginator, make_request_options
from ....types.beta.vector_stores import file_list_params, file_create_params
+from ....types.beta.file_chunking_strategy_param import FileChunkingStrategyParam
from ....types.beta.vector_stores.vector_store_file import VectorStoreFile
from ....types.beta.vector_stores.vector_store_file_deleted import VectorStoreFileDeleted
@@ -43,7 +42,7 @@ class Files(SyncAPIResource):
vector_store_id: str,
*,
file_id: str,
- chunking_strategy: file_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
@@ -62,7 +61,7 @@ class Files(SyncAPIResource):
files.
chunking_strategy: 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.
extra_headers: Send extra headers
@@ -245,7 +244,7 @@ class Files(SyncAPIResource):
*,
vector_store_id: str,
poll_interval_ms: int | NotGiven = NOT_GIVEN,
- chunking_strategy: file_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
) -> VectorStoreFile:
"""Attach a file to the given vector store and wait for it to be processed."""
self.create(vector_store_id=vector_store_id, file_id=file_id, chunking_strategy=chunking_strategy)
@@ -302,7 +301,7 @@ class Files(SyncAPIResource):
*,
vector_store_id: str,
file: FileTypes,
- chunking_strategy: file_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
) -> VectorStoreFile:
"""Upload a file to the `files` API and then attach it to the given vector store.
@@ -318,7 +317,7 @@ class Files(SyncAPIResource):
vector_store_id: str,
file: FileTypes,
poll_interval_ms: int | NotGiven = NOT_GIVEN,
- chunking_strategy: file_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
) -> VectorStoreFile:
"""Add a file to a vector store and poll until processing is complete."""
file_obj = self._client.files.create(file=file, purpose="assistants")
@@ -344,7 +343,7 @@ class AsyncFiles(AsyncAPIResource):
vector_store_id: str,
*,
file_id: str,
- chunking_strategy: file_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
@@ -363,7 +362,7 @@ class AsyncFiles(AsyncAPIResource):
files.
chunking_strategy: 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.
extra_headers: Send extra headers
@@ -546,7 +545,7 @@ class AsyncFiles(AsyncAPIResource):
*,
vector_store_id: str,
poll_interval_ms: int | NotGiven = NOT_GIVEN,
- chunking_strategy: file_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
) -> VectorStoreFile:
"""Attach a file to the given vector store and wait for it to be processed."""
await self.create(vector_store_id=vector_store_id, file_id=file_id, chunking_strategy=chunking_strategy)
@@ -603,7 +602,7 @@ class AsyncFiles(AsyncAPIResource):
*,
vector_store_id: str,
file: FileTypes,
- chunking_strategy: file_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
) -> VectorStoreFile:
"""Upload a file to the `files` API and then attach it to the given vector store.
@@ -621,7 +620,7 @@ class AsyncFiles(AsyncAPIResource):
vector_store_id: str,
file: FileTypes,
poll_interval_ms: int | NotGiven = NOT_GIVEN,
- chunking_strategy: file_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
) -> VectorStoreFile:
"""Add a file to a vector store and poll until processing is complete."""
file_obj = await self._client.files.create(file=file, purpose="assistants")
src/openai/resources/beta/vector_stores/vector_stores.py
@@ -33,13 +33,16 @@ from .file_batches import (
AsyncFileBatchesWithStreamingResponse,
)
from ....pagination import SyncCursorPage, AsyncCursorPage
-from ....types.beta import vector_store_list_params, vector_store_create_params, vector_store_update_params
-from ...._base_client import (
- AsyncPaginator,
- make_request_options,
+from ....types.beta import (
+ FileChunkingStrategyParam,
+ vector_store_list_params,
+ vector_store_create_params,
+ vector_store_update_params,
)
+from ...._base_client import AsyncPaginator, make_request_options
from ....types.beta.vector_store import VectorStore
from ....types.beta.vector_store_deleted import VectorStoreDeleted
+from ....types.beta.file_chunking_strategy_param import FileChunkingStrategyParam
__all__ = ["VectorStores", "AsyncVectorStores"]
@@ -64,7 +67,7 @@ class VectorStores(SyncAPIResource):
def create(
self,
*,
- chunking_strategy: vector_store_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
expires_after: vector_store_create_params.ExpiresAfter | NotGiven = NOT_GIVEN,
file_ids: List[str] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
@@ -331,7 +334,7 @@ class AsyncVectorStores(AsyncAPIResource):
async def create(
self,
*,
- chunking_strategy: vector_store_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN,
+ chunking_strategy: FileChunkingStrategyParam | NotGiven = NOT_GIVEN,
expires_after: vector_store_create_params.ExpiresAfter | NotGiven = NOT_GIVEN,
file_ids: List[str] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
src/openai/types/beta/vector_stores/file_batch_create_params.py
@@ -2,16 +2,12 @@
from __future__ import annotations
-from typing import List, Union
-from typing_extensions import Literal, Required, TypeAlias, TypedDict
+from typing import List
+from typing_extensions import Required, TypedDict
-__all__ = [
- "FileBatchCreateParams",
- "ChunkingStrategy",
- "ChunkingStrategyAutoChunkingStrategyRequestParam",
- "ChunkingStrategyStaticChunkingStrategyRequestParam",
- "ChunkingStrategyStaticChunkingStrategyRequestParamStatic",
-]
+from ..file_chunking_strategy_param import FileChunkingStrategyParam
+
+__all__ = ["FileBatchCreateParams"]
class FileBatchCreateParams(TypedDict, total=False):
@@ -22,40 +18,9 @@ class FileBatchCreateParams(TypedDict, total=False):
files.
"""
- chunking_strategy: ChunkingStrategy
+ chunking_strategy: FileChunkingStrategyParam
"""The chunking strategy used to chunk the file(s).
- If not set, will use the `auto` strategy.
- """
-
-
-class ChunkingStrategyAutoChunkingStrategyRequestParam(TypedDict, total=False):
- type: Required[Literal["auto"]]
- """Always `auto`."""
-
-
-class ChunkingStrategyStaticChunkingStrategyRequestParamStatic(TypedDict, total=False):
- chunk_overlap_tokens: Required[int]
- """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`.
+ If not set, will use the `auto` strategy. Only applicable if `file_ids` is
+ non-empty.
"""
-
- max_chunk_size_tokens: Required[int]
- """The maximum number of tokens in each chunk.
-
- The default value is `800`. The minimum value is `100` and the maximum value is
- `4096`.
- """
-
-
-class ChunkingStrategyStaticChunkingStrategyRequestParam(TypedDict, total=False):
- static: Required[ChunkingStrategyStaticChunkingStrategyRequestParamStatic]
-
- type: Required[Literal["static"]]
- """Always `static`."""
-
-
-ChunkingStrategy: TypeAlias = Union[
- ChunkingStrategyAutoChunkingStrategyRequestParam, ChunkingStrategyStaticChunkingStrategyRequestParam
-]
src/openai/types/beta/vector_stores/file_create_params.py
@@ -2,16 +2,11 @@
from __future__ import annotations
-from typing import Union
-from typing_extensions import Literal, Required, TypeAlias, TypedDict
+from typing_extensions import Required, TypedDict
-__all__ = [
- "FileCreateParams",
- "ChunkingStrategy",
- "ChunkingStrategyAutoChunkingStrategyRequestParam",
- "ChunkingStrategyStaticChunkingStrategyRequestParam",
- "ChunkingStrategyStaticChunkingStrategyRequestParamStatic",
-]
+from ..file_chunking_strategy_param import FileChunkingStrategyParam
+
+__all__ = ["FileCreateParams"]
class FileCreateParams(TypedDict, total=False):
@@ -22,40 +17,9 @@ class FileCreateParams(TypedDict, total=False):
files.
"""
- chunking_strategy: ChunkingStrategy
+ chunking_strategy: FileChunkingStrategyParam
"""The chunking strategy used to chunk the file(s).
- If not set, will use the `auto` strategy.
- """
-
-
-class ChunkingStrategyAutoChunkingStrategyRequestParam(TypedDict, total=False):
- type: Required[Literal["auto"]]
- """Always `auto`."""
-
-
-class ChunkingStrategyStaticChunkingStrategyRequestParamStatic(TypedDict, total=False):
- chunk_overlap_tokens: Required[int]
- """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`.
+ If not set, will use the `auto` strategy. Only applicable if `file_ids` is
+ non-empty.
"""
-
- max_chunk_size_tokens: Required[int]
- """The maximum number of tokens in each chunk.
-
- The default value is `800`. The minimum value is `100` and the maximum value is
- `4096`.
- """
-
-
-class ChunkingStrategyStaticChunkingStrategyRequestParam(TypedDict, total=False):
- static: Required[ChunkingStrategyStaticChunkingStrategyRequestParamStatic]
-
- type: Required[Literal["static"]]
- """Always `static`."""
-
-
-ChunkingStrategy: TypeAlias = Union[
- ChunkingStrategyAutoChunkingStrategyRequestParam, ChunkingStrategyStaticChunkingStrategyRequestParam
-]
src/openai/types/beta/vector_stores/vector_store_file.py
@@ -1,19 +1,12 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Union, Optional
-from typing_extensions import Literal, Annotated, TypeAlias
+from typing import Optional
+from typing_extensions import Literal
-from ...._utils import PropertyInfo
from ...._models import BaseModel
+from ..file_chunking_strategy import FileChunkingStrategy
-__all__ = [
- "VectorStoreFile",
- "LastError",
- "ChunkingStrategy",
- "ChunkingStrategyStatic",
- "ChunkingStrategyStaticStatic",
- "ChunkingStrategyOther",
-]
+__all__ = ["VectorStoreFile", "LastError"]
class LastError(BaseModel):
@@ -24,38 +17,6 @@ class LastError(BaseModel):
"""A human-readable description of the error."""
-class ChunkingStrategyStaticStatic(BaseModel):
- chunk_overlap_tokens: int
- """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`.
- """
-
- max_chunk_size_tokens: int
- """The maximum number of tokens in each chunk.
-
- The default value is `800`. The minimum value is `100` and the maximum value is
- `4096`.
- """
-
-
-class ChunkingStrategyStatic(BaseModel):
- static: ChunkingStrategyStaticStatic
-
- type: Literal["static"]
- """Always `static`."""
-
-
-class ChunkingStrategyOther(BaseModel):
- type: Literal["other"]
- """Always `other`."""
-
-
-ChunkingStrategy: TypeAlias = Annotated[
- Union[ChunkingStrategyStatic, ChunkingStrategyOther], PropertyInfo(discriminator="type")
-]
-
-
class VectorStoreFile(BaseModel):
id: str
"""The identifier, which can be referenced in API endpoints."""
@@ -93,5 +54,5 @@ class VectorStoreFile(BaseModel):
attached to.
"""
- chunking_strategy: Optional[ChunkingStrategy] = None
+ chunking_strategy: Optional[FileChunkingStrategy] = None
"""The strategy used to chunk the file."""
src/openai/types/beta/__init__.py
@@ -19,6 +19,7 @@ from .assistant_list_params import AssistantListParams as AssistantListParams
from .assistant_tool_choice import AssistantToolChoice as AssistantToolChoice
from .code_interpreter_tool import CodeInterpreterTool as CodeInterpreterTool
from .assistant_stream_event import AssistantStreamEvent as AssistantStreamEvent
+from .file_chunking_strategy import FileChunkingStrategy as FileChunkingStrategy
from .file_search_tool_param import FileSearchToolParam as FileSearchToolParam
from .assistant_create_params import AssistantCreateParams as AssistantCreateParams
from .assistant_update_params import AssistantUpdateParams as AssistantUpdateParams
@@ -28,11 +29,17 @@ from .vector_store_update_params import VectorStoreUpdateParams as VectorStoreUp
from .assistant_tool_choice_param import AssistantToolChoiceParam as AssistantToolChoiceParam
from .code_interpreter_tool_param import CodeInterpreterToolParam as CodeInterpreterToolParam
from .assistant_tool_choice_option import AssistantToolChoiceOption as AssistantToolChoiceOption
+from .file_chunking_strategy_param import FileChunkingStrategyParam as FileChunkingStrategyParam
from .thread_create_and_run_params import ThreadCreateAndRunParams as ThreadCreateAndRunParams
+from .static_file_chunking_strategy import StaticFileChunkingStrategy as StaticFileChunkingStrategy
from .assistant_tool_choice_function import AssistantToolChoiceFunction as AssistantToolChoiceFunction
from .assistant_response_format_option import AssistantResponseFormatOption as AssistantResponseFormatOption
+from .auto_file_chunking_strategy_param import AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam
from .assistant_tool_choice_option_param import AssistantToolChoiceOptionParam as AssistantToolChoiceOptionParam
+from .other_file_chunking_strategy_object import OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject
+from .static_file_chunking_strategy_param import StaticFileChunkingStrategyParam as StaticFileChunkingStrategyParam
from .assistant_tool_choice_function_param import AssistantToolChoiceFunctionParam as AssistantToolChoiceFunctionParam
+from .static_file_chunking_strategy_object import StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject
from .assistant_response_format_option_param import (
AssistantResponseFormatOptionParam as AssistantResponseFormatOptionParam,
)
src/openai/types/beta/assistant_create_params.py
@@ -3,10 +3,11 @@
from __future__ import annotations
from typing import List, Union, Iterable, Optional
-from typing_extensions import Literal, Required, TypeAlias, TypedDict
+from typing_extensions import Required, TypedDict
from ..chat_model import ChatModel
from .assistant_tool_param import AssistantToolParam
+from .file_chunking_strategy_param import FileChunkingStrategyParam
from .assistant_response_format_option_param import AssistantResponseFormatOptionParam
__all__ = [
@@ -15,10 +16,6 @@ __all__ = [
"ToolResourcesCodeInterpreter",
"ToolResourcesFileSearch",
"ToolResourcesFileSearchVectorStore",
- "ToolResourcesFileSearchVectorStoreChunkingStrategy",
- "ToolResourcesFileSearchVectorStoreChunkingStrategyAuto",
- "ToolResourcesFileSearchVectorStoreChunkingStrategyStatic",
- "ToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic",
]
@@ -118,43 +115,12 @@ class ToolResourcesCodeInterpreter(TypedDict, total=False):
"""
-class ToolResourcesFileSearchVectorStoreChunkingStrategyAuto(TypedDict, total=False):
- type: Required[Literal["auto"]]
- """Always `auto`."""
-
-
-class ToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic(TypedDict, total=False):
- chunk_overlap_tokens: Required[int]
- """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`.
- """
-
- max_chunk_size_tokens: Required[int]
- """The maximum number of tokens in each chunk.
-
- The default value is `800`. The minimum value is `100` and the maximum value is
- `4096`.
- """
-
-
-class ToolResourcesFileSearchVectorStoreChunkingStrategyStatic(TypedDict, total=False):
- static: Required[ToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic]
-
- type: Required[Literal["static"]]
- """Always `static`."""
-
-
-ToolResourcesFileSearchVectorStoreChunkingStrategy: TypeAlias = Union[
- ToolResourcesFileSearchVectorStoreChunkingStrategyAuto, ToolResourcesFileSearchVectorStoreChunkingStrategyStatic
-]
-
-
class ToolResourcesFileSearchVectorStore(TypedDict, total=False):
- chunking_strategy: ToolResourcesFileSearchVectorStoreChunkingStrategy
+ chunking_strategy: FileChunkingStrategyParam
"""The chunking strategy used to chunk the file(s).
- If not set, will use the `auto` strategy.
+ If not set, will use the `auto` strategy. Only applicable if `file_ids` is
+ non-empty.
"""
file_ids: List[str]
src/openai/types/beta/auto_file_chunking_strategy_param.py
@@ -0,0 +1,12 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, Required, TypedDict
+
+__all__ = ["AutoFileChunkingStrategyParam"]
+
+
+class AutoFileChunkingStrategyParam(TypedDict, total=False):
+ type: Required[Literal["auto"]]
+ """Always `auto`."""
src/openai/types/beta/file_chunking_strategy.py
@@ -0,0 +1,14 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Union
+from typing_extensions import Annotated, TypeAlias
+
+from ..._utils import PropertyInfo
+from .other_file_chunking_strategy_object import OtherFileChunkingStrategyObject
+from .static_file_chunking_strategy_object import StaticFileChunkingStrategyObject
+
+__all__ = ["FileChunkingStrategy"]
+
+FileChunkingStrategy: TypeAlias = Annotated[
+ Union[StaticFileChunkingStrategyObject, OtherFileChunkingStrategyObject], PropertyInfo(discriminator="type")
+]
src/openai/types/beta/file_chunking_strategy_param.py
@@ -0,0 +1,13 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Union
+from typing_extensions import TypeAlias
+
+from .auto_file_chunking_strategy_param import AutoFileChunkingStrategyParam
+from .static_file_chunking_strategy_param import StaticFileChunkingStrategyParam
+
+__all__ = ["FileChunkingStrategyParam"]
+
+FileChunkingStrategyParam: TypeAlias = Union[AutoFileChunkingStrategyParam, StaticFileChunkingStrategyParam]
src/openai/types/beta/other_file_chunking_strategy_object.py
@@ -0,0 +1,12 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = ["OtherFileChunkingStrategyObject"]
+
+
+class OtherFileChunkingStrategyObject(BaseModel):
+ type: Literal["other"]
+ """Always `other`."""
src/openai/types/beta/static_file_chunking_strategy.py
@@ -0,0 +1,22 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+
+
+from ..._models import BaseModel
+
+__all__ = ["StaticFileChunkingStrategy"]
+
+
+class StaticFileChunkingStrategy(BaseModel):
+ chunk_overlap_tokens: int
+ """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`.
+ """
+
+ max_chunk_size_tokens: int
+ """The maximum number of tokens in each chunk.
+
+ The default value is `800`. The minimum value is `100` and the maximum value is
+ `4096`.
+ """
src/openai/types/beta/static_file_chunking_strategy_object.py
@@ -0,0 +1,15 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+from .static_file_chunking_strategy import StaticFileChunkingStrategy
+
+__all__ = ["StaticFileChunkingStrategyObject"]
+
+
+class StaticFileChunkingStrategyObject(BaseModel):
+ static: StaticFileChunkingStrategy
+
+ type: Literal["static"]
+ """Always `static`."""
src/openai/types/beta/static_file_chunking_strategy_param.py
@@ -0,0 +1,22 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["StaticFileChunkingStrategyParam"]
+
+
+class StaticFileChunkingStrategyParam(TypedDict, total=False):
+ chunk_overlap_tokens: Required[int]
+ """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`.
+ """
+
+ max_chunk_size_tokens: Required[int]
+ """The maximum number of tokens in each chunk.
+
+ The default value is `800`. The minimum value is `100` and the maximum value is
+ `4096`.
+ """
src/openai/types/beta/thread_create_and_run_params.py
@@ -9,6 +9,7 @@ from ..chat_model import ChatModel
from .function_tool_param import FunctionToolParam
from .file_search_tool_param import FileSearchToolParam
from .code_interpreter_tool_param import CodeInterpreterToolParam
+from .file_chunking_strategy_param import FileChunkingStrategyParam
from .assistant_tool_choice_option_param import AssistantToolChoiceOptionParam
from .threads.message_content_part_param import MessageContentPartParam
from .assistant_response_format_option_param import AssistantResponseFormatOptionParam
@@ -24,10 +25,6 @@ __all__ = [
"ThreadToolResourcesCodeInterpreter",
"ThreadToolResourcesFileSearch",
"ThreadToolResourcesFileSearchVectorStore",
- "ThreadToolResourcesFileSearchVectorStoreChunkingStrategy",
- "ThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto",
- "ThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic",
- "ThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic",
"ToolResources",
"ToolResourcesCodeInterpreter",
"ToolResourcesFileSearch",
@@ -218,44 +215,12 @@ class ThreadToolResourcesCodeInterpreter(TypedDict, total=False):
"""
-class ThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto(TypedDict, total=False):
- type: Required[Literal["auto"]]
- """Always `auto`."""
-
-
-class ThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic(TypedDict, total=False):
- chunk_overlap_tokens: Required[int]
- """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`.
- """
-
- max_chunk_size_tokens: Required[int]
- """The maximum number of tokens in each chunk.
-
- The default value is `800`. The minimum value is `100` and the maximum value is
- `4096`.
- """
-
-
-class ThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic(TypedDict, total=False):
- static: Required[ThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic]
-
- type: Required[Literal["static"]]
- """Always `static`."""
-
-
-ThreadToolResourcesFileSearchVectorStoreChunkingStrategy: TypeAlias = Union[
- ThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto,
- ThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic,
-]
-
-
class ThreadToolResourcesFileSearchVectorStore(TypedDict, total=False):
- chunking_strategy: ThreadToolResourcesFileSearchVectorStoreChunkingStrategy
+ chunking_strategy: FileChunkingStrategyParam
"""The chunking strategy used to chunk the file(s).
- If not set, will use the `auto` strategy.
+ If not set, will use the `auto` strategy. Only applicable if `file_ids` is
+ non-empty.
"""
file_ids: List[str]
src/openai/types/beta/thread_create_params.py
@@ -6,6 +6,7 @@ from typing import List, Union, Iterable, Optional
from typing_extensions import Literal, Required, TypeAlias, TypedDict
from .code_interpreter_tool_param import CodeInterpreterToolParam
+from .file_chunking_strategy_param import FileChunkingStrategyParam
from .threads.message_content_part_param import MessageContentPartParam
__all__ = [
@@ -18,10 +19,6 @@ __all__ = [
"ToolResourcesCodeInterpreter",
"ToolResourcesFileSearch",
"ToolResourcesFileSearchVectorStore",
- "ToolResourcesFileSearchVectorStoreChunkingStrategy",
- "ToolResourcesFileSearchVectorStoreChunkingStrategyAuto",
- "ToolResourcesFileSearchVectorStoreChunkingStrategyStatic",
- "ToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic",
]
@@ -99,43 +96,12 @@ class ToolResourcesCodeInterpreter(TypedDict, total=False):
"""
-class ToolResourcesFileSearchVectorStoreChunkingStrategyAuto(TypedDict, total=False):
- type: Required[Literal["auto"]]
- """Always `auto`."""
-
-
-class ToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic(TypedDict, total=False):
- chunk_overlap_tokens: Required[int]
- """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`.
- """
-
- max_chunk_size_tokens: Required[int]
- """The maximum number of tokens in each chunk.
-
- The default value is `800`. The minimum value is `100` and the maximum value is
- `4096`.
- """
-
-
-class ToolResourcesFileSearchVectorStoreChunkingStrategyStatic(TypedDict, total=False):
- static: Required[ToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic]
-
- type: Required[Literal["static"]]
- """Always `static`."""
-
-
-ToolResourcesFileSearchVectorStoreChunkingStrategy: TypeAlias = Union[
- ToolResourcesFileSearchVectorStoreChunkingStrategyAuto, ToolResourcesFileSearchVectorStoreChunkingStrategyStatic
-]
-
-
class ToolResourcesFileSearchVectorStore(TypedDict, total=False):
- chunking_strategy: ToolResourcesFileSearchVectorStoreChunkingStrategy
+ chunking_strategy: FileChunkingStrategyParam
"""The chunking strategy used to chunk the file(s).
- If not set, will use the `auto` strategy.
+ If not set, will use the `auto` strategy. Only applicable if `file_ids` is
+ non-empty.
"""
file_ids: List[str]
src/openai/types/beta/vector_store_create_params.py
@@ -2,21 +2,16 @@
from __future__ import annotations
-from typing import List, Union, Optional
-from typing_extensions import Literal, Required, TypeAlias, TypedDict
+from typing import List, Optional
+from typing_extensions import Literal, Required, TypedDict
-__all__ = [
- "VectorStoreCreateParams",
- "ChunkingStrategy",
- "ChunkingStrategyAuto",
- "ChunkingStrategyStatic",
- "ChunkingStrategyStaticStatic",
- "ExpiresAfter",
-]
+from .file_chunking_strategy_param import FileChunkingStrategyParam
+
+__all__ = ["VectorStoreCreateParams", "ExpiresAfter"]
class VectorStoreCreateParams(TypedDict, total=False):
- chunking_strategy: ChunkingStrategy
+ chunking_strategy: FileChunkingStrategyParam
"""The chunking strategy used to chunk the file(s).
If not set, will use the `auto` strategy. Only applicable if `file_ids` is
@@ -45,36 +40,6 @@ class VectorStoreCreateParams(TypedDict, total=False):
"""The name of the vector store."""
-class ChunkingStrategyAuto(TypedDict, total=False):
- type: Required[Literal["auto"]]
- """Always `auto`."""
-
-
-class ChunkingStrategyStaticStatic(TypedDict, total=False):
- chunk_overlap_tokens: Required[int]
- """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`.
- """
-
- max_chunk_size_tokens: Required[int]
- """The maximum number of tokens in each chunk.
-
- The default value is `800`. The minimum value is `100` and the maximum value is
- `4096`.
- """
-
-
-class ChunkingStrategyStatic(TypedDict, total=False):
- static: Required[ChunkingStrategyStaticStatic]
-
- type: Required[Literal["static"]]
- """Always `static`."""
-
-
-ChunkingStrategy: TypeAlias = Union[ChunkingStrategyAuto, ChunkingStrategyStatic]
-
-
class ExpiresAfter(TypedDict, total=False):
anchor: Required[Literal["last_active_at"]]
"""Anchor timestamp after which the expiration policy applies.
.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
api.md
@@ -222,7 +222,17 @@ Methods:
Types:
```python
-from openai.types.beta import VectorStore, VectorStoreDeleted
+from openai.types.beta import (
+ AutoFileChunkingStrategyParam,
+ FileChunkingStrategy,
+ FileChunkingStrategyParam,
+ OtherFileChunkingStrategyObject,
+ StaticFileChunkingStrategy,
+ StaticFileChunkingStrategyObject,
+ StaticFileChunkingStrategyParam,
+ VectorStore,
+ VectorStoreDeleted,
+)
```
Methods: