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.
Summary
Functions
Returns true if a choice answer map (or choice value) selected expected_option,
comparing atoms and strings equivalently.
Aliases a secondary or legacy contract name (atom or string) to a canonical contract name.
Defines a single-question Choice contract using key -> "description" stab clauses.
Defines a multi-question contract combining choice, noul, and/or score sub-questions.
Alias for defcontract/2.
Defines a single-question Noul (boolean probability) contract.
Defines a single-question ordered Score contract (2..10 rubric levels) using label -> "description" stab clauses.
Exports compiled contracts into a CUE schema document.
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.
Fetches an answer by atom or string key, raising KeyError if not present.
Fetches the probability for option_key (atom or string) from a choice answer or probability map.
Functions
Returns true if a choice answer map (or choice value) selected expected_option,
comparing atoms and strings equivalently.
Aliases a secondary or legacy contract name (atom or string) to a canonical contract name.
Defines a single-question Choice contract using key -> "description" stab clauses.
Defines a multi-question contract combining choice, noul, and/or score sub-questions.
Alias for defcontract/2.
Defines a single-question Noul (boolean probability) contract.
Defines a single-question ordered Score contract (2..10 rubric levels) using label -> "description" stab clauses.
@spec export_cue(%{ optional(atom() | String.t()) => SystemOneDSL.Contract.t() | map() }) :: String.t()
Exports compiled contracts into a CUE schema document.
@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.
@spec fetch_answer!(ReqLLM.Response.t() | map(), atom() | String.t()) :: term()
Fetches an answer by atom or string key, raising KeyError if not present.
Fetches the probability for option_key (atom or string) from a choice answer or probability map.