diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/api.test.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/api.test.tsx index ebb5afe2f12a1ed..9119e024adcb297 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/api.test.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/api.test.tsx @@ -42,7 +42,6 @@ const fetchConnectorArgs: FetchConnectorExecuteAction = { http: mockHttp, messages, onNewReplacements: jest.fn(), - ragOnAlerts: false, }; describe('API tests', () => { beforeEach(() => { @@ -91,7 +90,6 @@ describe('API tests', () => { alertsIndexPattern: '.alerts-security.alerts-default', allow: ['a', 'b', 'c'], allowReplacement: ['b', 'c'], - ragOnAlerts: true, replacements: { auuid: 'real.hostname' }, size: 30, }; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/api.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/api.tsx index c2bdd4806a99acb..f186dab22f668f5 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/api.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/api.tsx @@ -29,7 +29,6 @@ export interface FetchConnectorExecuteAction { http: HttpSetup; messages: Message[]; onNewReplacements: (newReplacements: Record) => void; - ragOnAlerts: boolean; replacements?: Record; signal?: AbortSignal | undefined; size?: number; @@ -55,7 +54,6 @@ export const fetchConnectorExecuteAction = async ({ http, messages, onNewReplacements, - ragOnAlerts, replacements, apiConfig, signal, @@ -90,7 +88,6 @@ export const fetchConnectorExecuteAction = async ({ alertsIndexPattern, allow, allowReplacement, - ragOnAlerts, replacements, size, }); @@ -192,7 +189,6 @@ export const fetchConnectorExecuteAction = async ({ response: hasParsableResponse({ alerts, assistantLangChain, - ragOnAlerts, }) ? getFormattedMessageContent(response.data) : response.data, diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/helpers.test.ts b/x-pack/packages/kbn-elastic-assistant/impl/assistant/helpers.test.ts index 0c3c5a579d27483..8cd3c1479b46b58 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/helpers.test.ts +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/helpers.test.ts @@ -235,29 +235,12 @@ describe('getBlockBotConversation', () => { }); describe('getOptionalRequestParams', () => { - it('should return an empty object when ragOnAlerts is false', () => { - const params = { - alerts: true, - alertsIndexPattern: 'indexPattern', - allow: ['a', 'b', 'c'], - allowReplacement: ['b', 'c'], - ragOnAlerts: false, // <-- false - replacements: { key: 'value' }, - size: 10, - }; - - const result = getOptionalRequestParams(params); - - expect(result).toEqual({}); - }); - it('should return an empty object when alerts is false', () => { const params = { alerts: false, // <-- false alertsIndexPattern: 'indexPattern', allow: ['a', 'b', 'c'], allowReplacement: ['b', 'c'], - ragOnAlerts: true, replacements: { key: 'value' }, size: 10, }; @@ -267,13 +250,12 @@ describe('getBlockBotConversation', () => { expect(result).toEqual({}); }); - it('should return the optional request params when ragOnAlerts is true and alerts is true', () => { + it('should return the optional request params when alerts is true', () => { const params = { alerts: true, alertsIndexPattern: 'indexPattern', allow: ['a', 'b', 'c'], allowReplacement: ['b', 'c'], - ragOnAlerts: true, replacements: { key: 'value' }, size: 10, }; @@ -292,7 +274,6 @@ describe('getBlockBotConversation', () => { it('should return (only) the optional request params that are defined when some optional params are not provided', () => { const params = { alerts: true, - ragOnAlerts: true, allow: ['a', 'b', 'c'], // all the others are undefined }; @@ -305,31 +286,37 @@ describe('getBlockBotConversation', () => { }); describe('hasParsableResponse', () => { - it('returns true when assistantLangChain is true', () => { + it('returns true when just assistantLangChain is true', () => { const result = hasParsableResponse({ alerts: false, assistantLangChain: true, - ragOnAlerts: false, }); expect(result).toBe(true); }); - it('returns true when ragOnAlerts is true and alerts is true', () => { + it('returns true when just alerts is true', () => { const result = hasParsableResponse({ alerts: true, assistantLangChain: false, - ragOnAlerts: true, }); expect(result).toBe(true); }); - it('returns false when assistantLangChain, ragOnAlerts, and alerts are all false', () => { + it('returns true when both assistantLangChain and alerts are true', () => { + const result = hasParsableResponse({ + alerts: true, + assistantLangChain: true, + }); + + expect(result).toBe(true); + }); + + it('returns false when both assistantLangChain and alerts are false', () => { const result = hasParsableResponse({ alerts: false, assistantLangChain: false, - ragOnAlerts: false, }); expect(result).toBe(false); diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/helpers.ts b/x-pack/packages/kbn-elastic-assistant/impl/assistant/helpers.ts index 688416d2e738cb1..9149d4c84ca42b9 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/helpers.ts +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/helpers.ts @@ -101,7 +101,6 @@ export const getOptionalRequestParams = ({ alertsIndexPattern, allow, allowReplacement, - ragOnAlerts, replacements, size, }: { @@ -109,7 +108,6 @@ export const getOptionalRequestParams = ({ alertsIndexPattern?: string; allow?: string[]; allowReplacement?: string[]; - ragOnAlerts: boolean; replacements?: Record; size?: number; }): OptionalRequestParams => { @@ -119,10 +117,8 @@ export const getOptionalRequestParams = ({ const optionalReplacements = replacements ? { replacements } : undefined; const optionalSize = size ? { size } : undefined; - if ( - !ragOnAlerts || // the feature flag must be enabled - !alerts // the settings toggle must also be enabled - ) { + // the settings toggle must be enabled: + if (!alerts) { return {}; // don't send any optional params } @@ -138,9 +134,7 @@ export const getOptionalRequestParams = ({ export const hasParsableResponse = ({ alerts, assistantLangChain, - ragOnAlerts, }: { alerts: boolean; assistantLangChain: boolean; - ragOnAlerts: boolean; -}): boolean => assistantLangChain || (ragOnAlerts && alerts); +}): boolean => assistantLangChain || alerts; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/use_send_messages/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/use_send_messages/index.tsx index fcfbadb574bbdb3..fb973d492a6517a 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/use_send_messages/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/use_send_messages/index.tsx @@ -37,7 +37,6 @@ export const useSendMessages = (): UseSendMessages => { assistantStreamingEnabled, defaultAllow, defaultAllowReplacement, - ragOnAlerts, knowledgeBase, } = useAssistantContext(); const [isLoading, setIsLoading] = useState(false); @@ -56,7 +55,6 @@ export const useSendMessages = (): UseSendMessages => { assistantLangChain: knowledgeBase.assistantLangChain, assistantStreamingEnabled, http, - ragOnAlerts, // feature flag replacements, messages, size: knowledgeBase.latestAlerts, @@ -74,7 +72,6 @@ export const useSendMessages = (): UseSendMessages => { knowledgeBase.alerts, knowledgeBase.assistantLangChain, knowledgeBase.latestAlerts, - ragOnAlerts, ] ); diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.tsx index 4d0eec97f2639e6..980450b1758ff82 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.tsx @@ -88,7 +88,6 @@ export interface AssistantProviderProps { getInitialConversations: () => Record; modelEvaluatorEnabled?: boolean; nameSpace?: string; - ragOnAlerts?: boolean; setConversations: React.Dispatch>>; setDefaultAllow: React.Dispatch>; setDefaultAllowReplacement: React.Dispatch>; @@ -140,7 +139,6 @@ export interface UseAssistantContext { promptContexts: Record; modelEvaluatorEnabled: boolean; nameSpace: string; - ragOnAlerts: boolean; registerPromptContext: RegisterPromptContext; selectedSettingsTab: SettingsTabs; setAllQuickPrompts: React.Dispatch>; @@ -182,7 +180,6 @@ export const AssistantProvider: React.FC = ({ getInitialConversations, modelEvaluatorEnabled = false, nameSpace = DEFAULT_ASSISTANT_NAMESPACE, - ragOnAlerts = false, setConversations, setDefaultAllow, setDefaultAllowReplacement, @@ -319,7 +316,6 @@ export const AssistantProvider: React.FC = ({ modelEvaluatorEnabled, promptContexts, nameSpace, - ragOnAlerts, registerPromptContext, selectedSettingsTab, setAllQuickPrompts: setLocalStorageQuickPrompts, @@ -365,7 +361,6 @@ export const AssistantProvider: React.FC = ({ nameSpace, onConversationsUpdated, promptContexts, - ragOnAlerts, registerPromptContext, selectedSettingsTab, setDefaultAllow, diff --git a/x-pack/packages/kbn-elastic-assistant/impl/knowledge_base/knowledge_base_settings.test.tsx b/x-pack/packages/kbn-elastic-assistant/impl/knowledge_base/knowledge_base_settings.test.tsx index 06c1b33bfda850d..6e5d7e7b1b174b2 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/knowledge_base/knowledge_base_settings.test.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/knowledge_base/knowledge_base_settings.test.tsx @@ -22,7 +22,6 @@ const mockUseAssistantContext = { prepend: jest.fn(), }, }, - ragOnAlerts: true, setAllSystemPrompts: jest.fn(), setConversations: jest.fn(), }; @@ -210,7 +209,7 @@ describe('Knowledge base settings', () => { expect(queryByTestId('knowledgeBaseActionButton')).not.toBeInTheDocument(); }); - it('renders the alerts settings when ragOnAlerts is true', () => { + it('renders the alerts settings', () => { const { getByTestId } = render( diff --git a/x-pack/packages/kbn-elastic-assistant/impl/knowledge_base/knowledge_base_settings.tsx b/x-pack/packages/kbn-elastic-assistant/impl/knowledge_base/knowledge_base_settings.tsx index bd41f5b888c9319..5974bae6e5ab081 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/knowledge_base/knowledge_base_settings.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/knowledge_base/knowledge_base_settings.tsx @@ -47,7 +47,7 @@ interface Props { */ export const KnowledgeBaseSettings: React.FC = React.memo( ({ knowledgeBase, setUpdatedKnowledgeBaseSettings }) => { - const { http, ragOnAlerts } = useAssistantContext(); + const { http } = useAssistantContext(); const { data: kbStatus, isLoading, @@ -303,12 +303,10 @@ export const KnowledgeBaseSettings: React.FC = React.memo( - {ragOnAlerts && ( - - )} + ); } diff --git a/x-pack/plugins/security_solution/common/experimental_features.ts b/x-pack/plugins/security_solution/common/experimental_features.ts index a9f3affba56d76a..03bd7941a7b367c 100644 --- a/x-pack/plugins/security_solution/common/experimental_features.ts +++ b/x-pack/plugins/security_solution/common/experimental_features.ts @@ -94,11 +94,6 @@ export const allowedExperimentalValues = Object.freeze({ */ assistantModelEvaluation: false, - /** - * Enables Retrieval Augmented Generation (RAG) on Alerts in the assistant - */ - assistantRagOnAlerts: false, - /* * Enables the new user details flyout displayed on the Alerts page and timeline. * diff --git a/x-pack/plugins/security_solution/public/assistant/provider.tsx b/x-pack/plugins/security_solution/public/assistant/provider.tsx index 7a17a98bc0d6e34..a9f9e14a8d3e0ba 100644 --- a/x-pack/plugins/security_solution/public/assistant/provider.tsx +++ b/x-pack/plugins/security_solution/public/assistant/provider.tsx @@ -57,7 +57,6 @@ export const AssistantProvider: React.FC = ({ children }) => { const { signalIndexName } = useSignalIndex(); const alertsIndexPattern = signalIndexName ?? undefined; - const ragOnAlerts = useIsExperimentalFeatureEnabled('assistantRagOnAlerts'); const toasts = useAppToasts() as unknown as IToasts; // useAppToasts is the current, non-deprecated method of getting the toasts service in the Security Solution, but it doesn't return the IToasts interface (defined by core) return ( @@ -82,7 +81,6 @@ export const AssistantProvider: React.FC = ({ children }) => { assistantStreamingEnabled={assistantStreamingEnabled} modelEvaluatorEnabled={isModelEvaluationEnabled} nameSpace={nameSpace} - ragOnAlerts={ragOnAlerts} setConversations={setConversations} setDefaultAllow={setDefaultAllow} setDefaultAllowReplacement={setDefaultAllowReplacement}