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

[EN] Make shade queries more flexible for more generic requests #2221

Merged
merged 3 commits into from
Jun 17, 2024

Conversation

ViViDboarder
Copy link
Contributor

@ViViDboarder ViViDboarder commented Jun 7, 2024

Add coverage for new sentences. These are ones that I try all the time naturally but end up failing.

Summary by CodeRabbit

  • New Features

    • Enhanced HassGetState intent to allow optional specification of location (area or floor) for more flexible querying of cover states.
    • Added new queries for shades and areas such as "Outside" and "Guest Room."
  • Bug Fixes

    • Improved sentence structures for querying cover states to enhance natural language understanding.

Copy link

coderabbitai bot commented Jun 7, 2024

Walkthrough

Walkthrough

The recent updates to the HassGetState intent enhance its flexibility by allowing users to specify locations using either area or floor. Modified sentence structures now support more detailed queries regarding cover states (curtains, shades, etc.) across different house areas. Additionally, new entries in the test fixtures include an "Outside" area and a "Shade Left" entity in the "Guest Room".

Changes

File Change Summary
sentences/en/cover_HassGetState.yaml Expanded query options for HassGetState to include locations by area or floor, updating and adding relevant sentences.
tests/en/_fixtures.yaml Added a new "Outside" area and the "Shade Left" entity in "Guest Room" with specific attributes.
intents.yaml Added a new field floor to the HassGetState intent with a description, ensuring it is not a required field.

Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between b134d95 and fabcc6c.

Files selected for processing (1)
  • sentences/en/cover_HassGetState.yaml (1 hunks)
Additional context used
yamllint
sentences/en/cover_HassGetState.yaml

[error] 14-14: line too long (105 > 80 characters) (line-length)


[error] 15-15: line too long (93 > 80 characters) (line-length)


[error] 21-21: line too long (106 > 80 characters) (line-length)


[error] 22-22: line too long (94 > 80 characters) (line-length)


[error] 28-28: line too long (114 > 80 characters) (line-length)


[error] 29-29: line too long (102 > 80 characters) (line-length)


[error] 35-35: line too long (110 > 80 characters) (line-length)


[error] 36-36: line too long (98 > 80 characters) (line-length)

Additional comments not posted (1)
sentences/en/cover_HassGetState.yaml (1)

6-6: The updated sentence structure allows for more flexible specification of location, enhancing usability. However, consider revising the grammar for better clarity.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@tetele tetele left a comment

Choose a reason for hiding this comment

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

The same issue of splitting the sentences must be fixed throughout this PR.

@@ -3,33 +3,37 @@ intents:
HassGetState:
data:
- sentences:
- "is <name> {cover_states:state} [in <area>]"
- "is <name> {cover_states:state} [[in ](<area>|<floor>)]"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think "is the shutter closed in upstairs" sounds right.

The best idea would probably be to split this into 2 separate sentences instead of using the alternatives.

Also, here is probably a good place to replace is with (is|are) - e.g. are the bedroom blinds open?

Copy link
Contributor Author

@ViViDboarder ViViDboarder Jun 7, 2024

Choose a reason for hiding this comment

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

That's true, but also unavoidable.

Doing a little brainstorming here:

Possible area names:

  • Kitchen
  • Upstairs
  • Outside
  • Basement

Possible floor names:

  • Upstairs
  • First Floor
  • Basement

We'd want to match:

  • "... in the kitchen" in <area>
  • "... upstairs" -> (<area>|<floor>)
  • "... outside" -> (<area>|<floor>)
  • "... in the basement" in (<area>|<floor>)
  • "... on the first floor" on floor>

Since there is not really any strict alignment of article to area or floor, these can be generalized as:

[[(in|on) ](<area>|<floor>)] or, we can split this to two sentences

[[in ](<area>|<floor>)] and [[on ]<floor>], but that makes the number of refactors to support floors higher. Instead, they can be combined more exclusively as:

[([in ](<area>|<floor>)|[on ]<floor>)]

Either of the two single expansion options I listed are also very general and not specific to covers and something that I can, in another PR, add to _common.yaml so it's easier to add floor support to intents.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now, I'm using [[(in|on) ](<area>|<floor>)] because it's more concise, even though it possibly matches less correct grammar. I'm happy to change it to [([in ](<area>|<floor>)|[on ]<floor>)], especially by adding it to a common expansion.

Copy link
Contributor

Choose a reason for hiding this comment

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

I can think of stuff like on the patio.

I'd suggest creating a general expansion rule along the lines of in_area_or_floor: ([(in|on) ]<area>|[on ]<floor>).

Then you can use [<in_area_or_floor>] throughout all sentences where it makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I don't know how I missed this one... All the others were updated to cover that use case. I have a draft PR for more general expansion rules. I can add [in_area_or_floor] there. For now I'm using [[<in>] <area_floor>], which expands to [[(in|on|at|of)] (<area>|<floor>)]. #2225

@home-assistant home-assistant bot marked this pull request as draft June 7, 2024 09:55
@home-assistant
Copy link

