embed

open suspend override fun embed(model: String, text: String): FloatArray

Embeds text with one POST /v1/embeddings request and returns data[0].embedding.

The text is sent whole, with no client-side chunking or tokenizer. oMLX has no standard embedding model, so model is required. A chat model is a provider error (400).

Throws

if model is blank, before any request.

on a non-2xx response or a response with no embedding.