Skip to content
7 min read · 1,459 words

Interface: WebLLMChatCompletionsAdapterOptions

Extends

Properties

PropertyTypeDefault valueDescriptionInherited from
audio?{ format: "wav" | "mp3" | "flac" | "opus" | "pcm16"; voice: string; }undefined-OpenAIChatCompletionsAdapterOptions.audio
audio.format"wav" | "mp3" | "flac" | "opus" | "pcm16"undefined--
audio.voicestringundefined--
autoAck?booleanfalseWhether 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
bucketOrder?ChatCompletionsBucketOrderundefined-OpenAIChatCompletionsAdapterOptions.bucketOrder
chatOptions?ChatOptions | ChatOptions[]undefined--
contextWindow?numberundefined-OpenAIChatCompletionsAdapterOptions.contextWindow
createEngine?(input: { chatOptions?: ChatOptions | ChatOptions[]; engineConfig?: MLCEngineConfig; model: string; onInitProgress?: (report: InitProgressReport) => void; }) => Promise<MLCEngineInterface>undefined--
engine?MLCEngineInterfaceundefined--
engineConfig?MLCEngineConfigundefined--
extra_body?Record<string, unknown>undefined--
frequency_penalty?numberundefined-OpenAIChatCompletionsAdapterOptions.frequency_penalty
function_call?| "auto" | "none" | { name: string; }undefined-OpenAIChatCompletionsAdapterOptions.function_call
functions?{ description?: string; name: string; parameters?: JsonSchema; }[]undefined-OpenAIChatCompletionsAdapterOptions.functions
helpers?Partial<ChatCompletionsHelpers>undefined-OpenAIChatCompletionsAdapterOptions.helpers
ignore_eos?booleanundefined--
isWebGPUAvailable?() => booleanundefined--
logit_bias?Record<string, number>undefined-OpenAIChatCompletionsAdapterOptions.logit_bias
logprobs?booleanundefined-OpenAIChatCompletionsAdapterOptions.logprobs
max_completion_tokens?numberundefined-OpenAIChatCompletionsAdapterOptions.max_completion_tokens
max_tokens?numberundefined-OpenAIChatCompletionsAdapterOptions.max_tokens
metadata?Record<string, string>undefined-OpenAIChatCompletionsAdapterOptions.metadata
modalities?("text" | "audio")[]undefined-OpenAIChatCompletionsAdapterOptions.modalities
modelstringundefined-OpenAIChatCompletionsAdapterOptions.model
n?numberundefined-OpenAIChatCompletionsAdapterOptions.n
onInitProgress?(report: InitProgressReport) => voidundefined--
parallel_tool_calls?booleanundefined-OpenAIChatCompletionsAdapterOptions.parallel_tool_calls
prediction?{ content: | string | { text: string; type: "text"; }[]; type: "content"; }undefined-OpenAIChatCompletionsAdapterOptions.prediction
prediction.content| string | { text: string; type: "text"; }[]undefined--
prediction.type"content"undefined--
presence_penalty?numberundefined-OpenAIChatCompletionsAdapterOptions.presence_penalty
prompt_cache_key?stringundefined-OpenAIChatCompletionsAdapterOptions.prompt_cache_key
prompt_cache_retention?"in_memory" | "24h"undefined-OpenAIChatCompletionsAdapterOptions.prompt_cache_retention
reasoning_effort?"low" | "high" | "minimal" | "medium"undefined-OpenAIChatCompletionsAdapterOptions.reasoning_effort
repetition_penalty?numberundefined--
replayCompatibility?readonly string[]undefined-OpenAIChatCompletionsAdapterOptions.replayCompatibility
response_format?| { type: "text"; } | { type: "json_object"; } | { json_schema: { description?: string; name: string; schema: JsonSchema; strict?: boolean; }; type: "json_schema"; }undefined-OpenAIChatCompletionsAdapterOptions.response_format
safety_identifier?stringundefined-OpenAIChatCompletionsAdapterOptions.safety_identifier
seed?numberundefined-OpenAIChatCompletionsAdapterOptions.seed
selfIdentity?stringundefined-OpenAIChatCompletionsAdapterOptions.selfIdentity
service_tier?"default" | "auto" | "flex" | "priority" | "scale"undefined-OpenAIChatCompletionsAdapterOptions.service_tier
stop?string | string[]undefined-OpenAIChatCompletionsAdapterOptions.stop
store?booleanundefined-OpenAIChatCompletionsAdapterOptions.store
stream?booleanundefined-OpenAIChatCompletionsAdapterOptions.stream
stream_options?{ include_obfuscation?: boolean; include_usage?: boolean; }undefined-OpenAIChatCompletionsAdapterOptions.stream_options
stream_options.include_obfuscation?booleanundefined--
stream_options.include_usage?booleanundefined--
streamIdleTimeoutMs?numberundefined-OpenAIChatCompletionsAdapterOptions.streamIdleTimeoutMs
strictToolChoice?booleanfalseWhen 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
temperature?numberundefined-OpenAIChatCompletionsAdapterOptions.temperature
thoughtSurfacing?"all-self" | "latest-self" | "all"undefined-OpenAIChatCompletionsAdapterOptions.thoughtSurfacing
tokenEncoding?| "gpt2" | "r50k_base" | "p50k_base" | "p50k_edit" | "cl100k_base" | "o200k_base" | "gemini" | "llama2" | "claude" | nullundefined-OpenAIChatCompletionsAdapterOptions.tokenEncoding
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
top_logprobs?numberundefined-OpenAIChatCompletionsAdapterOptions.top_logprobs
top_p?numberundefined-OpenAIChatCompletionsAdapterOptions.top_p
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
user?stringundefined-OpenAIChatCompletionsAdapterOptions.user
verbosity?"low" | "high" | "medium"undefined-OpenAIChatCompletionsAdapterOptions.verbosity
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
web_search_options.search_context_size?"low" | "high" | "medium"undefined--
web_search_options.user_location?{ approximate: { city?: string; country?: string; region?: string; timezone?: string; }; type: "approximate"; }undefined--
web_search_options.user_location.approximate{ city?: string; country?: string; region?: string; timezone?: string; }undefined--
web_search_options.user_location.approximate.city?stringundefined--
web_search_options.user_location.approximate.country?stringundefined--
web_search_options.user_location.approximate.region?stringundefined--
web_search_options.user_location.approximate.timezone?stringundefined--
web_search_options.user_location.type"approximate"undefined--