# `Nous.Memory.Embedding`
[🔗](https://github.com/nyo16/nous/blob/v0.17.1/lib/nous/memory/embedding.ex#L1)

Behaviour for embedding providers.

Implement this behaviour to use any embedding provider with the memory system.
If no embedding provider is configured, the memory system falls back to keyword-only search.

# `dimension`

```elixir
@callback dimension() :: pos_integer()
```

# `embed`

```elixir
@callback embed(text :: String.t(), opts :: keyword()) ::
  {:ok, [float()]} | {:error, term()}
```

# `embed_batch`
*optional* 

```elixir
@callback embed_batch(texts :: [String.t()], opts :: keyword()) ::
  {:ok, [[float()]]} | {:error, term()}
```

# `dimension`

```elixir
@spec dimension(module()) :: pos_integer()
```

Get the embedding dimension for a provider.

# `embed`

```elixir
@spec embed(module(), String.t(), keyword()) :: {:ok, [float()]} | {:error, term()}
```

Embed a single text using the given provider module and options.
Returns {:ok, embedding} or {:error, reason}.

# `embed_batch`

```elixir
@spec embed_batch(module(), [String.t()], keyword()) ::
  {:ok, [[float()]]} | {:error, term()}
```

Embed a batch of texts. Falls back to sequential embed/2 calls if embed_batch/2 is not implemented.

---

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