Data store performance improvements

This guide provides recommendations for monitoring and improving the performance of data store handlers.

Track your agent's performance

You can monitor your agents conversation history and you can use the analytics tool for agent statistics.

Run self-service evaluation

You can run self-service evaluation which will assess the quality of your data store agent and recommend changes.

Improve agent responses

If you find some responses during testing that don't meet your expectations, try the following.

Handle conversation digressions

An end-user may ask clarifying questions during a conversation. For example, during credit card information collection, they may want to clarify what a CVV is. In this case, your agent should answer the question and return to collecting the necessary credit card information. To accomplish this, you can create a data store handler with data stores that answer the question, apply that handler to the flow start page of the flow that handles credit card information collection, and set a transition target for this handler to return to the "current page".

Handle undesired intent matches

If your agent is matching intents when it should be using a data store handler, you can try the following to correct this:

  • Delete or modify training phrases that are vague, so that all of your training phrases precisely handle the desired intention and do not conflict with your data store content.
  • Use negative examples to avoid intent matching.

Data store filtering

In some cases, you may only want certain data stores available for queries, depending on session parameter values. For example, you may have unique data stores for product categories. To accomplish data store filtering for product categories:

  • Set session parameters to product categories.
  • Create condition routes that check the values of the session parameters and transition to a specific page that has the desired data store handler.
  • The data store handler should transition back to the calling page, so that the conversation can continue.

Personalization

To make generative answers more relevant to end-users, you can provide Conversational Agents (Dialogflow CX) with information about users.

This information is provided as JSON. There is no expected schema, so you are free to define the object properties. This JSON is sent to the large language model as-is, so descriptive property names and values lead to the best results.

For example:

{
  "subscription plan": "Business Premium Plus",
  "devices owned": [
    {"model": "Google Pixel 7"},
    {"model": "Google Pixel Tablet"}
  ]
}

Personalizing with the API

You can provide this data to Conversational Agents (Dialogflow CX) when sending detect intent requests. This information must be provided in every detect intent request, because it is not persisted in the session.

Provide this information in the queryParams.endUserMetadata field in the Sessions.detectIntent method.

Select a protocol and version for the Session reference:

Protocol V3 V3beta1
REST Session resource Session resource
RPC Session interface Session interface
C++ SessionsClient Not available
C# SessionsClient Not available
Go SessionsClient Not available
Java SessionsClient SessionsClient
Node.js SessionsClient SessionsClient
PHP Not available Not available
Python SessionsClient SessionsClient
Ruby Not available Not available

Personalizing with Dialogflow CX Messenger

You can provide this data to the Dialogflow CX Messenger integration. See the setContext method.

Search configuration

To have better control over the agent behavior and improve the quality of the answers, boost and filter search configurations are exposed to let you boost, bury and filter documents.

Boost controls enable you to change search result ranking by applying a boost value (greater than zero for higher ranking, less than zero for lower ranking) to specific documents.

Filter controls let you to either keep or remove search results based on the specified filter criteria.

This information is provided as JSON to Conversational Agents (Dialogflow CX) requests. The format of the JSON depends on the search control type.

Boost control

The following search configuration describes a boost control:

"searchConfig": {
  "boostSpecs": [
    {
      "dataStores": [ "DATASTORE_ID" ],
      "spec": [
        {
          "conditionBoostSpecs": {
            "condition": "CONDITION",
            "boost": "1.0"
          }
        }
      ]
    }
  ]
}

Filter control

The following search configuration describes a filter control:

"searchConfig": {
  "filterSpecs": [
    {
      "dataStores": [ "DATASTORE_ID" ],
      "filter": "CONDITION"
    }
  ]
}

Setup search configuration with the API

You can provide this data to Conversational Agents (Dialogflow CX) when sending detect intent requests. This information must be provided in every detect intent request, because it is not persisted in the session.

Provide this information in the queryParams.searchConfig field in the Sessions.detectIntent method.

Select a protocol and version for the Session reference:

Protocol V3 V3beta1
REST Session resource Session resource
RPC Session interface Session interface
C++ SessionsClient Not available
C# SessionsClient Not available
Go SessionsClient Not available
Java SessionsClient SessionsClient
Node.js SessionsClient SessionsClient
PHP Not available Not available
Python SessionsClient SessionsClient
Ruby Not available Not available

Setup search configuration with Dialogflow CX Messenger

You can provide this data to the Dialogflow CX Messenger integration.

To apply a search control, the following snippet needs to be added to the messenger code when embedding it into a website:

<script>
  document.addEventListener('df-messenger-loaded', () => {
    const dfMessenger = document.querySelector('df-messenger');
    const searchConfig = { ... }
    dfMessenger.setQueryParameters(searchConfig);
  });
</script>

See the setQueryParameters method.