Skip to content

Commit

Permalink
chore: fix unit tests after rebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
djcowley committed Oct 4, 2023
1 parent a088531 commit 5cb9634
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
14 changes: 7 additions & 7 deletions rasa/dialogue_understanding/generator/llm_command_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ def render_template(
if top_flow is not None:
flow_slots = [
{
"name": info_step.collect_information,
"value": self.slot_value(tracker, info_step.collect_information),
"type": tracker.slots[info_step.collect_information].type_name,
"name": info_step.collect,
"value": self.slot_value(tracker, info_step.collect),
"type": tracker.slots[info_step.collect].type_name,
"allowed_values": self.allowed_values_for_slot(
tracker.slots[info_step.collect_information]
tracker.slots[info_step.collect]
),
"description": info_step.description,
}
Expand All @@ -192,7 +192,7 @@ def render_template(
flow_slots = []

collect_information, collect_information_description = (
(current_step.collect_information, current_step.description)
(current_step.collect, current_step.description)
if isinstance(current_step, CollectInformationFlowStep)
else (None, None)
)
Expand Down Expand Up @@ -398,7 +398,7 @@ def is_extractable(
Returns:
`True` if the slot can be filled, `False` otherwise.
"""
slot = tracker.slots.get(info_step.collect_information)
slot = tracker.slots.get(info_step.collect)
if slot is None:
return False

Expand All @@ -411,7 +411,7 @@ def is_extractable(
or (
current_step is not None
and isinstance(current_step, CollectInformationFlowStep)
and current_step.collect_information == info_step.collect_information
and current_step.collect == info_step.collect
)
)

Expand Down
2 changes: 1 addition & 1 deletion tests/dialogue_understanding/generator/rendered_prompt.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Your task is to analyze the current conversation context and generate a list of actions to start new business processes that we call flows, to extract slots, or respond to small talk and knowledge requests.\n\nThese are the flows that can be started, with their description and slots:\n\ntest_flow: some description\n slot: test_slot\n \n\n===\nHere is what happened previously in the conversation:\nUSER: Hello\nAI: Hi\nUSER: some message\n\n===\n\nYou are currently not in any flow and so there are no active slots.\nThis means you can only set a slot if you first start a flow that requires that slot.\n\nIf you start a flow, first start the flow and then optionally fill that flow\'s slots with information the user provided in their message.\n\nThe user just said """some message""".\n\n===\nBased on this information generate a list of actions you want to take. Your job is to start flows and to fill slots where appropriate. Any logic of what happens afterwards is handled by the flow engine. These are your available actions:\n* Slot setting, described by "SetSlot(slot_name, slot_value)". An example would be "SetSlot(recipient, Freddy)"\n* Starting another flow, described by "StartFlow(flow_name)". An example would be "StartFlow(transfer_money)"\n* Cancelling the current flow, described by "CancelFlow()"\n* Clarifying which flow should be started. An example would be Clarify(list_contacts, add_contact, remove_contact) if the user just wrote "contacts" and there are multiple potential candidates. It also works with a single flow name to confirm you understood correctly, as in Clarify(transfer_money).\n* Responding to knowledge-oriented user messages, described by "SearchAndReply()"\n* Responding to a casual, non-task-oriented user message, described by "ChitChat()".\n* Handing off to a human, in case the user seems frustrated or explicitly asks to speak to one, described by "HumanHandoff()".\n\n===\nWrite out the actions you want to take, one per line, in the order they should take place.\nDo not fill slots with abstract values or placeholders.\nOnly use information provided by the user.\nOnly start a flow if it\'s completely clear what the user wants. Imagine you were a person reading this message. If it\'s not 100% clear, clarify the next step.\nDon\'t be overly confident. Take a conservative approach and clarify before proceeding.\nIf the user asks for two things which seem contradictory, clarify before starting a flow.\nStrictly adhere to the provided action types listed above.\nFocus on the last message and take it one step at a time.\nUse the previous conversation steps only to aid understanding.\n\nYour action list:
Your task is to analyze the current conversation context and generate a list of actions to start new business processes that we call flows, to extract slots, or respond to small talk and knowledge requests.\n\nThese are the flows that can be started, with their description and slots:\n\ntest_flow: some description\n \n\n===\nHere is what happened previously in the conversation:\nUSER: Hello\nAI: Hi\nUSER: some message\n\n===\n\nYou are currently not in any flow and so there are no active slots.\nThis means you can only set a slot if you first start a flow that requires that slot.\n\nIf you start a flow, first start the flow and then optionally fill that flow\'s slots with information the user provided in their message.\n\nThe user just said """some message""".\n\n===\nBased on this information generate a list of actions you want to take. Your job is to start flows and to fill slots where appropriate. Any logic of what happens afterwards is handled by the flow engine. These are your available actions:\n* Slot setting, described by "SetSlot(slot_name, slot_value)". An example would be "SetSlot(recipient, Freddy)"\n* Starting another flow, described by "StartFlow(flow_name)". An example would be "StartFlow(transfer_money)"\n* Cancelling the current flow, described by "CancelFlow()"\n* Clarifying which flow should be started. An example would be Clarify(list_contacts, add_contact, remove_contact) if the user just wrote "contacts" and there are multiple potential candidates. It also works with a single flow name to confirm you understood correctly, as in Clarify(transfer_money).\n* Responding to knowledge-oriented user messages, described by "SearchAndReply()"\n* Responding to a casual, non-task-oriented user message, described by "ChitChat()".\n* Handing off to a human, in case the user seems frustrated or explicitly asks to speak to one, described by "HumanHandoff()".\n\n===\nWrite out the actions you want to take, one per line, in the order they should take place.\nDo not fill slots with abstract values or placeholders.\nOnly use information provided by the user.\nOnly start a flow if it\'s completely clear what the user wants. Imagine you were a person reading this message. If it\'s not 100% clear, clarify the next step.\nDon\'t be overly confident. Take a conservative approach and clarify before proceeding.\nIf the user asks for two things which seem contradictory, clarify before starting a flow.\nStrictly adhere to the provided action types listed above.\nFocus on the last message and take it one step at a time.\nUse the previous conversation steps only to aid understanding.\n\nYour action list:
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,12 @@ def test_allowed_values_for_slot(
def collect_info_step(self) -> CollectInformationFlowStep:
"""Create a CollectInformationFlowStep."""
return CollectInformationFlowStep(
collect_information="test_slot",
collect="test_slot",
idx=0,
ask_before_filling=True,
utter="hello",
rejections=[SlotRejection("test_slot", "some rejection")],
id="collect_information",
custom_id="collect",
description="test_slot",
metadata={},
next="next_step",
Expand Down Expand Up @@ -365,11 +366,12 @@ def test_is_extractable_when_slot_can_be_filled_without_asking(
sender_id="test", evts=[], slots=[TextSlot(name="test_slot", mappings=[])]
)
collect_info_step = CollectInformationFlowStep(
collect_information="test_slot",
collect="test_slot",
ask_before_filling=False,
utter="hello",
rejections=[SlotRejection("test_slot", "some rejection")],
id="collect_information",
custom_id="collect_information",
idx=0,
description="test_slot",
metadata={},
next="next_step",
Expand Down

0 comments on commit 5cb9634

Please sign in to comment.