Skip to content

Compatibility

Drop-in paths off other decision APIs. mimir.compat.systemone.v1 converts Jev /v1/systemone requests and answers, and mimir.compat.laya.v1 offers load(...).predict(state, questions) in Laya 0.3.20's shape, so existing callers move by changing what they import.

mimir.compat.systemone.v1

Jev's /v1/systemone wire format (TypeSafe API reference, checked 2026-09-27).

translate converts a request into a Context and one spec per question; respond converts the results back into Jev's answers. Question types map as follows:

Jev MIMIR spec
choice Choice over the criteria keys
noul Choice over false and true
score, 3 or more levels Rate over levels "0", "1", ...
score, 2 levels Choice over "0" and "1"

Option texts follow the training data: "<Key>: <description>" when a description is given, otherwise the key. Jev answers carry no policy status; confidence is (K * p_max - 1) / (K - 1), clipped to [0, 1].

Translated dataclass

One question as a spec, with what respond needs to answer in Jev's shape.

as_text

as_text(value: JsonValue) -> str

Return a string as is, and any other JSON value as compact JSON.

humanize

humanize(label: str) -> str

Turn a snake_case or camelCase key into a capitalised phrase, e.g. needs_review gives Needs review.

option_text

option_text(
    key: str,
    description: JsonValue,
    label: str | None = None,
) -> str

Return "<Label>: <description>", or the key alone without a description.

translate_question

translate_question(
    question: Question,
    labels: Mapping[str, str] | None = None,
) -> Translated

Convert one question; labels optionally renames the noul options' shown labels.

translate

translate(
    request: SystemOneRequest,
) -> tuple[Context, dict[str, Translated]]

Convert a request into a context and one translated question per question id.

answer

answer(
    translated: Translated, result: DecisionResult
) -> NoulAnswer | ChoiceAnswer | ScoreAnswer

Express one result as Jev's answer for its question type.

respond

respond(
    translated: Mapping[str, Translated],
    results: Mapping[str, DecisionResult],
    model: str,
    input_tokens: int,
) -> SystemOneResponse

Build Jev's response from one result per question id.

mimir.compat.laya.v1

A drop-in for Laya 0.3.20: load(...).predict(state, questions).

Requests use Laya's question format (Jev's, plus list-valued choice criteria and noul labels). Answers follow Laya 0.3.20's shape, with values rounded to 4 decimals. MIMIR has no separate act head, so action.act_probability is 1.0 when the certified decision may be acted on (DECIDED or ABSTAINED) and 0.0 when it is deferred.

Agent

Laya-compatible wrapper around a local Mimir engine.

predict

predict(
    state: LayaState, questions: Mapping[str, JsonValue]
) -> dict[str, JsonValue]

Answer every question about one state, in Laya's response shape.

predict_batch

predict_batch(
    states: Sequence[LayaState],
    questions: Mapping[str, JsonValue],
) -> list[dict[str, JsonValue]]

Answer the same questions about each state; one response per state, in order.

translate

translate(question: LayaQuestion) -> Translated

Convert one Laya question into a MIMIR spec.

entropy_confidence

entropy_confidence(probabilities: Sequence[float]) -> float

Return Laya's confidence: 1 - H(p) / log(k), clipped to [0, 1].

answer

answer(
    translated: Translated, result: DecisionResult
) -> dict[str, JsonValue]

Express one result as a Laya 0.3.20 answer.

load

load(
    model_id_or_path: str | Path = DEFAULT_REPOSITORY,
    device: str | None = None,
    *,
    risk: float = DEFAULT_RISK,
    revision: str | None = None,
) -> Agent

Load MIMIR behind Laya's load signature; device None means auto.