Natural Language Understanding topic discovery logic in Virtual Agent

  • Release version: Washingtondc
  • Updated February 1, 2024
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Natural Language Understanding Topic Discovery Logic in Virtual Agent

    This section provides insights into how ServiceNow's Virtual Agent utilizes Natural Language Understanding (NLU) to discover and return relevant topics based on user intents. Understanding this logic enhances the effectiveness of conversational interfaces in addressing user queries.

    Show full answer Show less

    Prerequisites for Topic Discovery

    • The topic must be published and active in the Topics [syscstopic] table with the Active, Published, and Is Topic Discoverable values set to true.
    • The topic must be discoverable and have conditions that evaluate to true at runtime.
    • If there are roles configured for the topic, the requestor must possess at least one of those roles.
    • The topic's NLU model must correspond with the session language.

    NLU Topic Discovery Logic

    Virtual Agent sends a prediction request to the NLU provider containing the user's utterance and registered NLU model IDs. The system processes the response to:

    • Automatically select a topic based on confidence scores.
    • Prompt the user to choose from a list of matches.
    • Fallback to keyword searches if no matches are found and backup keywords are enabled.

    Virtual Agent NLU Confidence Scores

    Confidence scores determine how intents are matched:

    • Auto-selects the highest predicted intent when there is a clear match or tie.
    • Returns a list of topics for user selection when auto-selection is not applicable.
    • Falls back to keyword searches if no intents meet the confidence threshold.

    Mid-Topic NLU Discovery Logic

    During an ongoing conversation, users can shift topics by entering new utterances. The system recognizes this change and issues a new NLU prediction request, allowing the conversation to switch to a relevant topic based on the new input.

    Related Reference

    For troubleshooting NLU topic discovery issues, refer to the guide on resolving such problems.

    Understand how Virtual Agent returns intents and how it selects which intents to show to the user.

    Prerequisites for topic discovery

    Virtual Agent can discover a topic when the following conditions are met:
    • The topic must be published and active.

      In the Topics [sys_cs_topic] table, the Active, Published, and Is Topic Discoverable values are set to true.

      Note:
      The Is Topic Visible column does not affect topic discovery.
    • The topic must be discoverable.
    • Topic conditions must evaluate to true at runtime.
    • If any roles are configured for the topic, the requestor must have at least one of those roles.
    • The topic's NLU model must have a binding for the session language.

    NLU topic discovery logic

    Virtual Agent sends a prediction request to the NLU provider. The request contains the utterance and all registered NLU model IDs that are bound to the session language. Matches return NLU intents that correspond with a topic. Virtual Agent then responds in one of the following ways:
    • Automatically selects a topic for the requester, based on the confidence score.
    • Prompts the requester to pick a topic from the returned list of matches.
    • Finds no matching topics.

    If no matches are found but backup keywords are enabled (the com.glide.cs.nlu.keywords.enabled property is true), Virtual Agent searches for a topic based on keywords.

    Figure 1. Virtual Agent topic discovery logic
    Topic discovery flow chart showing the process Virtual Agent uses to deliver a topic to the user.

    Virtual Agent NLU confidence scores

    Virtual Agent uses confidence scores to return predicted intents. If an intent's confidence score is greater than or equal to the configured threshold, Virtual Agent considers it a good match. The confidence threshold is set using the com.glide.cs.intent_confidence_threshold system property.

    Virtual Agent uses the following logic when selecting intents:
    Auto-selects the highest predicted intent
    This occurs when only one intent is matched, or in the event of a tie-breaker, when the next closest match is a distant second.
    Note:
    If ServiceNow NLU is used and the com.glide.cs.intent_confidence_delta system property is 0, there can be no tiebreaker.
    Returns a topic list for the requester to choose from
    This occurs if auto-select is not applicable. The length of the list is determined by the com.glide.cs.max_number_display_topics system property.
    No intents are matched
    When zero NLU Intents are predicted with a confidence score greater than or equal to the configured threshold, Virtual Agent falls back to a keyword search if configured. (The com.glide.cs.nlu.keywords.enabled and com.glide.cs.nlu.keywords.include_topics_bound_to_lang system properties are true).

    Mid-topic NLU topic discovery logic

    While a topic is running, the requester can enter an utterance or phrase that results in a topic switch. For example:

    1. The requester is in a Virtual Agent conversation, and Topic A is running.
    2. Topic A prompts the user to enter their date of birth.
    3. Instead of choosing a date, the requester types, "I want to view my Incidents."
    4. Virtual Agent can't resolve this phrase to a date, so it issues an NLU prediction request.
    5. The NLU predictor returns Intent B, and Virtual Agent sees that Topic B is bound to Intent B.
    6. Virtual Agent switches the conversation to Topic B, which then presents information to the requester about their incidents.
    Figure 2. Virtual Agent mid-topic discovery logic
    Topic discovery flow chart that shows the process Virtual Agent uses to change topics in the middle of a conversation.