-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Security Solution] [GenAi] Use default LLM setting for security GenAi features #234480
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
bb5afe9
use default LLM setting in security solution GenAi
KDKHD 267845a
lint
KDKHD 3e517a2
bootstrap
KDKHD b035cfe
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine fd7d96a
[CI] Auto-commit changed files from 'node scripts/eslint_all_files --…
kibanamachine 320aad1
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine 6ded1be
lint
KDKHD 5004700
lint
KDKHD 1a5f789
cr
KDKHD bf18c7b
lint
KDKHD 8714de3
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine 54466a8
lint
KDKHD 2c8d463
tests
KDKHD afcd0d8
cr
KDKHD ddacd02
comment
KDKHD 792be0f
Merge branch 'main' into feature/default-llm-security
elasticmachine 31019ad
code review
KDKHD 1bac393
code review
KDKHD 3d196ea
Merge branch 'main' of github.com:elastic/kibana into feature/default…
KDKHD 59416db
Merge branch 'main' into feature/default-llm-security
KDKHD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,8 @@ | |
| * 2.0. | ||
| */ | ||
|
|
||
| import type { SettingsStart } from '@kbn/core-ui-settings-browser'; | ||
| import { GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR } from '@kbn/management-settings-ids'; | ||
| import type { AIConnector } from '../connectorland/connector_selector'; | ||
| import type { FetchConnectorExecuteResponse } from './api'; | ||
| import type { ClientMessage } from '../assistant_context/types'; | ||
|
|
@@ -40,13 +42,30 @@ export const getMessageFromRawResponse = ( | |
| * @param connectors | ||
| */ | ||
| export const getDefaultConnector = ( | ||
| connectors: AIConnector[] | undefined | ||
| connectors: AIConnector[] | undefined, | ||
| settings: SettingsStart | ||
| ): AIConnector | undefined => { | ||
| const defaultAiConnectorId = settings.client.get<string>( | ||
| GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR, | ||
| undefined | ||
| ); | ||
|
|
||
| const validConnectors = connectors?.filter((connector) => !connector.isMissingSecrets); | ||
| const defaultConnector = validConnectors?.find( | ||
| (connector) => connector.id === defaultAiConnectorId | ||
| ); | ||
|
|
||
| if (defaultConnector) { | ||
| // If the user has set a default connector setting, and that connector exists, use it | ||
| return defaultConnector; | ||
| } | ||
|
|
||
| if (validConnectors?.length) { | ||
| // In case the default connector is not set or is invalid, return the first valid connector | ||
| return validConnectors[0]; | ||
| } | ||
|
|
||
| // If no valid connectors are available, return undefined | ||
| return undefined; | ||
| }; | ||
|
Comment on lines
44
to
70
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One of the main changes in this PR |
||
|
|
||
|
|
||
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
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
Suggestion to define another connector here with the overrides
here and use it for the tests below for readability. So below you can do:
const connectors: AIConnector[] = [anotherConnector, defaultConnector]
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.
added in ddacd02