How messages are split
- System turns become
options.systemPrompt. - The trailing user turn becomes the prompt.
- Everything between travels as history.
Streaming a conversation
Keeping a transcript
ChatMessage
Context length
Trim before the conversation outgrows the model’s window, keeping the system message:Persisting
Conversations are plain values, soAsyncStorage works. Persist the array, not SDK state:
models reload from disk on the next launch, and history is all you need to carry.