[9.0] [Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error (#218213)#218716
Merged
arturoliduena merged 1 commit intoelastic:9.0from Apr 22, 2025
Conversation
…Bedrock Error (elastic#218213) ### Fix: Bedrock Streaming Error on ES|QL Actions #### Summary When an ES|QL is generated, we present two action buttons: - Visualize Query - Display Results These actions were not working as expected when using Bedrock as the model provider. #### Error Details ```txt Encountered error in Bedrock stream of type validationException messages.8: Did not find 1 `tool_result` block(s) at the beginning of this message. Messages following `tool_use` blocks must begin with a matching number of `tool_result` blocks. ``` #### Root Cause We were sending a tool_use block in the assistant message without immediately following it with the corresponding tool_result block. This violates Bedrock’s message protocol. (cherry picked from commit 33993b7) # Conflicts: # x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_body.tsx
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Async chunks
Page load bundle
|
viduni94
approved these changes
Apr 22, 2025
Contributor
|
Pinging @elastic/obs-ai-assistant (Team:Obs AI Assistant) |
arturoliduena
added a commit
that referenced
this pull request
Jun 3, 2025
… query Bedrock Error (#218213) (#222298) # Backport This will backport the following commits from `main` to `8.19`: - [[Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error (#218213)](#218213) <!--- Backport version: 10.0.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Arturo Lidueña","email":"arturo.liduena@elastic.co"},"sourceCommit":{"committedDate":"2025-04-21T08:51:18Z","message":"[Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error (#218213)\n\n### Fix: Bedrock Streaming Error on ES|QL Actions\n\n#### Summary\n\nWhen an ES|QL is generated, we present two action buttons:\n- Visualize Query\n- Display Results\n\nThese actions were not working as expected when using Bedrock as the\nmodel provider.\n\n#### Error Details\n```txt\nEncountered error in Bedrock stream of type validationException messages.8: Did not find 1 `tool_result` block(s) at the beginning of this message. Messages following `tool_use` blocks must begin with a matching number of `tool_result` blocks.\n```\n#### Root Cause\n\nWe were sending a tool_use block in the assistant message without\nimmediately following it with the corresponding tool_result block. This\nviolates Bedrock’s message protocol.","sha":"33993b7123bc0d6c85d9c42b15610cc0d5092281","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:prev-minor","Team:Obs AI Assistant","ci:project-deploy-observability","v9.1.0","v9.0.1"],"title":"[Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error","number":218213,"url":"https://github.com/elastic/kibana/pull/218213","mergeCommit":{"message":"[Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error (#218213)\n\n### Fix: Bedrock Streaming Error on ES|QL Actions\n\n#### Summary\n\nWhen an ES|QL is generated, we present two action buttons:\n- Visualize Query\n- Display Results\n\nThese actions were not working as expected when using Bedrock as the\nmodel provider.\n\n#### Error Details\n```txt\nEncountered error in Bedrock stream of type validationException messages.8: Did not find 1 `tool_result` block(s) at the beginning of this message. Messages following `tool_use` blocks must begin with a matching number of `tool_result` blocks.\n```\n#### Root Cause\n\nWe were sending a tool_use block in the assistant message without\nimmediately following it with the corresponding tool_result block. This\nviolates Bedrock’s message protocol.","sha":"33993b7123bc0d6c85d9c42b15610cc0d5092281"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/218213","number":218213,"mergeCommit":{"message":"[Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error (#218213)\n\n### Fix: Bedrock Streaming Error on ES|QL Actions\n\n#### Summary\n\nWhen an ES|QL is generated, we present two action buttons:\n- Visualize Query\n- Display Results\n\nThese actions were not working as expected when using Bedrock as the\nmodel provider.\n\n#### Error Details\n```txt\nEncountered error in Bedrock stream of type validationException messages.8: Did not find 1 `tool_result` block(s) at the beginning of this message. Messages following `tool_use` blocks must begin with a matching number of `tool_result` blocks.\n```\n#### Root Cause\n\nWe were sending a tool_use block in the assistant message without\nimmediately following it with the corresponding tool_result block. This\nviolates Bedrock’s message protocol.","sha":"33993b7123bc0d6c85d9c42b15610cc0d5092281"}},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/218716","number":218716,"state":"MERGED","mergeCommit":{"sha":"f06981e08ad2dcd663bc6258b37c600bc68cd207","message":"[9.0] [Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error (#218213) (#218716)\n\n# Backport\n\nThis will backport the following commits from `main` to `9.0`:\n- [[Obs AI Assistant]fixing error - Display results and Visualize query\nBedrock Error (#218213)](https://github.com/elastic/kibana/pull/218213)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n"}}]}] BACKPORT-->
arturoliduena
added a commit
that referenced
this pull request
Jul 11, 2025
… query Bedrock Error (#218213) (#227656) # Backport This will backport the following commits from `main` to `8.18`: - [[Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error (#218213)](#218213) <!--- Backport version: 10.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Arturo Lidueña","email":"arturo.liduena@elastic.co"},"sourceCommit":{"committedDate":"2025-04-21T08:51:18Z","message":"[Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error (#218213)\n\n### Fix: Bedrock Streaming Error on ES|QL Actions\n\n#### Summary\n\nWhen an ES|QL is generated, we present two action buttons:\n- Visualize Query\n- Display Results\n\nThese actions were not working as expected when using Bedrock as the\nmodel provider.\n\n#### Error Details\n```txt\nEncountered error in Bedrock stream of type validationException messages.8: Did not find 1 `tool_result` block(s) at the beginning of this message. Messages following `tool_use` blocks must begin with a matching number of `tool_result` blocks.\n```\n#### Root Cause\n\nWe were sending a tool_use block in the assistant message without\nimmediately following it with the corresponding tool_result block. This\nviolates Bedrock’s message protocol.","sha":"33993b7123bc0d6c85d9c42b15610cc0d5092281","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:prev-minor","Team:Obs AI Assistant","ci:project-deploy-observability","v9.1.0","v8.19.0","v9.0.1"],"title":"[Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error","number":218213,"url":"https://github.com/elastic/kibana/pull/218213","mergeCommit":{"message":"[Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error (#218213)\n\n### Fix: Bedrock Streaming Error on ES|QL Actions\n\n#### Summary\n\nWhen an ES|QL is generated, we present two action buttons:\n- Visualize Query\n- Display Results\n\nThese actions were not working as expected when using Bedrock as the\nmodel provider.\n\n#### Error Details\n```txt\nEncountered error in Bedrock stream of type validationException messages.8: Did not find 1 `tool_result` block(s) at the beginning of this message. Messages following `tool_use` blocks must begin with a matching number of `tool_result` blocks.\n```\n#### Root Cause\n\nWe were sending a tool_use block in the assistant message without\nimmediately following it with the corresponding tool_result block. This\nviolates Bedrock’s message protocol.","sha":"33993b7123bc0d6c85d9c42b15610cc0d5092281"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/218213","number":218213,"mergeCommit":{"message":"[Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error (#218213)\n\n### Fix: Bedrock Streaming Error on ES|QL Actions\n\n#### Summary\n\nWhen an ES|QL is generated, we present two action buttons:\n- Visualize Query\n- Display Results\n\nThese actions were not working as expected when using Bedrock as the\nmodel provider.\n\n#### Error Details\n```txt\nEncountered error in Bedrock stream of type validationException messages.8: Did not find 1 `tool_result` block(s) at the beginning of this message. Messages following `tool_use` blocks must begin with a matching number of `tool_result` blocks.\n```\n#### Root Cause\n\nWe were sending a tool_use block in the assistant message without\nimmediately following it with the corresponding tool_result block. This\nviolates Bedrock’s message protocol.","sha":"33993b7123bc0d6c85d9c42b15610cc0d5092281"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/222298","number":222298,"state":"MERGED","mergeCommit":{"sha":"a67bac807c5c7e3a940296d1bfd969d5354a5926","message":"[8.19] [Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error (#218213) (#222298)\n\n# Backport\n\nThis will backport the following commits from `main` to `8.19`:\n- [[Obs AI Assistant]fixing error - Display results and Visualize query\nBedrock Error (#218213)](https://github.com/elastic/kibana/pull/218213)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n"}},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/218716","number":218716,"state":"MERGED","mergeCommit":{"sha":"f06981e08ad2dcd663bc6258b37c600bc68cd207","message":"[9.0] [Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error (#218213) (#218716)\n\n# Backport\n\nThis will backport the following commits from `main` to `9.0`:\n- [[Obs AI Assistant]fixing error - Display results and Visualize query\nBedrock Error (#218213)](https://github.com/elastic/kibana/pull/218213)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n"}}]}] BACKPORT--> Co-authored-by: Brad White <Ikuni17@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto9.0:Questions ?
Please refer to the Backport tool documentation