genai_primitives library

A set of primitives for working with generative AI.

Classes

ChatMessage
A chat message.
DataPart
A data part containing binary data (e.g., images).
LinkPart
A link part referencing external content.
Part
Base class for message content parts.
PartConverter<T extends Part>
A converter that converts a JSON map to a Part.
Parts
A collection of parts.
StandardPart
Base class for parts that became de-facto standard for AI messages.
TextPart
A text part of a message.
ThinkingPart
A "thinking" part of a message, used by some models to show reasoning.
ToolDefinition<TInput extends Object>
A tool that can be called by the LLM.
ToolPart
A tool interaction part of a message.

Enums

ChatMessageRole
The role of a message author.
ToolPartKind
The kind of tool interaction.

Constants

defaultPartConverterRegistry → const Map<String, JsonToPartConverter<Part>>
Converter registry for parts in this package.

Typedefs

JsonToPartConverter<T extends Part> = Converter<Map<String, Object?>, T>