# `Gralkor.Generalise`
[🔗](https://github.com/elimydlarz/jido_gralkor/blob/main/lib/gralkor/generalise.ex#L1)

Orchestrate one generalisation run: hypothesise generalisations from a
transcript, search existing generalisations to rule candidates in or out,
evaluate relationships, and persist the strongest.

Pure orchestration — all dependencies (hypothesise LLM call, evaluate LLM
call, search, add_episode, remove_episode) are passed as functions in
`opts`. Production wiring lives in `Gralkor.Client.Native`.

See `ex-generalise` in `TEST_TREES.md`.

# `group_id`

```elixir
@type group_id() :: String.t()
```

# `opts`

```elixir
@type opts() :: [
  hypothesise_fn: function(),
  search_gen_fn: function(),
  evaluate_fn: function(),
  add_episode_fn: function(),
  remove_episode_fn: function(),
  min_confidence: float(),
  max_gen_results: pos_integer()
]
```

# `evaluate_schema`

Schema for the evaluate LLM call. Returns a decision per hypothesis
relative to any existing generalisations found via search.

# `generalise`

```elixir
@spec generalise(group_id(), String.t(), opts()) :: :ok | {:error, term()}
```

Run the full generalisation pipeline against a flushed transcript.

Returns `:ok` (best-effort — failures are logged but do not propagate),
or `{:error, term()}` when no required `opts` keys are provided.

# `hypothesise_schema`

Schema for the hypothesise LLM call. Returns a list of candidate
generalisations with confidence scores.

---

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