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

[Observability AI Assistant] Auto-correct for ES|QL SORT commands adds duplicate backticks #184404

Closed
dgieselaar opened this issue May 29, 2024 · 1 comment
Labels
bug Fixes for quality problems that affect the customer experience Team:Obs AI Assistant Observability AI Assistant
Milestone

Comments

@dgieselaar
Copy link
Member

We have a process where we auto-correct common ES|QL mistakes. One of them is using an expression in a STATS command as the sorting expression. ES|QL does not support this, it does however create a column with the same name as the sorting expression, so we can add backticks to make it work.

E.g.,

FROM *
| STATS COUNT(*)
| SORT COUNT(*)

becomes:

FROM *
| STATS COUNT(*)
| SORT `COUNT(*)`

However, if an expression is already escaped, we add more backticks:

FROM *
| STATS COUNT(*)
| SORT ``COUNT(*)``

This leads to an invalid query, and causes the LLM to get confused because even when it has sent the right query, we introduce a syntax mistake that the LLM cannot correct.

@dgieselaar dgieselaar added bug Fixes for quality problems that affect the customer experience Team:Obs AI Assistant Observability AI Assistant labels May 29, 2024
@emma-raffenne emma-raffenne modified the milestones: 8.14, 8.15 Jun 4, 2024
@emma-raffenne emma-raffenne modified the milestones: 8.15, 8.16 Jul 11, 2024
@dgieselaar
Copy link
Member Author

Fixed in #186799

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:Obs AI Assistant Observability AI Assistant
Projects
None yet
Development

No branches or pull requests

2 participants