chat() method. Single-turn generation is generate(prompt:options:). Multi-turn
conversations pass prior messages through RALLMGenerateRequest.history.
Single turn
generate returns RALLMGenerationResult. Text is on .text; timing and token counts are on
.tokensPerSecond, .inputTokens, .tokensGenerated, .generationTimeMs, .ttftMs.
Multi-turn
Build anRALLMGenerateRequest and attach the conversation so far. The SDK formats it with the
model’s chat template.
RAMessageRole cases: .unspecified, .user, .assistant, .system, .tool, .developer.
After each turn, append both the user prompt and the assistant reply to history before the next
call.
System prompt
A persona applies to the whole conversation. Set it on the options, not as a history entry, so trimming cannot drop it.Conversation cache
A stableconversationID lets backends that keep a prompt cache reuse it across turns instead of
re-evaluating the whole history.