Contains incremental updates to the source content text during streaming
responses, allowing clients to build up the cited content progressively.
Source code in src/aws_sdk_bedrock_runtime/models.py
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879 | @dataclass(kw_only=True)
class CitationSourceContentDelta:
"""Contains incremental updates to the source content text during streaming
responses, allowing clients to build up the cited content progressively.
"""
text: str | None = None
"""An incremental update to the text content from the source document that
is being cited.
"""
def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_CITATION_SOURCE_CONTENT_DELTA, self)
def serialize_members(self, serializer: ShapeSerializer):
if self.text is not None:
serializer.write_string(
_SCHEMA_CITATION_SOURCE_CONTENT_DELTA.members["text"], self.text
)
@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["text"] = de.read_string(
_SCHEMA_CITATION_SOURCE_CONTENT_DELTA.members["text"]
)
case _:
logger.debug("Unexpected member schema: %s", schema)
deserializer.read_struct(
_SCHEMA_CITATION_SOURCE_CONTENT_DELTA, consumer=_consumer
)
return kwargs
|
Attributes
text
class-attribute
instance-attribute
An incremental update to the text content from the source document that
is being cited.