Exemple #1
0
async def test_nlg_conditional_response_variations_with_yaml_multi_constraints():
    domain = Domain.from_file(
        path="data/test_domains/conditional_response_variations.yml"
    )
    t = TemplatedNaturalLanguageGenerator(responses=domain.responses)

    first_slot = CategoricalSlot(
        name="account_type",
        mappings=[{}],
        initial_value="primary",
        influence_conversation=False,
    )
    second_slot = BooleanSlot(
        name="can_withdraw",
        mappings=[{}],
        initial_value=True,
        influence_conversation=False,
    )
    tracker = DialogueStateTracker(
        sender_id="conversation_id", slots=[first_slot, second_slot]
    )
    r = await t.generate(
        utter_action="utter_withdraw", tracker=tracker, output_channel=""
    )
    assert r.get("text") == "Withdrawal has been approved."
Exemple #2
0
 def create_slot(self, mappings: List[Dict[Text, Any]],
                 influence_conversation: bool) -> Slot:
     return BooleanSlot("test",
                        mappings=mappings,
                        influence_conversation=influence_conversation)
Exemple #3
0
 def create_slot(self, influence_conversation: bool) -> Slot:
     return BooleanSlot("test",
                        influence_conversation=influence_conversation)
Exemple #4
0
 def create_slot(self):
     return BooleanSlot("test")