Make extract_other_slots sync
MODIFY
rasa_sdk/forms.py
rasa_sdk/forms.py
@@ -196,7 +196,7 @@ class FormAction(Action):
return value
# noinspection PyUnusedLocal
- async def extract_other_slots(
+ def extract_other_slots(
self,
dispatcher: "CollectingDispatcher",
tracker: "Tracker",
@@ -337,7 +337,7 @@ class FormAction(Action):
# extract other slots that were not requested
# but set by corresponding entity or trigger intent mapping
- slot_values = await self.extract_other_slots(dispatcher, tracker, domain)
+ slot_values = self.extract_other_slots(dispatcher, tracker, domain)
# extract requested slot
slot_to_fill = tracker.get_slot(REQUESTED_SLOT)

MODIFY
tests/test_forms.py
tests/test_forms.py
@@ -390,7 +390,7 @@ def test_extract_requested_slot_from_text_with_not_intent():
assert slot_values == {"some_slot": "some_text"}
-async def test_extract_trigger_slots():
+def test_extract_trigger_slots():
"""Test extraction of a slot value from trigger intent
"""
@@ -423,7 +423,7 @@ async def test_extract_trigger_slots():
"action_listen",
)
- slot_values = await form.extract_other_slots(CollectingDispatcher(), tracker, {})
+ slot_values = form.extract_other_slots(CollectingDispatcher(), tracker, {})
# check that the value was extracted for correct intent
assert slot_values == {"some_slot": "some_value"}
@@ -438,7 +438,7 @@ async def test_extract_trigger_slots():
"action_listen",
)
- slot_values = await form.extract_other_slots(CollectingDispatcher(), tracker, {})
+ slot_values = form.extract_other_slots(CollectingDispatcher(), tracker, {})
# check that the value was not extracted for incorrect intent
assert slot_values == {}
@@ -454,12 +454,12 @@ async def test_extract_trigger_slots():
"action_listen",
)
- slot_values = await form.extract_other_slots(CollectingDispatcher(), tracker, {})
+ slot_values = form.extract_other_slots(CollectingDispatcher(), tracker, {})
# check that the value was not extracted for correct intent
assert slot_values == {}
-async def test_extract_other_slots_no_intent():
+def test_extract_other_slots_no_intent():
"""Test extraction of other not requested slots values
from entities with the same names
"""
@@ -486,7 +486,7 @@ async def test_extract_other_slots_no_intent():
"action_listen",
)
- slot_values = await form.extract_other_slots(CollectingDispatcher(), tracker, {})
+ slot_values = form.extract_other_slots(CollectingDispatcher(), tracker, {})
# check that the value was not extracted for requested slot
assert slot_values == {}
@@ -501,7 +501,7 @@ async def test_extract_other_slots_no_intent():
"action_listen",
)
- slot_values = await form.extract_other_slots(CollectingDispatcher(), tracker, {})
+ slot_values = form.extract_other_slots(CollectingDispatcher(), tracker, {})
# check that the value was extracted for non requested slot
assert slot_values == {"some_other_slot": "some_other_value"}
@@ -521,13 +521,13 @@ async def test_extract_other_slots_no_intent():
"action_listen",
)
- slot_values = await form.extract_other_slots(CollectingDispatcher(), tracker, {})
+ slot_values = form.extract_other_slots(CollectingDispatcher(), tracker, {})
# check that the value was extracted only for non requested slot
assert slot_values == {"some_other_slot": "some_other_value"}
-async def test_extract_other_slots_with_intent():
+def test_extract_other_slots_with_intent():
"""Test extraction of other not requested slots values
from entities with the same names
"""
@@ -564,7 +564,7 @@ async def test_extract_other_slots_with_intent():
"action_listen",
)
- slot_values = await form.extract_other_slots(CollectingDispatcher(), tracker, {})
+ slot_values = form.extract_other_slots(CollectingDispatcher(), tracker, {})
# check that the value was extracted for non requested slot
assert slot_values == {}
@@ -582,7 +582,7 @@ async def test_extract_other_slots_with_intent():
"action_listen",
)
- slot_values = await form.extract_other_slots(CollectingDispatcher(), tracker, {})
+ slot_values = form.extract_other_slots(CollectingDispatcher(), tracker, {})
# check that the value was extracted only for non requested slot
assert slot_values == {"some_other_slot": "some_other_value"}

Make extract_other_slots sync