Option classes
Option objects are immutable: each with… method returns a copy. Keep
that return value. Message arrays are still supported on relevant paths;
option arrays are not a substitute for a typed options object.
$options = (new ChatOptions())->withMaxTokens(2000);
$options = $options->withCallerSource('my_extension', 'summarize');
ChatOptions
-
class
ChatOptions -
- Fully qualified name
-
\Netresearch\Nr Llm\ Service\ Option\ Chat Options
Typed options for chat operations.
- static
factual() -
Create options optimized for factual responses (temperature: 0.1).
- returns
-
ChatOptions
withMaxTokens(int $maxTokens): self-
Request a maximum output-token budget. For recognized OpenAI reasoning models, the adapter raises values below 16,000 to 16,000 unless the applied reasoning effort is
None. Thinking consumes that budget too. This option is therefore not a universal hard output or cost cap.
withResponseFormat(string $format): self-
Request an output format:
text,jsonormarkdown. Adapter support differs. The current Claude adapter does not implement bareresponse_. Its object-schema path uses a forced tool instead. For validated structured output, useformat=json complete; local schema validation remains authoritative (ADR-128).Structured ()
withResponseSchema(array $schema): self-
Attach a strict-subset JSON schema (ADR-126) the provider should enforce natively where it can. Set automatically by
complete; the local strict validation remains authoritative either way.Structured ()
withStopSequences(array $sequences): self-
Set stop sequences the model must not generate past. The OpenAI provider does not send them to a reasoning model (GPT-6, GPT-5, o-series), because OpenAI refuses the parameter there; the answer is then not cut at the sequence.
withProvider(string $provider): self-
Set an explicit registered provider key on the unbound call path. This is not a substitute for a database configuration identifier.
withReasoningEffort(ReasoningEffort $effort): self-
Ask a reasoning model for an amount of thinking: one of the
ReasoningcasesEffort None,Minimal,Low,Medium,High,XHighandMax(ADR-204). It wins over the coarsethinkswitch. The adapter maps it to a bundled model profile, not a live provider capability query. Profiles cover the declared family rules. GPT-6.1 Sol, GPT-6 Astra and their dated snapshots accept low/medium/high/xhigh and mapNoneandthink=falsetoLow. GPT-6 Sol, GPT-6 Luna and GPT-6.1 Terra accept none to xhigh. No GPT-6 model acceptsMax; for these five models a request for it is clamped toXHigh(measured against the OpenAI API on 2026-11-09). Any othergpt-identifier has no effort scale, so it receives no effort at all,6 Maxincluded, and unknown gateway identifiers receive no guessed effort scale.nrllm_records an applied effort when available. Its absence does not prove the provider has no effort setting: the model may have no local profile or may use the provider default.reasoning_ effort
ToolOptions
Extends Chat. tool and parallel default to
null (no explicit override); capture defaults to false.
Tool selects automatic tool choice, but does not choose a
default provider. Use the configuration-bound service or set an explicit
registered provider key. with supplies task attribution;
with attaches a live text callback on supported paths.
EmbeddingOptions
model, provider and dimensions default to null. cache
defaults to 86400 seconds. Use with or no to change
caching, with to request a supported vector size, and the
compact / high factories for the offered presets.
Model limits and adapter support still apply; see EmbeddingService.
VisionOptions
detail, max, temperature, provider and model
default to null. with asks for the supported image-detail
mode; it does not make unsupported image input available on another adapter.
Budget attribution uses the shared controls. See VisionService.
TranslationOptions
preserve defaults to true. Provider/model/configuration,
languages' glossary/context controls, tag and cache are
unset by default; polishing is opt-in. with selects the
translator configuration on the specialized path, not automatically the
polisher's configuration. See Translation options for the full
method-specific options and LLM and specialized translator paths for result types.