@nhtio/adk/batteries/embeddings/webllm/adapter
WebLLM (WebGPU, in-process) Embeddings adapter battery.
Remarks
Embeddings battery backed by WebLLM's in-process engine.embeddings.create() (the OpenAI-style embeddings API exposed by @mlc-ai/web-llm). Runs entirely in the browser on WebGPU — no network round-trip, no API key.
This class is the same battery as @nhtio/adk/batteries/embeddings/openai!OpenAIEmbeddingsAdapter in every user-facing respect — identical method surface (isAvailable / dimensions / preload / reset / embed / embedMany), identical number[] return shape, identical query/document prefix handling (the shared applyEmbeddingPrefix helper) — differing only in the engine. Construction validates eagerly and throws @nhtio/adk/batteries/embeddings/webllm/exceptions!E_INVALID_WEBLLM_EMBEDDINGS_OPTIONS on failure.
@mlc-ai/web-llm is an optional peer dependency, imported lazily so non-WebGPU consumers pay nothing for it.
Classes
| Class | Description |
|---|---|
| WebLLMEmbeddingsAdapter | Embeddings adapter for WebLLM's in-process embeddings API. |