Skip to content

DocumentSource module-attribute

Contains the content of a document.

Union Members

DocumentSourceBytes dataclass

The raw bytes for the document. If you use an Amazon Web Services SDK, you don't need to encode the bytes in base64.

Source code in src/aws_sdk_bedrock_runtime/models.py
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
@dataclass
class DocumentSourceBytes:
    """The raw bytes for the document. If you use an Amazon Web Services SDK,
    you don't need to encode the bytes in base64.
    """

    value: bytes

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

    def serialize_members(self, serializer: ShapeSerializer):
        serializer.write_blob(_SCHEMA_DOCUMENT_SOURCE.members["bytes"], self.value)

    @classmethod
    def deserialize(cls, deserializer: ShapeDeserializer) -> Self:
        return cls(
            value=deserializer.read_blob(_SCHEMA_DOCUMENT_SOURCE.members["bytes"])
        )

DocumentSourceS3Location dataclass

The location of a document object in an Amazon S3 bucket. To see which models support S3 uploads, see Supported models and features for Converse.

Source code in src/aws_sdk_bedrock_runtime/models.py
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
@dataclass
class DocumentSourceS3Location:
    """The location of a document object in an Amazon S3 bucket. To see which
    models support S3 uploads, see [Supported models and features for
    Converse](https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html).
    """

    value: S3Location

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

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

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

DocumentSourceText dataclass

The text content of the document source.

Source code in src/aws_sdk_bedrock_runtime/models.py
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
@dataclass
class DocumentSourceText:
    """The text content of the document source."""

    value: str

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

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

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

DocumentSourceContent dataclass

The structured content of the document source, which may include various content blocks such as text, images, or other document elements.

Source code in src/aws_sdk_bedrock_runtime/models.py
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
@dataclass
class DocumentSourceContent:
    """The structured content of the document source, which may include various
    content blocks such as text, images, or other document elements.
    """

    value: list[DocumentContentBlock]

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

    def serialize_members(self, serializer: ShapeSerializer):
        _serialize_document_content_blocks(
            serializer, _SCHEMA_DOCUMENT_SOURCE.members["content"], self.value
        )

    @classmethod
    def deserialize(cls, deserializer: ShapeDeserializer) -> Self:
        return cls(
            value=_deserialize_document_content_blocks(
                deserializer, _SCHEMA_DOCUMENT_SOURCE.members["content"]
            )
        )

DocumentSourceUnknown 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
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
@dataclass
class DocumentSourceUnknown:
    """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()