Skip to content

text_message_content

TextMessageContent

Bases: BaseMessageContent

Source code in griptape/common/prompt_stack/contents/text_message_content.py
@define
class TextMessageContent(BaseMessageContent):
    artifact: TextArtifact = field(metadata={"serializable": True})

    @classmethod
    def from_deltas(cls, deltas: Sequence[BaseDeltaMessageContent]) -> TextMessageContent:
        text_deltas = [delta for delta in deltas if isinstance(delta, TextDeltaMessageContent)]

        artifact = TextArtifact(value="".join(delta.text for delta in text_deltas))

        return cls(artifact=artifact)

artifact: TextArtifact = field(metadata={'serializable': True}) class-attribute instance-attribute

from_deltas(deltas) classmethod

Source code in griptape/common/prompt_stack/contents/text_message_content.py
@classmethod
def from_deltas(cls, deltas: Sequence[BaseDeltaMessageContent]) -> TextMessageContent:
    text_deltas = [delta for delta in deltas if isinstance(delta, TextDeltaMessageContent)]

    artifact = TextArtifact(value="".join(delta.text for delta in text_deltas))

    return cls(artifact=artifact)