Set entity to specific value?

I’d like to set an entity to a specific value based on the intent wording. For example, an intent for “choose_same_or_different” that has the values “same” and “different”

## intent:choose_same_or_different
- the [same](same_or_diff)
- a [different](same_or_diff) one
- [change](same_or_diff) it please {"same_or_diff": "different"} 

The above code is how I might expect this to work in Rasa.

What is the correct syntax for mapping a user response to a specific entity value?

Thanks, thought this should be pretty obvious, but it’s not!

Hi @kombucha, you can define a synonym for when you want to map the entity to a specific value:

## intent:choose_same_or_different
- the [same](same_or_diff)
- a [different](same_or_diff) one
- [change]("entity": "same_or_diff", "value": "different") it please
1 Like

Thanks for the correct syntax on this. If anyone on the Rasa team could point out where this is in the documentation, I didn’t find it there.

Is that syntax all that is needed, or does it also need to be defined as a synonym in a separate block or synonyms.yml** file?

**(NB. training files will be yaml in Rasa 2.0, not markdown.)

Hi @kombucha, we have documentation on synonym definitions here and this syntax is all that is needed for this case.

Defining a separate block is useful for handling multiple cases so you don’t have to include the above syntax for every message that uses a synonym:

- intent: choose_same_or_different
  examples:  |
    - the [same](same_or_diff)
    - a [different](same_or_diff) one
    - [change](same_or_diff) it please

- synonym: different
  examples: |
    - change
    - changes
    - altered
    - ...
1 Like

A related basic question which I am frustratingly not able to find in in Rasa docs– what is the syntax to merely check if a slot is filled? That is, has any value, and not any particular value? (When not using a form.) TIA

@kombucha You would need to define the slot to influence the conversation and then you can condition on it in your training stores like this.

Oh that looks really straight forward! Thanks Ben!

Does Rasa have actual API documentation for stories? Ie. where something like this (slot_is_set) is listed as a possible value?

Also for anyone finding this thread who isn’t familiar with 2.0 (which is still in Beta), influence_conversation is used where you would use unfeaturized in 1.x (ttbomk).