Skip to main content
Pass a List<ChatMessage> instead of a prompt.

How messages are split

The list is not sent verbatim:
  • System turns become options.systemPrompt.
  • The trailing user turn becomes the prompt.
  • Everything between travels as history.
A conversation with no user turn throws SDKException.

Streaming a conversation

Keeping a transcript

ChatMessage

Context length

Trim old turns before the conversation outgrows the model’s context window, keeping the system message: