decisions/vocabulary
The words every part of decisions shares: references to immutable
data, the context a model started from, who an occurrence is about,
what recommended, verdicts and assessments.
These are plain values. Nothing here reads a store or a clock, and every
value has a JSON form in decisions/wire.
import decisions/vocabulary.{Manifest, Ref, Subject}
let context =
Manifest(refs: [Ref("message", "m1", "1")], renderer: "reply-1")
let ana = Subject(kind: "person", id: "ana")
Target-independent: builds for Erlang and JavaScript.
Types
What proved true later. It is appended and never overwrites a verdict or the output.
pub type Assessment(output) {
Assessment(
finding: Finding(output),
evidence: Ref,
source: String,
known_at: timestamp.Timestamp,
)
}
Constructors
-
Assessment( finding: Finding(output), evidence: Ref, source: String, known_at: timestamp.Timestamp, )
What became of a released output outside the database.
pub type Effect {
Performed(receipt: Ref)
NotPerformed(reason: String)
Uncertain(reason: String)
}
Constructors
-
Performed(receipt: Ref)The outside system did it;
receiptis its evidence. -
NotPerformed(reason: String) -
Uncertain(reason: String)Nobody knows yet. Only evidence, such as a lookup by the release’s key, settles it; nothing should retry blindly.
Why an occurrence can no longer be decided.
pub type ExpiryCause {
DeadlinePassed
Superseded(event: String)
}
Constructors
-
DeadlinePassed -
Superseded(event: String)
Why the recommender recommended this output. Every kind of recommender produces the same record and differs only here.
pub type Explanation {
RuleFired(rule: String)
Receipt(evidence: Ref)
RunAnswer(run: String)
RunAction(run: String, action: String)
OwnAct
}
Constructors
-
RuleFired(rule: String) -
Receipt(evidence: Ref)Captured evidence holds the explanation, such as a provider’s answer.
-
RunAnswer(run: String) -
RunAction(run: String, action: String) -
OwnAct
A value a policy may read. A policy reads nothing but named facts and the recommender.
pub type Fact {
Number(Float)
Text(String)
Flag(Bool)
}
Constructors
-
Number(Float) -
Text(String) -
Flag(Bool)
Named facts. Build them with the typed keys of decisions/fact.
pub type Facts =
List(#(String, Fact))
Whether the final output proved right. Wrong may carry the output that
would have been right.
pub type Finding(output) {
Right
Wrong(truth: option.Option(output))
}
Constructors
-
Right -
Wrong(truth: option.Option(output))
The context a model started from: references only, and the version of the renderer that turns them into a prompt, a card and a training example. The content behind each reference never changes.
pub type Manifest {
Manifest(refs: List(Ref), renderer: String)
}
Constructors
-
Manifest(refs: List(Ref), renderer: String)
What an occurrence hangs from, so that settling it can start what follows: the run to follow on, or the occurrence that consulted this one.
pub type Parent {
ParentRun(run: String)
ParentOccurrence(id: String)
}
Constructors
-
ParentRun(run: String) -
ParentOccurrence(id: String)
Why a validator rejected or corrected. category is required and
machine-readable; note is free text.
pub type Reason {
Reason(category: String, note: option.Option(String))
}
Constructors
-
Reason(category: String, note: option.Option(String))
What a recommender proposes, with everything a policy and a person need to judge it.
pub type Recommendation(output) {
Recommendation(
output: output,
by: Recommender,
explanation: Explanation,
signals: List(#(String, Fact)),
reads: List(Ref),
)
}
Constructors
-
Recommendation( output: output, by: Recommender, explanation: Explanation, signals: List(#(String, Fact)), reads: List(Ref), )Arguments
- signals
-
Facts the recommender reports beside its output, such as a score.
- reads
-
What the model received beyond its context, each as a reference to captured evidence.
decisions/model.runfills it; seedecisions/modelfor observed and reported reads.
What recommended. Agreement and accuracy are counted per value of this type, so a new version is a new value.
pub type Recommender {
Rules(name: String, version: String)
Classifier(name: String, version: String)
ModelCall(configuration: String, version: String)
Agent(kind: String, version: String)
Person(subject: String)
}
Constructors
-
Rules(name: String, version: String) -
Classifier(name: String, version: String) -
ModelCall(configuration: String, version: String) -
Agent(kind: String, version: String) -
Person(subject: String)A person, for their own act only. A policy can let a person’s own act proceed with the
OwnActcondition.
A reference to immutable data. id names the thing and revision
names the exact value that was read. For a read a model made beyond its
context, kind is the read’s name and id its argument.
pub type Ref {
Ref(kind: String, id: String, revision: String)
}
Constructors
-
Ref(kind: String, id: String, revision: String)
Who a gated tool call is about: a person, a company, a service.
pub type Subject {
Subject(kind: String, id: String)
}
Constructors
-
Subject(kind: String, id: String)
What asked for the decision: a message, a run, a build. It is not the model.
pub type Trigger {
Trigger(kind: String, id: String)
}
Constructors
-
Trigger(kind: String, id: String)
A person, or another system, giving verdicts, with the decision sets they hold. Who holds a set is a fact of the session, not of the record.
pub type Validator {
Validator(subject: String, holds: List(String))
}
Constructors
-
Validator(subject: String, holds: List(String))