Package com.tnsai.context.integration
Class BDIContextMapper
java.lang.Object
com.tnsai.context.integration.BDIContextMapper
Maps BDI (Belief-Desire-Intention) model to Context Graph components.
This mapper bridges the gap between TnsAI's BDI architecture and the Foundation Capital Context Graphs model, enabling:
- Beliefs to be captured as decision inputs
- Desires to be mapped to decision goals
- Intentions to be traced as committed actions
Usage Example
BDIContextMapper mapper = new BDIContextMapper();
// Map beliefs to decision input
DecisionInput input = mapper.mapBeliefsToInput(agent.getBeliefs());
// Derive goal from desires
String goal = mapper.mapDesiresToGoal(agent.getDesires());
// Create reasoning from BDI state
DecisionReasoning reasoning = mapper.createReasoning(
beliefs, desires, selectedIntention
);
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a mapper with default confidence threshold (0.7).BDIContextMapper(double confidenceThreshold) Creates a mapper with custom confidence threshold. -
Method Summary
Modifier and TypeMethodDescriptioncom.tnsai.context.decision.DecisionPolicycreatePolicyFromBeliefs(List<com.tnsai.models.agent.Belief> beliefs) Creates decision policy from beliefs about rules.com.tnsai.context.decision.DecisionReasoningcreateReasoning(List<com.tnsai.models.agent.Belief> beliefs, List<com.tnsai.models.agent.Desire> desires, com.tnsai.models.agent.Intention intention) Creates decision reasoning from BDI state.com.tnsai.context.decision.DecisionReasoningcreateReasoningFromIntention(com.tnsai.models.agent.Intention intention) Creates simple reasoning from intention only.com.tnsai.context.decision.DecisionTriggercreateTriggerFromBeliefChange(com.tnsai.models.agent.Belief oldBelief, com.tnsai.models.agent.Belief newBelief) Creates a decision trigger from belief change.com.tnsai.context.decision.DecisionTriggercreateTriggerFromIntention(com.tnsai.models.agent.Intention intention, String source) Creates a decision trigger from intention activation.doubleGets the confidence threshold used by this mapper.com.tnsai.context.decision.DecisionInputmapBeliefsToInput(List<com.tnsai.models.agent.Belief> beliefs) Maps beliefs to decision input.com.tnsai.context.decision.DecisionInputmapBeliefsToInput(List<com.tnsai.models.agent.Belief> beliefs, String query) Maps beliefs to decision input with a query.mapDesiresToGoal(List<com.tnsai.models.agent.Desire> desires) Maps desires to a goal description.mapDesireToGoal(com.tnsai.models.agent.Desire desire) Maps a single desire to a goal.mapIntentionToAction(com.tnsai.models.agent.Intention intention) Maps an intention to an action name.
-
Constructor Details
-
BDIContextMapper
public BDIContextMapper()Creates a mapper with default confidence threshold (0.7). -
BDIContextMapper
public BDIContextMapper(double confidenceThreshold) Creates a mapper with custom confidence threshold.- Parameters:
confidenceThreshold- minimum confidence for high-confidence beliefs
-
-
Method Details
-
mapBeliefsToInput
public com.tnsai.context.decision.DecisionInput mapBeliefsToInput(List<com.tnsai.models.agent.Belief> beliefs) Maps beliefs to decision input.Converts the agent's beliefs into a structured decision input that captures what the agent knows when making a decision.
- Parameters:
beliefs- agent's current beliefs- Returns:
- decision input containing the beliefs
-
mapBeliefsToInput
public com.tnsai.context.decision.DecisionInput mapBeliefsToInput(List<com.tnsai.models.agent.Belief> beliefs, String query) Maps beliefs to decision input with a query.- Parameters:
beliefs- agent's current beliefsquery- the decision query- Returns:
- decision input containing beliefs and query
-
mapDesiresToGoal
Maps desires to a goal description.Derives a goal string from the agent's desires, prioritizing by priority level (CRITICAL > HIGH > MEDIUM > LOW).
- Parameters:
desires- agent's current desires- Returns:
- goal description string
-
mapDesireToGoal
Maps a single desire to a goal.- Parameters:
desire- the desire to map- Returns:
- goal description
-
createReasoning
public com.tnsai.context.decision.DecisionReasoning createReasoning(List<com.tnsai.models.agent.Belief> beliefs, List<com.tnsai.models.agent.Desire> desires, com.tnsai.models.agent.Intention intention) Creates decision reasoning from BDI state.Constructs a reasoning trace that explains how the agent arrived at a decision based on its beliefs, desires, and selected intention.
- Parameters:
beliefs- agent's beliefs at decision timedesires- agent's desires at decision timeintention- the selected intention (committed task)- Returns:
- decision reasoning with BDI-based explanation
-
createReasoningFromIntention
public com.tnsai.context.decision.DecisionReasoning createReasoningFromIntention(com.tnsai.models.agent.Intention intention) Creates simple reasoning from intention only.- Parameters:
intention- the selected intention- Returns:
- decision reasoning
-
mapIntentionToAction
Maps an intention to an action name.- Parameters:
intention- the intention to map- Returns:
- action name derived from intention
-
createTriggerFromIntention
public com.tnsai.context.decision.DecisionTrigger createTriggerFromIntention(com.tnsai.models.agent.Intention intention, String source) Creates a decision trigger from intention activation.- Parameters:
intention- the activated intentionsource- the source of activation- Returns:
- decision trigger
-
createTriggerFromBeliefChange
public com.tnsai.context.decision.DecisionTrigger createTriggerFromBeliefChange(com.tnsai.models.agent.Belief oldBelief, com.tnsai.models.agent.Belief newBelief) Creates a decision trigger from belief change.- Parameters:
oldBelief- previous belief (null if new)newBelief- new belief- Returns:
- decision trigger
-
createPolicyFromBeliefs
public com.tnsai.context.decision.DecisionPolicy createPolicyFromBeliefs(List<com.tnsai.models.agent.Belief> beliefs) Creates decision policy from beliefs about rules.Extracts policy rules from beliefs that contain rule-like statements.
- Parameters:
beliefs- beliefs that may contain rules- Returns:
- decision policy
-
getConfidenceThreshold
public double getConfidenceThreshold()Gets the confidence threshold used by this mapper.- Returns:
- confidence threshold (0.0 - 1.0)
-