Free text type for slot

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?

hi @r4sn4! did you find a good solution for your issue of free-text? i am facing a similar issue and the core expects my free text to belong in an intent.

Please share your experience.Thanks in advance! :slight_smile:

Hi guys, is there a solution to this problem ? i’m facing a similar issue.

Thanks for all :slight_smile:


EDIT : found my solution → How to input free text with custom actions & slots

hi @akelad …what if I have to ask the following questions , all of them are free text 1)what is the name of the story 2)what is the name of the project 3)what is the name of the lead

I want to capture these free text and send to one single action where API call is performed on these 3. How to capture them.

anyone knows if this was implemented and released?

Hi Is this issue fixed by new feature that allow free or random text to be capture in slot without specifying intent. I tried to implement with some intent having specific prefix but it again requires entire example w/ prefix. Why can’t it consider some prefix or suffix word as identifier or indicator for specific intent w/ some random or free text?

e.g.
entities -generic_query

and

intent generic_query_inform: examples | query=[ xxxxxx ] ( generic_query ) ?

so when bot utter (utter_ask_generic_query) either through form slot then with above example when i enter below text with some prefix (i.e. here query=) ideally classify it to <generic_query_inform> intent but it does not.

query=who is the CEO of Apple?

any idea, whether this feature or bug fix still in progress or there is any workaround like some regEx w/ or w/o prefix/suffix can help to classify free or random text to some intent and capture that into slot.

This can be achieved in forms by using code snippet for example:

forms:
  form_name:
     required_slots:
       name:
          type: from_text

if you still face issue let me know

HI All, I need to read a path from user input. Something like /tmp. So my flow is breaking in the stories.yml and actions.py. domain.yml path: type: rasa.shared.core.slots.TextSlot initial_value: null auto_fill: true influence_conversation: true

stories.yml

  • story: create directory steps:
    • intent: request_create_dir
    • action: utter_ask_host
    • intent: my_host entities:
      • host: “etlld0013”
    • slot_was_set:
      • host: “etlld0013”
    • action: utter_ask_dir
    • intent: my_dir entities:
      • dir: “test”
    • slot_was_set:
      • dir: “test”
    • action: utter_ask_path
    • intent: my_path entities:
      • path: “/tmp”
    • slot_was_set:
      • path: “/tmp”

actions.py class ActionCreateSubmit(Action): def name(self) → Text: return “action_create”

def run(
    self,
    dispatcher,
    tracker: Tracker,
    domain: Dict[Text, Any],
) -> List[Dict[Text, Any]]:
    dispatcher.utter_message(template="utter_create_thanks",
                             Host=tracker.get_slot("host"),
                             Directory=tracker.get_slot("dir"),
                             Path=tracker.get_slot("path"))

Hi, don’t validate your slot value in stories instead do it inside custom actions, also why you want to influence conversation?

Hi Dishant…Is it necessary to mentioned intent in case of Slot mapping from_text ?

just if you want to get that intent values

Hello, @Horizon733 I am trying to use forms to fill slots with responses to three questions. I am using Rasa 3 forms and from_text mapping but when the first slot has filled the others are also filled with the same value causing the form to be deactivated. I want after the first slot is filled, the bot asks the second question so on until three questions. Do you know what I am doing wrong? Thanks in advance for your help.

Hi Jonathan, It is possible, there is a way. You can use validate_<slot_name> inside class validate_form_name. On top of that, you can check inside validate_<slot_name> if the pre-filled value is correct or not.

def validate_slot_name(...):
   if slot_value in [something]:
     return {"slot_name": slot_value}
  else:
    return {"requested_slot": "slot_name"}

Like above code

Thanks, @Horizon733 for the response. I also found another solution on Rasa github using conditions. I am using it and works as I expected “requested_slot” makes the magic.

slots:
  topic:
    type: text
    influence_conversation: true
    mappings:
      - type: from_text
        conditions:
          - active_loop: simple_trainning_form
            requested_slot: topic

  meet_with:
    type: text
    influence_conversation: true
    mappings:
      - type: from_text
        conditions:
          - active_loop: simple_trainning_form
            requested_slot: meet_with

Hi, yes it is good like this, but I don’t consider this as solution for every form. Since validation will be needed even after adding conditions