Optional
options: { parser?: MessageParser<T> }Optional
metadataOptional
parserReturns all tool requests annotated with interrupt metadata.
Array of all interrupt tool requests.
Returns the first media part detected in the message. Useful for extracting (for example) an image from a generation expected to create one.
The first detected media
part in the message.
Concatenates all text
parts present in the message with no delimiter.
A string of all concatenated text parts.
Returns all tool request found in this message.
Array of all tool request found in this message.
Converts the Message to a plain JS object.
Plain JS object representing the data contained in the message.
Static
parseStatic
parseStatic
parseOptional
defaultRole: "user" | "model" | "tool" | "system"
Message represents a single role's contribution to a generation. Each message can contain multiple parts (for example text and an image), and each generation can contain multiple messages.