Skip to content

Commit

Permalink
Eng 368 taking stock (#12731)
Browse files Browse the repository at this point in the history
* Allow users to reset slots with corrections

* not giving interruption message if flow is only one on the stack
  • Loading branch information
twerkmeister authored Aug 15, 2023
1 parent a1db105 commit 34667b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions rasa/cdu/command_generator/llm_command_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,13 @@ def predict_commands(
return commands

@staticmethod
def is_hallucinated_value(value: str) -> bool:
def is_none_value(value: str) -> bool:
return value in {
"[missing information]",
"[missing]",
"None",
"undefined",
"null",
}

@classmethod
Expand Down Expand Up @@ -192,9 +193,9 @@ def parse_commands(cls, actions: Optional[str]) -> List[Command]:
# error case where the llm tries to start a flow using a slot set
if slot_name == "flow_name":
commands.append(StartFlowCommand(flow=slot_value))
elif cls.is_hallucinated_value(slot_value):
continue
else:
if cls.is_none_value(slot_value):
slot_value = None
commands.append(SetSlotCommand(name=slot_name, value=slot_value))
elif m := start_flow_re.search(action):
commands.append(StartFlowCommand(flow=m.group(1).strip()))
Expand Down
5 changes: 4 additions & 1 deletion rasa/core/policies/flow_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,10 @@ def _run_step(
if current_frame := self.flow_stack.pop():
previous_flow = self.flow_stack.top_flow(self.all_flows)
previous_flow_step = self.flow_stack.top_flow_step(self.all_flows)
if current_frame.frame_type == StackFrameType.INTERRUPT:
if (
current_frame.frame_type == StackFrameType.INTERRUPT
and previous_flow is not None
):
# get stack frame that is below the current one and which will
# be continued now that this one has ended.
previous_flow_name = (
Expand Down

0 comments on commit 34667b1

Please sign in to comment.