[Security solution] Create new class instance for each use of LangChain chat model#190004
Merged
stephmilovic merged 1 commit intoelastic:mainfrom Aug 7, 2024
Merged
Conversation
Contributor
|
Pinging @elastic/security-solution (Team: SecuritySolution) |
💚 Build Succeeded
Metrics [docs]
To update your PR or re-run it, just comment with: |
andrew-goldstein
approved these changes
Aug 6, 2024
Contributor
andrew-goldstein
left a comment
There was a problem hiding this comment.
Thanks for this fix @stephmilovic! 🙏
✅ Desk tested locally
LGTM
Contributor
Author
|
Another example, this will solve the titling step from invoking tools: https://smith.langchain.com/public/e34f8013-12cc-49c2-b68a-b42205322c9c/r |
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Aug 7, 2024
…in chat model (elastic#190004) (cherry picked from commit 34f1f0f)
Contributor
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
kibanamachine
added a commit
that referenced
this pull request
Aug 7, 2024
…LangChain chat model (#190004) (#190096) # Backport This will backport the following commits from `main` to `8.15`: - [[Security solution] Create new class instance for each use of LangChain chat model (#190004)](#190004) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Steph Milovic","email":"stephanie.milovic@elastic.co"},"sourceCommit":{"committedDate":"2024-08-07T19:28:14Z","message":"[Security solution] Create new class instance for each use of LangChain chat model (#190004)","sha":"34f1f0f75b01df87720a2f81de46381dc3876378","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team: SecuritySolution","Team:Security Generative AI","v8.15.0","v8.16.0"],"title":"[Security solution] Create new class instance for each use of LangChain chat model","number":190004,"url":"https://github.com/elastic/kibana/pull/190004","mergeCommit":{"message":"[Security solution] Create new class instance for each use of LangChain chat model (#190004)","sha":"34f1f0f75b01df87720a2f81de46381dc3876378"}},"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/190004","number":190004,"mergeCommit":{"message":"[Security solution] Create new class instance for each use of LangChain chat model (#190004)","sha":"34f1f0f75b01df87720a2f81de46381dc3876378"}}]}] BACKPORT--> Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Contributor
|
This PR didn't make it on time of the latest v8.15 BC. Updating the labels. |
1 task
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.
Summary
Follow up from #189810
Related to #189771
We need to create a new class instance for each use of any LangChain chat model. This is necessary to avoid any potential side effects from shared state and a variety of bugs.
getLlmInstancetocreateLlmInstancellmClasswas assigned to a variable (llm) and instead always callscreateLlmInstance()Tests
ESQLKnowledgeBaseToolAlertsCountToolOpenAndAcknowledgedAlertsTool