Skip to content

Commit

Permalink
chore(types): add union discriminator metadata (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed May 14, 2024
1 parent 77cfa5c commit 44efaeb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/anthropic/types/beta/tools/tools_beta_content_block.py
Original file line number Diff line number Diff line change
@@ -1,10 +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 ...._utils import PropertyInfo
from ...text_block import TextBlock
from .tool_use_block import ToolUseBlock

__all__ = ["ToolsBetaContentBlock"]

ToolsBetaContentBlock = Union[TextBlock, ToolUseBlock]
ToolsBetaContentBlock = Annotated[Union[TextBlock, ToolUseBlock], PropertyInfo(discriminator="type")]
19 changes: 12 additions & 7 deletions src/anthropic/types/message_stream_event.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Union
from typing_extensions import Annotated

from .._utils import PropertyInfo
from .message_stop_event import MessageStopEvent
from .message_delta_event import MessageDeltaEvent
from .message_start_event import MessageStartEvent
Expand All @@ -11,11 +13,14 @@

__all__ = ["MessageStreamEvent"]

MessageStreamEvent = Union[
MessageStartEvent,
MessageDeltaEvent,
MessageStopEvent,
ContentBlockStartEvent,
ContentBlockDeltaEvent,
ContentBlockStopEvent,
MessageStreamEvent = Annotated[
Union[
MessageStartEvent,
MessageDeltaEvent,
MessageStopEvent,
ContentBlockStartEvent,
ContentBlockDeltaEvent,
ContentBlockStopEvent,
],
PropertyInfo(discriminator="type"),
]

0 comments on commit 44efaeb

Please sign in to comment.