# General about Response Selection depth and Multiple Intents

**URL:** <https://forum.rasa.com/t/general-about-response-selection-depth-and-multiple-intents/41889>\
**Category:** Rasa Open Source\
**Created:** [March 30, 2021, 2:56pm UTC](https://forum.rasa.com/t/general-about-response-selection-depth-and-multiple-intents/41889 "2021-03-30T14:56:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![steinnhauser](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@steinnhauser](https://forum.rasa.com/u/steinnhauser)\
**Post date:** [March 30, 2021, 2:56pm UTC](https://forum.rasa.com/t/general-about-response-selection-depth-and-multiple-intents/41889/1 "2021-03-30T14:56:49Z")

</div>

Our team is working on developing a realistic conversational chatbot with Rasa and we’ve explored [retrieval intents](https://rasa.com/docs/rasa/chitchat-faqs/) and [multi-intents](https://blog.rasa.com/how-to-handle-multiple-intents-per-input-using-rasa-nlu-tensorflow-pipeline/) as methods to generate appropriate responses. I have two questions about these two methodologies:

1. Is it possible to have embedded intents in the Retrieval Intent classification? For example, a user input of `weather is nice` could be classified as `introduction/chitchat/weather`.

2. Could retrieval intent / response selection possibly be connected with multi-intent classification? For example, a user input of `Weather is nice. Do you like movies?` could be classified as `chitchat/weather + chitchat/movies`

---

<div class="post-metadata">

**Author:** ![SamS](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sams/32/3497_2.png) [@SamS](https://forum.rasa.com/u/SamS)\
**Post date:** [March 31, 2021, 8:43am UTC](https://forum.rasa.com/t/general-about-response-selection-depth-and-multiple-intents/41889/2 "2021-03-31T08:43:12Z")

</div>

Hi @steinnhauser, good questions! I’ll try to answer with regards to the current state of Rasa but bear in mind that this is an open-source project, so you might be able to achieve more by changing the code 😉

1. Multi-level intent hierarchy isn’t currently supported. This is partly because the current retrieval intents aren’t meant to create real intent hierarchy – while they enable more granular choice of response, Rasa Core doesn’t take the subintent (the response key) into account when making further predictions (hence your stories/rules [will look like `chitchat > utter_chitchat`](https://rasa.com/docs/rasa/chitchat-faqs/#3-creating-rules), i.e. omitting the subintents).

2. I believe this is currently possible, though it’s one of the edge cases that aren’t properly documented. The syntax would be `chitchat/weather+movies`. Under the hood, intent splitting works like this: Intents `weather` and `weather+movies` are treated as separate intents. (Hence, for an intent like `chitchat/weather+movies` you’ll need to define a separate response.) However, the `weather+movies` gets split into multiple words and since it has a shared word with the `weather` intent, `DIET` should learn that the intents are somewhat similar. And in the case of response keys, `ResponseSelector` should learn this too, since it uses `DIET` internally. Hence, I think that you should be safe to combine multi-intent with retrieval intents. Of course, bearing in mind the pitfalls of the multi-intent approach: The model needs enough data to learn the similarity between intents, and the model can’t predict any intent combination that it hasn’t seen during training.

Let me know how it goes, I’m really curious. Your work could also help us improve the docs 🙂

---

<div class="post-metadata">

**Author:** ![steinnhauser](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@steinnhauser](https://forum.rasa.com/u/steinnhauser)\
**Post date:** [March 31, 2021, 10:32am UTC](https://forum.rasa.com/t/general-about-response-selection-depth-and-multiple-intents/41889/3 "2021-03-31T10:32:44Z")

</div>

Thanks for your response! The second seems to be possible, though navigating how it can be done is tricky. I’ve managed it with the following configuration:

Domain:

```auto
intents:
 - chitchat

responses:
 utter_chitchat/weather+movies
  - text: Weather is nice indeed. Yes movies are great.

```

with rules:

```auto
rules:
 - rule: chitchatting
  steps:
   - intent: chitchat
   - action: utter_chitchat

```

and nlu:

```auto
nlu:
- intent: chitchat/weather+movies
  examples: |
    - Weather is nice. Do you like movies?

```

I think the main confusion for me came from the way multi-intents are declared, and how this should be extended using sub-intents. With a normal multi-intent, one would typically need to declare the combination `intent1+intent2` in the `intents:` section of `domain`, but the ResponseSelector class seems to pick up on these combinations without needing implicit declaration.

---

<div class="post-metadata">

**Author:** ![SamS](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sams/32/3497_2.png) [@SamS](https://forum.rasa.com/u/SamS)\
**Post date:** [March 31, 2021, 10:47am UTC](https://forum.rasa.com/t/general-about-response-selection-depth-and-multiple-intents/41889/4 "2021-03-31T10:47:49Z")

</div>

I’m glad that you’ve managed to make it work; the example looks very sensible to me. And yes, I agree that finding out how it should be done isn’t the easiest…

As for listing intents in the domain: Strictly speaking, that’s only needed for Rasa Core. Rasa NLU doesn’t need all the intents listed because it infers them from the NLU training examples. And when it comes to retrieval intents, there’s no need to list the various response key cases (e.g. `weather`, `movies`, etc.) in the domain, since the keys don’t matter at all to Rasa Core (I hope this is reasonably clear from the docs) – hence, no need to list multiple response keys (e.g. `weather+movies`) in the domain either.

---

<div class="post-metadata">

**Author:** ![steinnhauser](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@steinnhauser](https://forum.rasa.com/u/steinnhauser)\
**Post date:** [March 31, 2021, 1:12pm UTC](https://forum.rasa.com/t/general-about-response-selection-depth-and-multiple-intents/41889/5 "2021-03-31T13:12:52Z")

</div>

Oh good, `weather+movies` does not need to be listed in the domain. I think what lead me to believe so was the following warning from the interpreter:

```auto
UserWarning: Interpreter parsed an intent 'weather+movies' 
which is not defined in the domain. Please make sure all 
intents are listed in the domain.
  More info at https://rasa.com/docs/rasa/domain

```

seems this warning is just from rasa core, and that multi-intent classification is working well. Project structure is much cleaner now, thanks! 🎊
