diff --git a/.stats.yml b/.stats.yml index 2371b7b8d4..185585b675 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-285bce7dcdae7eea5fe84a8d6e5af2c1473d65ea193109370fb2257851eef7eb.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-8ff62fa1091460d68fbd36d72c17d91b709917bebf2983c9c4de5784bc384a2e.yml diff --git a/api.md b/api.md index 1687476d86..648d0f3708 100644 --- a/api.md +++ b/api.md @@ -82,7 +82,7 @@ Methods: Types: ```python -from openai.types import FileContent, FileDeleted, FileObject +from openai.types import FileContent, FileDeleted, FileObject, FilePurpose ``` Methods: diff --git a/src/openai/resources/files.py b/src/openai/resources/files.py index 75c971a8bc..a240e1d886 100644 --- a/src/openai/resources/files.py +++ b/src/openai/resources/files.py @@ -5,12 +5,11 @@ import time import typing_extensions from typing import Mapping, cast -from typing_extensions import Literal import httpx from .. import _legacy_response -from ..types import file_list_params, file_create_params +from ..types import FilePurpose, file_list_params, file_create_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes from .._utils import ( extract_files, @@ -35,6 +34,7 @@ ) from ..types.file_object import FileObject from ..types.file_deleted import FileDeleted +from ..types.file_purpose import FilePurpose __all__ = ["Files", "AsyncFiles"] @@ -52,7 +52,7 @@ def create( self, *, file: FileTypes, - purpose: Literal["assistants", "batch", "fine-tune", "vision"], + purpose: FilePurpose, # 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, @@ -334,7 +334,7 @@ async def create( self, *, file: FileTypes, - purpose: Literal["assistants", "batch", "fine-tune", "vision"], + purpose: FilePurpose, # 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, diff --git a/src/openai/resources/uploads/uploads.py b/src/openai/resources/uploads/uploads.py index 4100423d3e..3590a3843f 100644 --- a/src/openai/resources/uploads/uploads.py +++ b/src/openai/resources/uploads/uploads.py @@ -3,7 +3,6 @@ from __future__ import annotations from typing import List -from typing_extensions import Literal import httpx @@ -16,7 +15,7 @@ PartsWithStreamingResponse, AsyncPartsWithStreamingResponse, ) -from ...types import upload_create_params, upload_complete_params +from ...types import FilePurpose, upload_create_params, upload_complete_params from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, @@ -27,6 +26,7 @@ from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ..._base_client import make_request_options from ...types.upload import Upload +from ...types.file_purpose import FilePurpose __all__ = ["Uploads", "AsyncUploads"] @@ -50,7 +50,7 @@ def create( bytes: int, filename: str, mime_type: str, - purpose: Literal["assistants", "batch", "fine-tune", "vision"], + purpose: FilePurpose, # 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, @@ -233,7 +233,7 @@ async def create( bytes: int, filename: str, mime_type: str, - purpose: Literal["assistants", "batch", "fine-tune", "vision"], + purpose: FilePurpose, # 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, diff --git a/src/openai/types/__init__.py b/src/openai/types/__init__.py index f621fb67c5..ad9284fbd5 100644 --- a/src/openai/types/__init__.py +++ b/src/openai/types/__init__.py @@ -24,6 +24,7 @@ from .image_model import ImageModel as ImageModel from .file_content import FileContent as FileContent from .file_deleted import FileDeleted as FileDeleted +from .file_purpose import FilePurpose as FilePurpose from .model_deleted import ModelDeleted as ModelDeleted from .images_response import ImagesResponse as ImagesResponse from .completion_usage import CompletionUsage as CompletionUsage diff --git a/src/openai/types/file_create_params.py b/src/openai/types/file_create_params.py index 8b1c296f39..ecf7503358 100644 --- a/src/openai/types/file_create_params.py +++ b/src/openai/types/file_create_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict from .._types import FileTypes +from .file_purpose import FilePurpose __all__ = ["FileCreateParams"] @@ -13,7 +14,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", "vision"]] + purpose: Required[FilePurpose] """The intended purpose of the uploaded file. Use "assistants" for diff --git a/src/openai/types/file_purpose.py b/src/openai/types/file_purpose.py new file mode 100644 index 0000000000..32dc352c62 --- /dev/null +++ b/src/openai/types/file_purpose.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["FilePurpose"] + +FilePurpose: TypeAlias = Literal["assistants", "batch", "fine-tune", "vision"] diff --git a/src/openai/types/upload_create_params.py b/src/openai/types/upload_create_params.py index 3165ebcc7a..2ebabe6c66 100644 --- a/src/openai/types/upload_create_params.py +++ b/src/openai/types/upload_create_params.py @@ -2,7 +2,9 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict + +from .file_purpose import FilePurpose __all__ = ["UploadCreateParams"] @@ -21,7 +23,7 @@ class UploadCreateParams(TypedDict, total=False): supported MIME types for assistants and vision. """ - purpose: Required[Literal["assistants", "batch", "fine-tune", "vision"]] + purpose: Required[FilePurpose] """The intended purpose of the uploaded file. See the