Skip to content
1 min read · 201 words

@nhtio/adk/batteries/llm/webllm_chat_completions/exceptions

Battery-scoped exception constructors for WebLLM Chat Completions adapter failures.

Remarks

Battery-scoped exception classes for the WebLLM Chat Completions adapter. These exceptions are owned by the battery (not the ADK core) and are minted via createException from @nhtio/adk/factories. Re-exported from the battery's barrel.

Variables

VariableDescription
E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONSThrown when the resolved adapter options (constructor, executor overrides, or per-dispatch stash.webLLMChatCompletions) fail validation against webLLMChatCompletionsOptionsSchema.
E_UNSUPPORTED_MEDIA_MODALITYRaised when a @nhtio/adk!Media instance whose modality cannot be natively represented in the WebLLM Chat Completions wire format reaches the adapter under unsupportedMediaPolicy: 'throw'.
E_WEBLLM_CHAT_COMPLETIONS_CONTEXT_OVERFLOWThrown when the total token weight of the resolved request exceeds contextWindow. Only raised when tokenEncoding is non-null. Carries { total, contextWindow, tokenEncoding, perBucket } in the message so middleware can target shedding.
E_WEBLLM_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGSRaised when a tool-call's arguments string emitted by the model is not a JSON object — either non-parseable JSON, or parseable JSON whose root is not an object (e.g. a bare string, number, array, or null).
E_WEBLLM_CHAT_COMPLETIONS_STREAM_ERRORThrown when the WebLLM engine call or async stream fails. Non-fatal — surfaced via ctx.nack(...).