Skip to content

BetaMessageParam potentially missing BetaContentBlock? #1022

@wonderseif

Description

@wonderseif

Using latest version 0.64.0

The definition for MessageParam content is:

content: Required[
        Union[
            str,
            Iterable[
                Union[
                    TextBlockParam,
                    ImageBlockParam,
                    DocumentBlockParam,
                    SearchResultBlockParam,
                    ThinkingBlockParam,
                    RedactedThinkingBlockParam,
                    ToolUseBlockParam,
                    ToolResultBlockParam,
                    ServerToolUseBlockParam,
                    WebSearchToolResultBlockParam,
                    ContentBlock,
                ]
            ],
        ]
    ]

However, the equivalent definition for BetaMessageParam is:

content: Required[Union[str, Iterable[BetaContentBlockParam]]]

Where BetaContentBlockParam is

BetaContentBlockParam: TypeAlias = Union[
    BetaTextBlockParam,
    BetaImageBlockParam,
    BetaRequestDocumentBlockParam,
    BetaSearchResultBlockParam,
    BetaThinkingBlockParam,
    BetaRedactedThinkingBlockParam,
    BetaToolUseBlockParam,
    BetaToolResultBlockParam,
    BetaServerToolUseBlockParam,
    BetaWebSearchToolResultBlockParam,
    BetaCodeExecutionToolResultBlockParam,
    BetaMCPToolUseBlockParam,
    BetaRequestMCPToolResultBlockParam,
    BetaContainerUploadBlockParam,
]

To my understanding ContentBlocks are received as API responses and can be passed back as part of history for multi-turn conversations, so am I missing something or should BetaContentBlock be allowed as a type for BetaMessageParam.content ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions