messages parameter enables multi-turn conversations by providing the full conversation history to the AI.
Basic Multi-turn Conversation
Message Structure
Messages use a simple dict structure withrole and content. See Message for details:
Roles
System Instructions
Use thesystem parameter to set the AI’s behavior:
prompt shorthand:
Streaming Conversations
Usestream_text for real-time responses:
Multimodal Content
Send images and files in conversations. Theimage field accepts base64-encoded data or a URL.
prompt vs messages
Next Steps
Chatbot
Build a complete chatbot with message history
Multimodal Chatbot
Handle images and files in conversations