-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security GenAI] Fix VertexChatAI
tool calling
#195689
Conversation
Pinging @elastic/security-solution (Team: SecuritySolution) |
@elasticmachine merge upstream |
💔 Build Failed
Failed CI StepsTest FailuresMetrics [docs]
History
|
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/11282616255 |
(cherry picked from commit 6ff2d87)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…5689) (#195832) # Backport This will backport the following commits from `main` to `8.x`: - [[Security GenAI] Fix `VertexChatAI` tool calling (#195689)](#195689) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Steph Milovic","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-10T21:59:10Z","message":"[Security GenAI] Fix `VertexChatAI` tool calling (#195689)","sha":"6ff2d87b5c8ed48ccfaa66f9cc8d712ae161a076","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team: SecuritySolution","backport:prev-minor","Team:Security Generative AI","v8.16.0"],"title":"[Security GenAI] Fix `VertexChatAI` tool calling","number":195689,"url":"https://github.com/elastic/kibana/pull/195689","mergeCommit":{"message":"[Security GenAI] Fix `VertexChatAI` tool calling (#195689)","sha":"6ff2d87b5c8ed48ccfaa66f9cc8d712ae161a076"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195689","number":195689,"mergeCommit":{"message":"[Security GenAI] Fix `VertexChatAI` tool calling (#195689)","sha":"6ff2d87b5c8ed48ccfaa66f9cc8d712ae161a076"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Steph Milovic <[email protected]>
Summary
Resolves the bug that surfaces when invoking tools with Gemini and returns an error of
INVALID_ARGUMENT
.Previously, our
ActionsClientGeminiChatModel
handled messages in the array that were next to messages of their same role (prevMessage.role === nextMessage.role
). I made the bad assumption thatVertexChatAI
would handle this case since this is what the Vertex AI API expects (Discovered via experimentation. I've requested from Google the exact docs on this and will link back once I have them.). By bringing over theprevMessage.role === nextMessage.role
handling fromActionsClientGeminiChatModel
toActionsClientVertexChatAI
, we can prevent this error from happening.