-
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
BedrockChat
& GeminiChat
#186809
BedrockChat
& GeminiChat
#186809
Conversation
/ci |
/ci |
…nski/kibana into feat/langchain-bedrock-chat
…bedrock-chat # Conflicts: # package.json # x-pack/plugins/integration_assistant/tsconfig.json # yarn.lock
|
||
let out; | ||
try { | ||
out = await toolExecutor.invoke(agentAction, config); |
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.
/ci |
…nski/kibana into feat/langchain-bedrock-chat
/ci |
/ci |
/ci |
/ci |
/ci |
Pinging @elastic/security-solution (Team: SecuritySolution) |
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.
Thanks for these changes @patrykkopycinski. When using the feature flags, I got more accurate and consistent results for Bedrock and Gemini with and without streaming. LGTM
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.
Checked this PR with Patryk and due to the introduction of safety_settings
, this meant some setups (like mine, no monthly billing google setup), it throws an 400 API exception.
Patryk going to discuss what we can do in this situation.
"{\n \"error\": {\n \"code\": 400,\n \"message\": \"User has requested a restricted HarmBlockThreshold setting BLOCK_NONE. You can get access either (a) through an allowlist via your Google account team, or (b) by switching your account type to monthly invoiced billing via this instruction: https://cloud.google.com/billing/docs/how-to/invoiced-billing.\",\n \"status\": \"INVALID_ARGUMENT\"\n }\n}\n"
…nski/kibana into feat/langchain-bedrock-chat
@joemcelroy I think I fixed the issue. I bubbled up this error so it will reach the user. Additionally, I scaled back the threshold from |
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.
Looks good from playground POV
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
💔 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 |
## Summary Adopted `BedrockChat` from `@langchain/community` package that adds support for tools calling https://js.langchain.com/v0.2/docs/integrations/chat/bedrock/ Adopted `ChatGoogleGenerativeAI ` from `@langchain/google-genai` package that adds support for tools calling https://js.langchain.com/v0.2/docs/integrations/chat/google_generativeai Hidden behind FF: `--xpack.securitySolution.enableExperimental=[assistantBedrockChat]` As of this PR `integration_assistant` is still going to use `ActionsClientSimpleChatModel`. After the FF will be enabled by default we will switch `integration_assistant` to use new chat model. Thank you @stephmilovic a ton 🙇 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co> Co-authored-by: Garrett Spong <spong@users.noreply.github.com> (cherry picked from commit 26dd61e) # Conflicts: # package.json # yarn.lock
# Backport This will backport the following commits from `main` to `8.15`: - [`BedrockChat` & `GeminiChat` (#186809)](#186809) <!--- Backport version: 8.9.8 --> ### 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-07-23T20:17:21Z","message":"`BedrockChat` & `GeminiChat` (#186809)\n\n## Summary\r\n\r\nAdopted `BedrockChat` from `@langchain/community` package that adds\r\nsupport for tools calling\r\nhttps://js.langchain.com/v0.2/docs/integrations/chat/bedrock/\r\n\r\nAdopted `ChatGoogleGenerativeAI ` from `@langchain/google-genai` package\r\nthat adds support for tools calling\r\nhttps://js.langchain.com/v0.2/docs/integrations/chat/google_generativeai\r\n\r\nHidden behind FF:\r\n`--xpack.securitySolution.enableExperimental=[assistantBedrockChat]`\r\n\r\nAs of this PR `integration_assistant` is still going to use\r\n`ActionsClientSimpleChatModel`. After the FF will be enabled by default\r\nwe will switch `integration_assistant` to use new chat model.\r\n\r\nThank you @stephmilovic a ton 🙇\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Steph Milovic <stephanie.milovic@elastic.co>\r\nCo-authored-by: Garrett Spong <spong@users.noreply.github.com>","sha":"26dd61efa2784c5008efede5880f514926795fe1","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team: SecuritySolution","ci:cloud-deploy","Team:Security Generative AI","v8.15.0","v8.16.0"],"number":186809,"url":"https://github.com/elastic/kibana/pull/186809","mergeCommit":{"message":"`BedrockChat` & `GeminiChat` (#186809)\n\n## Summary\r\n\r\nAdopted `BedrockChat` from `@langchain/community` package that adds\r\nsupport for tools calling\r\nhttps://js.langchain.com/v0.2/docs/integrations/chat/bedrock/\r\n\r\nAdopted `ChatGoogleGenerativeAI ` from `@langchain/google-genai` package\r\nthat adds support for tools calling\r\nhttps://js.langchain.com/v0.2/docs/integrations/chat/google_generativeai\r\n\r\nHidden behind FF:\r\n`--xpack.securitySolution.enableExperimental=[assistantBedrockChat]`\r\n\r\nAs of this PR `integration_assistant` is still going to use\r\n`ActionsClientSimpleChatModel`. After the FF will be enabled by default\r\nwe will switch `integration_assistant` to use new chat model.\r\n\r\nThank you @stephmilovic a ton 🙇\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Steph Milovic <stephanie.milovic@elastic.co>\r\nCo-authored-by: Garrett Spong <spong@users.noreply.github.com>","sha":"26dd61efa2784c5008efede5880f514926795fe1"}},"sourceBranch":"main","suggestedTargetBranches":["8.15"],"targetPullRequestStates":[{"branch":"8.15","label":"v8.15.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","labelRegex":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/186809","number":186809,"mergeCommit":{"message":"`BedrockChat` & `GeminiChat` (#186809)\n\n## Summary\r\n\r\nAdopted `BedrockChat` from `@langchain/community` package that adds\r\nsupport for tools calling\r\nhttps://js.langchain.com/v0.2/docs/integrations/chat/bedrock/\r\n\r\nAdopted `ChatGoogleGenerativeAI ` from `@langchain/google-genai` package\r\nthat adds support for tools calling\r\nhttps://js.langchain.com/v0.2/docs/integrations/chat/google_generativeai\r\n\r\nHidden behind FF:\r\n`--xpack.securitySolution.enableExperimental=[assistantBedrockChat]`\r\n\r\nAs of this PR `integration_assistant` is still going to use\r\n`ActionsClientSimpleChatModel`. After the FF will be enabled by default\r\nwe will switch `integration_assistant` to use new chat model.\r\n\r\nThank you @stephmilovic a ton 🙇\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Steph Milovic <stephanie.milovic@elastic.co>\r\nCo-authored-by: Garrett Spong <spong@users.noreply.github.com>","sha":"26dd61efa2784c5008efede5880f514926795fe1"}}]}] BACKPORT--> --------- Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
* master: (3487 commits) `BedrockChat` & `GeminiChat` (elastic#186809) [ResponseOps] log error when ES Query rules find docs out of time range (elastic#186332) skip flaky suite (elastic#188997) [Security solution][Alert Details] Enable preview feature flag and cypress tests (elastic#188580) [EuiProviders] Warn Developer if EuiProvider is missing (elastic#184608) [Security Solution ] Fixes Timeline infinite loading bug (elastic#188943) Improve SearchSource SearchRequest type (elastic#186862) Deprecate Search Sessions config (elastic#188037) [Synthetics] Add missing monitorType and tag info in cards !! (elastic#188824) [Console Monaco] Resolve uncaught error from tokenizer (elastic#188746) [Data Forge] Add `service.logs` dataset as a data stream (elastic#188786) [Console] Fix failing bulk requests (elastic#188552) Update dependency terser to ^5.31.2 (main) (elastic#188528) [APM][ECO] Telemetry (elastic#188627) [Fleet] Fix uninstall package validation accross space (elastic#188749) Update warning on `xpack.fleet.enableExperimental` (elastic#188917) [DOCS][Cases] Automate more screenshots for cases (elastic#188697) [Fleet] Fix get one agent when feature flag disabled (elastic#188953) chore(investigate): Add investigate-app plugin from poc (elastic#188122) [Monaco Editor] Add Search functionality (elastic#188337) ...
* master: (2400 commits) `BedrockChat` & `GeminiChat` (elastic#186809) [ResponseOps] log error when ES Query rules find docs out of time range (elastic#186332) skip flaky suite (elastic#188997) [Security solution][Alert Details] Enable preview feature flag and cypress tests (elastic#188580) [EuiProviders] Warn Developer if EuiProvider is missing (elastic#184608) [Security Solution ] Fixes Timeline infinite loading bug (elastic#188943) Improve SearchSource SearchRequest type (elastic#186862) Deprecate Search Sessions config (elastic#188037) [Synthetics] Add missing monitorType and tag info in cards !! (elastic#188824) [Console Monaco] Resolve uncaught error from tokenizer (elastic#188746) [Data Forge] Add `service.logs` dataset as a data stream (elastic#188786) [Console] Fix failing bulk requests (elastic#188552) Update dependency terser to ^5.31.2 (main) (elastic#188528) [APM][ECO] Telemetry (elastic#188627) [Fleet] Fix uninstall package validation accross space (elastic#188749) Update warning on `xpack.fleet.enableExperimental` (elastic#188917) [DOCS][Cases] Automate more screenshots for cases (elastic#188697) [Fleet] Fix get one agent when feature flag disabled (elastic#188953) chore(investigate): Add investigate-app plugin from poc (elastic#188122) [Monaco Editor] Add Search functionality (elastic#188337) ...
partialStreamChunk += nextChunk; | ||
} | ||
|
||
if (parsedStreamChunk !== null && !parsedStreamChunk.candidates?.[0]?.finishReason) { |
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.
Why no finishReason
chunks?
Summary
Adopted
BedrockChat
from@langchain/community
package that adds support for tools callinghttps://js.langchain.com/v0.2/docs/integrations/chat/bedrock/
Adopted
ChatGoogleGenerativeAI
from@langchain/google-genai
package that adds support for tools calling https://js.langchain.com/v0.2/docs/integrations/chat/google_generativeaiHidden behind FF:
--xpack.securitySolution.enableExperimental=[assistantBedrockChat]
As of this PR
integration_assistant
is still going to useActionsClientSimpleChatModel
. After the FF will be enabled by default we will switchintegration_assistant
to use new chat model.Thank you @stephmilovic a ton 🙇