# `LlamaCppEx.Embedding`
[🔗](https://github.com/nyo16/llama_cpp_ex/blob/main/lib/llama_cpp_ex/embedding.ex#L1)

Generate embeddings from text using an embedding model.

# `t`

```elixir
@type t() :: [float()]
```

# `embed`

```elixir
@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 to `2048`.
  * `: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.

# `embed_batch`

```elixir
@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`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
