[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments #217680
[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments #217680darnautov merged 5 commits intoelastic:mainfrom
Conversation
|
@elasticmachine merge upstream |
|
merge conflict between base and head |
.../platform/plugins/shared/observability_ai_assistant/common/convert_messages_for_inference.ts
Outdated
Show resolved
Hide resolved
|
Pinging @elastic/appex-ai-infra (Team:AI Infra) |
|
Pinging @elastic/obs-ai-assistant (Team:Obs AI Assistant) |
|
Pinging @elastic/ml-ui (:ml) |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
History
cc @darnautov |
|
Starting backport for target branches: 8.18, 8.19, 9.0 https://github.com/elastic/kibana/actions/runs/14754766803 |
…ments (elastic#217680) (cherry picked from commit ccf23d0)
…ments (elastic#217680) (cherry picked from commit ccf23d0)
…ments (elastic#217680) (cherry picked from commit ccf23d0)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…on arguments (#217680) (#219726) # Backport This will backport the following commits from `main` to `8.19`: - [[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments (#217680)](#217680) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Dima Arnautov","email":"dmitrii.arnautov@elastic.co"},"sourceCommit":{"committedDate":"2025-04-30T12:39:07Z","message":"[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments (#217680)","sha":"ccf23d065434a255a838ef2c0b746f4db356a6fa","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Team:Obs AI Assistant","backport:version","Team:AI Infra","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments ","number":217680,"url":"https://github.com/elastic/kibana/pull/217680","mergeCommit":{"message":"[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments (#217680)","sha":"ccf23d065434a255a838ef2c0b746f4db356a6fa"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217680","number":217680,"mergeCommit":{"message":"[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments (#217680)","sha":"ccf23d065434a255a838ef2c0b746f4db356a6fa"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Dima Arnautov <dmitrii.arnautov@elastic.co>
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
2 similar comments
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
…n arguments (#217680) (#219727) # Backport This will backport the following commits from `main` to `9.0`: - [[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments (#217680)](#217680) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Dima Arnautov","email":"dmitrii.arnautov@elastic.co"},"sourceCommit":{"committedDate":"2025-04-30T12:39:07Z","message":"[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments (#217680)","sha":"ccf23d065434a255a838ef2c0b746f4db356a6fa","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Team:Obs AI Assistant","backport:version","Team:AI Infra","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments ","number":217680,"url":"https://github.com/elastic/kibana/pull/217680","mergeCommit":{"message":"[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments (#217680)","sha":"ccf23d065434a255a838ef2c0b746f4db356a6fa"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217680","number":217680,"mergeCommit":{"message":"[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments (#217680)","sha":"ccf23d065434a255a838ef2c0b746f4db356a6fa"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: Dima Arnautov <dmitrii.arnautov@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…on arguments (#217680) (#219725) # Backport This will backport the following commits from `main` to `8.18`: - [[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments (#217680)](#217680) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Dima Arnautov","email":"dmitrii.arnautov@elastic.co"},"sourceCommit":{"committedDate":"2025-04-30T12:39:07Z","message":"[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments (#217680)","sha":"ccf23d065434a255a838ef2c0b746f4db356a6fa","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Team:Obs AI Assistant","backport:version","Team:AI Infra","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments ","number":217680,"url":"https://github.com/elastic/kibana/pull/217680","mergeCommit":{"message":"[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments (#217680)","sha":"ccf23d065434a255a838ef2c0b746f4db356a6fa"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217680","number":217680,"mergeCommit":{"message":"[O11y AI Assistant] Correct quotes in ES|QL queries for function arguments (#217680)","sha":"ccf23d065434a255a838ef2c0b746f4db356a6fa"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: Dima Arnautov <dmitrii.arnautov@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
Fixes #216445
Related issue #198942
An attempt to fix incorrect quotes for field arguments inserted by LLMs. The solution isn’t perfect, but it’s the best we could come up with for now. Since ES|QL functions can have varying numbers of arguments, with different orders and types, we use a regex to scan the query string, look up the function definition, and replace quotes only when the argument is identified as a field.
Checklist