class
ion7.llm.Engine
Functions
Engine.new
Build an engine.
Engine:chat
Synchronous chat. Decodes the session, samples until a stop condition, returns a fully-parsed Response.
Engine:stream
Streaming chat. Returns an iterator that yields typed chunks : { kind = "content", text = "..." } { kind = "thinking", text = "..." } { kind = "tool_call_delta", call_id, name, args_partial } { kind = "tool_call_done", call_id, call } { kind = "stop", reason = "stop" | "length" | "stop_string" | "tool_use" } The iterator emits exactly one final `stop` chunk after the model halts. Tool-call chunks fire AS SOON AS the open marker is detected in the content stream, with `tool_call_delta` updates as the arguments JSON accumulates and a `tool_call_done` once the close marker (or balanced JSON braces) closes the call.
Engine:complete
One-shot completion : create an ephemeral session, chat, return the Response. The session is discarded — no history is preserved.