Skip to content
1 min read · 125 words

@nhtio/adk/batteries/embeddings/openai/adapter

Cross-environment OpenAI Embeddings adapter battery.

Remarks

Opinionated embeddings battery for the OpenAI /v1/embeddings wire shape. Ships an OpenAIEmbeddingsAdapter that targets any OpenAI-/v1/embeddings-compatible endpoint (OpenAI proper, Azure-behind-proxy, vLLM, Together, a local gateway, etc.) over raw fetch — no SDK dependency, so it runs unchanged in Node, the browser, edge runtimes, and workers.

The class shares its method surface, return types, prefix handling, and option base with the WebLLM Embeddings battery: the two differ only in their engine. See @nhtio/adk/batteries/embeddings/openai/types!BaseEmbeddingsAdapterOptions.

Construction validates options eagerly via @nhtio/adk/batteries/embeddings/openai/validation!validateOptions and throws @nhtio/adk/batteries/embeddings/openai/exceptions!E_INVALID_OPENAI_EMBEDDINGS_OPTIONS on failure — config bugs fail loud, not at embed time.

Classes

ClassDescription
OpenAIEmbeddingsAdapterEmbeddings adapter for the OpenAI /v1/embeddings wire shape.