Skip to content

error_artifact

ErrorArtifact

Bases: BaseArtifact

Represents an error that may want to be conveyed to the LLM.

Attributes:

Name Type Description
value str

The error message.

exception Optional[Exception]

The exception that caused the error. Defaults to None.

Source code in griptape/artifacts/error_artifact.py
@define
class ErrorArtifact(BaseArtifact):
    """Represents an error that may want to be conveyed to the LLM.

    Attributes:
        value: The error message.
        exception: The exception that caused the error. Defaults to None.
    """

    value: str = field(converter=str, metadata={"serializable": True})
    exception: Optional[Exception] = field(default=None, kw_only=True, metadata={"serializable": False})

    def to_text(self) -> str:
        return self.value

exception: Optional[Exception] = field(default=None, kw_only=True, metadata={'serializable': False}) class-attribute instance-attribute

value: str = field(converter=str, metadata={'serializable': True}) class-attribute instance-attribute

to_text()

Source code in griptape/artifacts/error_artifact.py
def to_text(self) -> str:
    return self.value