
Drives a chat turn against a locally served Ollama model from a user and system String, streaming the reply as String chunks and closing with a StreamEnd; for a bundled GPU sidecar prefer generate_text_sglang.
Voice assistant — transcribe speech, reason locally, speak the answer.
Document Q&A — OCR a page, answer over it, emit the result as JSON.
model_name is pulled on startup if it is not already cached, so a missing model or unreachable runtime fails before any prompt is served.streaming on, the reply arrives as incremental String chunks; with it off the whole reply is emitted as a single chunk at completion. emit_stream_end is what produces the StreamEnd on the second output, so consumers that need an end-of-turn signal must keep it on.history_messages set to zero runs stateless, a negative value keeps the full conversation, and a positive value keeps the last N turns; max_parallel only takes effect in the stateless case, since carrying history forces sequential turns.context_tokens sizes the context window the server holds a turn in, and left at zero the server's own default applies. Whatever the system message, the retained history and the user message do not fit into that window is dropped without an error, and the reply is written from what survived, so a long system message or a long history needs the window raised to match.preempt_on_new_input cancels an in-flight generation when a fresh prompt arrives, so downstream sees a truncated stream for the abandoned turn.display_reasoning appends a structured reasoning instruction to the system message; the structure is requested, not enforced, and it costs extra tokens and latency. JSON mode likewise only requests a JSON object from the model rather than guaranteeing one.Automated release