feat: support force completed goals in semantic belief agent
ref: N25B-427
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user