-
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 Assistant] Fix abort stream OpenAI issue #203193
Merged
Merged
+137
−2
Conversation
This file contains 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
stephmilovic
added
release_note:skip
Skip the PR/issue when compiling release notes
Team: SecuritySolution
Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.
backport:prev-minor
Backport to (8.x) the previous minor version (i.e. one version back from main)
Team:Security Generative AI
Security Generative AI
labels
Dec 5, 2024
Pinging @elastic/security-solution (Team: SecuritySolution) |
💚 Build Succeeded
Metrics [docs]
|
patrykkopycinski
approved these changes
Dec 6, 2024
Starting backport for target branches: 8.x |
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Dec 6, 2024
(cherry picked from commit 4b42953)
💚 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
Dec 6, 2024
…203230) # Backport This will backport the following commits from `main` to `8.x`: - [[Security Assistant] Fix abort stream OpenAI issue (#203193)](#203193) <!--- 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-12-06T11:20:13Z","message":"[Security Assistant] Fix abort stream OpenAI issue (#203193)","sha":"4b42953aacfe903b6c9ecef4ac841348e65ed5d5","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.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"],"title":"[Security Assistant] Fix abort stream OpenAI issue","number":203193,"url":"https://github.com/elastic/kibana/pull/203193","mergeCommit":{"message":"[Security Assistant] Fix abort stream OpenAI issue (#203193)","sha":"4b42953aacfe903b6c9ecef4ac841348e65ed5d5"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/203193","number":203193,"mergeCommit":{"message":"[Security Assistant] Fix abort stream OpenAI issue (#203193)","sha":"4b42953aacfe903b6c9ecef4ac841348e65ed5d5"}}]}] BACKPORT--> Co-authored-by: Steph Milovic <[email protected]>
markov00
pushed a commit
to markov00/kibana
that referenced
this pull request
Dec 7, 2024
SoniaSanzV
pushed a commit
to SoniaSanzV/kibana
that referenced
this pull request
Dec 9, 2024
SoniaSanzV
pushed a commit
to SoniaSanzV/kibana
that referenced
this pull request
Dec 9, 2024
CAWilson94
pushed a commit
to CAWilson94/kibana
that referenced
this pull request
Dec 9, 2024
Samiul-TheSoccerFan
pushed a commit
to Samiul-TheSoccerFan/kibana
that referenced
this pull request
Dec 10, 2024
mykolaharmash
pushed a commit
to mykolaharmash/kibana
that referenced
this pull request
Dec 11, 2024
CAWilson94
pushed a commit
to CAWilson94/kibana
that referenced
this pull request
Dec 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport:prev-minor
Backport to (8.x) the previous minor version (i.e. one version back from main)
release_note:skip
Skip the PR/issue when compiling release notes
Team:Security Generative AI
Security Generative AI
Team: SecuritySolution
Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.
v8.18.0
v9.0.0
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
I made a mistake in the Abort signal fix PR. I thought I could get rid of the
finish_reason
condition, but we need it as some finish reasons should not end the stream.I brought back that
finish_reason === 'stop'
condition and added to the condition tohandleStreamEnd
when there is not afinish_reason
as this indicates abort.I also found that my addition of
signal
to agent.invoke
in order to satisfy Bedrock broke abort signal handling for OpenAI. Therefore, I added a condition to only includesignal
to agent.invoke
when the connector is Bedrock.To test