Skip to content

CitationsConfig dataclass

Configuration settings for enabling and controlling document citations in Converse API responses. When enabled, the model can include citation information that links generated content back to specific source documents.

Source code in src/aws_sdk_bedrock_runtime/models.py
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
@dataclass(kw_only=True)
class CitationsConfig:
    """Configuration settings for enabling and controlling document citations
    in Converse API responses. When enabled, the model can include citation
    information that links generated content back to specific source
    documents.
    """

    enabled: bool
    """Specifies whether citations from the selected document should be used in
    the model's response. When set to true, the model can generate
    citations that reference the source documents used to inform the
    response.
    """

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

    def serialize_members(self, serializer: ShapeSerializer):
        serializer.write_boolean(
            _SCHEMA_CITATIONS_CONFIG.members["enabled"], self.enabled
        )

    @classmethod
    def deserialize(cls, deserializer: ShapeDeserializer) -> Self:
        return cls(**cls.deserialize_kwargs(deserializer))

    @classmethod
    def deserialize_kwargs(cls, deserializer: ShapeDeserializer) -> dict[str, Any]:
        kwargs: dict[str, Any] = {}

        def _consumer(schema: Schema, de: ShapeDeserializer) -> None:
            match schema.expect_member_index():
                case 0:
                    kwargs["enabled"] = de.read_boolean(
                        _SCHEMA_CITATIONS_CONFIG.members["enabled"]
                    )

                case _:
                    logger.debug("Unexpected member schema: %s", schema)

        deserializer.read_struct(_SCHEMA_CITATIONS_CONFIG, consumer=_consumer)
        return kwargs

Attributes

enabled instance-attribute

enabled: bool

Specifies whether citations from the selected document should be used in the model's response. When set to true, the model can generate citations that reference the source documents used to inform the response.