Usage
Signature
Parameters
The role of the message.
The content of the message. This can be a rich Python object.
The id of the message.
Parts from AI SDK Stream Protocol (must be serializable to JSON).
Optional attachments to the message.
Optional metadata.
Part Types
TextPart
Represents a text content part. Attributes:type(Literal[“text”]): Part typetext(str): The text content
ReasoningPart
Represents a reasoning content part. Attributes:type(Literal[“reasoning”]): Part typetext(str): The reasoning textdetails(Optional[list[ReasoningDetails]]): Optional reasoning details
ToolInvocationPart
Represents a tool invocation part from the AI SDK. Attributes:type(str): Starts with “tool-”tool_call_id(str): The tool call identifierstate(Union[str, Literal[“output-available”]]): The state of the invocationinput(dict[str, Any]): The input to the tooloutput(Optional[Any]): The output from the tool
tool_name: Returns the tool name (extracted from type)
FilePart
Represents a FileUIPart from the AI SDK. Attributes:type(Literal[“file”]): Part typemedia_type(str): The media typeurl(str): The file URLfilename(Optional[str]): Optional filename