Commit 1ff30bf5

Stainless Bot <107565488+stainless-bot@users.noreply.github.com>
2024-06-04 06:55:27
feat(api): updates (#1461)
1 parent 89dee3f
src/openai/resources/beta/vector_stores/file_batches.py
@@ -47,6 +47,7 @@ class FileBatches(SyncAPIResource):
         vector_store_id: str,
         *,
         file_ids: List[str],
+        chunking_strategy: file_batch_create_params.ChunkingStrategy | 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,6 +63,9 @@ class FileBatches(SyncAPIResource):
               the vector store should use. Useful for tools like `file_search` that can access
               files.
 
+          chunking_strategy: The chunking strategy used to chunk the file(s). If not set, will use the `auto`
+              strategy.
+
           extra_headers: Send extra headers
 
           extra_query: Add additional query parameters to the request
@@ -75,7 +79,13 @@ class FileBatches(SyncAPIResource):
         extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}
         return self._post(
             f"/vector_stores/{vector_store_id}/file_batches",
-            body=maybe_transform({"file_ids": file_ids}, file_batch_create_params.FileBatchCreateParams),
+            body=maybe_transform(
+                {
+                    "file_ids": file_ids,
+                    "chunking_strategy": chunking_strategy,
+                },
+                file_batch_create_params.FileBatchCreateParams,
+            ),
             options=make_request_options(
                 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
             ),
@@ -351,6 +361,7 @@ class AsyncFileBatches(AsyncAPIResource):
         vector_store_id: str,
         *,
         file_ids: List[str],
+        chunking_strategy: file_batch_create_params.ChunkingStrategy | 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,
@@ -366,6 +377,9 @@ class AsyncFileBatches(AsyncAPIResource):
               the vector store should use. Useful for tools like `file_search` that can access
               files.
 
+          chunking_strategy: The chunking strategy used to chunk the file(s). If not set, will use the `auto`
+              strategy.
+
           extra_headers: Send extra headers
 
           extra_query: Add additional query parameters to the request
@@ -379,7 +393,13 @@ class AsyncFileBatches(AsyncAPIResource):
         extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}
         return await self._post(
             f"/vector_stores/{vector_store_id}/file_batches",
-            body=await async_maybe_transform({"file_ids": file_ids}, file_batch_create_params.FileBatchCreateParams),
+            body=await async_maybe_transform(
+                {
+                    "file_ids": file_ids,
+                    "chunking_strategy": chunking_strategy,
+                },
+                file_batch_create_params.FileBatchCreateParams,
+            ),
             options=make_request_options(
                 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
             ),
src/openai/resources/beta/vector_stores/files.py
@@ -43,6 +43,7 @@ class Files(SyncAPIResource):
         vector_store_id: str,
         *,
         file_id: str,
+        chunking_strategy: file_create_params.ChunkingStrategy | 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,
@@ -60,6 +61,9 @@ class Files(SyncAPIResource):
               vector store should use. Useful for tools like `file_search` that can access
               files.
 
+          chunking_strategy: The chunking strategy used to chunk the file(s). If not set, will use the `auto`
+              strategy.
+
           extra_headers: Send extra headers
 
           extra_query: Add additional query parameters to the request
@@ -73,7 +77,13 @@ class Files(SyncAPIResource):
         extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}
         return self._post(
             f"/vector_stores/{vector_store_id}/files",
-            body=maybe_transform({"file_id": file_id}, file_create_params.FileCreateParams),
+            body=maybe_transform(
+                {
+                    "file_id": file_id,
+                    "chunking_strategy": chunking_strategy,
+                },
+                file_create_params.FileCreateParams,
+            ),
             options=make_request_options(
                 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
             ),
@@ -330,6 +340,7 @@ class AsyncFiles(AsyncAPIResource):
         vector_store_id: str,
         *,
         file_id: str,
+        chunking_strategy: file_create_params.ChunkingStrategy | 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,
@@ -347,6 +358,9 @@ class AsyncFiles(AsyncAPIResource):
               vector store should use. Useful for tools like `file_search` that can access
               files.
 
+          chunking_strategy: The chunking strategy used to chunk the file(s). If not set, will use the `auto`
+              strategy.
+
           extra_headers: Send extra headers
 
           extra_query: Add additional query parameters to the request
@@ -360,7 +374,13 @@ class AsyncFiles(AsyncAPIResource):
         extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}
         return await self._post(
             f"/vector_stores/{vector_store_id}/files",
-            body=await async_maybe_transform({"file_id": file_id}, file_create_params.FileCreateParams),
+            body=await async_maybe_transform(
+                {
+                    "file_id": file_id,
+                    "chunking_strategy": chunking_strategy,
+                },
+                file_create_params.FileCreateParams,
+            ),
             options=make_request_options(
                 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
             ),
src/openai/resources/beta/vector_stores/vector_stores.py
@@ -64,6 +64,7 @@ class VectorStores(SyncAPIResource):
     def create(
         self,
         *,
+        chunking_strategy: vector_store_create_params.ChunkingStrategy | 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,
@@ -79,6 +80,9 @@ class VectorStores(SyncAPIResource):
         Create a vector store.
 
         Args:
+          chunking_strategy: 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.
+
           expires_after: The expiration policy for a vector store.
 
           file_ids: A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
@@ -105,6 +109,7 @@ class VectorStores(SyncAPIResource):
             "/vector_stores",
             body=maybe_transform(
                 {
+                    "chunking_strategy": chunking_strategy,
                     "expires_after": expires_after,
                     "file_ids": file_ids,
                     "metadata": metadata,
@@ -326,6 +331,7 @@ class AsyncVectorStores(AsyncAPIResource):
     async def create(
         self,
         *,
+        chunking_strategy: vector_store_create_params.ChunkingStrategy | 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,
@@ -341,6 +347,9 @@ class AsyncVectorStores(AsyncAPIResource):
         Create a vector store.
 
         Args:
+          chunking_strategy: 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.
+
           expires_after: The expiration policy for a vector store.
 
           file_ids: A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
@@ -367,6 +376,7 @@ class AsyncVectorStores(AsyncAPIResource):
             "/vector_stores",
             body=await async_maybe_transform(
                 {
+                    "chunking_strategy": chunking_strategy,
                     "expires_after": expires_after,
                     "file_ids": file_ids,
                     "metadata": metadata,
src/openai/resources/fine_tuning/jobs/jobs.py
@@ -87,6 +87,11 @@ class Jobs(SyncAPIResource):
               Your dataset must be formatted as a JSONL file. Additionally, you must upload
               your file with the purpose `fine-tune`.
 
+              The contents of the file should differ depending on if the model uses the
+              [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or
+              [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input)
+              format.
+
               See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning)
               for more details.
 
@@ -362,6 +367,11 @@ class AsyncJobs(AsyncAPIResource):
               Your dataset must be formatted as a JSONL file. Additionally, you must upload
               your file with the purpose `fine-tune`.
 
+              The contents of the file should differ depending on if the model uses the
+              [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or
+              [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input)
+              format.
+
               See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning)
               for more details.
 
src/openai/resources/batches.py
@@ -68,7 +68,7 @@ class Batches(SyncAPIResource):
               for how to upload a file.
 
               Your input file must be formatted as a
-              [JSONL file](https://platform.openai.com/docs/api-reference/batch/requestInput),
+              [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input),
               and must be uploaded with the purpose `batch`. The file can contain up to 50,000
               requests, and can be up to 100 MB in size.
 
@@ -195,8 +195,11 @@ class Batches(SyncAPIResource):
         extra_body: Body | None = None,
         timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
     ) -> Batch:
-        """
-        Cancels an in-progress batch.
+        """Cancels an in-progress batch.
+
+        The batch will be in status `cancelling` for up to
+        10 minutes, before changing to `cancelled`, where it will have partial results
+        (if any) available in the output file.
 
         Args:
           extra_headers: Send extra headers
@@ -259,7 +262,7 @@ class AsyncBatches(AsyncAPIResource):
               for how to upload a file.
 
               Your input file must be formatted as a
-              [JSONL file](https://platform.openai.com/docs/api-reference/batch/requestInput),
+              [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input),
               and must be uploaded with the purpose `batch`. The file can contain up to 50,000
               requests, and can be up to 100 MB in size.
 
@@ -386,8 +389,11 @@ class AsyncBatches(AsyncAPIResource):
         extra_body: Body | None = None,
         timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
     ) -> Batch:
-        """
-        Cancels an in-progress batch.
+        """Cancels an in-progress batch.
+
+        The batch will be in status `cancelling` for up to
+        10 minutes, before changing to `cancelled`, where it will have partial results
+        (if any) available in the output file.
 
         Args:
           extra_headers: Send extra headers
src/openai/resources/files.py
@@ -52,7 +52,7 @@ class Files(SyncAPIResource):
         self,
         *,
         file: FileTypes,
-        purpose: Literal["assistants", "batch", "fine-tune"],
+        purpose: Literal["assistants", "batch", "fine-tune", "vision"],
         # 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,
@@ -71,9 +71,15 @@ class Files(SyncAPIResource):
         [Assistants Tools guide](https://platform.openai.com/docs/assistants/tools) for
         details.
 
-        The Fine-tuning API only supports `.jsonl` files.
+        The Fine-tuning API only supports `.jsonl` files. The input also has certain
+        required formats for fine-tuning
+        [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or
+        [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input)
+        models.
 
-        The Batch API only supports `.jsonl` files up to 100 MB in size.
+        The Batch API only supports `.jsonl` files up to 100 MB in size. The input also
+        has a specific required
+        [format](https://platform.openai.com/docs/api-reference/batch/request-input).
 
         Please [contact us](https://help.openai.com/) if you need to increase these
         storage limits.
@@ -329,7 +335,7 @@ class AsyncFiles(AsyncAPIResource):
         self,
         *,
         file: FileTypes,
-        purpose: Literal["assistants", "batch", "fine-tune"],
+        purpose: Literal["assistants", "batch", "fine-tune", "vision"],
         # 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,
@@ -348,9 +354,15 @@ class AsyncFiles(AsyncAPIResource):
         [Assistants Tools guide](https://platform.openai.com/docs/assistants/tools) for
         details.
 
-        The Fine-tuning API only supports `.jsonl` files.
+        The Fine-tuning API only supports `.jsonl` files. The input also has certain
+        required formats for fine-tuning
+        [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or
+        [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input)
+        models.
 
-        The Batch API only supports `.jsonl` files up to 100 MB in size.
+        The Batch API only supports `.jsonl` files up to 100 MB in size. The input also
+        has a specific required
+        [format](https://platform.openai.com/docs/api-reference/batch/request-input).
 
         Please [contact us](https://help.openai.com/) if you need to increase these
         storage limits.
src/openai/types/beta/vector_stores/file_batch_create_params.py
@@ -2,10 +2,16 @@
 
 from __future__ import annotations
 
-from typing import List
-from typing_extensions import Required, TypedDict
+from typing import List, Union
+from typing_extensions import Literal, Required, TypedDict
 
-__all__ = ["FileBatchCreateParams"]
+__all__ = [
+    "FileBatchCreateParams",
+    "ChunkingStrategy",
+    "ChunkingStrategyAutoChunkingStrategyRequestParam",
+    "ChunkingStrategyStaticChunkingStrategyRequestParam",
+    "ChunkingStrategyStaticChunkingStrategyRequestParamStatic",
+]
 
 
 class FileBatchCreateParams(TypedDict, total=False):
@@ -15,3 +21,41 @@ class FileBatchCreateParams(TypedDict, total=False):
     the vector store should use. Useful for tools like `file_search` that can access
     files.
     """
+
+    chunking_strategy: ChunkingStrategy
+    """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`.
+    """
+
+    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 = Union[
+    ChunkingStrategyAutoChunkingStrategyRequestParam, ChunkingStrategyStaticChunkingStrategyRequestParam
+]
src/openai/types/beta/vector_stores/file_create_params.py
@@ -2,9 +2,16 @@
 
 from __future__ import annotations
 
-from typing_extensions import Required, TypedDict
+from typing import Union
+from typing_extensions import Literal, Required, TypedDict
 
-__all__ = ["FileCreateParams"]
+__all__ = [
+    "FileCreateParams",
+    "ChunkingStrategy",
+    "ChunkingStrategyAutoChunkingStrategyRequestParam",
+    "ChunkingStrategyStaticChunkingStrategyRequestParam",
+    "ChunkingStrategyStaticChunkingStrategyRequestParamStatic",
+]
 
 
 class FileCreateParams(TypedDict, total=False):
@@ -14,3 +21,41 @@ class FileCreateParams(TypedDict, total=False):
     vector store should use. Useful for tools like `file_search` that can access
     files.
     """
+
+    chunking_strategy: ChunkingStrategy
+    """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`.
+    """
+
+    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 = Union[
+    ChunkingStrategyAutoChunkingStrategyRequestParam, ChunkingStrategyStaticChunkingStrategyRequestParam
+]
src/openai/types/beta/vector_stores/vector_store_file.py
@@ -1,11 +1,19 @@
 # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
 
-from typing import Optional
-from typing_extensions import Literal
+from typing import Union, Optional
+from typing_extensions import Literal, Annotated
 
+from ...._utils import PropertyInfo
 from ...._models import BaseModel
 
-__all__ = ["VectorStoreFile", "LastError"]
+__all__ = [
+    "VectorStoreFile",
+    "LastError",
+    "ChunkingStrategy",
+    "ChunkingStrategyStatic",
+    "ChunkingStrategyStaticStatic",
+    "ChunkingStrategyOther",
+]
 
 
 class LastError(BaseModel):
@@ -16,6 +24,36 @@ 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 = Annotated[Union[ChunkingStrategyStatic, ChunkingStrategyOther], PropertyInfo(discriminator="type")]
+
+
 class VectorStoreFile(BaseModel):
     id: str
     """The identifier, which can be referenced in API endpoints."""
@@ -52,3 +90,6 @@ class VectorStoreFile(BaseModel):
     that the [File](https://platform.openai.com/docs/api-reference/files) is
     attached to.
     """
+
+    chunking_strategy: Optional[ChunkingStrategy] = None
+    """The strategy used to chunk the file."""
src/openai/types/beta/assistant_create_params.py
@@ -14,6 +14,10 @@ __all__ = [
     "ToolResourcesCodeInterpreter",
     "ToolResourcesFileSearch",
     "ToolResourcesFileSearchVectorStore",
+    "ToolResourcesFileSearchVectorStoreChunkingStrategy",
+    "ToolResourcesFileSearchVectorStoreChunkingStrategyAuto",
+    "ToolResourcesFileSearchVectorStoreChunkingStrategyStatic",
+    "ToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic",
 ]
 
 
@@ -134,7 +138,45 @@ 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 = Union[
+    ToolResourcesFileSearchVectorStoreChunkingStrategyAuto, ToolResourcesFileSearchVectorStoreChunkingStrategyStatic
+]
+
+
 class ToolResourcesFileSearchVectorStore(TypedDict, total=False):
+    chunking_strategy: ToolResourcesFileSearchVectorStoreChunkingStrategy
+    """The chunking strategy used to chunk the file(s).
+
+    If not set, will use the `auto` strategy.
+    """
+
     file_ids: List[str]
     """
     A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
src/openai/types/beta/assistant_stream_event.py
@@ -21,6 +21,7 @@ __all__ = [
     "ThreadRunInProgress",
     "ThreadRunRequiresAction",
     "ThreadRunCompleted",
+    "ThreadRunIncomplete",
     "ThreadRunFailed",
     "ThreadRunCancelling",
     "ThreadRunCancelled",
@@ -101,6 +102,16 @@ class ThreadRunCompleted(BaseModel):
     event: Literal["thread.run.completed"]
 
 
+class ThreadRunIncomplete(BaseModel):
+    data: Run
+    """
+    Represents an execution run on a
+    [thread](https://platform.openai.com/docs/api-reference/threads).
+    """
+
+    event: Literal["thread.run.incomplete"]
+
+
 class ThreadRunFailed(BaseModel):
     data: Run
     """
@@ -257,6 +268,7 @@ AssistantStreamEvent = Annotated[
         ThreadRunInProgress,
         ThreadRunRequiresAction,
         ThreadRunCompleted,
+        ThreadRunIncomplete,
         ThreadRunFailed,
         ThreadRunCancelling,
         ThreadRunCancelled,
src/openai/types/beta/file_search_tool.py
@@ -1,12 +1,30 @@
 # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
 
+from typing import Optional
 from typing_extensions import Literal
 
 from ..._models import BaseModel
 
-__all__ = ["FileSearchTool"]
+__all__ = ["FileSearchTool", "FileSearch"]
+
+
+class FileSearch(BaseModel):
+    max_num_results: Optional[int] = None
+    """The maximum number of results the file search tool should output.
+
+    The default is 20 for gpt-4\\** models and 5 for gpt-3.5-turbo. This number should
+    be between 1 and 50 inclusive.
+
+    Note that the file search tool may output fewer than `max_num_results` results.
+    See the
+    [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/number-of-chunks-returned)
+    for more information.
+    """
 
 
 class FileSearchTool(BaseModel):
     type: Literal["file_search"]
     """The type of tool being defined: `file_search`"""
+
+    file_search: Optional[FileSearch] = None
+    """Overrides for the file search tool."""
src/openai/types/beta/file_search_tool_param.py
@@ -4,9 +4,26 @@ from __future__ import annotations
 
 from typing_extensions import Literal, Required, TypedDict
 
-__all__ = ["FileSearchToolParam"]
+__all__ = ["FileSearchToolParam", "FileSearch"]
+
+
+class FileSearch(TypedDict, total=False):
+    max_num_results: int
+    """The maximum number of results the file search tool should output.
+
+    The default is 20 for gpt-4\\** models and 5 for gpt-3.5-turbo. This number should
+    be between 1 and 50 inclusive.
+
+    Note that the file search tool may output fewer than `max_num_results` results.
+    See the
+    [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/number-of-chunks-returned)
+    for more information.
+    """
 
 
 class FileSearchToolParam(TypedDict, total=False):
     type: Required[Literal["file_search"]]
     """The type of tool being defined: `file_search`"""
+
+    file_search: FileSearch
+    """Overrides for the file search tool."""
src/openai/types/beta/thread_create_and_run_params.py
@@ -22,6 +22,10 @@ __all__ = [
     "ThreadToolResourcesCodeInterpreter",
     "ThreadToolResourcesFileSearch",
     "ThreadToolResourcesFileSearchVectorStore",
+    "ThreadToolResourcesFileSearchVectorStoreChunkingStrategy",
+    "ThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto",
+    "ThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic",
+    "ThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic",
     "ToolResources",
     "ToolResourcesCodeInterpreter",
     "ToolResourcesFileSearch",
@@ -220,7 +224,46 @@ 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 = Union[
+    ThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto,
+    ThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic,
+]
+
+
 class ThreadToolResourcesFileSearchVectorStore(TypedDict, total=False):
+    chunking_strategy: ThreadToolResourcesFileSearchVectorStoreChunkingStrategy
+    """The chunking strategy used to chunk the file(s).
+
+    If not set, will use the `auto` strategy.
+    """
+
     file_ids: List[str]
     """
     A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
src/openai/types/beta/thread_create_params.py
@@ -18,6 +18,10 @@ __all__ = [
     "ToolResourcesCodeInterpreter",
     "ToolResourcesFileSearch",
     "ToolResourcesFileSearchVectorStore",
+    "ToolResourcesFileSearchVectorStoreChunkingStrategy",
+    "ToolResourcesFileSearchVectorStoreChunkingStrategyAuto",
+    "ToolResourcesFileSearchVectorStoreChunkingStrategyStatic",
+    "ToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic",
 ]
 
 
@@ -90,7 +94,45 @@ 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 = Union[
+    ToolResourcesFileSearchVectorStoreChunkingStrategyAuto, ToolResourcesFileSearchVectorStoreChunkingStrategyStatic
+]
+
+
 class ToolResourcesFileSearchVectorStore(TypedDict, total=False):
+    chunking_strategy: ToolResourcesFileSearchVectorStoreChunkingStrategy
+    """The chunking strategy used to chunk the file(s).
+
+    If not set, will use the `auto` strategy.
+    """
+
     file_ids: List[str]
     """
     A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
src/openai/types/beta/vector_store_create_params.py
@@ -2,13 +2,27 @@
 
 from __future__ import annotations
 
-from typing import List, Optional
+from typing import List, Union, Optional
 from typing_extensions import Literal, Required, TypedDict
 
-__all__ = ["VectorStoreCreateParams", "ExpiresAfter"]
+__all__ = [
+    "VectorStoreCreateParams",
+    "ChunkingStrategy",
+    "ChunkingStrategyAuto",
+    "ChunkingStrategyStatic",
+    "ChunkingStrategyStaticStatic",
+    "ExpiresAfter",
+]
 
 
 class VectorStoreCreateParams(TypedDict, total=False):
+    chunking_strategy: ChunkingStrategy
+    """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.
+    """
+
     expires_after: ExpiresAfter
     """The expiration policy for a vector store."""
 
@@ -31,6 +45,36 @@ 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 = Union[ChunkingStrategyAuto, ChunkingStrategyStatic]
+
+
 class ExpiresAfter(TypedDict, total=False):
     anchor: Required[Literal["last_active_at"]]
     """Anchor timestamp after which the expiration policy applies.
src/openai/types/chat/chat_completion_assistant_message_param.py
@@ -33,7 +33,7 @@ class ChatCompletionAssistantMessageParam(TypedDict, total=False):
     Required unless `tool_calls` or `function_call` is specified.
     """
 
-    function_call: FunctionCall
+    function_call: Optional[FunctionCall]
     """Deprecated and replaced by `tool_calls`.
 
     The name and arguments of a function that should be called, as generated by the
src/openai/types/chat/completion_create_params.py
@@ -219,9 +219,8 @@ class Function(TypedDict, total=False):
     parameters: shared_params.FunctionParameters
     """The parameters the functions accepts, described as a JSON Schema object.
 
-    See the
-    [guide](https://platform.openai.com/docs/guides/text-generation/function-calling)
-    for examples, and the
+    See the [guide](https://platform.openai.com/docs/guides/function-calling) for
+    examples, and the
     [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
     documentation about the format.
 
src/openai/types/fine_tuning/job_create_params.py
@@ -25,6 +25,11 @@ class JobCreateParams(TypedDict, total=False):
     Your dataset must be formatted as a JSONL file. Additionally, you must upload
     your file with the purpose `fine-tune`.
 
+    The contents of the file should differ depending on if the model uses the
+    [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or
+    [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input)
+    format.
+
     See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning)
     for more details.
     """
src/openai/types/shared/function_definition.py
@@ -25,9 +25,8 @@ class FunctionDefinition(BaseModel):
     parameters: Optional[FunctionParameters] = None
     """The parameters the functions accepts, described as a JSON Schema object.
 
-    See the
-    [guide](https://platform.openai.com/docs/guides/text-generation/function-calling)
-    for examples, and the
+    See the [guide](https://platform.openai.com/docs/guides/function-calling) for
+    examples, and the
     [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
     documentation about the format.
 
src/openai/types/shared_params/function_definition.py
@@ -26,9 +26,8 @@ class FunctionDefinition(TypedDict, total=False):
     parameters: shared_params.FunctionParameters
     """The parameters the functions accepts, described as a JSON Schema object.
 
-    See the
-    [guide](https://platform.openai.com/docs/guides/text-generation/function-calling)
-    for examples, and the
+    See the [guide](https://platform.openai.com/docs/guides/function-calling) for
+    examples, and the
     [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
     documentation about the format.
 
src/openai/types/batch_create_params.py
@@ -30,7 +30,7 @@ class BatchCreateParams(TypedDict, total=False):
     for how to upload a file.
 
     Your input file must be formatted as a
-    [JSONL file](https://platform.openai.com/docs/api-reference/batch/requestInput),
+    [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input),
     and must be uploaded with the purpose `batch`. The file can contain up to 50,000
     requests, and can be up to 100 MB in size.
     """
src/openai/types/file_create_params.py
@@ -13,7 +13,7 @@ class FileCreateParams(TypedDict, total=False):
     file: Required[FileTypes]
     """The File object (not file name) to be uploaded."""
 
-    purpose: Required[Literal["assistants", "batch", "fine-tune"]]
+    purpose: Required[Literal["assistants", "batch", "fine-tune", "vision"]]
     """The intended purpose of the uploaded file.
 
     Use "assistants" for
tests/api_resources/beta/vector_stores/test_file_batches.py
@@ -29,6 +29,15 @@ class TestFileBatches:
         )
         assert_matches_type(VectorStoreFileBatch, file_batch, path=["response"])
 
+    @parametrize
+    def test_method_create_with_all_params(self, client: OpenAI) -> None:
+        file_batch = client.beta.vector_stores.file_batches.create(
+            "vs_abc123",
+            file_ids=["string"],
+            chunking_strategy={"type": "auto"},
+        )
+        assert_matches_type(VectorStoreFileBatch, file_batch, path=["response"])
+
     @parametrize
     def test_raw_response_create(self, client: OpenAI) -> None:
         response = client.beta.vector_stores.file_batches.with_raw_response.create(
@@ -232,6 +241,15 @@ class TestAsyncFileBatches:
         )
         assert_matches_type(VectorStoreFileBatch, file_batch, path=["response"])
 
+    @parametrize
+    async def test_method_create_with_all_params(self, async_client: AsyncOpenAI) -> None:
+        file_batch = await async_client.beta.vector_stores.file_batches.create(
+            "vs_abc123",
+            file_ids=["string"],
+            chunking_strategy={"type": "auto"},
+        )
+        assert_matches_type(VectorStoreFileBatch, file_batch, path=["response"])
+
     @parametrize
     async def test_raw_response_create(self, async_client: AsyncOpenAI) -> None:
         response = await async_client.beta.vector_stores.file_batches.with_raw_response.create(
tests/api_resources/beta/vector_stores/test_files.py
@@ -29,6 +29,15 @@ class TestFiles:
         )
         assert_matches_type(VectorStoreFile, file, path=["response"])
 
+    @parametrize
+    def test_method_create_with_all_params(self, client: OpenAI) -> None:
+        file = client.beta.vector_stores.files.create(
+            "vs_abc123",
+            file_id="string",
+            chunking_strategy={"type": "auto"},
+        )
+        assert_matches_type(VectorStoreFile, file, path=["response"])
+
     @parametrize
     def test_raw_response_create(self, client: OpenAI) -> None:
         response = client.beta.vector_stores.files.with_raw_response.create(
@@ -221,6 +230,15 @@ class TestAsyncFiles:
         )
         assert_matches_type(VectorStoreFile, file, path=["response"])
 
+    @parametrize
+    async def test_method_create_with_all_params(self, async_client: AsyncOpenAI) -> None:
+        file = await async_client.beta.vector_stores.files.create(
+            "vs_abc123",
+            file_id="string",
+            chunking_strategy={"type": "auto"},
+        )
+        assert_matches_type(VectorStoreFile, file, path=["response"])
+
     @parametrize
     async def test_raw_response_create(self, async_client: AsyncOpenAI) -> None:
         response = await async_client.beta.vector_stores.files.with_raw_response.create(
tests/api_resources/beta/test_assistants.py
@@ -45,6 +45,7 @@ class TestAssistants:
                     "vector_stores": [
                         {
                             "file_ids": ["string", "string", "string"],
+                            "chunking_strategy": {"type": "auto"},
                             "metadata": {},
                         }
                     ],
@@ -276,6 +277,7 @@ class TestAsyncAssistants:
                     "vector_stores": [
                         {
                             "file_ids": ["string", "string", "string"],
+                            "chunking_strategy": {"type": "auto"},
                             "metadata": {},
                         }
                     ],
tests/api_resources/beta/test_threads.py
@@ -132,6 +132,7 @@ class TestThreads:
                     "vector_stores": [
                         {
                             "file_ids": ["string", "string", "string"],
+                            "chunking_strategy": {"type": "auto"},
                             "metadata": {},
                         }
                     ],
@@ -408,6 +409,7 @@ class TestThreads:
                         "vector_stores": [
                             {
                                 "file_ids": ["string", "string", "string"],
+                                "chunking_strategy": {"type": "auto"},
                                 "metadata": {},
                             }
                         ],
@@ -576,6 +578,7 @@ class TestThreads:
                         "vector_stores": [
                             {
                                 "file_ids": ["string", "string", "string"],
+                                "chunking_strategy": {"type": "auto"},
                                 "metadata": {},
                             }
                         ],
@@ -737,6 +740,7 @@ class TestAsyncThreads:
                     "vector_stores": [
                         {
                             "file_ids": ["string", "string", "string"],
+                            "chunking_strategy": {"type": "auto"},
                             "metadata": {},
                         }
                     ],
@@ -1013,6 +1017,7 @@ class TestAsyncThreads:
                         "vector_stores": [
                             {
                                 "file_ids": ["string", "string", "string"],
+                                "chunking_strategy": {"type": "auto"},
                                 "metadata": {},
                             }
                         ],
@@ -1181,6 +1186,7 @@ class TestAsyncThreads:
                         "vector_stores": [
                             {
                                 "file_ids": ["string", "string", "string"],
+                                "chunking_strategy": {"type": "auto"},
                                 "metadata": {},
                             }
                         ],
tests/api_resources/beta/test_vector_stores.py
@@ -29,6 +29,7 @@ class TestVectorStores:
     @parametrize
     def test_method_create_with_all_params(self, client: OpenAI) -> None:
         vector_store = client.beta.vector_stores.create(
+            chunking_strategy={"type": "auto"},
             expires_after={
                 "anchor": "last_active_at",
                 "days": 1,
@@ -233,6 +234,7 @@ class TestAsyncVectorStores:
     @parametrize
     async def test_method_create_with_all_params(self, async_client: AsyncOpenAI) -> None:
         vector_store = await async_client.beta.vector_stores.create(
+            chunking_strategy={"type": "auto"},
             expires_after={
                 "anchor": "last_active_at",
                 "days": 1,
.stats.yml
@@ -1,2 +1,2 @@
 configured_endpoints: 64
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-363dd904e5d6e65b3a323fc88e6b502fb23a6aa319be219273e3ee47c7530993.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-0577fd0d08da6b867b002a5accd45f7116ef91c4940b41cf45dc479938c77163.yml