Generate embeddings from text using an embedding model.
Summary
Types
@type t() :: [float()]
Functions
@spec embed(LlamaCppEx.Model.t(), String.t(), keyword()) :: {:ok, t()} | {:error, String.t()}
Computes an embedding for a single text.
Options
:n_ctx- Context size. Defaults to2048.:pooling_type- Pooling type. Defaults to:unspecified(model's default). Values::unspecified,:none,:mean,:cls,:last.:normalize- Normalization mode.2= L2 (default),0= max-abs,-1= none.
@spec embed_batch(LlamaCppEx.Model.t(), [String.t()], keyword()) :: {:ok, [t()]} | {:error, String.t()}
Computes embeddings for multiple texts.
Uses a fresh context for each text. Accepts the same options as embed/3.