# How to set response in Rasa

**URL:** <https://forum.rasa.com/t/how-to-set-response-in-rasa/50497>\
**Category:** Rasa Open Source\
**Created:** [January 12, 2022, 5:39am UTC](https://forum.rasa.com/t/how-to-set-response-in-rasa/50497 "2022-01-12T05:39:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![samarthsv](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/samarthsv/32/18915_2.png) [@samarthsv](https://forum.rasa.com/u/samarthsv)\
**Post date:** [January 12, 2022, 5:39am UTC](https://forum.rasa.com/t/how-to-set-response-in-rasa/50497/1 "2022-01-12T05:39:01Z")

</div>

I have created a pipeline in rasa which looks like this.

```auto

language: en

pipeline:

  - name: components.data_processing.DataProcessingComponent # preprocess

  - name: components.data_processing.FastAPIComponent

```

The last FastAPIComponent processes the request message and produces the response. **I want to set that response in rasa so that rasa can send that response to the user.**

  

This is the sample response of FastAPIComponent. **It can generate both text and button responses.**

> { ‘intent’: {‘name’: ‘greet’, ‘confidence’: 0.9999999403953552}, ‘entities’: None, ‘response’: [{‘recipientId’: None, ‘text’: “Hey! How are you today?”, ‘buttons’: None}]}

  

Thanks in Advance.

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [January 12, 2022, 5:20pm UTC](https://forum.rasa.com/t/how-to-set-response-in-rasa/50497/2 "2022-01-12T17:20:46Z")

</div>

Why not the FastAPI as a custom action?

---

<div class="post-metadata">

**Author:** ![anoopshrma](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/anoopshrma/32/13349_2.png) [@anoopshrma](https://forum.rasa.com/u/anoopshrma)\
**Post date:** [January 12, 2022, 5:29pm UTC](https://forum.rasa.com/t/how-to-set-response-in-rasa/50497/3 "2022-01-12T17:29:16Z")

</div>

Hi @stephens, you mean to say to call custom action directly from the FastAPI component?

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [January 12, 2022, 5:37pm UTC](https://forum.rasa.com/t/how-to-set-response-in-rasa/50497/4 "2022-01-12T17:37:22Z")

</div>

Write a rule or story:

```auto
- rule: greet
  steps:
  - intent: greet
  - action: action_fastapi_response

```

`action_fastapi_response` is a custom action that calls [dispatcher.utter\_message](https://rasa.com/docs/action-server/sdk-dispatcher/#collectingdispatcher) with your generated response.

---

<div class="post-metadata">

**Author:** ![anoopshrma](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/anoopshrma/32/13349_2.png) [@anoopshrma](https://forum.rasa.com/u/anoopshrma)\
**Post date:** [January 12, 2022, 5:42pm UTC](https://forum.rasa.com/t/how-to-set-response-in-rasa/50497/5 "2022-01-12T17:42:46Z")

</div>

@stephens we have to handle multiple rasa models at once and we do that by using rasa agent in our fastapi application. The fastAPI component interacts with our fastapi application and send us back the final response. So even intent detection takes place there. The above config that you see does

1. Preprocess the text
2. Sends the text to the fastapi server and gets response in return

Now we need to set this response in our rasa , if it was text only we could easily set that, it’s the buttons that we are trying to find out way for.

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [January 12, 2022, 9:56pm UTC](https://forum.rasa.com/t/how-to-set-response-in-rasa/50497/6 "2022-01-12T21:56:29Z")

</div>

ok, but the NLU pipeline is not the place to handle responses.

I don’t fully understand your architecture (wonder why you don’t follow a standard approach with each model hosted by a Rasa instance) but I don’t think your approach fits in well with the Rasa architecture.

NLU and Dialog have always been separate in Rasa. Since you’re doing both in the same component, I’m not sure that Rasa fits well.
