Record Class Choice
java.lang.Object
java.lang.Record
org.springframework.ai.systemone.api.question.Choice
- Record Components:
instructions- what the model is being askedcriteria- the options, in declaration order, mapped to their descriptions
- All Implemented Interfaces:
Question
public record Choice(@Nullable JsonContent instructions, Map<String,JsonContent> criteria)
extends Record
implements Question
A selection of exactly one label out of a set. The answer carries the selected label,
the probability of every option and a confidence statistic derived from how
concentrated that distribution is.
Choice.builder()
.instructions("Which team should handle this?")
.option("billing", "Payments, invoicing, refunds")
.option("technical", "Bugs, outages, integrations")
.option("sales", "Pricing, upgrades, new accounts")
.build()
Option descriptions may themselves be structured, which is the way to sharpen the
boundary between options, and they may be null when the label speaks for
itself.- Since:
- 2.1.0
- Author:
- Christian Tzolov
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionChoice(@Nullable JsonContent instructions, Map<String, JsonContent> criteria) Creates an instance of aChoicerecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic Choice.Builderbuilder()criteria()Returns the value of thecriteriarecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@Nullable JsonContentReturns the value of theinstructionsrecord component.static ChoiceCreates a choice over undescribed labels.final StringtoString()Returns a string representation of this record class.type()
-
Constructor Details
-
Choice
Creates an instance of aChoicerecord class.- Parameters:
instructions- the value for theinstructionsrecord componentcriteria- the value for thecriteriarecord component
-
-
Method Details
-
type
-
of
Creates a choice over undescribed labels.- Parameters:
instructions- the question to askoptions- the option labels, in the order they should be presented- Returns:
- a new choice
-
builder
- Returns:
- a new builder
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
instructions
Returns the value of theinstructionsrecord component.- Specified by:
instructionsin interfaceQuestion- Returns:
- the value of the
instructionsrecord component
-
criteria
Returns the value of thecriteriarecord component.- Returns:
- the value of the
criteriarecord component
-