Skip to main content
Decision layer: one interface (Decider), with adapters for DecisionLite, an LLM judge, or any endpoint.

decision.base

The interface the index depends on to make small decisions, and the types around it.

Decider

Small decisions over English text. Construct with Decider(*args, **kwargs).

DecisionError

The call failed (model error, timeout, bad answer) after the adapter’s own retries.

Option

Pick

The outcome of pick.

PickSpec

A pick question without its text: the options, whether ‘none’ is allowed, and the instructions.

Preparable

Optional: a decider that is cheaper when it learns its option sets before the first pick. Construct with Preparable(*args, **kwargs).

check_options

Reject a bad option set.

decision.composite

Use one decider for pick and another for score.

CompositeDecider

Construct with CompositeDecider(picker: Decider, scorer: Decider).

decision.decision_lite

A decider backed by the DecisionLite SDK (EmbeddingGemma through the MediaPipe Decision Maker).

DecisionLiteDecider

Decider over a DecisionLite SDK instance. Construct with DecisionLiteDecider(decision_model: str \| pathlib.Path, *, backend: str = 'cpu', workers: int = 1, auto_prepare: bool = True).

build_config_text

A DecisionLite config, as YAML text, with one choice decision per spec and no translator.

spec_name

The decision name for a spec.

decision.fake

A scripted decider for tests: no model, no network.

FakeDecider

Returns canned replies in order and records every request. Construct with FakeDecider(picks: list[Pick \| Exception \| Callable[[str, Sequence[Option], bool], Pick]] \| None = None, scores: list[list[float] \| Exception \| Callable[[str, Sequence[str]], list[float]]] \| None = None, model: str = 'fake/decider').

decision.lexical

A decider that works from the words in the text, with no model and no network.

LexicalDecider

Construct with LexicalDecider(embedder: Embedder \| None = None, *, temperature: float = 12.0, other_similarity: float = 0.3).

decision.llm_judge

A decider that asks an LLM to rate the options, through the LlmClient Protocol.

LlmJudgeDecider

Decider over any LlmClient. Construct with LlmJudgeDecider(llm: LlmClient, *, max_texts: int = 40).

pick_from_ratings

The fixed rule from ratings to a Pick.

decision.system_one

A decider for System One style decision endpoints: POST /v1/systemone (Cloudflare Clef, Kev, a PPLX decider, or any model that SGLang serves through that route).

SystemOneDecider

Decider over a System One endpoint. Construct with SystemOneDecider(base_url: str, *, model: str = 'Cloudflare/clef-flash', timeout_s: float = 300.0, attempts: int = 3, backoff_s: float = 1.0, max_concurrency: int = 10, api_key_env: str \| None = None, score_instructions: str = 'Does the text directly answer the question?', transport: httpx.BaseTransport \| httpx.AsyncBaseTransport \| None = None, sleep: Callable[[float], None] = <built-in function sleep>, asleep: Callable[[float], typing.Any] = <function sleep at 0x102764b80>).

option_names

Server-safe names for the options, and the name of the ‘none of the above’ option (None when not offered).

parse_pick

parse_score

pick_request

The request body, and the map from option name back to key (None is the ‘other’ answer).

score_request