Package com.tnsai.context.decision
Class DecisionInput
java.lang.Object
com.tnsai.context.decision.DecisionInput
Represents what information was considered when making a decision.
DecisionInput captures all the context that fed into a decision: relevant beliefs, entities, and any external data. This enables understanding what the agent "knew" when it made its choice.
Usage Example
DecisionInput input = DecisionInput.builder()
.belief(new Belief("Customer has premium account", 0.95, "crm"))
.belief(new Belief("Previous request was denied", 0.8, "history"))
.entity(customerEntity)
.data("requestedDiscount", 0.20)
.data("orderTotal", 1500.00)
.query("Should we approve the 20% discount?")
.build();
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic DecisionInput.Builderbuilder()Creates a new builder.getBeliefsBySource(String source) Finds beliefs by source.Gets a context data value.<T> Optional<T> Gets a typed context data value.Finds high-confidence beliefs.intReturns the total number of input elements.getQuery()booleanReturns true if there are any beliefs.booleanReturns true if there are any constraints.booleanReturns true if there are any entities.booleanReturns true if there are any precedents.static DecisionInputCreates a simple input with just a query.toString()
-
Method Details
-
builder
Creates a new builder. -
ofQuery
Creates a simple input with just a query. -
getRelevantBeliefs
-
getRelevantEntities
-
getContextData
-
getQuery
-
getConstraints
-
getPrecedents
-
getData
Gets a context data value.- Parameters:
key- data key- Returns:
- Optional containing the value if present
-
getData
Gets a typed context data value.- Parameters:
key- data keytype- expected type- Returns:
- Optional containing the typed value if present and castable
-
getBeliefsBySource
Finds beliefs by source.- Parameters:
source- source identifier- Returns:
- list of beliefs from that source
-
getHighConfidenceBeliefs
Finds high-confidence beliefs.- Returns:
- beliefs with confidence >= 0.9
-
getInputCount
public int getInputCount()Returns the total number of input elements. -
hasBeliefs
public boolean hasBeliefs()Returns true if there are any beliefs. -
hasEntities
public boolean hasEntities()Returns true if there are any entities. -
hasConstraints
public boolean hasConstraints()Returns true if there are any constraints. -
hasPrecedents
public boolean hasPrecedents()Returns true if there are any precedents. -
toString
-