[Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error#218213
Conversation
…actions on an ES|QL query doesn't work with Bedrock
|
Pinging @elastic/obs-ai-assistant (Team:Obs AI Assistant) |
There was a problem hiding this comment.
Hey @arturoliduena
The fix works well with Claude Sonnet 3.5
But with Claude Sonnet 3.7, I'm noticing this error when I click on Display Results:
[2025-04-16T19:22:08.836-04:00][ERROR][plugins.observabilityAIAssistant] Failed to parse function call arguments when converting messages for inference: SyntaxError: Unexpected end of JSON input
I'm not sure whether it's related to this change or whether it's an existing issue..
Are you able to reproduce it?
If it's not related to this change, we can create a separate issue for that and merge this PR.
I don’t think it’s caused by the changes in this PR. This fix was specifically addressing an issue where the function The actual fix involved wrapping the triggering function with The parsing error you’re seeing with Claude Sonnet 3.7 (Unexpected end of JSON input) looks like a separate issue. I’d suggest moving forward with merging this PR since it resolves the Bedrock error, and I can open a follow-up issue to investigate the 3.7-specific bug. |
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
…Visualize-query-Bedrock-error
⏳ Build in-progress
|
|
Starting backport for target branches: 9.0 https://github.com/elastic/kibana/actions/runs/14570559822 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…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
…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.
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
…query Bedrock Error (#218213) (#218716) # Backport This will backport the following commits from `main` to `9.0`: - [[Obs AI Assistant]fixing error - Display results and Visualize query Bedrock Error (#218213)](#218213) <!--- Backport version: 9.6.6 --> ### 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"],"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"}}]}] BACKPORT-->
…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.
|
I see the fix has merged for 9.0 and 9.1 🚀 |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…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)
… 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-->
|
Starting backport for target branches: 8.18, 8.19, 9.0, 9.1 https://github.com/elastic/kibana/actions/runs/16220896528 |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…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
… 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>
Closes #214005
Fix: Bedrock Streaming Error on ES|QL Actions
Summary
When an ES|QL is generated, we present two action buttons:
These actions were not working as expected when using Bedrock as the model provider.
Error Details
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.