feat: support force completed goals in semantic belief agent

ref: N25B-427
This commit is contained in:
Twirre Meulenbelt
2026-01-13 17:04:44 +01:00
parent 8f52f8bf0c
commit f7669c021b
5 changed files with 52 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
from pydantic import BaseModel
from control_backend.schemas.program import BaseGoal
from control_backend.schemas.program import Belief as ProgramBelief
from control_backend.schemas.program import Goal
class BeliefList(BaseModel):
@@ -16,4 +16,4 @@ class BeliefList(BaseModel):
class GoalList(BaseModel):
goals: list[Goal]
goals: list[BaseGoal]

View File

@@ -15,6 +15,9 @@ class ProgramElement(BaseModel):
name: str
id: UUID4
# To make program elements hashable
model_config = {"frozen": True}
class LogicalOperator(Enum):
AND = "AND"
@@ -105,23 +108,33 @@ class Plan(ProgramElement):
steps: list[PlanElement]
class Goal(ProgramElement):
class BaseGoal(ProgramElement):
"""
Represents an objective to be achieved. To reach the goal, we should execute
the corresponding plan. If we can fail to achieve a goal after executing the plan,
for example when the achieving of the goal is dependent on the user's reply, this means
that the achieved status will be set from somewhere else in the program.
Represents an objective to be achieved. This base version does not include a plan to achieve
this goal, and is used in semantic belief extraction.
:ivar description: A description of the goal, used to determine if it has been achieved.
:ivar plan: The plan to execute.
:ivar can_fail: Whether we can fail to achieve the goal after executing the plan.
"""
description: str = ""
plan: Plan
can_fail: bool = True
class Goal(BaseGoal):
"""
Represents an objective to be achieved. To reach the goal, we should execute the corresponding
plan. It inherits from the BaseGoal a variable `can_fail`, which if true will cause the
completion to be determined based on the conversation.
Instances of this goal are not hashable because a plan is not hashable.
:ivar plan: The plan to execute.
"""
plan: Plan
type Action = SpeechAction | GestureAction | LLMAction