Skip to content
1 min read · 115 words

@nhtio/adk/batteries/embeddings/webllm/validation

Runtime validation schema and wrapper for WebLLM Embeddings adapter options.

Remarks

Validates WebLLMEmbeddingsAdapterOptions at construction time. Throws E_INVALID_WEBLLM_EMBEDDINGS_OPTIONS on failure. model is required; unknown top-level keys are rejected so typos fail loud. WebGPU availability is checked at engine-resolution time (not here), since an engine may be injected for tests/non-WebGPU paths.

Variables

VariableDescription
webLLMEmbeddingsOptionsSchemaValidator schema for WebLLMEmbeddingsAdapterOptions. Rejects unknown top-level keys.

Functions

FunctionDescription
validateOptionsValidates an arbitrary input against webLLMEmbeddingsOptionsSchema and returns the resolved options shape. Throws E_INVALID_WEBLLM_EMBEDDINGS_OPTIONS (carrying the validator's report on cause) on failure.