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

Problem with Vertex ai agent builder using the dialogflow widget

Hello everyone,

I am using Vertex AI Agent Builder and I am facing an issue that I can't resolve. My agent responds correctly in the Google console but not when I use the Dialogflow Messenger widget. Sometimes it switches languages on its own. I would like to point out that I am in the draft environment and that my language settings are correctly configured in the Google widget. Does anyone have any idea?

Solved Solved
0 3 1,131
1 ACCEPTED SOLUTION

Hi @antho29,

Welcome to Google Cloud Community!

With regard to language mismatch or auto-switching,  Dialogflow Messenger widget language setting might not be explicitly set to the desired language, or it might be defaulting to a browser's language setting or auto-detecting incorrectly. You may try to do in the Dialogflow Messenger embed code (typically within the df-messenger tag), make sure you include the language-code attribute. For example, <df-messenger language-code="en"> </df-messenger> for English. You can also check the browser language setting which could be influencing the widget's language detection. You can check the browser language preferences and try again.

While you've configured the desired language for responses, the agent's core language might still be set to something else. You may double-check the default language setting within your agent in the Vertex AI Agent Builder UI. Ensure it matches your desired language.

Then, if you have multiple intents targeting different languages, make sure they are correctly configured. Incorrect language tagging in your intents could lead to the agent incorrectly identifying language. Review each intent and make sure the language is set correctly. If you want intents to only trigger in specific languages, make sure training phrases and language settings are congruent.

Also, custom code within your agent's fulfillment (if used) might have logic that influences language switching. Carefully review the fulfillment code for anything that could be causing or contributing to language detection/switching. Check if you are using a library or function that incorrectly translates your agent output.

Other key factors may be your connection and configuration errors. An incorrect or mismatched API key or project ID can cause the connection between Dialogflow Messenger and your agent to fail or behave unexpectedly. Carefully verify that the API key and project ID used in the Dialogflow Messenger code match the ones associated with your Vertex AI Agent Builder project.

Although you are using Agent Builder, sometimes some configurations within the Dialogflow console still have an impact. Ensure you are using the correct Dialogflow Agent (from which your Agent Builder is based). Within the Dialogflow Console, verify that the language is correctly configured for your agent.

If your agent uses webhooks, there might be issues with the communication between Dialogflow Messenger and your fulfillment server. Carefully review the webhook configuration (URL, authentication, etc). Check server logs for errors if you are using custom fulfillment.

Lastly is due to caching and browser issues. Browser caching might interfere with changes made to the agent's configuration or the Messenger widget code. Ask the users experiencing the problem to clear their browser cache and cookies and try again.

An old version of the Dialogflow Messenger widget code might be causing compatibility issues. Get the latest embed code from the Dialogflow Messenger console. Replace your current widget code with the updated version.

And some browser extensions might alter the behavior of the widget. Test the widget in an incognito window or disable the browser extensions to confirm if that is causing the issue.

Here are the debugging steps that you may follow:

  1. Start with the Simplest: Focus on the language configuration in the widget code and within your Agent Builder agent first.
  2. Isolate the Widget: If you're using a website or other platform to embed the widget, try embedding it in a very simple HTML file. This isolates if the problem is your broader site, or the widget itself.
  3. Network Analysis: Use the browser's developer tools (Network tab) to examine the requests and responses between the Dialogflow Messenger widget and the Dialogflow API. Look for errors or unusual behavior.
  4. Verbose Logging: If you are using webhooks, log incoming and outgoing data to pinpoint any issues.
  5. Step by Step: Try each suggestion one at a time, retesting between steps. This will help you identify the root cause.

Here are some references that you may find useful:

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

3 REPLIES 3

Hi @antho29,

Welcome to Google Cloud Community!

With regard to language mismatch or auto-switching,  Dialogflow Messenger widget language setting might not be explicitly set to the desired language, or it might be defaulting to a browser's language setting or auto-detecting incorrectly. You may try to do in the Dialogflow Messenger embed code (typically within the df-messenger tag), make sure you include the language-code attribute. For example, <df-messenger language-code="en"> </df-messenger> for English. You can also check the browser language setting which could be influencing the widget's language detection. You can check the browser language preferences and try again.

While you've configured the desired language for responses, the agent's core language might still be set to something else. You may double-check the default language setting within your agent in the Vertex AI Agent Builder UI. Ensure it matches your desired language.

Then, if you have multiple intents targeting different languages, make sure they are correctly configured. Incorrect language tagging in your intents could lead to the agent incorrectly identifying language. Review each intent and make sure the language is set correctly. If you want intents to only trigger in specific languages, make sure training phrases and language settings are congruent.

Also, custom code within your agent's fulfillment (if used) might have logic that influences language switching. Carefully review the fulfillment code for anything that could be causing or contributing to language detection/switching. Check if you are using a library or function that incorrectly translates your agent output.

Other key factors may be your connection and configuration errors. An incorrect or mismatched API key or project ID can cause the connection between Dialogflow Messenger and your agent to fail or behave unexpectedly. Carefully verify that the API key and project ID used in the Dialogflow Messenger code match the ones associated with your Vertex AI Agent Builder project.

Although you are using Agent Builder, sometimes some configurations within the Dialogflow console still have an impact. Ensure you are using the correct Dialogflow Agent (from which your Agent Builder is based). Within the Dialogflow Console, verify that the language is correctly configured for your agent.

If your agent uses webhooks, there might be issues with the communication between Dialogflow Messenger and your fulfillment server. Carefully review the webhook configuration (URL, authentication, etc). Check server logs for errors if you are using custom fulfillment.

Lastly is due to caching and browser issues. Browser caching might interfere with changes made to the agent's configuration or the Messenger widget code. Ask the users experiencing the problem to clear their browser cache and cookies and try again.

An old version of the Dialogflow Messenger widget code might be causing compatibility issues. Get the latest embed code from the Dialogflow Messenger console. Replace your current widget code with the updated version.

And some browser extensions might alter the behavior of the widget. Test the widget in an incognito window or disable the browser extensions to confirm if that is causing the issue.

Here are the debugging steps that you may follow:

  1. Start with the Simplest: Focus on the language configuration in the widget code and within your Agent Builder agent first.
  2. Isolate the Widget: If you're using a website or other platform to embed the widget, try embedding it in a very simple HTML file. This isolates if the problem is your broader site, or the widget itself.
  3. Network Analysis: Use the browser's developer tools (Network tab) to examine the requests and responses between the Dialogflow Messenger widget and the Dialogflow API. Look for errors or unusual behavior.
  4. Verbose Logging: If you are using webhooks, log incoming and outgoing data to pinpoint any issues.
  5. Step by Step: Try each suggestion one at a time, retesting between steps. This will help you identify the root cause.

Here are some references that you may find useful:

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.

Thank you for these solutions. I have checked many of them 🙂 But I need to verify some paramaters. I will let you know if I found the solution

Many thanks

 

Anthony

 

The issue is now resolved. The problem occurred when launching the conversation: the parameters were correctly set, but sometimes the bot did not respond in the correct language. When the conversation starts with "Bonjour" for French, "Hello" for English, or "Dag" for Dutch, the issue does not occur. So, we forced the conversation to start in the language of the browser and pushed a message ("Bonjour," "Hello," or "Dag") to enforce the language, and the problem no longer occurs.

Thank you for your response