embed

open suspend override fun embed(text: String, model: LLModel): List<Double>(source)

Embeds the given text using the Ollama model.

Return

A vector representation of the text.

Parameters

text

The text to embed.

model

The model to use for embedding. Must have the Embed capability.

Throws

if the model does not have the Embed capability.


open suspend override fun embed(inputs: List<String>, model: LLModel): List<List<Double>>(source)

Embeds the given inputs using the Ollama embeddings API.

Return

A list of embedding vectors, one per input string.

Parameters

inputs

The list of texts to embed.

model

The model to use for embedding. Must have the LLMCapability.Embed capability and belong to LLMProvider.Ollama.

Throws

if the model does not have the Embed capability.