Share via


Use generative answers in your voice-enabled agents

When you create a voice-enabled agent, it automatically supports the addition of knowledge for generative answers. The voice-enabled agent formats text-to-speech (TTS) output, based on generative answers.

Informing users that responses were AI generated

When you incorporate generative answers into your voice-enabled agent, it's important to inform your users of the following:

  • AI is being used to generate responses.

  • Users can consult the references used by your agent to generate responses.

  • Users must verify the accuracy of the generated responses themselves.

Note

For more information, see FAQ for generative answers.

The following sample messages are returned to users when incorporating generative answers messages in a voice-enabled agent.

Type of message Description Example
AI disclaimer Message to inform the user that AI might have been used, and that the user should verify the information in the message. "Please note that some responses are generated by AI and might require verification for accuracy.
Latency message Message to inform the user to hold while information is retrieved. "Please hold while I gather information. <break time="5000ms"/>"
Note that the latency message loops, so timeouts should be adjusted.
Apology message Message to apologize to the user if no answer was found. "I'm sorry, I don't have the knowledge to answer at this time."
Hear references Message to inform the user that they can hear a list of the references used by the AI. "This response was used by AI and might be incorrect. To hear the references that were consulted, please press 9. To return to the main menu, press star."
Barge-in message Message to inform the user that they can skip listening to references. "The following references were consulted. Press star at any time to return to the main menu."

Setup generative answers in your voice-enabled agent

  1. Configure your agent to support voice capabilities.

  2. Provide your agent with a minimum of one knowledge source.

  3. Optionally, configure content moderation.

  4. Test your responses. The received answers should be concise, follow the same language as the input query, and be free of incorrect information. Citations and sources should be stripped from the response.

Access citations and sources from responses

By default, citations and sources are automatically stripped from responses. However, makers can retrieve the stripped citations and sources using the Conversational boosting system topic.

Update the Conversational boosting system topic

  1. Select your agent and select the Topics page.

  2. Select the Conversational boosting system topic.

  3. Select the Create generative answers node, select the More icon () of the node, and then select Properties.

  4. Select Advanced and set Save LLM response to Complete (recommended), and Save bot response to the Answer Topic.Answer variable.

  5. Assign the Answer.Speech.Citations table variable to a global variable, such as GenAnsVoiceRef.

  6. Add a Message node that instructs the caller how to hear the citations, such as, "This response was generated by AI and might be incorrect. To hear the references, please press 9. To return to the main menu, press *."

    1. Optionally, update the knowledge sources, content moderation, and other properties of the generative answers node.

    2. Optionally, configure a latency message for generative answers, or reference a publicly accessible audio file with speech synthesis markup language (SSML) to be played to cover the latency.

Create a topic to output the citation

A topic containing one or more of the following nodes is used to capture and output citations referenced by the agent.

  • The Trigger node is inserted by default. Select DTMF global command received as the trigger type, and set the DTMF Key property to 9.

  • Message nodes are used to inform users either that a reference was used, or the agent was unable to use a reference to generate a response. These responses could be either of the following messages:

    • "The following reference was consulted. Press * at any point to return to the main menu."

    • "No specific references were used to generate the previous answer."

  • Condition nodes are set to branch the dialog based on the user's responses. In the left branch, these are the conditions met when the user asks a question that utilizes a reference.

    • The left branch of the conditions are used when the first condition sets the global variable set in the previous steps. For example, Global.GenAnsVoiceRef. Set the variable to has value. This branch is also followed by another Message node. Here a Reference.Name variable is inserted, followed by "consulted at", and another variable, Reference.Url, is added.

    • The right branch of the conditions are used when the user's questions aren't answered or a reference isn't used to return a response. A Message node follows, with a message such as, "No specific references were used to generate the previous answer."

  • A Set a variable value node flows under the left branch of the condition node. The first variable is set to Create Variable name and set to NumReferences. The To value is set to a formula: Count Rows(Global.GenAnsVoiceRef). The Type is set number, and Reference is set to Topic.NumReferences.

  • A Loop through a list node sets Items to loop over to the Global.GenAnsVoiceRef variable, and the Loop value variable is set to record type and given the name, "Reference."

  • A Go to another topic node is set to Main Menu.

  • An End current topic node completes the topic.

Sample topic YAML to output citations

The following YAML demonstrates how a topic can be created to output citations. Copy and paste the YAML into a new topic to speed up the creation of the topic to output citations. To use the YAML, do the following:

Note

The YAML relies on having assigned the Answer.Speech.Citations table variable to a global variable, named GenAnsVoiceRef. For more information, see Access citations and sources from responses.

  1. Select your agent and select the Topics page.

  2. Select Add a topic and select From blank.

  3. Open the code editor, and paste the YAML over the existing YAML.

  4. Close the code editor and save the topic.

kind: AdaptiveDialog
beginDialog:
  kind: OnDtmfKeyPress
  id: main
  dtmfKey: Num9
  actions:
    - kind: ConditionGroup
      id: conditionGroup_Im7G18
      conditions:
        - id: conditionItem_a2ax5d
          condition: =!IsEmpty(Global.GenAnsVoiceRef)
          actions:
            - kind: SetVariable
              id: setVariable_dgK3w7
              variable: Topic.NumReferences
              value: =CountRows(Global.GenAnsVoiceRef)

            - kind: ConditionGroup
              id: conditionGroup_YRrOBv
              conditions:
                - id: conditionItem_hD1dXt
                  condition: =Topic.NumReferences = 1
                  actions:
                    - kind: SendActivity
                      id: sendActivity_42mrfG
                      activity:
                        speak:
                          - The following reference was consulted. Press * at any point to return to the main menu.

              elseActions:
                - kind: SendActivity
                  id: sendActivity_zyZNYz
                  activity:
                    speak:
                      - The following references were consulted. Press * at any point to return to the main menu.

            - kind: Foreach
              id: foreach_oWbdVm
              items: =Global.GenAnsVoiceRef
              value: init:Topic.Reference
              index: init:Topic.LoopIndex1
              actions:
                - kind: SendActivity
                  id: sendActivity_CAqLKs
                  activity:
                    speak:
                      - "{Topic.Reference.Name} consulted at {Topic.Reference.Url}"

      elseActions:
        - kind: SendActivity
          id: sendActivity_XHfqKK
          activity:
            speak:
              - No specific references were used to generate the previous answer.

    - kind: BeginDialog
      id: zkSWAP
      dialog: crc82_sophieGenAnswers.topic.Untitled

    - kind: EndDialog
      id: MXYSAQ