Message chunk from an AI (yielded when streaming).
AIMessageChunk(
self,
content: str | list[str | dict] | None = None,
content_blocks: list[types.ContentBlock] | None = None,
**kwargs: Any = {}
)The type of the message (used for deserialization).
If provided, tool call chunks associated with the message.
Optional span represented by an aggregated AIMessageChunk.
If a chunk with chunk_position="last" is aggregated into a stream,
tool_call_chunks in message content will be parsed into tool_calls.
Return standard, typed ContentBlock dicts from the message.
The contents of the message.
Reserved for additional payload data associated with the message.
Examples: response headers, logprobs, token counts, model name.
An optional name for the message.
An optional unique identifier for the message.
Get the text content of the message as a string.