DecisionSpec

@ApiStatus.Experimental
open class DecisionSpec

An immutable, ordered set of questions to put to a model in one decision. Question names are unique within a spec and name the answers in a response.

Declare the questions inline with builder, or pass questions made with Questions.named(...) to of. Both forms validate the same way and give equal specs for equal questions.

var triage = DecisionSpec.builder()
.proposition("is_urgent", question -> question
.asking("Does this convey urgency?"))
.choice("department", question -> question
.asking("Which team should handle this?")
.option("billing", "Payments, invoicing, refunds")
.option("technical", "Bugs, outages, integrations"))
.build();

Two specs are equal when they hold equal questions in the same order, whatever their class. A ClassificationSpec is the one subclass: a spec with a single choice question.

Inheritors

Types

Link copied to clipboard
@ApiStatus.Experimental
class Builder

Collects the questions of a decision spec in declared order. Get one from DecisionSpec.builder.

Link copied to clipboard
object Companion

Creates decision specs.

Properties

Link copied to clipboard

The questions in declared order. The list cannot be modified.

Functions

Link copied to clipboard
operator override fun equals(other: Any?): Boolean
Link copied to clipboard
override fun hashCode(): Int
Link copied to clipboard
fun question(name: String): Question<*>?

Returns the question with the given name.

Link copied to clipboard
open override fun toString(): String