//clika-runtime/io.clika.modelverse/GenerativeModel/generate
generate
[common]
fun generate(prompt: String? = null, messages: List<ChatMessage>? = null, config: GenerationConfig = capabilities.defaults, images: List<ByteArray> = emptyList(), tools: List<ToolDef> = emptyList(), toolChoice: ToolChoice = ToolChoice.Auto, stageObserver: StageObserver? = null): String
One reply, blocking: prompt as the user turn (with images), or messages as the conversation; exactly one of the two. A model with a chat template renders it, one without reads the prompt as text. Answers the reply's visible text; report then says how it ended and what it cost. tools are offered under toolChoice, and the calls the reply made are on the report. stageObserver hears this call's stages alone, beside the model's own (setStageObserver). A failure throws ModelverseException with the library's message (an offer of tools to a model that takes none among them); a close while the reply runs ends it as FinishReason.CANCELED with the text so far.