# `SystemOneDSL`
[🔗](https://github.com/boxxxie/jev_dsl/blob/v1.0.0/lib/system_one_dsl.ex#L1)

Compile-time Elixir macro DSL, two-tier caching layer, and execution runner for
`ReqLLM.Evaluation` (TypeSafe Jev, Google Gemini Decisions, OpenAI Decisions, and more).

`SystemOneDSL` compiles `%SystemOneDSL.Prepared{}` contracts at build time (`defnoul`, `defchoice`,
`defscore`, `defcontract`, `defjev`, `defalias`), provides model-aware deterministic
SHA-256 content-addressed L1/L2 caching (`SystemOneDSL.Cache`), and generates `evaluate/3`,
`evaluate!/3`, `evaluate_many/3`, `available?/2`, `cache_key/3`, `contract/1`,
`prepared/1`, and `__export_cue__/0` directly on your contract module.

# `choice?`

```elixir
@spec choice?(map() | atom() | String.t(), atom() | String.t()) :: boolean()
```

Returns `true` if a choice answer map (or choice value) selected `expected_option`,
comparing atoms and strings equivalently.

# `defalias`
*macro* 

Aliases a secondary or legacy contract name (atom or string) to a canonical contract name.

# `defchoice`
*macro* 

Defines a single-question Choice contract using `key -> "description"` stab clauses.

# `defcontract`
*macro* 

Defines a multi-question contract combining `choice`, `noul`, and/or `score` sub-questions.

# `defjev`
*macro* 

Alias for `defcontract/2`.

# `defnoul`
*macro* 

Defines a single-question Noul (boolean probability) contract.

# `defscore`
*macro* 

Defines a single-question ordered Score contract (2..10 rubric levels) using `label -> "description"` stab clauses.

# `export_cue`

```elixir
@spec export_cue(%{
  optional(atom() | String.t()) =&gt; SystemOneDSL.Contract.t() | map()
}) :: String.t()
```

Exports compiled contracts into a CUE schema document.

# `fetch_answer`

```elixir
@spec fetch_answer(ReqLLM.Response.t() | map(), atom() | String.t()) ::
  {:ok, term()} | :error
```

Fetches an answer from a `%ReqLLM.Response{object: answers}` (or plain map double with
`:object` or `:answers`), matching `key` whether passed as an atom or a string.

# `fetch_answer!`

```elixir
@spec fetch_answer!(ReqLLM.Response.t() | map(), atom() | String.t()) :: term()
```

Fetches an answer by atom or string `key`, raising `KeyError` if not present.

# `probability`

```elixir
@spec probability(map(), atom() | String.t()) :: {:ok, number()} | :error
```

Fetches the probability for `option_key` (atom or string) from a choice answer or probability map.

---

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