Skip to content

ToolResultContentBlock module-attribute

The tool result content block. For more information, see Call a tool with the Converse API in the Amazon Bedrock User Guide.

Union Members

ToolResultContentBlockJson dataclass

A tool result that is JSON format data.

Source code in src/aws_sdk_bedrock_runtime/models.py
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
@dataclass
class ToolResultContentBlockJson:
    """A tool result that is JSON format data."""

    value: Document

    def serialize(self, serializer: ShapeSerializer):
        serializer.write_struct(_SCHEMA_TOOL_RESULT_CONTENT_BLOCK, self)

    def serialize_members(self, serializer: ShapeSerializer):
        serializer.write_document(
            _SCHEMA_TOOL_RESULT_CONTENT_BLOCK.members["json"], self.value
        )

    @classmethod
    def deserialize(cls, deserializer: ShapeDeserializer) -> Self:
        return cls(
            value=deserializer.read_document(
                _SCHEMA_TOOL_RESULT_CONTENT_BLOCK.members["json"]
            )
        )

ToolResultContentBlockText dataclass

A tool result that is text.

Source code in src/aws_sdk_bedrock_runtime/models.py
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
@dataclass
class ToolResultContentBlockText:
    """A tool result that is text."""

    value: str

    def serialize(self, serializer: ShapeSerializer):
        serializer.write_struct(_SCHEMA_TOOL_RESULT_CONTENT_BLOCK, self)

    def serialize_members(self, serializer: ShapeSerializer):
        serializer.write_string(
            _SCHEMA_TOOL_RESULT_CONTENT_BLOCK.members["text"], self.value
        )

    @classmethod
    def deserialize(cls, deserializer: ShapeDeserializer) -> Self:
        return cls(
            value=deserializer.read_string(
                _SCHEMA_TOOL_RESULT_CONTENT_BLOCK.members["text"]
            )
        )

ToolResultContentBlockImage dataclass

A tool result that is an image.

Note

This field is only supported by Amazon Nova and Anthropic Claude 3 and 4 models.

Source code in src/aws_sdk_bedrock_runtime/models.py
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
@dataclass
class ToolResultContentBlockImage:
    """A tool result that is an image.

    Note:
        This field is only supported by Amazon Nova and Anthropic Claude 3 and 4
        models.
    """

    value: ImageBlock

    def serialize(self, serializer: ShapeSerializer):
        serializer.write_struct(_SCHEMA_TOOL_RESULT_CONTENT_BLOCK, self)

    def serialize_members(self, serializer: ShapeSerializer):
        serializer.write_struct(
            _SCHEMA_TOOL_RESULT_CONTENT_BLOCK.members["image"], self.value
        )

    @classmethod
    def deserialize(cls, deserializer: ShapeDeserializer) -> Self:
        return cls(value=ImageBlock.deserialize(deserializer))

ToolResultContentBlockDocument dataclass

A tool result that is a document.

Source code in src/aws_sdk_bedrock_runtime/models.py
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
@dataclass
class ToolResultContentBlockDocument:
    """A tool result that is a document."""

    value: DocumentBlock

    def serialize(self, serializer: ShapeSerializer):
        serializer.write_struct(_SCHEMA_TOOL_RESULT_CONTENT_BLOCK, self)

    def serialize_members(self, serializer: ShapeSerializer):
        serializer.write_struct(
            _SCHEMA_TOOL_RESULT_CONTENT_BLOCK.members["document"], self.value
        )

    @classmethod
    def deserialize(cls, deserializer: ShapeDeserializer) -> Self:
        return cls(value=DocumentBlock.deserialize(deserializer))

ToolResultContentBlockVideo dataclass

A tool result that is video.

Source code in src/aws_sdk_bedrock_runtime/models.py
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
@dataclass
class ToolResultContentBlockVideo:
    """A tool result that is video."""

    value: VideoBlock

    def serialize(self, serializer: ShapeSerializer):
        serializer.write_struct(_SCHEMA_TOOL_RESULT_CONTENT_BLOCK, self)

    def serialize_members(self, serializer: ShapeSerializer):
        serializer.write_struct(
            _SCHEMA_TOOL_RESULT_CONTENT_BLOCK.members["video"], self.value
        )

    @classmethod
    def deserialize(cls, deserializer: ShapeDeserializer) -> Self:
        return cls(value=VideoBlock.deserialize(deserializer))

ToolResultContentBlockUnknown dataclass

Represents an unknown variant.

If you receive this value, you will need to update your library to receive the parsed value.

This value may not be deliberately sent.

Source code in src/aws_sdk_bedrock_runtime/models.py
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
@dataclass
class ToolResultContentBlockUnknown:
    """Represents an unknown variant.

    If you receive this value, you will need to update your library to receive the
    parsed value.

    This value may not be deliberately sent.
    """

    tag: str

    def serialize(self, serializer: ShapeSerializer):
        raise SerializationError("Unknown union variants may not be serialized.")

    def serialize_members(self, serializer: ShapeSerializer):
        raise SerializationError("Unknown union variants may not be serialized.")

    @classmethod
    def deserialize(cls, deserializer: ShapeDeserializer) -> Self:
        raise NotImplementedError()