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

Dialogflow CX DetectIntent - Response Delay

Hello Community

I'm currently building a simple widget for a Dialogflow based chatbot in nodejs . In the process, I'm calling the detectIntent API and when I execute the nodejs code, there was significant delay in the response reception which is why I added the console.time  to profile the code and determine the bottleneck. As a result, I found out the detectIntent is currently taking roughly 14 secs to receive the response. I would highly appreciate it, if any info on the factors pertaining to the delay can be provided.

Attaching the code snippet used:
-- There are 2 time console.time based profilers in this code namely "Intent Detect Time" specific to detectIntent API and lastly "Dialogflow Request Time"  specific to the whole of the request.


async function runSample(msg, projectId = 'integral-kiln-396613') {
 
  console.time('Dialogflow Request Time');
  const client = new SessionsClient({apiEndpoint: locationId + '-dialogflow.googleapis.com'});
  const sessionPath = client.projectLocationAgentSessionPath(projectId, locationId, agentId, sessionId);

  // The text query request.
  const request = {
    session: sessionPath,
    queryInput: {
      text: {
        text: msg,
      },
      languageCode,
    },
  };

  // Send request and log result
  console.time("Intent Detect Time");
  const [response] = await client.detectIntent(request);
  console.timeEnd("Intent Detect Time");
  console.timeEnd('Dialogflow Request Time');
  const allText = response.queryResult.responseMessages.map(message => message.text.text).flat();
  console.log(`Agent Response: ${allText}`);

 

0 1 335
1 REPLY 1

Hi,

Quick question, are you using any generative AI features?

Best,

Xavi