Skip to content

Commit

Permalink
chore(internal): use TypeAlias marker for type assignments (#621)
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 0a3f3fa commit a4bff9c
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/anthropic/types/content_block.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 .text_block import TextBlock
from .tool_use_block import ToolUseBlock

__all__ = ["ContentBlock"]

ContentBlock = Annotated[Union[TextBlock, ToolUseBlock], PropertyInfo(discriminator="type")]
ContentBlock: TypeAlias = Annotated[Union[TextBlock, ToolUseBlock], PropertyInfo(discriminator="type")]
4 changes: 2 additions & 2 deletions src/anthropic/types/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 List, Union, Iterable, Optional
from typing_extensions import Literal, Required, TypedDict
from typing_extensions import Literal, Required, TypeAlias, TypedDict

from .tool_param import ToolParam
from .model_param import ModelParam
Expand Down Expand Up @@ -287,7 +287,7 @@ class ToolChoiceToolChoiceTool(TypedDict, total=False):
type: Required[Literal["tool"]]


ToolChoice = Union[ToolChoiceToolChoiceAuto, ToolChoiceToolChoiceAny, ToolChoiceToolChoiceTool]
ToolChoice: TypeAlias = Union[ToolChoiceToolChoiceAuto, ToolChoiceToolChoiceAny, ToolChoiceToolChoiceTool]


class MessageCreateParamsNonStreaming(MessageCreateParamsBase):
Expand Down
4 changes: 2 additions & 2 deletions src/anthropic/types/model.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# 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

__all__ = ["Model"]

Model = Union[
Model: TypeAlias = Union[
str,
Literal[
"claude-3-5-sonnet-20240620",
Expand Down
4 changes: 2 additions & 2 deletions src/anthropic/types/model_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from __future__ import annotations

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

__all__ = ["ModelParam"]

ModelParam = Union[
ModelParam: TypeAlias = Union[
str,
Literal[
"claude-3-5-sonnet-20240620",
Expand Down
4 changes: 2 additions & 2 deletions src/anthropic/types/raw_content_block_delta_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 .._utils import PropertyInfo
from .._models import BaseModel
Expand All @@ -10,7 +10,7 @@

__all__ = ["RawContentBlockDeltaEvent", "Delta"]

Delta = Annotated[Union[TextDelta, InputJSONDelta], PropertyInfo(discriminator="type")]
Delta: TypeAlias = Annotated[Union[TextDelta, InputJSONDelta], PropertyInfo(discriminator="type")]


class RawContentBlockDeltaEvent(BaseModel):
Expand Down
4 changes: 2 additions & 2 deletions src/anthropic/types/raw_content_block_start_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 .._utils import PropertyInfo
from .._models import BaseModel
Expand All @@ -10,7 +10,7 @@

__all__ = ["RawContentBlockStartEvent", "ContentBlock"]

ContentBlock = Annotated[Union[TextBlock, ToolUseBlock], PropertyInfo(discriminator="type")]
ContentBlock: TypeAlias = Annotated[Union[TextBlock, ToolUseBlock], PropertyInfo(discriminator="type")]


class RawContentBlockStartEvent(BaseModel):
Expand Down
4 changes: 2 additions & 2 deletions src/anthropic/types/raw_message_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 Annotated
from typing_extensions import Annotated, TypeAlias

from .._utils import PropertyInfo
from .raw_message_stop_event import RawMessageStopEvent
Expand All @@ -13,7 +13,7 @@

__all__ = ["RawMessageStreamEvent"]

RawMessageStreamEvent = Annotated[
RawMessageStreamEvent: TypeAlias = Annotated[
Union[
RawMessageStartEvent,
RawMessageDeltaEvent,
Expand Down
4 changes: 2 additions & 2 deletions src/anthropic/types/tool_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

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

__all__ = ["ToolParam", "InputSchema"]

Expand All @@ -14,7 +14,7 @@ class InputSchemaTyped(TypedDict, total=False):
properties: Optional[object]


InputSchema = Union[InputSchemaTyped, Dict[str, object]]
InputSchema: TypeAlias = Union[InputSchemaTyped, Dict[str, object]]


class ToolParam(TypedDict, total=False):
Expand Down
4 changes: 2 additions & 2 deletions src/anthropic/types/tool_result_block_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
from __future__ import annotations

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

from .text_block_param import TextBlockParam
from .image_block_param import ImageBlockParam

__all__ = ["ToolResultBlockParam", "Content"]

Content = Union[TextBlockParam, ImageBlockParam]
Content: TypeAlias = Union[TextBlockParam, ImageBlockParam]


class ToolResultBlockParam(TypedDict, total=False):
Expand Down

0 comments on commit a4bff9c

Please sign in to comment.