# `GEPA.Adapters.Confidence`
[🔗](https://github.com/nshkrdotcom/gepa_ex/blob/v0.3.0/lib/gepa/adapters/confidence.ex#L1)

Logprob-aware classification adapter.

This ports the upstream ConfidenceAdapter concept while keeping the Elixir
adapter mechanism.  The adapter asks a model for structured JSON, extracts a
target field, checks correctness against `:answer`, and optionally applies a
confidence penalty using joint field logprob metadata.

The optional `:logprob_extractor` seam lets tests or provider-specific code
supply logprob data without depending on a Python package.  It may return:

  * a number joint logprob
  * `%{joint_logprob: number, top_logprobs: list}`
  * `%{"joint_logprob" => number, "top_logprobs" => list}`

# `data_inst`

```elixir
@type data_inst() :: map()
```

# `t`

```elixir
@type t() :: %GEPA.Adapters.Confidence{
  failure_score: float(),
  field_path: String.t() | [String.t() | atom()],
  logprob_extractor: function() | nil,
  model: term(),
  normalizer: function() | nil,
  prompt_template: String.t() | nil,
  schema: map() | keyword() | nil,
  scoring_strategy: term()
}
```

# `build_feedback`

```elixir
@spec build_feedback(map()) :: String.t()
```

Build human-readable feedback for reflection.

# `extract_answer_from_json`

```elixir
@spec extract_answer_from_json(map() | String.t(), String.t() | [String.t() | atom()]) ::
  term()
```

Extract a nested field from a decoded JSON map.

# `new`

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

---

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