Artifacts#

Overview#

** Artifacts ** are the core data structure in Gen AI Builder. They are used to encapsulate data and enhance it with metadata.

Text#

TextArtifact s 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 and Off Prompt if the Tool has set off_prompt=True .

Blob#

BlobArtifact s store binary large objects (blobs).

When BlobArtifact s are returned from Tools, they will be stored in Task Memory and Off Prompt if the Tool has set off_prompt=True .

Image#

ImageArtifact s store image data. This includes binary image data along with metadata such as MIME type and dimensions. They are a subclass of BlobArtifactStorage .

Url#

ImageUrlArtifact s store URLs pointing to resources.

Image Url#

ImageUrlArtifact s store URLs pointing to images. They are a subclass of ImageUrlArtifact .

Audio#

AudioArtifact s store audio content. This includes binary audio data and metadata such as format, and duration. They are a subclass of BlobArtifactStorage .

List#

ListArtifact s store lists of Artifacts.

When ListArtifact s are returned from Tools, their elements will be stored in Task Memory and Off Prompt if the element is either a TextArtifact or a BlobArtifact and the Tool has set off_prompt=True .

Info#

InfoArtifact s 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#

JsonArtifact s store JSON-serializable data. Any data assigned to the value property is processed using json.dumps(json.loads(value)) .

Error#

ErrorArtifact s store exception information, providing a structured way to convey errors.

Action#

ActionArtifact s represent actions taken by an LLM. Currently, the only supported action type is ToolAction , which is used to execute a RAG Tool .

Generic#

GenericArtifact s 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.