Skip to main content
The 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 with role and content. See Message for details:

Roles

System Instructions

Use the system parameter to set the AI’s behavior:
For single-turn queries, use the prompt shorthand:

Streaming Conversations

Use stream_text for real-time responses:

Multimodal Content

Send images and files in conversations. The image field accepts base64-encoded data or a URL.
Image from URL:

prompt vs messages

Next Steps

Chatbot

Build a complete chatbot with message history

Multimodal Chatbot

Handle images and files in conversations