github RasaHQ/rasa-sdk 2.1.0

latest releases: 3.8.0, 3.8.0rc2, 3.8.0rc1...
3 years ago

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.

Don't miss a new rasa-sdk release

NewReleases is sending notifications on new releases.