1

I'm trying to integrate a chatbot on my Pepper robot using Dialogflow API. Everything works fine except the latency for getting responses from Dialogflow agent is very high (about 10 seconds to execute the following line according to my time log):

response = self.detect_intent_texts(project_id,session_id,question,language_code)

Also, there are warnings about this request:

/home/nao/.local/lib/python2.7/site-packages/urllib3/util/ssl_.py:365: SNIMissingWarning: An HTTPS request has been made, but the SNI (Server Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings SNIMissingWarning

/home/nao/.local/lib/python2.7/site-packages/urllib3/util/ssl_.py:149: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecurePlatformWarning

I'm not sure if this is related to the latency, but it seems that I need to update the python version of my Pepper (2.7.6 for now). However I don't know if the python version on Pepper is updatable or if everything will still work if I do update the python version.

Apart from this, do you have other ideas about reducing the latency?

3 Answers 3

2

Have you tried another connection? E.g. mobile hotspot?

So you can find out if it is some issue with your network.

Also check this post on how to get rid of InsecurePlatformWarning Or this.

It would also be helpful if you provide context of you function call.

I assume detect_intent_texts implementation is this ?

Please note that this method also imports dialogflow_v2, creates the SessionsClient object and the session path. But this is not neccessary for every utterance. So if call this method for each utterance, you conversation will have a bigger latency.

How do you measure your lacency? do you do something like:

start = time.time()
detect_intent_texts(
print("recognition took: " + str(time.time() - start)[:5])

better measure the query only in the for loop of detect_intent_texts:

for text in texts:
    start = time.time()
    [...]
    print("querytook: " + str(time.time() - start)[:5])

I dont think a python update will be possible since you dont have root access.

Sign up to request clarification or add additional context in comments.

6 Comments

Here's my code for the function: project_id = "xxxxxxxxxxxxx" session_id = "yyyyyyyyyyyyy" message = "zzzzzzzzz" language_code = "en" response = self.detect_intent_texts(project_id,session_id,message,language_code)
Actually I'm not using a loop for detect_intent_texts. I just send one single message to the agent and get one single answer for one time.
Please get used to add informations to your question, rather to comments. Also message should be an array. So here might be the cause for your latency. If you pass a string each char will be send in a separate message. In your example there will be 9 querys for "z". So please try message=["zzzzzzzzz"] instead of message = "zzzzzzzzz"
btw: In my network 9 "z" querys took 5.5s, one "zzzzzzzzz" query took 3.2s
Thank you for your suggestions. Actually I've already deleted the loop for treating the array in the function and just send one text to the agent at a time. Since the reponse I get is always right, so I suppose the query is not seperated.
|
1

There is a huge Latency when initial access validation is performed. The documentation says it is normal to have multiple seconds for validation: https://cloud.google.com/dialogflow/docs/best-practices

Sorry, I don't think it is normal such LONG validation time and it completely destroys the initial user experience waiting so much.

I'm sure Google engineers can solve it to make it under 1 second. Please do!

Thanks, Francisco

Comments

0

You may want to try puting your system on the right timezone and the right time. TLS certificates use the system time to validate. And your response time may be a lot quicker.

1 Comment

Thank you, this is a good point. But the timezone and time of my system do correspond with those of my Dialogflow agent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.