Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing dynamic timezone to duckling ISSUE-2801 #10781

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AnthonyDurussel
Copy link

@AnthonyDurussel AnthonyDurussel commented Jan 31, 2022

Proposed changes:
Issue: #2801

  • Allow to dynamically give timezone to the NLU duckling component using message metadata time_zone property.

Status (please check what you already did):

  • added some tests for the functionality
  • updated the documentation
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

@AnthonyDurussel AnthonyDurussel requested a review from a team as a code owner January 31, 2022 15:02
@AnthonyDurussel AnthonyDurussel requested review from carlad and removed request for a team January 31, 2022 15:02
@CLAassistant
Copy link

CLAassistant commented Jan 31, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Anthony seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@AnthonyDurussel AnthonyDurussel changed the title Allow passing dynamic timezone to duckling #2801 Allow passing dynamic timezone to duckling ISSUE-2801 Jan 31, 2022
@carlad carlad requested review from a team and removed request for carlad January 31, 2022 15:59
@natcohen
Copy link

natcohen commented Feb 2, 2022

Hey @wochinge, would be awesome if you could merge this! Please let us know what is missing so we can work on it. It's a feature that is much needed for duckling and hasn't been implemented (while the issue is quite old...). Thanks

@m-vdb m-vdb linked an issue May 16, 2022 that may be closed by this pull request
@m-vdb m-vdb removed the request for review from a team May 20, 2022 07:33
@indam23 indam23 self-requested a review May 25, 2022 09:07
Copy link
Contributor

@indam23 indam23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I left some comments on the PR itself, but in general I'm not clear why the addition of explicit metadata is necessary, since it's already available in NLU components. Could you clarify your use case and also add tests for the presence and absence of this metadata key?

matches = self._duckling_parse(message.get(TEXT), reference_time)
matches = self._duckling_parse(
message.get(TEXT),
message.get(METADATA).get(METADATA_TIME_ZONE),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could throw an error in the absence of metadata

Comment on lines +1289 to +1291
parsed_data = await app.agent.parse_message(
data.get("text"), data.get("metadata")
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The metadata should already form part of the standard UserMessage object that is passed all the way down to Duckling. Can you clarify why it's necessary to pass it in explicitly here?

Comment on lines +32 to +37
_metadata = {}
for k, v in data.items():
if k not in ("text", "model", "time"):
_metadata[k] = v
if _metadata:
_data["metadata"] = _metadata
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this is needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Allow passing dynamic timezone to duckling
4 participants