[Security assistant] Fix Bedrock Langgraph ESQL tool calling#189810
[Security assistant] Fix Bedrock Langgraph ESQL tool calling#189810andrew-goldstein merged 8 commits intoelastic:mainfrom
Conversation
|
/ci |
|
/ci |
|
/ci |
…hain/graphs/default_assistant_graph/prompts.ts
Reverts change to x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/prompts.ts
|
@elasticmachine merge upstream |
|
Pinging @elastic/security-solution (Team: SecuritySolution) |
…e-gemini-prompt-update Restores change to the Gemini system prompt
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
peluja1012
left a comment
There was a problem hiding this comment.
Tested locally with Sonnet 3.5, Gemini, and gpt-4o. ES|QL generation with Sonnet (Bedrock connector) worked as expected and the ESQL tool was called every time. Also tested the RAG on alerts workflow with these models. There didn't appear to be any regressions with Gemini or gpt-4o on the RAG on alerts or ES|QL generation workflows.
It's worth noting that, as the PR description mentions, it only fixes Bedrock ES|QL generation. Gemini ES|QL generation is still not working well, although, it works better when the default System Prompt is cleared before sending the message.
…#189810) ## Summary Addresses the Bedrock portion of elastic#189771. When using the Bedrock connector and asking the AI Assistant ES|QL generation questions, the AI Assistant is now consistently using the `ESQLKnowledgeBaseTool` and responding with correct ES|QL syntax. This is an example of a [successful trace](https://smith.langchain.com/o/b739bf24-7ba4-4994-b632-65dd677ac74e/projects/p/34f01a8b-e9a5-4df6-8cc2-163960220718?timeModel=%7B%22duration%22%3A%227d%22%7D&peek=9b7d5f31-c98b-4f63-bb9b-b2df95863218).  (cherry picked from commit 83490a0)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…189810) (#189845) # Backport This will backport the following commits from `main` to `8.15`: - [[Security assistant] Fix Bedrock Langgraph ESQL tool calling (#189810)](#189810) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Patryk Kopyciński","email":"contact@patrykkopycinski.com"},"sourceCommit":{"committedDate":"2024-08-02T23:47:27Z","message":"[Security assistant] Fix Bedrock Langgraph ESQL tool calling (#189810)\n\n## Summary\r\n\r\nAddresses the Bedrock portion of https://github.com/elastic/kibana/issues/189771.\r\n\r\nWhen using the Bedrock connector and asking the AI Assistant ES|QL generation questions, the AI Assistant is now consistently using the `ESQLKnowledgeBaseTool` and responding with correct ES|QL syntax. This is an example of a [successful trace](https://smith.langchain.com/o/b739bf24-7ba4-4994-b632-65dd677ac74e/projects/p/34f01a8b-e9a5-4df6-8cc2-163960220718?timeModel=%7B%22duration%22%3A%227d%22%7D&peek=9b7d5f31-c98b-4f63-bb9b-b2df95863218).\r\n\r\n","sha":"83490a0a3e70b7514918bf98263c96030a3939fd","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team: SecuritySolution","ci:cloud-deploy","Team:Security Generative AI","v8.15.0","v8.16.0"],"title":"[Security assistant] Fix Bedrock Langgraph ESQL tool calling","number":189810,"url":"https://github.com/elastic/kibana/pull/189810","mergeCommit":{"message":"[Security assistant] Fix Bedrock Langgraph ESQL tool calling (#189810)\n\n## Summary\r\n\r\nAddresses the Bedrock portion of https://github.com/elastic/kibana/issues/189771.\r\n\r\nWhen using the Bedrock connector and asking the AI Assistant ES|QL generation questions, the AI Assistant is now consistently using the `ESQLKnowledgeBaseTool` and responding with correct ES|QL syntax. This is an example of a [successful trace](https://smith.langchain.com/o/b739bf24-7ba4-4994-b632-65dd677ac74e/projects/p/34f01a8b-e9a5-4df6-8cc2-163960220718?timeModel=%7B%22duration%22%3A%227d%22%7D&peek=9b7d5f31-c98b-4f63-bb9b-b2df95863218).\r\n\r\n","sha":"83490a0a3e70b7514918bf98263c96030a3939fd"}},"sourceBranch":"main","suggestedTargetBranches":["8.15"],"targetPullRequestStates":[{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/189810","number":189810,"mergeCommit":{"message":"[Security assistant] Fix Bedrock Langgraph ESQL tool calling (#189810)\n\n## Summary\r\n\r\nAddresses the Bedrock portion of https://github.com/elastic/kibana/issues/189771.\r\n\r\nWhen using the Bedrock connector and asking the AI Assistant ES|QL generation questions, the AI Assistant is now consistently using the `ESQLKnowledgeBaseTool` and responding with correct ES|QL syntax. This is an example of a [successful trace](https://smith.langchain.com/o/b739bf24-7ba4-4994-b632-65dd677ac74e/projects/p/34f01a8b-e9a5-4df6-8cc2-163960220718?timeModel=%7B%22duration%22%3A%227d%22%7D&peek=9b7d5f31-c98b-4f63-bb9b-b2df95863218).\r\n\r\n","sha":"83490a0a3e70b7514918bf98263c96030a3939fd"}}]}] BACKPORT--> Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
Summary
Addresses the Bedrock portion of #189771.
When using the Bedrock connector and asking the AI Assistant ES|QL generation questions, the AI Assistant is now consistently using the
ESQLKnowledgeBaseTooland responding with correct ES|QL syntax. This is an example of a successful trace.