Mizlul
Mizlul

Reputation: 2290

How to detect Intent by context and not query input in Dialogflow

I am desperately looking for a solution for how to detect an intent not only based by the user input, let say by context.

I have a case where I would like the user to leave a question and once the question is sent a specific Intent to response.

Now the problem is you never know the user input as it is a question that cannot be predicted.

So how do i go fixing this? I already wrote some code that would pass a context but this does not seem to work at all.

var query = req.body.query;
    const request = {
      session: sessionPath,
      queryInput: {
        text: {
          text: query,
          languageCode: 'en-US',
        },
      },
      queryParams: {
      contexts: [
          {
            "name": "projects/lakiklinikka/agent/sessions/xx/contexts/question-followup",
            "lifespanCount": 5,
            "parameters": {
              "key": "test value"
            }
          }
        ]
      }
    };

Upvotes: 0

Views: 1088

Answers (1)

Todd Morrill
Todd Morrill

Reputation: 11

You're looking for fallback intents.

Fallback intents are a catch-all intent to manage the state of the conversation. When you have an intent that you don't want to provide training examples for, you use a fallback intent. The interesting thing is they provide the option of providing negative examples. The idea is that you don't want other intents to fire at the point in the conversation where you use the fallback intent.

You can modify the default fallback intent that your agent has OOTB or define follow-up (i.e. sub-intents) fallback intents.

Upvotes: 1

Related Questions