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 AI Assistant] Removed connectorTypeTitle from the Conversation API required params. Replaced usage replaced with actionsClient on server and API call on the client #179117

Merged

Conversation

YulNaumenko
Copy link
Contributor

@YulNaumenko YulNaumenko commented Mar 21, 2024

Current PR is fixing bug mentioned here and reducing connectorTypeTitle/llmType params for AI assistant APIs.

Streaming is working as it was before:

Screen.Recording.2024-03-20.at.7.41.12.PM.mov

…params, replaced with actionsClient on server and API call on the client
@YulNaumenko YulNaumenko requested a review from a team as a code owner March 21, 2024 00:59
@YulNaumenko YulNaumenko self-assigned this Mar 21, 2024
@YulNaumenko YulNaumenko added v8.14.0 release_note:skip Skip the PR/issue when compiling release notes bug Fixes for quality problems that affect the customer experience labels Mar 21, 2024
@YulNaumenko YulNaumenko requested a review from a team as a code owner March 21, 2024 02:43
@@ -7,6 +7,7 @@

import React, { useEffect, useMemo, useRef } from 'react';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { useFetchConnectorsQuery } from '../../../detection_engine/rule_management/api/hooks/use_fetch_connectors_query';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: move to useFetchConnectorsQuery to /security_solution/public/common/

Copy link
Contributor

Choose a reason for hiding this comment

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

Even better would be to add a featureId argument to useFetchConnectorTypesQuery and pass the featureId to fetchConnectorTypes to use as the feature_id argument. Then we could call like:

useFetchConnectorTypesQuery(GenerativeAIForSecurityConnectorFeatureId)

Available featureIds:

export const AlertingConnectorFeatureId = 'alerting';
export const CasesConnectorFeatureId = 'cases';
export const UptimeConnectorFeatureId = 'uptime';
export const SecurityConnectorFeatureId = 'siem';
export const GenerativeAIForSecurityConnectorFeatureId = 'generativeAIForSecurity';
export const GenerativeAIForObservabilityConnectorFeatureId = 'generativeAIForObservability';

Copy link
Contributor

@stephmilovic stephmilovic Mar 21, 2024

Choose a reason for hiding this comment

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

actually maybe we should use useLoadActionTypesQuery from triggers_actions_ui. we'd just need to add an arg for featureId and default it to AlertingConnectorFeatureId. It could use the existing function loadActionTypes instead of fetchConnectorTypes don't do it, i tried locally and there were too many unexpected changes

@@ -435,7 +435,6 @@ export default function bedrockTest({ getService }: FtrProviderContext) {
message: 'Hello world',
isEnabledKnowledgeBase: false,
isEnabledRAGAlerts: false,
llmType: 'bedrock',
Copy link
Contributor

Choose a reason for hiding this comment

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

We should decouple this test from our GenAI code so we aren't triggering a ResponseOps review for changes to the internal execute API.

The reason this test is here is because I wanted to add a test for the Bedrock subaction invokeStream. However, the integration tests here use the execute route, which does not support streaming. In order to call this subaction, one must implement a own route to call the actions api directly. The only places that exist are within solutions code. That is why the test calls the security GenAI execute API instead of the actions execute API.

It would be nice if the actions team could extend the execute route to support streaming. That way, we can update this test to call the actions execute API and ResponseOps will not have to review every change to our GenAI route. @ymao1 I cannot remember if there is an existing issue to add support for streaming to execute route. Is there plans for that? Maybe we could skip this test until that is implemented?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't believe we have an existing issue for this. Feel free to create one and we will prioritize as capacity allows or PR contributions are welcome as well!

Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -85,7 +84,7 @@ export default ({ getService }: FtrProviderContext) => {
it('should execute a chat completion', async () => {
const response = await postActionsClientExecute(
openaiActionId,
{ ...mockRequest, llmType: 'openai' },
{ ...mockRequest },
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{ ...mockRequest },
mockRequest,

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

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

LGTM! Left a few suggestions but nothing critical.

Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

Response Ops changes LGTM

@YulNaumenko YulNaumenko enabled auto-merge (squash) March 22, 2024 03:37
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
securitySolution 15.5MB 15.5MB +618.0B

History

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

cc @YulNaumenko

@YulNaumenko YulNaumenko merged commit 175b59b into elastic:main Mar 22, 2024
35 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Mar 22, 2024
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 bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants