Reputation: 47
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?
Upvotes: 1
Views: 971
Reputation: 11
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
Upvotes: 1
Reputation: 1150
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.
Upvotes: 2
Reputation: 1
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.
Upvotes: 0