Structure
Fields
string
required
The role of the message sender. One of:
"user"- Message from the user"assistant"- Message from the AI"tool"- Tool execution results
string | list
required
The message content. Can be:
- A simple string for text-only messages
- A list of content parts for multimodal messages
System instructions should use the
system parameter in generate_text(), not a message with role: "system".Content Part Types
Text Part
Image Part
Images can be base64-encoded data, raw bytes, or a URL:File Part
Using the Message Class
While the dict interface is recommended, you can also use theMessage class:
Provider Support
See Also
- Conversations Guide - Multi-turn conversation patterns
- Multimodal Chatbot - Complete multimodal examples