Interface: WebLLMChatCompletionsAdapterOptions
Defined in: batteries/llm/webllm_chat_completions/types.ts:54
Extends
Omit<OpenAIChatCompletionsAdapterOptions,"apiKey"|"baseURL"|"headers"|"fetch"|"retry"|"requestTimeoutMs">
Properties
| Property | Type | Default value | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
audio? | { format: "wav" | "mp3" | "flac" | "opus" | "pcm16"; voice: string; } | undefined | - | OpenAIChatCompletionsAdapterOptions.audio | batteries/llm/openai_chat_completions/types.ts:545 |
audio.format | "wav" | "mp3" | "flac" | "opus" | "pcm16" | undefined | - | - | batteries/llm/openai_chat_completions/types.ts:545 |
audio.voice | string | undefined | - | - | batteries/llm/openai_chat_completions/types.ts:545 |
autoAck? | boolean | false | Whether the executor should call ctx.ack() itself when a generation completes with no tool calls (a terminal text answer). Remarks ack() is terminal and one-shot: once called, the dispatch loop exits after the current iteration. When the executor acks automatically, it seizes turn-completion control from the implementor — a dispatchOutputPipeline quality gate can never run, because the signal is already set before the output pipeline executes. This option therefore defaults to false (opt-in). With autoAck: false, a tool-call-free response leaves the context unsignalled and the executor returns; the implementor's output pipeline (or a later iteration) is responsible for calling ctx.ack() / ctx.nack(). This is the seam that makes output-side quality gates (citation enforcement, schema validation, regenerate-on-reject) possible. Set autoAck: true to restore single-shot behavior: the executor acks the moment a tool-call-free answer finishes, terminating the turn without giving the output pipeline a vote. The tool-call path is unaffected by this flag — it always withholds ack so the runner can iterate and execute the calls. Error paths always nack regardless of this flag. | OpenAIChatCompletionsAdapterOptions.autoAck | batteries/llm/openai_chat_completions/types.ts:541 |
bucketOrder? | ChatCompletionsBucketOrder | undefined | - | OpenAIChatCompletionsAdapterOptions.bucketOrder | batteries/llm/openai_chat_completions/types.ts:444 |
chatOptions? | ChatOptions | ChatOptions[] | undefined | - | - | batteries/llm/webllm_chat_completions/types.ts:63 |
contextWindow? | number | undefined | - | OpenAIChatCompletionsAdapterOptions.contextWindow | batteries/llm/openai_chat_completions/types.ts:445 |
createEngine? | (input: { chatOptions?: ChatOptions | ChatOptions[]; engineConfig?: MLCEngineConfig; model: string; onInitProgress?: (report: InitProgressReport) => void; }) => Promise<MLCEngineInterface> | undefined | - | - | batteries/llm/webllm_chat_completions/types.ts:64 |
engine? | MLCEngineInterface | undefined | - | - | batteries/llm/webllm_chat_completions/types.ts:61 |
engineConfig? | MLCEngineConfig | undefined | - | - | batteries/llm/webllm_chat_completions/types.ts:62 |
extra_body? | Record<string, unknown> | undefined | - | - | batteries/llm/webllm_chat_completions/types.ts:60 |
frequency_penalty? | number | undefined | - | OpenAIChatCompletionsAdapterOptions.frequency_penalty | batteries/llm/openai_chat_completions/types.ts:546 |
function_call? | | "auto" | "none" | { name: string; } | undefined | - | OpenAIChatCompletionsAdapterOptions.function_call | batteries/llm/openai_chat_completions/types.ts:547 |
functions? | { description?: string; name: string; parameters?: JsonSchema; }[] | undefined | - | OpenAIChatCompletionsAdapterOptions.functions | batteries/llm/openai_chat_completions/types.ts:548 |
helpers? | Partial<ChatCompletionsHelpers> | undefined | - | OpenAIChatCompletionsAdapterOptions.helpers | batteries/llm/openai_chat_completions/types.ts:469 |
ignore_eos? | boolean | undefined | - | - | batteries/llm/webllm_chat_completions/types.ts:59 |
isWebGPUAvailable? | () => boolean | undefined | - | - | batteries/llm/webllm_chat_completions/types.ts:71 |
logit_bias? | Record<string, number> | undefined | - | OpenAIChatCompletionsAdapterOptions.logit_bias | batteries/llm/openai_chat_completions/types.ts:549 |
logprobs? | boolean | undefined | - | OpenAIChatCompletionsAdapterOptions.logprobs | batteries/llm/openai_chat_completions/types.ts:550 |
max_completion_tokens? | number | undefined | - | OpenAIChatCompletionsAdapterOptions.max_completion_tokens | batteries/llm/openai_chat_completions/types.ts:551 |
max_tokens? | number | undefined | - | OpenAIChatCompletionsAdapterOptions.max_tokens | batteries/llm/openai_chat_completions/types.ts:552 |
metadata? | Record<string, string> | undefined | - | OpenAIChatCompletionsAdapterOptions.metadata | batteries/llm/openai_chat_completions/types.ts:553 |
modalities? | ("text" | "audio")[] | undefined | - | OpenAIChatCompletionsAdapterOptions.modalities | batteries/llm/openai_chat_completions/types.ts:554 |
model | string | undefined | - | OpenAIChatCompletionsAdapterOptions.model | batteries/llm/openai_chat_completions/types.ts:544 |
n? | number | undefined | - | OpenAIChatCompletionsAdapterOptions.n | batteries/llm/openai_chat_completions/types.ts:555 |
onInitProgress? | (report: InitProgressReport) => void | undefined | - | - | batteries/llm/webllm_chat_completions/types.ts:70 |
parallel_tool_calls? | boolean | undefined | - | OpenAIChatCompletionsAdapterOptions.parallel_tool_calls | batteries/llm/openai_chat_completions/types.ts:556 |
prediction? | { content: | string | { text: string; type: "text"; }[]; type: "content"; } | undefined | - | OpenAIChatCompletionsAdapterOptions.prediction | batteries/llm/openai_chat_completions/types.ts:557 |
prediction.content | | string | { text: string; type: "text"; }[] | undefined | - | - | batteries/llm/openai_chat_completions/types.ts:559 |
prediction.type | "content" | undefined | - | - | batteries/llm/openai_chat_completions/types.ts:558 |
presence_penalty? | number | undefined | - | OpenAIChatCompletionsAdapterOptions.presence_penalty | batteries/llm/openai_chat_completions/types.ts:561 |
prompt_cache_key? | string | undefined | - | OpenAIChatCompletionsAdapterOptions.prompt_cache_key | batteries/llm/openai_chat_completions/types.ts:562 |
prompt_cache_retention? | "in_memory" | "24h" | undefined | - | OpenAIChatCompletionsAdapterOptions.prompt_cache_retention | batteries/llm/openai_chat_completions/types.ts:563 |
reasoning_effort? | "low" | "high" | "minimal" | "medium" | undefined | - | OpenAIChatCompletionsAdapterOptions.reasoning_effort | batteries/llm/openai_chat_completions/types.ts:564 |
reasoningFieldPrecedence? | ReasoningFieldPrecedence | ['reasoning', 'reasoning_content'] | Ordered precedence of the wire fields the adapter reads for model reasoning/thinking output. Remarks Reasoning is not part of OpenAI's official Chat Completions spec, so OpenAI-compatible providers disagree on the field name: Ollama's /v1 and current vLLM emit reasoning, while legacy vLLM (≤0.8) and the DeepSeek API emit reasoning_content. The adapter reads every field in this list that is present on the response. Precedence governs two things. When more than one listed field is present with identical content (or only one is present), the adapter emits a single thought attributed to the highest-precedence field. When listed fields are present with divergent content, each surfaces as its own thought (ordered by precedence) rather than silently dropping one — a thought stream is the wrong place to lose data. | OpenAIChatCompletionsAdapterOptions.reasoningFieldPrecedence | batteries/llm/openai_chat_completions/types.ts:468 |
repetition_penalty? | number | undefined | - | - | batteries/llm/webllm_chat_completions/types.ts:58 |
replayCompatibility? | readonly string[] | undefined | - | OpenAIChatCompletionsAdapterOptions.replayCompatibility | batteries/llm/openai_chat_completions/types.ts:449 |
response_format? | | { type: "text"; } | { type: "json_object"; } | { json_schema: { description?: string; name: string; schema: JsonSchema; strict?: boolean; }; type: "json_schema"; } | undefined | - | OpenAIChatCompletionsAdapterOptions.response_format | batteries/llm/openai_chat_completions/types.ts:565 |
safety_identifier? | string | undefined | - | OpenAIChatCompletionsAdapterOptions.safety_identifier | batteries/llm/openai_chat_completions/types.ts:577 |
seed? | number | undefined | - | OpenAIChatCompletionsAdapterOptions.seed | batteries/llm/openai_chat_completions/types.ts:578 |
selfIdentity? | string | undefined | - | OpenAIChatCompletionsAdapterOptions.selfIdentity | batteries/llm/openai_chat_completions/types.ts:446 |
service_tier? | "default" | "auto" | "flex" | "priority" | "scale" | undefined | - | OpenAIChatCompletionsAdapterOptions.service_tier | batteries/llm/openai_chat_completions/types.ts:579 |
spoolStore? | SpoolStore | a new InMemorySpoolStore per dispatch | Backing store for string / Uint8Array tool returns. Tool output bytes are written under the tool call's id; the resulting @nhtio/adk!SpooledArtifact (or the tool's configured subclass) is the model-visible handle for the rest of the turn. Remarks Defaults to a fresh, ephemeral per-dispatch @nhtio/adk/batteries/storage/in_memory!InMemorySpoolStore. Inject an @nhtio/adk/batteries/storage/opfs!OpfsSpoolStore or a Flydrive-backed store to persist artifacts to durable storage (and to stream large/binary tool output to disk rather than buffering it in memory). Lifetime / namespacing: the default store is per-dispatch, so tool-call ids only need to be unique within a dispatch. An injected durable store persists across turns and dispatches, so the tool-call ids used as keys must be globally unique for that store (or the store must apply its own keyPrefix); the adapter does not namespace keys for you, and it does not delete entries — lifetime and cleanup of an injected store are the consumer's responsibility. | OpenAIChatCompletionsAdapterOptions.spoolStore | batteries/llm/openai_chat_completions/types.ts:490 |
stop? | string | string[] | undefined | - | OpenAIChatCompletionsAdapterOptions.stop | batteries/llm/openai_chat_completions/types.ts:580 |
store? | boolean | undefined | - | OpenAIChatCompletionsAdapterOptions.store | batteries/llm/openai_chat_completions/types.ts:581 |
stream? | boolean | undefined | - | OpenAIChatCompletionsAdapterOptions.stream | batteries/llm/openai_chat_completions/types.ts:439 |
stream_options? | { include_obfuscation?: boolean; include_usage?: boolean; } | undefined | - | OpenAIChatCompletionsAdapterOptions.stream_options | batteries/llm/openai_chat_completions/types.ts:582 |
stream_options.include_obfuscation? | boolean | undefined | - | - | batteries/llm/openai_chat_completions/types.ts:582 |
stream_options.include_usage? | boolean | undefined | - | - | batteries/llm/openai_chat_completions/types.ts:582 |
streamIdleTimeoutMs? | number | undefined | - | OpenAIChatCompletionsAdapterOptions.streamIdleTimeoutMs | batteries/llm/openai_chat_completions/types.ts:440 |
strictToolChoice? | boolean | false | When tool_choice (or the allowed_tools variant) forces the model onto a specific tool name, and that name resolves to an ephemeral, forged artifact-query tool (one produced by <Subclass>.forgeTools(ctx) — i.e. tool.ephemeral === true), this flag controls how the adapter reacts: - false (default): emit a single helpers.log.warn({ kind: 'tool-choice-forged-artifact', ... }) record and continue. Forging an artifact-query tool by name is almost always a misconfiguration — the tool may not exist in the next iteration once the artifact ages out — but the call still goes through. - true: hard-fail with E_INVALID_OPENAI_CHAT_COMPLETIONS_OPTIONS. Use this in production deployments where forcing a forged tool indicates a real bug. | OpenAIChatCompletionsAdapterOptions.strictToolChoice | batteries/llm/openai_chat_completions/types.ts:506 |
temperature? | number | undefined | - | OpenAIChatCompletionsAdapterOptions.temperature | batteries/llm/openai_chat_completions/types.ts:583 |
thoughtSurfacing? | "all-self" | "latest-self" | "all" | undefined | - | OpenAIChatCompletionsAdapterOptions.thoughtSurfacing | batteries/llm/openai_chat_completions/types.ts:447 |
tokenEncoding? | | "gpt2" | "r50k_base" | "p50k_base" | "p50k_edit" | "cl100k_base" | "o200k_base" | "gemini" | "llama2" | "claude" | null | undefined | - | OpenAIChatCompletionsAdapterOptions.tokenEncoding | batteries/llm/openai_chat_completions/types.ts:448 |
tool_choice? | | "required" | "auto" | "none" | { function: { name: string; }; type: "function"; } | { custom: { name: string; }; type: "custom"; } | { allowed_tools: { mode: "required" | "auto"; tools: ( | { function: { name: string; }; type: "function"; } | { custom: { name: string; }; type: "custom"; })[]; }; type: "allowed_tools"; } | undefined | - | OpenAIChatCompletionsAdapterOptions.tool_choice | batteries/llm/openai_chat_completions/types.ts:584 |
top_logprobs? | number | undefined | - | OpenAIChatCompletionsAdapterOptions.top_logprobs | batteries/llm/openai_chat_completions/types.ts:600 |
top_p? | number | undefined | - | OpenAIChatCompletionsAdapterOptions.top_p | batteries/llm/openai_chat_completions/types.ts:601 |
unsupportedMediaPolicy? | UnsupportedMediaPolicy | 'throw' | Policy for how the adapter handles a @nhtio/adk!Media instance whose modality the OpenAI Chat Completions wire format does not natively support (today: video). See UnsupportedMediaPolicy. | OpenAIChatCompletionsAdapterOptions.unsupportedMediaPolicy | batteries/llm/openai_chat_completions/types.ts:515 |
user? | string | undefined | - | OpenAIChatCompletionsAdapterOptions.user | batteries/llm/openai_chat_completions/types.ts:602 |
verbosity? | "low" | "high" | "medium" | undefined | - | OpenAIChatCompletionsAdapterOptions.verbosity | batteries/llm/openai_chat_completions/types.ts:603 |
web_search_options? | { search_context_size?: "low" | "high" | "medium"; user_location?: { approximate: { city?: string; country?: string; region?: string; timezone?: string; }; type: "approximate"; }; } | undefined | - | OpenAIChatCompletionsAdapterOptions.web_search_options | batteries/llm/openai_chat_completions/types.ts:604 |
web_search_options.search_context_size? | "low" | "high" | "medium" | undefined | - | - | batteries/llm/openai_chat_completions/types.ts:605 |
web_search_options.user_location? | { approximate: { city?: string; country?: string; region?: string; timezone?: string; }; type: "approximate"; } | undefined | - | - | batteries/llm/openai_chat_completions/types.ts:606 |
web_search_options.user_location.approximate | { city?: string; country?: string; region?: string; timezone?: string; } | undefined | - | - | batteries/llm/openai_chat_completions/types.ts:608 |
web_search_options.user_location.approximate.city? | string | undefined | - | - | batteries/llm/openai_chat_completions/types.ts:609 |
web_search_options.user_location.approximate.country? | string | undefined | - | - | batteries/llm/openai_chat_completions/types.ts:610 |
web_search_options.user_location.approximate.region? | string | undefined | - | - | batteries/llm/openai_chat_completions/types.ts:611 |
web_search_options.user_location.approximate.timezone? | string | undefined | - | - | batteries/llm/openai_chat_completions/types.ts:612 |
web_search_options.user_location.type | "approximate" | undefined | - | - | batteries/llm/openai_chat_completions/types.ts:607 |