Skip to content

Commit

Permalink
chore(internal): use TypeAlias marker for type assignments (#1597)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Aug 5, 2024
1 parent da48e4c commit 5907ea0
Show file tree
Hide file tree
Showing 42 changed files with 99 additions and 80 deletions.
4 changes: 2 additions & 2 deletions src/openai/types/audio/speech_model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias

__all__ = ["SpeechModel"]

SpeechModel = Literal["tts-1", "tts-1-hd"]
SpeechModel: TypeAlias = Literal["tts-1", "tts-1-hd"]
4 changes: 2 additions & 2 deletions src/openai/types/audio_model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias

__all__ = ["AudioModel"]

AudioModel = Literal["whisper-1"]
AudioModel: TypeAlias = Literal["whisper-1"]
4 changes: 2 additions & 2 deletions src/openai/types/beta/assistant_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from typing import List, Union, Iterable, Optional
from typing_extensions import Literal, Required, TypedDict
from typing_extensions import Literal, Required, TypeAlias, TypedDict

from ..chat_model import ChatModel
from .assistant_tool_param import AssistantToolParam
Expand Down Expand Up @@ -140,7 +140,7 @@ class ToolResourcesFileSearchVectorStoreChunkingStrategyStatic(TypedDict, total=
"""Always `static`."""


ToolResourcesFileSearchVectorStoreChunkingStrategy = Union[
ToolResourcesFileSearchVectorStoreChunkingStrategy: TypeAlias = Union[
ToolResourcesFileSearchVectorStoreChunkingStrategyAuto, ToolResourcesFileSearchVectorStoreChunkingStrategyStatic
]

Expand Down
4 changes: 2 additions & 2 deletions src/openai/types/beta/assistant_response_format_option.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Union
from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias

from .assistant_response_format import AssistantResponseFormat

__all__ = ["AssistantResponseFormatOption"]

AssistantResponseFormatOption = Union[Literal["none", "auto"], AssistantResponseFormat]
AssistantResponseFormatOption: TypeAlias = Union[Literal["none", "auto"], AssistantResponseFormat]
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from __future__ import annotations

from typing import Union
from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias

from .assistant_response_format_param import AssistantResponseFormatParam

__all__ = ["AssistantResponseFormatOptionParam"]

AssistantResponseFormatOptionParam = Union[Literal["none", "auto"], AssistantResponseFormatParam]
AssistantResponseFormatOptionParam: TypeAlias = Union[Literal["none", "auto"], AssistantResponseFormatParam]
4 changes: 2 additions & 2 deletions src/openai/types/beta/assistant_stream_event.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Union
from typing_extensions import Literal, Annotated
from typing_extensions import Literal, Annotated, TypeAlias

from .thread import Thread
from ..._utils import PropertyInfo
Expand Down Expand Up @@ -260,7 +260,7 @@ class ErrorEvent(BaseModel):
event: Literal["error"]


AssistantStreamEvent = Annotated[
AssistantStreamEvent: TypeAlias = Annotated[
Union[
ThreadCreated,
ThreadRunCreated,
Expand Down
6 changes: 4 additions & 2 deletions src/openai/types/beta/assistant_tool.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Union
from typing_extensions import Annotated
from typing_extensions import Annotated, TypeAlias

from ..._utils import PropertyInfo
from .function_tool import FunctionTool
Expand All @@ -10,4 +10,6 @@

__all__ = ["AssistantTool"]

AssistantTool = Annotated[Union[CodeInterpreterTool, FileSearchTool, FunctionTool], PropertyInfo(discriminator="type")]
AssistantTool: TypeAlias = Annotated[
Union[CodeInterpreterTool, FileSearchTool, FunctionTool], PropertyInfo(discriminator="type")
]
4 changes: 2 additions & 2 deletions src/openai/types/beta/assistant_tool_choice_option.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Union
from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias

from .assistant_tool_choice import AssistantToolChoice

__all__ = ["AssistantToolChoiceOption"]

AssistantToolChoiceOption = Union[Literal["none", "auto", "required"], AssistantToolChoice]
AssistantToolChoiceOption: TypeAlias = Union[Literal["none", "auto", "required"], AssistantToolChoice]
4 changes: 2 additions & 2 deletions src/openai/types/beta/assistant_tool_choice_option_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from __future__ import annotations

from typing import Union
from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias

from .assistant_tool_choice_param import AssistantToolChoiceParam

__all__ = ["AssistantToolChoiceOptionParam"]

AssistantToolChoiceOptionParam = Union[Literal["none", "auto", "required"], AssistantToolChoiceParam]
AssistantToolChoiceOptionParam: TypeAlias = Union[Literal["none", "auto", "required"], AssistantToolChoiceParam]
3 changes: 2 additions & 1 deletion src/openai/types/beta/assistant_tool_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
from __future__ import annotations

from typing import Union
from typing_extensions import TypeAlias

from .function_tool_param import FunctionToolParam
from .file_search_tool_param import FileSearchToolParam
from .code_interpreter_tool_param import CodeInterpreterToolParam

__all__ = ["AssistantToolParam"]

AssistantToolParam = Union[CodeInterpreterToolParam, FileSearchToolParam, FunctionToolParam]
AssistantToolParam: TypeAlias = Union[CodeInterpreterToolParam, FileSearchToolParam, FunctionToolParam]
8 changes: 4 additions & 4 deletions src/openai/types/beta/thread_create_and_run_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from typing import List, Union, Iterable, Optional
from typing_extensions import Literal, Required, TypedDict
from typing_extensions import Literal, Required, TypeAlias, TypedDict

from ..chat_model import ChatModel
from .function_tool_param import FunctionToolParam
Expand Down Expand Up @@ -168,7 +168,7 @@ class ThreadMessageAttachmentToolFileSearch(TypedDict, total=False):
"""The type of tool being defined: `file_search`"""


ThreadMessageAttachmentTool = Union[CodeInterpreterToolParam, ThreadMessageAttachmentToolFileSearch]
ThreadMessageAttachmentTool: TypeAlias = Union[CodeInterpreterToolParam, ThreadMessageAttachmentToolFileSearch]


class ThreadMessageAttachment(TypedDict, total=False):
Expand Down Expand Up @@ -240,7 +240,7 @@ class ThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic(TypedDict,
"""Always `static`."""


ThreadToolResourcesFileSearchVectorStoreChunkingStrategy = Union[
ThreadToolResourcesFileSearchVectorStoreChunkingStrategy: TypeAlias = Union[
ThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto,
ThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic,
]
Expand Down Expand Up @@ -342,7 +342,7 @@ class ToolResources(TypedDict, total=False):
file_search: ToolResourcesFileSearch


Tool = Union[CodeInterpreterToolParam, FileSearchToolParam, FunctionToolParam]
Tool: TypeAlias = Union[CodeInterpreterToolParam, FileSearchToolParam, FunctionToolParam]


class TruncationStrategy(TypedDict, total=False):
Expand Down
6 changes: 3 additions & 3 deletions src/openai/types/beta/thread_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from typing import List, Union, Iterable, Optional
from typing_extensions import Literal, Required, TypedDict
from typing_extensions import Literal, Required, TypeAlias, TypedDict

from .code_interpreter_tool_param import CodeInterpreterToolParam
from .threads.message_content_part_param import MessageContentPartParam
Expand Down Expand Up @@ -54,7 +54,7 @@ class MessageAttachmentToolFileSearch(TypedDict, total=False):
"""The type of tool being defined: `file_search`"""


MessageAttachmentTool = Union[CodeInterpreterToolParam, MessageAttachmentToolFileSearch]
MessageAttachmentTool: TypeAlias = Union[CodeInterpreterToolParam, MessageAttachmentToolFileSearch]


class MessageAttachment(TypedDict, total=False):
Expand Down Expand Up @@ -126,7 +126,7 @@ class ToolResourcesFileSearchVectorStoreChunkingStrategyStatic(TypedDict, total=
"""Always `static`."""


ToolResourcesFileSearchVectorStoreChunkingStrategy = Union[
ToolResourcesFileSearchVectorStoreChunkingStrategy: TypeAlias = Union[
ToolResourcesFileSearchVectorStoreChunkingStrategyAuto, ToolResourcesFileSearchVectorStoreChunkingStrategyStatic
]

Expand Down
4 changes: 2 additions & 2 deletions src/openai/types/beta/threads/annotation.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Union
from typing_extensions import Annotated
from typing_extensions import Annotated, TypeAlias

from ...._utils import PropertyInfo
from .file_path_annotation import FilePathAnnotation
from .file_citation_annotation import FileCitationAnnotation

__all__ = ["Annotation"]

Annotation = Annotated[Union[FileCitationAnnotation, FilePathAnnotation], PropertyInfo(discriminator="type")]
Annotation: TypeAlias = Annotated[Union[FileCitationAnnotation, FilePathAnnotation], PropertyInfo(discriminator="type")]
4 changes: 2 additions & 2 deletions src/openai/types/beta/threads/annotation_delta.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Union
from typing_extensions import Annotated
from typing_extensions import Annotated, TypeAlias

from ...._utils import PropertyInfo
from .file_path_delta_annotation import FilePathDeltaAnnotation
from .file_citation_delta_annotation import FileCitationDeltaAnnotation

__all__ = ["AnnotationDelta"]

AnnotationDelta = Annotated[
AnnotationDelta: TypeAlias = Annotated[
Union[FileCitationDeltaAnnotation, FilePathDeltaAnnotation], PropertyInfo(discriminator="type")
]
4 changes: 2 additions & 2 deletions src/openai/types/beta/threads/message.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Union, Optional
from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias

from ...._models import BaseModel
from .message_content import MessageContent
Expand All @@ -21,7 +21,7 @@ class AttachmentToolAssistantToolsFileSearchTypeOnly(BaseModel):
"""The type of tool being defined: `file_search`"""


AttachmentTool = Union[CodeInterpreterTool, AttachmentToolAssistantToolsFileSearchTypeOnly]
AttachmentTool: TypeAlias = Union[CodeInterpreterTool, AttachmentToolAssistantToolsFileSearchTypeOnly]


class Attachment(BaseModel):
Expand Down
4 changes: 2 additions & 2 deletions src/openai/types/beta/threads/message_content.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Union
from typing_extensions import Annotated
from typing_extensions import Annotated, TypeAlias

from ...._utils import PropertyInfo
from .text_content_block import TextContentBlock
Expand All @@ -10,6 +10,6 @@

__all__ = ["MessageContent"]

MessageContent = Annotated[
MessageContent: TypeAlias = Annotated[
Union[ImageFileContentBlock, ImageURLContentBlock, TextContentBlock], PropertyInfo(discriminator="type")
]
4 changes: 2 additions & 2 deletions src/openai/types/beta/threads/message_content_delta.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Union
from typing_extensions import Annotated
from typing_extensions import Annotated, TypeAlias

from ...._utils import PropertyInfo
from .text_delta_block import TextDeltaBlock
Expand All @@ -10,6 +10,6 @@

__all__ = ["MessageContentDelta"]

MessageContentDelta = Annotated[
MessageContentDelta: TypeAlias = Annotated[
Union[ImageFileDeltaBlock, TextDeltaBlock, ImageURLDeltaBlock], PropertyInfo(discriminator="type")
]
3 changes: 2 additions & 1 deletion src/openai/types/beta/threads/message_content_part_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
from __future__ import annotations

from typing import Union
from typing_extensions import TypeAlias

from .text_content_block_param import TextContentBlockParam
from .image_url_content_block_param import ImageURLContentBlockParam
from .image_file_content_block_param import ImageFileContentBlockParam

__all__ = ["MessageContentPartParam"]

MessageContentPartParam = Union[ImageFileContentBlockParam, ImageURLContentBlockParam, TextContentBlockParam]
MessageContentPartParam: TypeAlias = Union[ImageFileContentBlockParam, ImageURLContentBlockParam, TextContentBlockParam]
4 changes: 2 additions & 2 deletions src/openai/types/beta/threads/message_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from typing import Union, Iterable, Optional
from typing_extensions import Literal, Required, TypedDict
from typing_extensions import Literal, Required, TypeAlias, TypedDict

from .message_content_part_param import MessageContentPartParam
from ..code_interpreter_tool_param import CodeInterpreterToolParam
Expand Down Expand Up @@ -41,7 +41,7 @@ class AttachmentToolFileSearch(TypedDict, total=False):
"""The type of tool being defined: `file_search`"""


AttachmentTool = Union[CodeInterpreterToolParam, AttachmentToolFileSearch]
AttachmentTool: TypeAlias = Union[CodeInterpreterToolParam, AttachmentToolFileSearch]


class Attachment(TypedDict, total=False):
Expand Down
4 changes: 2 additions & 2 deletions src/openai/types/beta/threads/run_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from typing import Union, Iterable, Optional
from typing_extensions import Literal, Required, TypedDict
from typing_extensions import Literal, Required, TypeAlias, TypedDict

from ...chat_model import ChatModel
from ..assistant_tool_param import AssistantToolParam
Expand Down Expand Up @@ -154,7 +154,7 @@ class AdditionalMessageAttachmentToolFileSearch(TypedDict, total=False):
"""The type of tool being defined: `file_search`"""


AdditionalMessageAttachmentTool = Union[CodeInterpreterToolParam, AdditionalMessageAttachmentToolFileSearch]
AdditionalMessageAttachmentTool: TypeAlias = Union[CodeInterpreterToolParam, AdditionalMessageAttachmentToolFileSearch]


class AdditionalMessageAttachment(TypedDict, total=False):
Expand Down
4 changes: 2 additions & 2 deletions src/openai/types/beta/threads/run_status.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias

__all__ = ["RunStatus"]

RunStatus = Literal[
RunStatus: TypeAlias = Literal[
"queued",
"in_progress",
"requires_action",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Union
from typing_extensions import Literal, Annotated
from typing_extensions import Literal, Annotated, TypeAlias

from ....._utils import PropertyInfo
from ....._models import BaseModel
Expand Down Expand Up @@ -39,7 +39,7 @@ class CodeInterpreterOutputImage(BaseModel):
"""Always `image`."""


CodeInterpreterOutput = Annotated[
CodeInterpreterOutput: TypeAlias = Annotated[
Union[CodeInterpreterOutputLogs, CodeInterpreterOutputImage], PropertyInfo(discriminator="type")
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Union, Optional
from typing_extensions import Literal, Annotated
from typing_extensions import Literal, Annotated, TypeAlias

from ....._utils import PropertyInfo
from ....._models import BaseModel
Expand All @@ -10,7 +10,7 @@

__all__ = ["CodeInterpreterToolCallDelta", "CodeInterpreter", "CodeInterpreterOutput"]

CodeInterpreterOutput = Annotated[
CodeInterpreterOutput: TypeAlias = Annotated[
Union[CodeInterpreterLogs, CodeInterpreterOutputImage], PropertyInfo(discriminator="type")
]

Expand Down
Loading

0 comments on commit 5907ea0

Please sign in to comment.