feat: check goals only for this phase
Since conversation history still remains we can still check at a later point. ref: N25B-429
This commit is contained in:
@@ -86,6 +86,7 @@ class BDIProgramManager(BaseAgent):
|
|||||||
self._phase = phase
|
self._phase = phase
|
||||||
|
|
||||||
self._send_beliefs_to_semantic_belief_extractor()
|
self._send_beliefs_to_semantic_belief_extractor()
|
||||||
|
self._send_goals_to_semantic_belief_extractor()
|
||||||
|
|
||||||
# Notify user interaction agent
|
# Notify user interaction agent
|
||||||
msg = InternalMessage(
|
msg = InternalMessage(
|
||||||
@@ -131,12 +132,10 @@ class BDIProgramManager(BaseAgent):
|
|||||||
|
|
||||||
await self.send(message)
|
await self.send(message)
|
||||||
|
|
||||||
@staticmethod
|
def _extract_current_goals(self) -> list[Goal]:
|
||||||
def _extract_goals_from_program(program: Program) -> list[Goal]:
|
|
||||||
"""
|
"""
|
||||||
Extract all goals from the program, including subgoals.
|
Extract all goals from the program, including subgoals.
|
||||||
|
|
||||||
:param program: The program received from the API.
|
|
||||||
:return: A list of Goal objects.
|
:return: A list of Goal objects.
|
||||||
"""
|
"""
|
||||||
goals: list[Goal] = []
|
goals: list[Goal] = []
|
||||||
@@ -148,19 +147,16 @@ class BDIProgramManager(BaseAgent):
|
|||||||
goals_.extend(extract_goals_from_goal(plan))
|
goals_.extend(extract_goals_from_goal(plan))
|
||||||
return goals_
|
return goals_
|
||||||
|
|
||||||
for phase in program.phases:
|
for goal in self._phase.goals:
|
||||||
for goal in phase.goals:
|
goals.extend(extract_goals_from_goal(goal))
|
||||||
goals.extend(extract_goals_from_goal(goal))
|
|
||||||
|
|
||||||
return goals
|
return goals
|
||||||
|
|
||||||
async def _send_goals_to_semantic_belief_extractor(self, program: Program):
|
async def _send_goals_to_semantic_belief_extractor(self):
|
||||||
"""
|
"""
|
||||||
Extract goals from the program and send them to the Semantic Belief Extractor Agent.
|
Extract goals for the current phase and send them to the Semantic Belief Extractor Agent.
|
||||||
|
|
||||||
:param program: The program received from the API.
|
|
||||||
"""
|
"""
|
||||||
goals = GoalList(goals=self._extract_goals_from_program(program))
|
goals = GoalList(goals=self._extract_current_goals())
|
||||||
|
|
||||||
message = InternalMessage(
|
message = InternalMessage(
|
||||||
to=settings.agent_settings.text_belief_extractor_name,
|
to=settings.agent_settings.text_belief_extractor_name,
|
||||||
@@ -192,7 +188,7 @@ class BDIProgramManager(BaseAgent):
|
|||||||
await asyncio.gather(
|
await asyncio.gather(
|
||||||
self._create_agentspeak_and_send_to_bdi(program),
|
self._create_agentspeak_and_send_to_bdi(program),
|
||||||
self._send_beliefs_to_semantic_belief_extractor(),
|
self._send_beliefs_to_semantic_belief_extractor(),
|
||||||
self._send_goals_to_semantic_belief_extractor(program),
|
self._send_goals_to_semantic_belief_extractor(),
|
||||||
)
|
)
|
||||||
|
|
||||||
async def setup(self):
|
async def setup(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user