Skip to main content
There is no 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 an RALLMGenerateRequest 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 stable conversationID lets backends that keep a prompt cache reuse it across turns instead of re-evaluating the whole history.

Streaming a turn

See Streaming for cancellation and the full event shape.

Trimming history

Context is finite. Drop the oldest turns once the conversation outgrows the model’s context window.

SwiftUI