Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Dynamic Playbook with session parameters

Goal: To have a dynamic playbook that interacts with the tool based on the incoming session parameters.

The goal is that when a user enters a playbook from a flow the country and language session parameters are based into the playbook. ie. if a user is interacting from English/USA the params en and us are passed into the session parameters or say from Japan, the value would be ja (Japanese) /jp (Japan).

Once these values are in the playbook, I have a datastore tool that is connected to our support website that has documents for all languages and countries (ie. https://support.xyz.com/sp/en/us/how_to_download_product_A or https://support.xyz.com/sp/ja/jp/how_to_download_product_A)

Can the playbook have instructions to pull region based documents from the datastore tool based what the session parameters are.

Below is my attempt of instructions to do this but no luck.  Is this a possibility with playbooks or no?

Instructions:

capture the session input parameters:
- the country from where the customer is from: session.params.ct
- the language from where the customer is from: session.params.lg
- From here build out the total region by combining the two parameters: session.params.ct / session.params.lg
- For example the locale may look like en/us (Engligh/United States), en/in (English/India), ja/jp (Japenese/ Japan)
- Attempt to answer the user's intent on a region based condition. Look through the tool and only return solutions/documents that match the corresponding region using the tool: ${TOOL:Datastore All regions}
Solved Solved
0 1 147
1 ACCEPTED SOLUTION

Hi @Ian_Stack,

Welcome to Google Cloud Community!

Yes, this is possible with Playbooks and its integration with Datastore tools.

The recommended way to implement this is to make the Datastore Tool itself responsible for the regional filtering, based on parameters you pass to it from the Playbook. This is more reliable and efficient than trying to instruct the Playbook's LLM to construct dynamic URLs or filter logic within its text-based instructions.

Here's how you may approach this:

  1. Prepare Your Datastore
    • Ensure your documents ingested into the Datastore have distinct metadata fields for language and country.
  2. Configure the Datastore Tool in Dialogflow CX:
    • Define Tool Input Parameters:
      • Go to your Tool's configuration in Dialogflow CX.
      • Add two input parameters, for example:
        • input_language (Type: String)
        • input_country (Type: String)
    • Use the Tool's Filter Option:
      • In the Datastore-specific settings for your tool, find the "Filter" field.
      • Construct a filter string that uses the tool input parameters to match your document metadata.
        • Example: language_code = $TOOL_INPUT.input_language AND country_code = $TOOL_INPUT.input_country
        • (The exact syntax $TOOL_INPUT.parameter_name should be verified in Dialogflow CX documentation, but this is the concept.)
      • This tells the Datastore: "Only return documents that match both the language and country provided to these input parameters."
  3. Configure the Playbook:
    • Ensure Session Parameters Exist: Make sure session.params.lg (e.g., "en") and session.params.ct (e.g., "us") are correctly populated before this Playbook is called.
    • Map Session Parameters to Tool Inputs:
      • When you add or configure the ${TOOL:Datastore All regions} in your Playbook's "Goals" or "Examples":
        • Set the tool's input_language parameter to the value: $session.params.lg
        • Set the tool's input_country parameter to the value: $session.params.ct
    • Refine Playbook Instructions:
      • Your instructions should now guide the LLM on how to use the already-filtered results, not how to perform the filtering.

In summary, your initial instructions were trying to get the Playbook LLM to do the job that the Datastore Tool's configuration is designed for. By shifting the filtering logic to the Tool configuration and simply passing the necessary session parameters to it, you achieve a maintainable solution.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help

View solution in original post

1 REPLY 1