Skip to content

Releases: RasaHQ/rasa-sdk

2.1.2

19 Nov 10:17
3e0e7bc
Compare
Choose a tag to compare

No significant changes.

2.1.1

17 Nov 20:08
55bf64f
Compare
Choose a tag to compare

Bugfixes

  • #344: Fix a bug in the FormValidationAction which immediately deactivated the form.

2.1.0

17 Nov 12:34
1807800
Compare
Choose a tag to compare

Features

  • #329: Extend FormValidationAction with support for extracting slots. If you
    want to extract an additional slot, add the slot's name to the list of required_slots
    and add a method extract_<slot name> to your action:

    from typing import Text, Dict, Any, List, Optional
    
    from rasa_sdk.forms import (
        FormValidationAction,
    )
    
    class FormWithSlotExtractions(FormValidationAction):
        def name(self) -> Text:
            return "some_form"
    
        async def required_slots(
            self,
            slots_mapped_in_domain: List[Text],
            dispatcher: "CollectingDispatcher",
            tracker: "Tracker",
            domain: "DomainDict",
        ) -> Optional[List[Text]]:
            return slots_mapped_in_domain + ["my_slot"]
    
        async def extract_my_slot(
            self,
            dispatcher: "CollectingDispatcher",
            tracker: "Tracker",
            domain: "DomainDict",
        ) -> Dict[Text, Any]:
            return {"my_slot": "some value"}

    If all slots returned by required_slots are filled,
    the action will automatically return an event to disable the form.
    If not all required slots are filled, the SDK will return an event
    to Rasa Open Source to fill the first missing slot next.

Improvements

  • #7078: Adds the method get_intent_of_latest_message to the Tracker allowing easier
    access to the user's latest intent in case of an nlu_fallback.

2.0.0

07 Oct 13:49
f57e257
Compare
Choose a tag to compare

Deprecations and Removals

  • #246: Using the Form event is
    deprecated. Please use the new ActiveLoop event instead.
    Using the active_form property of the Tracker object is now deprecated. Please
    use the active_loop property instead.

    The usage of the FormAction is deprecated. Please see the migration guide
    for Rasa Open Source 2.0 for instructions how to migrate your FormActions.

  • #250: Removed support for the
    rasa_core_sdk python module: use import rasa_sdk syntax instead.

  • #6463: The FormValidation event
    was renamed to LoopInterrupted as part of Rasa Open Source 2.0. Using the
    FormValidation is now deprecated and will be removed in the future.
    Please use LoopInterrupted instead.

Features

  • #238: Added the method
    slots_to_validate to Tracker. This method is helpful
    when using a custom action to validate slots which were extracted by a
    form as shown by the following example.

    from typing import Text, Dict, List, Any
    from rasa_sdk import Action, Tracker
    from rasa_sdk.events import EventType, SlotSet
    from rasa_sdk.types import DomainDict
    from rasa_sdk.executor import CollectingDispatcher
    
    class ValidateSlots(Action):
        def name(self) -> Text:
            return "validate_your_form"
    
        def run(
            self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: DomainDict
        ) -> List[EventType]:
            extracted_slots: Dict[Text, Any] = tracker.slots_to_validate()
    
            validation_events = []
    
            for slot_name, slot_value in extracted_slots.items():
                # Check if slot is valid.
                if self.is_valid(slot_value):
                    validation_events.append(SlotSet(slot_name, slot_value))
                else:
                    # Return a `SlotSet` event with value `None` to indicate that this
                    # slot still needs to be filled.
                    validation_events.append(SlotSet(slot_name, None))
    
            return validation_events
    
        def is_valid(self, slot_value: Any) -> bool:
            # Implementation of the validate function.
          return True

    Please note that tracker.form_slots_to_validate only works with Rasa Open Source 2.

Improvements

  • #239: Validate user input during
    form activation even if there is an action in between.

  • #246: Rasa Open Source 2.0 renamed
    the Form event to ActiveLoop. The ActiveLoop
    event was added to the SDK and support for the active_loop field in JSON payloads
    was added.

  • #267: The actions package
    in a Rasa project may contain multiple files containing custom
    action code. The Rasa SDK Docker container now loads the entire actions package.

  • #288: Add the FormValidationAction
    abstract class that can be used to validate slots which were extracted by a Form.

    Example:

    from typing import Text, Any, Dict
    from rasa_sdk import FormValidationAction, Tracker
    from rasa_sdk.types import DomainDict
    from rasa_sdk.executor import CollectingDispatcher
    
    class MyFormValidationAction(FormValidationAction):
        def name(self) -> Text:
            return "some_form"
    
        def validate_slot1(
            self,
            slot_value: Any,
            dispatcher: "CollectingDispatcher",
            tracker: "Tracker",
            domain: "DomainDict",
        ) -> Dict[Text, Any]:
            if slot_value == "correct_value":
                return {
                    "slot1": "validated_value",
                }
            return {
                "slot1": None,
            }
  • #6463: Added support for the
    LoopInterrupted event.

Bugfixes

  • #280: tracker.applied_events
    now correctly deals with restart, undo, and rewind events

Miscellaneous internal changes

refs/tags/1.10.3: 1.10.3

23 Sep 13:10
03d0981
Compare
Choose a tag to compare
next micro release

2.0.0a3

31 Aug 14:31
945a97b
Compare
Choose a tag to compare
next release

2.0.0a2

14 Aug 16:18
Compare
Choose a tag to compare
next release

2.0.0a1: Merge pull request #235 from RasaHQ/1.10.x-merge

13 Jul 14:36
6514a8a
Compare
Choose a tag to compare

refs/tags/0.10.2: Merge pull request #224 from RasaHQ/dependabot-pip-flake8-3.8.2

25 Jun 15:27
e8a4e55
Compare
Choose a tag to compare

refs/tags/1.10.1: Merge pull request #213 from RasaHQ/prepare-release-1.10.1

11 May 16:14
f634046
Compare
Choose a tag to compare