Context
  • 16 May 2024
  • 1 Minute to read
  • PDF

Context

  • PDF

Article summary

Contexts are simple single words that are related to a specific situation, circumstance, concept, etc.

Note:
Use contexts only for the questions and answers, not for replacing slot filling.

Step 1 - Create a context

To create a context, you have two options:

In Workbench:

  1. Click Q&A from the left menu.
  2. Click + at the top right of the page.
  3. Under Contexts, type the context you want to add.
    Note:

    Don't forget to create your questions and answers.

In the Config File:

  • Create context specific to a bot, create (or edit) this file data/bots/<your_bot>/config/qna.json.
  • Create context specific to all bots, create (or edit) this file data/global/config/qna.json.
Best Practice
It's way easier to add a context directly in the Workbench.

Step 2 - Append your Context

To set a context, let's use the appendContext action and add our new context in the contexts field. You can use comma-separated values to pass multiple contexts.

Figure: Append Context

Then append the name of your new contexts to qnaCategories like so:

{
  "$schema""../../../assets/modules/qna/config.schema.json",
  "qnaCategories""global,monkeys,giraffes"
}

Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.