Rasa Core version: 0.11.12
Suppose we have a customer in Berlin (UTC+1) and we allow them to ask the following two questions:
If we configure duckling to always use UTC and the customer asks that question at 18:00, question 1 will return the correct time back (15:00 UTC, 16:00 UTC+1) but question 2 will return 15:00 UTC - 16:00 UTC, which is wrong because the customer means UTC+1.
Ducking allows tz on /parse requests which we can use to get the correct result back so is it a good idea to allow request-level component config to rasa core?
@alexmic
I think there are two things here:
Number 1 is that Duckling does not currently not actually use specified timezones (see https://duckling.wit.ai/ , Limitations)
Timezones are parsed, but they don鈥檛 impact the time value (will be fixed shortly).
The second thing is, that you want to use different time zones depending on the user, right?
I think this is best done using custom actions since Rasa Core does not know the location of the user. In the custom action you can check the whether you know the location of the user, and then select the correct timezone.
This issue has been automatically closed because there has been no response to our request for more information from the original author. Without this, we don't have enough information to help you. Please comment below with the requested information if you still need help.
@wochinge This doesn't work in custom action (unless I am missing something). If the user gives absolute time (case two above) we can blindly replace the timezone of the Duckling with timezone of the user.
However, it doesn't work for relative times. For example, "last 2 hours" will give wrong results if we replace the Duckling timezone with the user timezone.
@akshay2000
However, it doesn't work for relative times. For example, "last 2 hours" will give wrong results if we replace the Duckling timezone with the user timezone.
Yes, but that also would not work with Duckling. I mean, how should it now the timezone of the user? Only option is to ask the user I guess.
@akshay2000
However, it doesn't work for relative times. For example, "last 2 hours" will give wrong results if we replace the Duckling timezone with the user timezone.
Yes, but that also would not work with Duckling. I mean, how should it now the timezone of the user? Only option is to ask the user I guess.
Hence the option to send timezone with every request. As the bot sits on the client device, it can send timezone along with sender id and message. That is what I ended up doing. Had to override a bunch of methods on a bunch of core and NLU classes though.
As the bot sits on the client device, it can send timezone along with sender id and message.
That highly depends on the input channel, doesn't it?
@wochinge
I think the statement on wit.ai site is wrong. Duckling has had the timezone feature for a really long time.
I also tried with rasa's docker image:
"tonight"
curl -XPOST http://0.0.0.0:5006/parse --data 'dims=time&lang=en&tz=Asia/Kolkata&text=tonight'
[{"body":"tonight","start":0,"value":{"values":[{"to":{"value":"2019-12-18T00:00:00.000+05:30","grain":"hour"},"from":{"value":"2019-12-17T18:00:00.000+05:30","grain":"hour"},"type":"interval"}],"to":{"value":"2019-12-18T00:00:00.000+05:30","grain":"hour"},"from":{"value":"2019-12-17T18:00:00.000+05:30","grain":"hour"},"type":"interval"},"end":7,"dim":"time","latent":false}]
curl -XPOST http://0.0.0.0:5006/parse --data 'dims=time&lang=en&tz=America/New_York&text=tonight'
[{"body":"tonight","start":0,"value":{"values":[{"to":{"value":"2019-12-17T00:00:00.000-05:00","grain":"hour"},"from":{"value":"2019-12-16T18:00:00.000-05:00","grain":"hour"},"type":"interval"}],"to":{"value":"2019-12-17T00:00:00.000-05:00","grain":"hour"},"from":{"value":"2019-12-16T18:00:00.000-05:00","grain":"hour"},"type":"interval"},"end":7,"dim":"time","latent":false}]
"right now"
curl -XPOST http://0.0.0.0:5006/parse --data 'dims=time&lang=en&tz=America/New_York&text=right now'
[{"body":"right now","start":0,"value":{"values":[{"value":"2019-12-16T16:32:07.450-05:00","grain":"second","type":"value"}],"value":"2019-12-16T16:32:07.450-05:00","grain":"second","type":"value"},"end":9,"dim":"time","latent":false}]%
curl -XPOST http://0.0.0.0:5006/parse --data 'dims=time&lang=en&tz=Asia/Kolkata&text=right now'
[{"body":"right now","start":0,"value":{"values":[{"value":"2019-12-17T03:02:20.075+05:30","grain":"second","type":"value"}],"value":"2019-12-17T03:02:20.075+05:30","grain":"second","type":"value"},"end":9,"dim":"time","latent":false}]%
Hi guys, we had the same issue in 2018 where we needed to pass the timezone as we knew the timezone of the user, we implemented this for version 0.14.x and it works fine in our case.
https://github.com/horeapopa/rasa_nlu/commit/278fb2356739846f6547e78fcb1aed0dd8688808
The issue is that we are stuck with the old version of Rasa at the moment and looking into updating it; is there any plan of having this kind of functionality implemented?
This is the initial conversation that we had on the forum when we fixed it for us, as we did not get a confirmation of this being a priority.
@horeapopa @mmalhotra
Can you please try to set the timezone in your model configuration as described in the Configuration section of https://rasa.com/docs/rasa/nlu/components/#ducklinghttpextractor ?
@wochinge that is not an option when the product serves multiple timezones, there are 38 Different Local Times (https://www.timeanddate.com/time/current-number-time-zones.html) so we would need to run 38 servers (2x = 1 rasa + 1 duckling) and have logic to push each request to the appropriate one based on user timezone.
@horeapopa Re-opened the issue. I don't know when we will get around doing this, if you want to pick it up I'm happy to provide help / feedback :-)