# `Minga.Extension.AI`
[🔗](https://github.com/jsmestad/minga/blob/main/sdk/lib/minga/extension/ai.ex#L1)

Sanctioned text-generation helper for extensions.

`stream/2` streams chunks to `reply_to` asynchronously; `complete/2`
blocks until the full text is ready. The user's configured model is used
by default.

This is a compile-time stub. At runtime, the real module in Minga's
BEAM VM provides the implementation.

# `error`

```elixir
@type error() :: :empty_response | {:provider_error, term()}
```

# `event`

```elixir
@type event() :: {:chunk, String.t()} | {:done, String.t()} | {:error, error()}
```

# `message`

```elixir
@type message() :: %{role: String.t(), content: String.t()}
```

# `opts`

```elixir
@type opts() :: keyword()
```

# `complete`

```elixir
@spec complete([message()], opts()) :: {:ok, String.t()} | {:error, error()}
```

# `stream`

```elixir
@spec stream([message()], opts()) :: {:ok, reference()}
```

---

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