Free text type for slot

I have a slot reminder_subject. This slot accept any random text as user input. I want bot to treat this user message as a value. Is there any way to define type for this slot as Free text in domain.yml.

I have read FormAction but not getting clarity how to implement this use case

My story for this looks like this -

  • set_reminder
    • utter_what_reminder_for
  • set_reminder{“reminder_subject”: “movie with family”}
    • slot{“reminder_subject”: “movie with family”}
    • utter_ask_time
  • time_info{“time”: “2018-09-24T16:00:00.000Z”, “number”: 4.0}
    • slot{“number”: 4.0}
    • slot{“time”: “2018-09-24T16:00:00.000Z”}
    • action_set_reminder

User and bot conversation would look like this -

User: Set reminder

Bot: What is the reminder for?

User: movie with family

Bot: When you want to be reminded?

User: tomorrow at 5 pm

you should do this in a custom_action, there you can grab the whole user message with tracker.latest_message.get('text') and then store it in a slot :slight_smile:

I did the same way… but for this text wrong intent is predicted and so the flow is breaking. This reminder text should not belong to any intent because this is random text that user can ask bot to remind later.

You should have a generic intent called /inform where all this information goes. However, we’re also working on a new verison of the form action where you’ll be able to input free text without paying much attention to the intent. we’ll be merging this in the next few weeks

Now, I have implemented /inform intent for routing random text to this intent. sometimes random text is recognised as reminder_subject and sometimes it is not recognised. How do I make sure that reminder_subject is always detected? Here, reminder_subject is the random text that user want bot remind later.

You can try running the NLU evaluate script and see what intents are getting confused. But a more general solution will be provided with these new forms i described above

@akelad Is the general intent available i the current version?

this is an intent you have to define yourself and provide training data for

How can I prepend text like “to” with tracker.latest_message.get(‘text’) in rasa or Before hitting the api, I want to prepend text with as per requested slots to input text

what do you mean exactly? can you post an example?

@akelad is the form action(in current version of rasa-core) capable of taking free text as slot values for requested slot (incase the intent is detected as inform) or any text.

Curious to know if this has been implemented and released. I am badly waiting for this feature.

Yes to both of your questions: read more in our docs

1 Like

Thanks. Are you referring to from_text() ?

yep

from_text() doesn’t see to be pulling the freetext input of the user after activation of requeststatus_form, do you know what could be the issue?

class IncStatus(FormAction):
"""Check INC Status FormAction"""

def name(self):
    """Unique identifier of the form"""
    return "requeststatus_form"

@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
    """A list of required slots that the form has to fill"""

    return ["requestnum"]

def slot_mappings(self):
    # type: () -> Dict[Text: Union[Dict, List[Dict]]]
    """A dictionary to map required slots to
        - an extracted entity
        - intent: value pairs
        - a whole message
        or a list of them, where a first match will be picked"""

    return {"requestnum": [self.from_text()]}

def submit(self,
           dispatcher: CollectingDispatcher,
           tracker: Tracker,
           domain: Dict[Text, Any]) -> List[Dict]:
    """Define what the form has to do
        after all required slots are filled"""

    # utter submit template
    dispatcher.utter_template('utter_request_status', tracker)
    return []

Story

* greet
    - utter_greet
* request_status
    - requeststatus_form
    - form:{"name": "requeststatus_form"}
    - utter_request_status
* goodbye
    - utter_goodbyes

domain

actions:
- utter_goodbye
- utter_greet
- utter_thanks
- utter_ask_inc
- utter_request_status
entities:
- request
- requestnum
forms:
- requeststatus_form
intents:
- request_status:
    use_entities: false
- greet
- inform
- goodbye
- thanks
slots:
  inc:
    auto_fill: false
    type: unfeaturized
  request:
    type: text
  requested_slot:
    type: unfeaturized
templates:
  utter_ask_requestnum:
  - text: Please provide the incident number in this format (INC000012345678)
  utter_goodbye:
  - text: Talk to you later!
  - text: See ya!
  - text: Bye!
  utter_greet:
  - buttons:
    - payload: Status of Request
      title: Status of Request
    text: "Hey there! Hope you're having a great day, what help do you need today?\
      \ You can pick from the below options:"
  utter_request_status:
  - text: You are trying to check request status of {requestnum}
  utter_thanks:
  - text: My pleasure.
  - text: No Worries!
  - text: Happy to help :)
  - text: Anytime!
  - text: You are welcome!

+1, facing the similar kind of issue. Though am using master from git for rasa-core, instead of taking the user input as it is, nlu is being called. Explained here.

hi @akelad would you be able to help advise on my issue as well? thanks!

Hi, I am also facing the same isse while writing the custom action based on user input. The flow is breaking.

@neslieang could you post the debug logs of your conversation where this happens?