Skip to content
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 solution] Fix streaming on cloud #171578

Merged
merged 18 commits into from
Nov 23, 2023

Conversation

stephmilovic
Copy link
Contributor

@stephmilovic stephmilovic commented Nov 20, 2023

Summary

Unfortunately, the strategy to use a TransformStream in the invokeStream method (see 1, 2) was unsuccessful in production. The transform caused additional latency and caused the stream not to work at all when passing through the cloud proxy. I removed the TransformStream from the stack_connectors, and instead we need to count on the consumer to properly parse the response stream.

Bedrock

Bedrock will sometimes send multiple messages in one buffer. To account for this, I again followed the langchain bedrock extension and used a concatenated buffer to process multiple messages one at a time.

To test

  1. Test with the deployment on this PR
  2. Use vault to access creds: vault read secret/kibana-issues/dev/cloud-deploy/kibana-pr-171578
  3. Ensure Knowledge Base is turned off
  4. Test with both OpenAI and Bedrock credentials, responses should stream
  5. Test stop generating and regenerate buttons
  6. I also created connectors with bad model. Test that you receive an error with the connectors labeled "bad model"

@stephmilovic stephmilovic added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore ci:cloud-deploy Create or update a Cloud deployment ci:build-example-plugins v8.12.0 labels Nov 20, 2023
@stephmilovic
Copy link
Contributor Author

@elasticmachine merge upstream

@stephmilovic stephmilovic changed the title [Security solution] Fix streaming [Security solution] Fix streaming on cloud Nov 22, 2023
@stephmilovic stephmilovic marked this pull request as ready for review November 22, 2023 18:27
@stephmilovic stephmilovic requested review from a team as code owners November 22, 2023 18:27
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@kibana-ci
Copy link
Collaborator

kibana-ci commented Nov 22, 2023

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Serverless Investigations - Security Solution Cypress Tests #1 / Correlation tab should update timeline after removing eql should update timeline after removing eql

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 4706 4733 +27

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 12.8MB 12.8MB +19.2KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@semd semd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stephmilovic stephmilovic merged commit 6905a0f into elastic:main Nov 23, 2023
28 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Nov 23, 2023
@stephmilovic stephmilovic deleted the fix_stream branch November 23, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:build-example-plugins ci:cloud-deploy Create or update a Cloud deployment release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore Team:Threat Hunting Security Solution Threat Hunting Team v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants