LogoLogo
  • About Hala.ai
  • Getting started with Hala
  • Hala Web Chat
  • Hala Platform
  • Platform Key concepts
    • Dashboard
      • Skills usage and chat history
    • User Management
    • Skills Kit
      • Dialog nodes
      • Conditions
      • Actions
      • Context
      • Output
        • Text
        • Text random
        • Quick reply
        • Video
        • Images
        • Forms
        • Tables (beta)
      • Behavior
    • Intents
    • Entities
    • Pre-built content
    • Context variables
    • Integrations
      • SAP (via Web Services)
      • ServiceNow
      • REST API
    • Actions
      • SAP (via Web Services)
      • ServiceNow
      • REST API
  • How to
    • Create a simple skill
    • Create a more complex skill
    • Create skill for SAP
    • Create skill for ServiceNow
    • Create the weather skill
    • Create skill with forms
  • help
    • Changelog
    • Support
    • Service Plan
  • reference
    • Articles
      • How AI empower sustainable growth of the organizations
      • How the Conversational AI Analytics will transform the business
      • Digital Skills as a Service (DSaaS)
      • Emerging Technologies and Enterprise Software
      • Identify the potential for automation
      • Few reasons to empower your ERP with Digital Assistant
      • AI Technology VS Value
      • SAP AMS Market Overview
Powered by GitBook
On this page
  • Overview
  • Example
  • Adding the context variables
  • Reasons for adding the context variables
  • The lifetime of the context variables

Was this helpful?

  1. Platform Key concepts
  2. Skills Kit

Context

Last updated: 25.10.2019

PreviousActionsNextOutput

Last updated 5 years ago

Was this helpful?

Overview

A context variable is a variable that you define in a node. You can specify a default context variable values in the root node, or you can create the context variables during the conversation with the user. Those context variables can be in use in any dialog nodes of the skill.

Basically the context variable is the information or values that you want to keep and reuse during the conversation.

You also can use context variables as a condition for triggering the nodes.

Example

If you have added the Action into the dialog node, most probably, you would need to send some parameters to an external application via Action.

To make this happen, at first, you need to create a context variable and store the value in it. Then you can use the created context variable in the Action parameters.

For example, you have a skill Get weather forecast. You also have created the integration with weather services and created the action with one parameter to send. This parameter is query. Now you need to get information from the user regarding the city for which we need to provide the weather forecast.

The user input is, in Tallinn. If your entity.city entity recognizes Tallinn, then Hala stores Tallinn in the context_variable_city context variable. You can do this by using next format:

So now we need to specify the context variable context_variable_city in the Action parameters for getting the weather forecast for city Tallinn.

In other words, if you need to store the value from the conversation with the users for some purposes, you need to use the context section. In our example, we wanted to store the Tallinn and then send this value to the external application.

Adding the context variables

Option 1. To store the full user input that was provided by the user, use input.text:

For example, the user input is, I have a problem with the printer. If the node output is, Problem description: {{context.full_user_input}}, then the user will see the next Problem description: I have a problem with the printer.

Option 2. To store the value of an entity in a context variable, use this syntax:

For example, the user input is, The status is urgent. If your entity.status entity recognizes urgent, then Hala stores urgent in the context.incident_status context variable.

Option 3. To store the hardcoded value into the context variable, use this syntax:

In some cases, you would specify some default values for the context variables. With this option, you can do so and then reuse this context variable in your skill logic.

Option 4. To store the API response into the context variable, use next option:

When you are adding the action into the dialog node, you need to specify the "Action response" where the response from the API will be stored.

Reasons for adding the context variables

  • You can use the context variables in the output for building the conversation with the users.

  • You can use the context variables for specifying the conditions for triggering the nodes.

  • If you want to add the Actions and make the API calls to the external application, you must store the context variables and then specify them in the parameters for the Action. The context variables include the information that will be sent to the external application.

The lifetime of the context variables

The context variables lifetime is equal to the time of the processing of one skill. In other words, if the user starts the conversation and triggered one Skill, during the conversation in that skill, the created context variables will exist, but if the user jumps to another Skill, all the context variables that were created during the previous Skill will be deleted.

If you want to know how to access the context variable from the API, please go to this section

Actions.
Context variables