Artifacts
Overview
Artifacts are the core data structure in Griptape. They are used to encapsulate data and enhance it with metadata.
Text
TextArtifacts store textual data. They offer methods such as token_count() for counting tokens with a tokenizer, and generate_embedding() for creating text embeddings. You can also access the embedding via the embedding property.
When TextArtifact
s are returned from Tools, they will be stored in Task Memory if the Tool has set off_prompt=True
.
Blob
BlobArtifacts store binary large objects (blobs).
When BlobArtifact
s are returned from Tools, they will be stored in Task Memory if the Tool has set off_prompt=True
.
Image
ImageArtifacts store image data. This includes binary image data along with metadata such as MIME type and dimensions. They are a subclass of BlobArtifacts.
Audio
AudioArtifacts store audio content. This includes binary audio data and metadata such as format, and duration. They are a subclass of BlobArtifacts.
List
ListArtifacts store lists of Artifacts.
When ListArtifact
s are returned from Tools, their elements will be stored in Task Memory if the element is either a TextArtifact
or a BlobArtifact
and the Tool has set off_prompt=True
.
Info
InfoArtifacts store small pieces of textual information. These are useful for conveying messages about the execution or results of an operation, such as "No results found" or "Operation completed successfully."
JSON
JsonArtifacts store JSON-serializable data. Any data assigned to the value
property is processed using json.dumps(json.loads(value))
.
Error
ErrorArtifacts store exception information, providing a structured way to convey errors.
Action
ActionArtifacts represent actions taken by an LLM. Currently, the only supported action type is ToolAction, which is used to execute a Tool.
Generic
GenericArtifacts provide a flexible way to pass data that does not fit into any other artifact category. While not generally recommended, they can be useful for specific use cases. For instance, see talking to a video, which demonstrates using a GenericArtifact
to pass a Gemini-specific video file.