Fill Slot in Form With Free Text in Rasa 3.0

Hi.

I am trying to build a small form that requests a slot ‘search_string’, and I want this slot to take free text from the user.

The only examples of this that I have seen were in Rasa 2.x, and the docs of Forms in Rasa 3.x no longer has from_text mentioned in them.

Does anyone have a complete example of filling a slot with free text in Rasa 3.x? Thanks in advance for the help!

It still does! Here it is :slight_smile:

https://rasa.com/docs/rasa/domain/#from_text

Hi @ChrisRahme, thank you very much for your reply!

I did not realise it moved from the Forms section to the Domain section - thank you for pointing that out to me :slight_smile: .

How would I implement this in a form? For example, my current form looks like:

- rule: Activate search_string form
  steps:
  - intent: search_internet
  - action: search_string_form
  - active_loop: search_string_form

- rule: Submit form
  condition:
  - active_loop: search_string_form
  steps:
  - action: search_string_form
  - active_loop: null
  - slot_was_set:
    - requested_slot: null
  - action: action_search_internet

Thanks so much for your help.

1 Like

From the docs:

entities:
- search_string
- number

slots:
  cuisine:
    type: text
    mappings:
    - type: from_text
      not_intent: stop

forms:
  search_string_form:
    required_slots:
        - search_string
1 Like

Thanks again @ChrisRahme.

Sorry for the confusion, but why would we have type: custom, and not type: from_text? And how would you write the form in rules/stories.yml?

Apologies for all these questions!

Oops, that’s a mistake from my side! Fixed it now :slight_smile:

Exactly as you did it :slight_smile: Again, all mentioned in the docs:


No worries man, that’s what the forum is for :slight_smile:

1 Like

Hi @ChrisRahme, got it, makes sense!

I really appreciate your help, thanks again!

1 Like