home-assistant bot commented Jun 7, 2024

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@tetele tetele changed the title Make shade queries more flexible for more generic requests [EN] Make shade queries more flexible for more generic requests Jun 7, 2024
@ViViDboarder ViViDboarder marked this pull request as ready for review June 7, 2024 17:50
@home-assistant home-assistant bot requested a review from tetele June 7, 2024 17:50
@@ -3,33 +3,37 @@ intents:
HassGetState:
data:
- sentences:
- "is <name> {cover_states:state} [in <area>]"
- "is <name> {cover_states:state} [[in ](<area>|<floor>)]"
Copy link
Contributor

Choose a reason for hiding this comment

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

I can think of stuff like on the patio.

I'd suggest creating a general expansion rule along the lines of in_area_or_floor: ([(in|on) ]<area>|[on ]<floor>).

Then you can use [<in_area_or_floor>] throughout all sentences where it makes sense.

@home-assistant home-assistant bot marked this pull request as draft June 14, 2024 17:13
@ViViDboarder ViViDboarder marked this pull request as ready for review June 14, 2024 18:26
@home-assistant home-assistant bot requested a review from tetele June 14, 2024 18:26
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Comment on lines +35 to +36
- "how many {cover_classes:device_class} (is|are) {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "how many (<area>|<floor>) {cover_classes:device_class} (is|are) {cover_states:state}"
Copy link

Choose a reason for hiding this comment

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

These sentences are too long per the linter's recommendations. Consider revising them to improve readability and maintain the width standard.

- "how many {cover_classes:device_class} (is|are) {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "how many (<area>|<floor>) {cover_classes:device_class} (is|are) {cover_states:state}"
+ "how many {cover_classes:device_class} (is|are) {cover_states:state} [[(in|on) ](<area>|<floor>)]"  # Consider splitting this into multiple lines
+ "how many (<area>|<floor>) {cover_classes:device_class} (is|are) {cover_states:state}"  # Consider splitting this into multiple lines

Committable suggestion was skipped due to low confidence.

Tools
yamllint

[error] 35-35: line too long (110 > 80 characters) (line-length)


[error] 36-36: line too long (98 > 80 characters) (line-length)

Comment on lines +28 to +29
- "(which|what) {cover_classes:device_class} (is|are) {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "(which|what) (<area>|<floor>) {cover_classes:device_class} (is|are) {cover_states:state}"
Copy link

Choose a reason for hiding this comment

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

The sentences effectively enhance query flexibility but exceed the recommended line length, potentially impacting readability.

- "(which|what) {cover_classes:device_class} (is|are) {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "(which|what) (<area>|<floor>) {cover_classes:device_class} (is|are) {cover_states:state}"
+ "(which|what) {cover_classes:device_class} (is|are) {cover_states:state} [[(in|on) ](<area>|<floor>)]"  # Consider splitting this into multiple lines
+ "(which|what) (<area>|<floor>) {cover_classes:device_class} (is|are) {cover_states:state}"  # Consider splitting this into multiple lines

Committable suggestion was skipped due to low confidence.

Tools
yamllint

[error] 28-28: line too long (114 > 80 characters) (line-length)


[error] 29-29: line too long (102 > 80 characters) (line-length)

Comment on lines +14 to +15
- "(is|are) any {cover_classes:device_class} {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "(is|are) any (<area>|<floor>) {cover_classes:device_class} {cover_states:state}"
Copy link

Choose a reason for hiding this comment

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

The new sentences greatly improve the flexibility of queries. However, both lines exceed the recommended 80 characters, affecting readability.

- "(is|are) any {cover_classes:device_class} {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "(is|are) any (<area>|<floor>) {cover_classes:device_class} {cover_states:state}"
+ "(is|are) any {cover_classes:device_class} {cover_states:state} [[(in|on) ](<area>|<floor>)]"  # Consider splitting this into multiple lines
+ "(is|are) any (<area>|<floor>) {cover_classes:device_class} {cover_states:state}"  # Consider splitting this into multiple lines

Committable suggestion was skipped due to low confidence.

Tools
yamllint

[error] 14-14: line too long (105 > 80 characters) (line-length)


[error] 15-15: line too long (93 > 80 characters) (line-length)

Comment on lines +21 to +22
- "are all [the] {cover_classes:device_class} {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "are all [the] (<area>|<floor>) {cover_classes:device_class} {cover_states:state}"
Copy link

Choose a reason for hiding this comment

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

These sentences also exceed the 80 character limit. Splitting these into multiple lines could enhance readability and maintainability.

- "are all [the] {cover_classes:device_class} {cover_states:state} [[(in|on) ](<area>|<floor>)]"
- "are all [the] (<area>|<floor>) {cover_classes:device_class} {cover_states:state}"
+ "are all [the] {cover_classes:device_class} {cover_states:state} [[(in|on) ](<area>|<floor>)]"  # Consider splitting this into multiple lines
+ "are all [the] (<area>|<floor>) {cover_classes:device_class} {cover_states:state}"  # Consider splitting this into multiple lines

Committable suggestion was skipped due to low confidence.

Tools
yamllint

[error] 21-21: line too long (106 > 80 characters) (line-length)


[error] 22-22: line too long (94 > 80 characters) (line-length)

@tetele tetele merged commit b5e6869 into home-assistant:main Jun 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants