# `Jido.AI.Output`
[🔗](https://github.com/agentjido/jido_ai/blob/v2.4.0/lib/jido_ai/output.ex#L1)

Structured final-output contracts for Jido.AI runtimes.

This module validates an agent's final response against an object-shaped
schema. It is intentionally independent from any DSL layer: callers provide a
Zoi object/map schema or an object-shaped JSON Schema map.

# `enforcement_mode`

```elixir
@type enforcement_mode() :: :prompt | :native
```

# `repair_callback`

```elixir
@type repair_callback() :: {module(), atom()}
```

# `schema_kind`

```elixir
@type schema_kind() :: :zoi | :json_schema
```

# `t`

```elixir
@type t() :: %Jido.AI.Output{
  mode: enforcement_mode(),
  on_validation_error: validation_mode(),
  repair_fun: repair_callback() | nil,
  retries: non_neg_integer(),
  schema: Zoi.schema() | map(),
  schema_kind: schema_kind()
}
```

# `validation_mode`

```elixir
@type validation_mode() :: :repair | :error
```

# `apply_instructions`

```elixir
@spec apply_instructions([map()], t() | nil) :: [map()]
```

Adds output instructions to a ReqLLM message list.

# `instructions`

```elixir
@spec instructions(t() | nil) :: String.t() | nil
```

Returns prompt instructions that require the final response to match the schema.

# `json_schema`

```elixir
@spec json_schema(t()) :: map()
```

Converts the contract to JSON Schema.

# `new`

```elixir
@spec new(keyword() | map() | t() | nil) :: {:ok, t() | nil} | {:error, term()}
```

Builds a structured output contract from options.

# `new!`

```elixir
@spec new!(keyword() | map() | t() | nil) :: t() | nil
```

Builds a structured output contract or raises `ArgumentError`.

# `parse`

```elixir
@spec parse(t(), term()) :: {:ok, map()} | {:error, term()}
```

Parses and validates raw model output.

# `repair`

```elixir
@spec repair(t(), term(), term(), map(), keyword()) :: {:ok, map()} | {:error, term()}
```

Repairs a raw assistant answer into the configured object shape.

# `validate`

```elixir
@spec validate(t(), term()) :: {:ok, map()} | {:error, term()}
```

Validates a parsed map against the configured schema.

---

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