OptionaljsonOptionalmaxRounds of model call + tool execution the factory runs before returning (default 1: calls are returned, not executed).
OptionalmaxOptionalmessagesThe conversation so far. A user message may carry image parts.
OptionalmetadataOptionalmodelOptionalonCalled after each round of the tool loop, with what the model said, what it called and what came back. Awaited.
OptionalpromptShorthand for a final user message; appended after messages. One of prompt or messages is required.
OptionalproviderProvider-specific fields merged last into the wire body, one level deep
({ options: { num_ctx: 8192 } } for Ollama, { top_p: 0.9 } for an
OpenAI-format host). Whatever you put here wins over what the client sets.
OptionalreasoningAsk a reasoning model to think before answering (Ollama think,
Anthropic extended thinking, Gemini includeThoughts). The thinking text
comes back as reasoning on the response and as reasoning deltas on
stream chunks, never mixed into text. Off by default for Ollama, where a
model that thinks into its output budget otherwise returns an empty answer;
whatever an OpenAI-format server sends (reasoning_content, inline
<think> tags) is surfaced regardless of this flag.
OptionalschemaStructured output: a JSON Schema object, or any Standard Schema (Zod,
Valibot, ArkType, ...). Implies jsonMode. The answer is parsed (and, for
a Standard Schema, validated) onto response.object; a bad answer fails
with INVALID_JSON or SCHEMA_MISMATCH. Not applied to streams.
OptionalsignalAborts an in-flight request/stream.
OptionalstreamStreaming: ms of upstream silence before the stream fails with STREAM_IDLE (default 60000; 0 disables).
OptionalsystemOptionaltemperatureOptionaltimeoutWhole-request timeout in ms for non-streaming calls (default 30000; 0 disables).
OptionaltoolOptionaltoolsFunctions the model may call. Calls come back on toolCalls; with maxSteps > 1 and execute set, the factory runs them and continues.
Ask the provider for JSON. Providers that support a native JSON mode use it.