Exemplo n.º 1
0
def test_reading_of_trackers_with_legacy_form_events():
    loop_name1 = "my loop"
    loop_name2 = "my form"
    tracker = DialogueStateTracker.from_dict(
        "sender",
        events_as_dict=[
            {
                "event": ActiveLoop.type_name,
                LOOP_NAME: loop_name1
            },
            {
                "event": LegacyForm.type_name,
                LOOP_NAME: None
            },
            {
                "event": LegacyForm.type_name,
                LOOP_NAME: loop_name2
            },
        ],
    )

    expected_events = [
        ActiveLoop(loop_name1),
        LegacyForm(None),
        LegacyForm(loop_name2)
    ]
    assert list(tracker.events) == expected_events
    assert tracker.active_loop[LOOP_NAME] == loop_name2
Exemplo n.º 2
0
def test_writing_trackers_with_legacy_form_events():
    loop_name = "my loop"
    tracker = DialogueStateTracker.from_events(
        "sender", evts=[ActiveLoop(loop_name), LegacyForm(None), LegacyForm("some")]
    )

    events_as_dict = [event.as_dict() for event in tracker.events]

    for event in events_as_dict:
        assert event["event"] == ActiveLoop.type_name
Exemplo n.º 3
0
         },
     ],
     timestamp=None,
 ),
 DefinePrevUserUtteredFeaturization(use_text_for_featurization=False,
                                    timestamp=None,
                                    metadata=None),
 ReminderCancelled(timestamp=1621590172.3872123),
 ReminderScheduled(timestamp=None,
                   trigger_date_time=datetime.now(),
                   intent="greet"),
 ActionExecutionRejected(action_name="my_action"),
 LegacyFormValidation(validate=True, timestamp=None),
 LoopInterrupted(timestamp=None, is_interrupted=False),
 ActiveLoop(name="loop"),
 LegacyForm(name="my_form"),
 AllSlotsReset(),
 SlotSet(key="my_slot", value={}),
 SlotSet(key="my slot", value=[]),
 SlotSet(key="test", value=1),
 SlotSet(key="test", value="text"),
 ConversationResumed(),
 ConversationPaused(),
 FollowupAction(name="test"),
 StoryExported(),
 Restarted(),
 ActionReverted(),
 UserUtteranceReverted(),
 BotUttered(text="Test bot utterance"),
 UserUttered(
     parse_data={