Skip to main content
Version: Next

Function: useTextEmbeddings()

useTextEmbeddings<M>(TextEmbeddingsProps): TextEmbeddingsType<M>

Defined in: hooks/natural_language_processing/useTextEmbeddings.ts:20

React hook for managing a Text Embeddings model instance.

Type Parameters

M

M extends TextEmbeddingsModel

Parameters

TextEmbeddingsProps

TextEmbeddingsProps<M>

Configuration object containing model source and optional preventLoad flag.

Returns

TextEmbeddingsType<M>

Ready to use Text Embeddings model. forward returns a Float32Array for pooled models and an EmbeddingResult (per-token vectors) for multi-vector models. Models with prompts require a role ('query' | 'document') on forward.