A content block that contains both generated text and associated
citation information. This block type is returned when document
citations are enabled, providing traceability between the generated
content and the source documents that informed the response.
Source code in src/aws_sdk_bedrock_runtime/models.py
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442 | @dataclass(kw_only=True)
class CitationsContentBlock:
"""A content block that contains both generated text and associated
citation information. This block type is returned when document
citations are enabled, providing traceability between the generated
content and the source documents that informed the response.
"""
content: list[CitationGeneratedContent] | None = None
"""The generated content that is supported by the associated citations."""
citations: list[Citation] | None = None
"""An array of citations that reference the source documents used to
generate the associated content.
"""
def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_CITATIONS_CONTENT_BLOCK, self)
def serialize_members(self, serializer: ShapeSerializer):
if self.content is not None:
_serialize_citation_generated_content_list(
serializer,
_SCHEMA_CITATIONS_CONTENT_BLOCK.members["content"],
self.content,
)
if self.citations is not None:
_serialize_citations(
serializer,
_SCHEMA_CITATIONS_CONTENT_BLOCK.members["citations"],
self.citations,
)
@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["content"] = _deserialize_citation_generated_content_list(
de, _SCHEMA_CITATIONS_CONTENT_BLOCK.members["content"]
)
case 1:
kwargs["citations"] = _deserialize_citations(
de, _SCHEMA_CITATIONS_CONTENT_BLOCK.members["citations"]
)
case _:
logger.debug("Unexpected member schema: %s", schema)
deserializer.read_struct(_SCHEMA_CITATIONS_CONTENT_BLOCK, consumer=_consumer)
return kwargs
|
Attributes
citations
class-attribute
instance-attribute
An array of citations that reference the source documents used to
generate the associated content.
content
class-attribute
instance-attribute
The generated content that is supported by the associated citations.