Confused about documentation about how external NLU should communicate with DM

Hi,

I am confused by a piece of documentation and want to know:

(a) is this a mistake in the documentation and is my suggested correction appropriate? (b) if it is not a mistake can someone please clarify my confusion?

So, here is the specific issue:

If you go here: Rasa Open Source Documentation

You will see in the example to the right of the screen that this is an example of a the payload of request going from the DM to the NLU server:

{

  • “text”: “Hello, I am Rasa!”,
  • “message_id”: “b2831e73-1407-4ba0-a861-0f30a42a2a5a” }

Right below that (also on the right), under ‘Request Samples’ one sees an example of what the NLU should send back to the DM. In that json, the “text” field has this value: “Hello”.

If the input is “Hello, I am Rasa!” then the value of the text field should be exactly the same, i.e. “Hello, I am Rasa!”.

I thought that the request going from the DM to the NLU would be something the user says. E.g. “Hello”. Only a deranged or malicious user would say “Hello, I am Rasa”. Right?

In sum,

(a) the “text” in the post going from the DM to the NLU service must match the text in the Response Sample.
(b) the best way to fix this problem would be change “Hello, I am Rasa” in the request sample JSON to “Hello”.

Can someone confirm or deny that I am correct here? And if I am incorrect can you explain what I am misunderstanding?

@Tester01 Interesting question and let me clear your doubt, Firstly, this document is used for APIs (OpenAPI) i.e

The Rasa server provides endpoints to retrieve trackers of conversations as well as endpoints to modify them. Additionally, endpoints for training and testing models are provided.

All this you can check using Postman (https://www.postman.com) for that you need to create an account and login.

Here, the text is the user enter such as Hi, Hello, Hey then as per training example in nlu.yml under intent: greet it will check “Predicts the intent and entities of the message posted to this endpoint.” it will check the intent and then check the utterance i.e utter_greet and with its corresponding response, in here its is " Hello, I am Rasa!". API’s only have the raw data in Key-Value pairs i.e JSON format.

If you see the Response Sample, you will see the while clicking on the + sign, as there is not entities, only intents so here he will show you intent with the confidence value (matching value) i.e greet and 0.6323 and the input text enter by user is Hello!

If the response return successful then the status will be 200 else check response what its means 400 , 401, 403, and 500

this one is the automatic generated message id for the conversation, if you run the rasa shell --debug or you are using socket IO or even rasa X you will see this message id associated with every session. Same goes with other Unload the trained model | Domain etc

PS: I would just recommend to check your code, its flow and then see this, you will be able to understand everything by your own.

If you still have any issue please, let us know. I hope I answer and clear your doubt :slight_smile:

Hi, @nik202 thanks for your reply.

Hrm. I am still confused. To help clarify, let’s get down to basics, to make sure we are “on the same page”.

Do you agree with the following:

The documentation I am referring to, i.e. this:

https://rasa.com/docs/rasa/pages/http-api#operation/predictConversationAction

This piece of the documentation is trying to explain how the dialog manager communicates with an NLU server whether that NLU server is a Rasa component or some non-Rasa NLU system. Question 1: Do you agree or disagree?

There are two examples associated with this piece of documentation. The first example is titled " Request samples". The second example is titled " Response samples".

Question 2: Do you agree or disagree?

@Tester01 All, which is mentioned on the doc is 100% correct, its a generic process POST and GET request / response, while using API we POST (request) or ping to the server using HTTP and as a response we get the GET response.

For example: We post are mail to a particular address, and expecting the replies from that person, if he/shhe reply, he/she will send us the mail back as a response of our message, same is happening here.

Still any doubt, please discuss till you not get it, even if you want I can explain you with online assistance :slight_smile:

@ChrisRahme I wondered if you might have any thoughts on my question above.

I’m with Nik on that one… I’m not sure what’s the problem here.

“Hello, I am Rasa!” is just an example.

What if the user’s name really is Rasa? What if his name is something close to Rasa? Why does this even matter? The user could say anything and you cannot do anything about it. You should properly build a bot to handle new, unexpected, and even incomprehensible inputs.

Thanks @ChrisRahme for chiming in here.

Yes, I completely agree that the user should be able to say anything they want to the system. Indeed, they might might say “Hello, I am Rasa”, “Howdie”, “Hi my name’s Bob”, “What’s the weather in Peoria”, “2 + 2 = 52”, etc etc.

But my issue is not really about that. My issue is that I believe the documentation at At Rasa Open Source Documentation is inconsistent. (In other words it is wrong).

This part of the documentation is about how one can post a message to Rasa NLU and get a response from Rasa NLU. It is not about the DM in any way shape or form. Like it says in the docs “This will just retrieve the NLU parse results.”.

Are you with me?

Next, look at the Request Sample. Can you see what the value in the “text” is in in the request sample? (You will see that the value is “Hello, I am Rasa”…right?).

The Rasa NLU service – which is what this part of the API documentation is about – can used by developers in the following way: The developers code can post a message to NLU. That message should contain what the human user just said. In the Response Sample, the authors are showing a situation in which the human user said “Hello, I am Rasa”.

Now, look at “Response samples”. These response samples are supposed to be what is returned by the Rasa NLU standalone service. It should return intents and other data…Just natural language understanding is happening here…Nothing more - no DM, no actions etc (just like the documentation says).

Now, as you can see in the example, the intent returned by the NLU is “greet”. That seems right. (If someone says “Hello I am Rasa”, or “Hello”, or “Hi I’m Bob” etc, all of these are extremely likely to be “greet” intents).

Hopefully you are still strongly agreeing with what I am saying so far. Are you?

However, look at the value in the “text” field in the Response Sample. That value should precisely match character to character what is said in the Request Sample.

Unfortunately, that value does not precisely match what is said in the Request Sample. Thus the documentation is inconsistent or wrong - it is a small typo. It says “Hello!”. But it should not say “Hello!”. It should say “Hello, I am Rasa” because that is what was originally passed into the NLU mode in the Request Sample.

The “text” field in the request indicates what was passed into the NLU. And the “text” field in the response indicates the same thing, i.e. what was passed into the NLU as input.

Do you agree? If you do not agree where is the error in my logic? I you could please help me understand what I am misunderstanding about the documentation or about how Rasa is supposed to work.

1 Like

Ah I see! Good eye :slight_smile:

Maybe open an issue on GitHub for that, since it is more suitable than the forum for bug reports and things like that.

1 Like

Okay, thanks @ChrisRahme … I wanted another pair of eyes to verify before I did the GitHub report.

1 Like