3 concepts of Dialogflow

  1. Intents and Entities

  2. Datastores and prompt engineering for Generators

  3. Webhooks and parameters exchange

Terminology

Any output is called by Dialogflow CX documentation fulfillment.

Inserting the parameter into the prompt is demonstrated in HALGenerative agent: assuming some page has collected the parameter $city, the page with Generator’s fulfillment provides $request.generative.answer as usual response:

and the Generator used the collected parameter as:

HALDatastore agent demonstrates the use of datastore. Once the datastore is added to the Default Page, asking the agent the questions without further configuration is possible. This is due to the order of evaluation employed by Dialogflow CX:

DialogFlowArchitecture.jpg

  • The "Question answering" handler here has little in common with this term's common meaning. In the realm of Conversational AI "QA" (Question answering) means the same vector DB search (for KNN embeddings) preceded by the step of input pre-processing (to understand what to search) and followed by the step of "wrapping" the found result with LLM sugar to expose it as human answer.

  • The raw answer ($request.knowledge.sources) from the datastore has a structure like this

  •     {
            "uri": "...",
            "snippet: "...",
            "title": "...",
            "metadata": "..."
        }
    

    The corresponding fields can be extracted with a help of system functions

$sys.func.GET_FIELD($sys.func.GET($request.knowledge.sources[0], 0), "uri")

In the single Agent response, it can the compound answer may look like

Now you can add a Generator by the way we discussed with the parameters obtained by previous steps and associated with a prompt. In our case such a parameter is $request.knownledge.answers[0]

and

The final fulfillment consists of two parts:

Agent says:

$request.generative.answer === $sys.func.GET_FIELD($sys.func.GET($request.knowledge.sources[0], 0), "snippet")

and

Custom payload:

{
  "richContent": [
    [
      {
        "type": "match_citations",
        "citations": [
          {
            "title": "$sys.func.GET_FIELD($sys.func.GET($request.knowledge.sources[0], 0), \"title\")",
            "subtitle": "",
            "anchor": {
              "href": "$sys.func.GET_FIELD($sys.func.GET($request.knowledge.sources[0], 0), \"uri\")"
            }
          }
        ]
      }
    ]
  ]
}

ss