# Set entity to specific value?

**URL:** <https://forum.rasa.com/t/set-entity-to-specific-value/36076>\
**Category:** Rasa Open Source\
**Created:** [October 19, 2020, 10:47pm UTC](https://forum.rasa.com/t/set-entity-to-specific-value/36076 "2020-10-19T22:47:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kombucha](https://avatars.discourse-cdn.com/v4/letter/k/da6949/32.png) [@kombucha](https://forum.rasa.com/u/kombucha)\
**Post date:** [October 19, 2020, 10:47pm UTC](https://forum.rasa.com/t/set-entity-to-specific-value/36076/1 "2020-10-19T22:47:49Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![b-quachtran](https://avatars.discourse-cdn.com/v4/letter/b/c67d28/32.png) [@b-quachtran](https://forum.rasa.com/u/b-quachtran)\
**Post date:** [October 20, 2020, 9:07pm UTC](https://forum.rasa.com/t/set-entity-to-specific-value/36076/2 "2020-10-20T21:07:14Z")

</div>

Hi @kombucha, you can define a [synonym](https://rasa.com/docs/rasa/training-data-format#synonyms) for when you want to map the entity to a specific value:

```auto
## 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

```

---

<div class="post-metadata">

**Author:** ![kombucha](https://avatars.discourse-cdn.com/v4/letter/k/da6949/32.png) [@kombucha](https://forum.rasa.com/u/kombucha)\
**Post date:** [October 20, 2020, 9:12pm UTC](https://forum.rasa.com/t/set-entity-to-specific-value/36076/4 "2020-10-20T21:12:49Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![b-quachtran](https://avatars.discourse-cdn.com/v4/letter/b/c67d28/32.png) [@b-quachtran](https://forum.rasa.com/u/b-quachtran)\
**Post date:** [October 20, 2020, 9:24pm UTC](https://forum.rasa.com/t/set-entity-to-specific-value/36076/5 "2020-10-20T21:24:01Z")

</div>

Hi @kombucha, we have documentation on synonym definitions [here](https://rasa.com/docs/rasa/training-data-format#synonyms) 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:

```auto
- 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
    - ...
```

---

<div class="post-metadata">

**Author:** ![kombucha](https://avatars.discourse-cdn.com/v4/letter/k/da6949/32.png) [@kombucha](https://forum.rasa.com/u/kombucha)\
**Post date:** [October 21, 2020, 12:24am UTC](https://forum.rasa.com/t/set-entity-to-specific-value/36076/6 "2020-10-21T00:24:52Z")

</div>

A related basic question which I am frustratingly not able to find in in [Rasa docs](https://rasa.com/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

---

<div class="post-metadata">

**Author:** ![b-quachtran](https://avatars.discourse-cdn.com/v4/letter/b/c67d28/32.png) [@b-quachtran](https://forum.rasa.com/u/b-quachtran)\
**Post date:** [October 22, 2020, 11:01pm UTC](https://forum.rasa.com/t/set-entity-to-specific-value/36076/7 "2020-10-22T23:01:57Z")

</div>

@kombucha You would need to [define the slot to influence the conversation](https://rasa.com/docs/rasa/domain#slots-and-conversation-behavior) and then you can condition on it in your training stores like [this](https://rasa.com/docs/rasa/stories#slot-events).

---

<div class="post-metadata">

**Author:** ![kombucha](https://avatars.discourse-cdn.com/v4/letter/k/da6949/32.png) [@kombucha](https://forum.rasa.com/u/kombucha)\
**Post date:** [October 23, 2020, 4:57am UTC](https://forum.rasa.com/t/set-entity-to-specific-value/36076/8 "2020-10-23T04:57:49Z")

</div>

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).
