From 6b9c7586b47ba6bcf942a654760a4589bfd2c69e Mon Sep 17 00:00:00 2001 From: Steph Milovic Date: Wed, 9 Oct 2024 13:36:47 -0600 Subject: [PATCH] [8.x] [Security GenAI] Remove `assistantBedrockChat` feature flag (#195461) (#195516) # Backport This will backport the following commits from `main` to `8.x`: - [[Security GenAI] Remove `assistantBedrockChat` feature flag (#195461)](https://github.com/elastic/kibana/pull/195461) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Elastic Machine --- .../kbn_elastic_assistant_common.devdocs.json | 10 +- api_docs/security_solution.devdocs.json | 14 +- .../impl/capabilities/index.ts | 1 - .../get_capabilities_route.gen.ts | 1 - .../get_capabilities_route.schema.yaml | 3 - .../server/lib/langchain/executors/types.ts | 1 - .../graphs/default_assistant_graph/graph.ts | 4 - .../default_assistant_graph/helpers.test.ts | 179 ++++++++++-------- .../graphs/default_assistant_graph/helpers.ts | 53 +----- .../graphs/default_assistant_graph/index.ts | 10 +- .../nodes/model_input.ts | 4 +- .../graphs/default_assistant_graph/types.ts | 2 - .../server/routes/evaluate/post_evaluate.ts | 3 +- .../server/routes/helpers.ts | 3 - .../elastic_assistant/server/routes/utils.ts | 20 +- .../plugins/elastic_assistant/server/types.ts | 4 +- .../common/experimental_features.ts | 5 - .../security_solution/server/plugin.ts | 1 - 18 files changed, 131 insertions(+), 187 deletions(-) diff --git a/api_docs/kbn_elastic_assistant_common.devdocs.json b/api_docs/kbn_elastic_assistant_common.devdocs.json index 2fc5def8c52ae..1975106aea7fb 100644 --- a/api_docs/kbn_elastic_assistant_common.devdocs.json +++ b/api_docs/kbn_elastic_assistant_common.devdocs.json @@ -844,7 +844,7 @@ "\nInterface for features available to the elastic assistant" ], "signature": [ - "{ readonly assistantKnowledgeBaseByDefault: boolean; readonly assistantModelEvaluation: boolean; readonly assistantBedrockChat: boolean; }" + "{ readonly assistantKnowledgeBaseByDefault: boolean; readonly assistantModelEvaluation: boolean; }" ], "path": "x-pack/packages/kbn-elastic-assistant-common/impl/capabilities/index.ts", "deprecated": false, @@ -2574,7 +2574,7 @@ "label": "GetCapabilitiesResponse", "description": [], "signature": [ - "{ assistantKnowledgeBaseByDefault: boolean; assistantModelEvaluation: boolean; assistantBedrockChat: boolean; }" + "{ assistantKnowledgeBaseByDefault: boolean; assistantModelEvaluation: boolean; }" ], "path": "x-pack/packages/kbn-elastic-assistant-common/impl/schemas/capabilities/get_capabilities_route.gen.ts", "deprecated": false, @@ -4522,7 +4522,7 @@ "\nDefault features available to the elastic assistant" ], "signature": [ - "{ readonly assistantKnowledgeBaseByDefault: false; readonly assistantModelEvaluation: false; readonly assistantBedrockChat: true; }" + "{ readonly assistantKnowledgeBaseByDefault: false; readonly assistantModelEvaluation: false; }" ], "path": "x-pack/packages/kbn-elastic-assistant-common/impl/capabilities/index.ts", "deprecated": false, @@ -4987,7 +4987,7 @@ "label": "GetCapabilitiesResponse", "description": [], "signature": [ - "Zod.ZodObject<{ assistantBedrockChat: Zod.ZodBoolean; assistantKnowledgeBaseByDefault: Zod.ZodBoolean; assistantModelEvaluation: Zod.ZodBoolean; }, \"strip\", Zod.ZodTypeAny, { assistantKnowledgeBaseByDefault: boolean; assistantModelEvaluation: boolean; assistantBedrockChat: boolean; }, { assistantKnowledgeBaseByDefault: boolean; assistantModelEvaluation: boolean; assistantBedrockChat: boolean; }>" + "Zod.ZodObject<{ assistantKnowledgeBaseByDefault: Zod.ZodBoolean; assistantModelEvaluation: Zod.ZodBoolean; }, \"strip\", Zod.ZodTypeAny, { assistantKnowledgeBaseByDefault: boolean; assistantModelEvaluation: boolean; }, { assistantKnowledgeBaseByDefault: boolean; assistantModelEvaluation: boolean; }>" ], "path": "x-pack/packages/kbn-elastic-assistant-common/impl/schemas/capabilities/get_capabilities_route.gen.ts", "deprecated": false, @@ -5941,4 +5941,4 @@ } ] } -} \ No newline at end of file +} diff --git a/api_docs/security_solution.devdocs.json b/api_docs/security_solution.devdocs.json index 9d4957972ff47..7364ea24cc677 100644 --- a/api_docs/security_solution.devdocs.json +++ b/api_docs/security_solution.devdocs.json @@ -485,7 +485,7 @@ "\nExperimental flag needed to enable the link" ], "signature": [ - "\"assistantKnowledgeBaseByDefault\" | \"assistantModelEvaluation\" | \"assistantBedrockChat\" | \"excludePoliciesInFilterEnabled\" | \"kubernetesEnabled\" | \"donutChartEmbeddablesEnabled\" | \"previewTelemetryUrlEnabled\" | \"extendedRuleExecutionLoggingEnabled\" | \"socTrendsEnabled\" | \"responseActionUploadEnabled\" | \"automatedProcessActionsEnabled\" | \"responseActionsSentinelOneV1Enabled\" | \"responseActionsSentinelOneV2Enabled\" | \"responseActionsSentinelOneGetFileEnabled\" | \"responseActionsSentinelOneKillProcessEnabled\" | \"responseActionsSentinelOneProcessesEnabled\" | \"responseActionsCrowdstrikeManualHostIsolationEnabled\" | \"securitySolutionNotesEnabled\" | \"entityAlertPreviewDisabled\" | \"newUserDetailsFlyoutManagedUser\" | \"riskScoringPersistence\" | \"riskScoringRoutesEnabled\" | \"esqlRulesDisabled\" | \"protectionUpdatesEnabled\" | \"disableTimelineSaveTour\" | \"riskEnginePrivilegesRouteEnabled\" | \"sentinelOneDataInAnalyzerEnabled\" | \"sentinelOneManualHostActionsEnabled\" | \"crowdstrikeDataInAnalyzerEnabled\" | \"jamfDataInAnalyzerEnabled\" | \"timelineEsqlTabDisabled\" | \"unifiedComponentsInTimelineDisabled\" | \"analyzerDatePickersAndSourcererDisabled\" | \"prebuiltRulesCustomizationEnabled\" | \"malwareOnWriteScanOptionAvailable\" | \"unifiedManifestEnabled\" | \"valueListItemsModalEnabled\" | \"manualRuleRunEnabled\" | \"filterProcessDescendantsForEventFiltersEnabled\" | \"dataIngestionHubEnabled\" | undefined" + "\"assistantKnowledgeBaseByDefault\" | \"assistantModelEvaluation\" | \"excludePoliciesInFilterEnabled\" | \"kubernetesEnabled\" | \"donutChartEmbeddablesEnabled\" | \"previewTelemetryUrlEnabled\" | \"extendedRuleExecutionLoggingEnabled\" | \"socTrendsEnabled\" | \"responseActionUploadEnabled\" | \"automatedProcessActionsEnabled\" | \"responseActionsSentinelOneV1Enabled\" | \"responseActionsSentinelOneV2Enabled\" | \"responseActionsSentinelOneGetFileEnabled\" | \"responseActionsSentinelOneKillProcessEnabled\" | \"responseActionsSentinelOneProcessesEnabled\" | \"responseActionsCrowdstrikeManualHostIsolationEnabled\" | \"securitySolutionNotesEnabled\" | \"entityAlertPreviewDisabled\" | \"newUserDetailsFlyoutManagedUser\" | \"riskScoringPersistence\" | \"riskScoringRoutesEnabled\" | \"esqlRulesDisabled\" | \"protectionUpdatesEnabled\" | \"disableTimelineSaveTour\" | \"riskEnginePrivilegesRouteEnabled\" | \"sentinelOneDataInAnalyzerEnabled\" | \"sentinelOneManualHostActionsEnabled\" | \"crowdstrikeDataInAnalyzerEnabled\" | \"jamfDataInAnalyzerEnabled\" | \"timelineEsqlTabDisabled\" | \"unifiedComponentsInTimelineDisabled\" | \"analyzerDatePickersAndSourcererDisabled\" | \"prebuiltRulesCustomizationEnabled\" | \"malwareOnWriteScanOptionAvailable\" | \"unifiedManifestEnabled\" | \"valueListItemsModalEnabled\" | \"manualRuleRunEnabled\" | \"filterProcessDescendantsForEventFiltersEnabled\" | \"dataIngestionHubEnabled\" | undefined" ], "path": "x-pack/plugins/security_solution/public/common/links/types.ts", "deprecated": false, @@ -565,7 +565,7 @@ "\nExperimental flag needed to disable the link. Opposite of experimentalKey" ], "signature": [ - "\"assistantKnowledgeBaseByDefault\" | \"assistantModelEvaluation\" | \"assistantBedrockChat\" | \"excludePoliciesInFilterEnabled\" | \"kubernetesEnabled\" | \"donutChartEmbeddablesEnabled\" | \"previewTelemetryUrlEnabled\" | \"extendedRuleExecutionLoggingEnabled\" | \"socTrendsEnabled\" | \"responseActionUploadEnabled\" | \"automatedProcessActionsEnabled\" | \"responseActionsSentinelOneV1Enabled\" | \"responseActionsSentinelOneV2Enabled\" | \"responseActionsSentinelOneGetFileEnabled\" | \"responseActionsSentinelOneKillProcessEnabled\" | \"responseActionsSentinelOneProcessesEnabled\" | \"responseActionsCrowdstrikeManualHostIsolationEnabled\" | \"securitySolutionNotesEnabled\" | \"entityAlertPreviewDisabled\" | \"newUserDetailsFlyoutManagedUser\" | \"riskScoringPersistence\" | \"riskScoringRoutesEnabled\" | \"esqlRulesDisabled\" | \"protectionUpdatesEnabled\" | \"disableTimelineSaveTour\" | \"riskEnginePrivilegesRouteEnabled\" | \"sentinelOneDataInAnalyzerEnabled\" | \"sentinelOneManualHostActionsEnabled\" | \"crowdstrikeDataInAnalyzerEnabled\" | \"jamfDataInAnalyzerEnabled\" | \"timelineEsqlTabDisabled\" | \"unifiedComponentsInTimelineDisabled\" | \"analyzerDatePickersAndSourcererDisabled\" | \"prebuiltRulesCustomizationEnabled\" | \"malwareOnWriteScanOptionAvailable\" | \"unifiedManifestEnabled\" | \"valueListItemsModalEnabled\" | \"manualRuleRunEnabled\" | \"filterProcessDescendantsForEventFiltersEnabled\" | \"dataIngestionHubEnabled\" | undefined" + "\"assistantKnowledgeBaseByDefault\" | \"assistantModelEvaluation\" | \"excludePoliciesInFilterEnabled\" | \"kubernetesEnabled\" | \"donutChartEmbeddablesEnabled\" | \"previewTelemetryUrlEnabled\" | \"extendedRuleExecutionLoggingEnabled\" | \"socTrendsEnabled\" | \"responseActionUploadEnabled\" | \"automatedProcessActionsEnabled\" | \"responseActionsSentinelOneV1Enabled\" | \"responseActionsSentinelOneV2Enabled\" | \"responseActionsSentinelOneGetFileEnabled\" | \"responseActionsSentinelOneKillProcessEnabled\" | \"responseActionsSentinelOneProcessesEnabled\" | \"responseActionsCrowdstrikeManualHostIsolationEnabled\" | \"securitySolutionNotesEnabled\" | \"entityAlertPreviewDisabled\" | \"newUserDetailsFlyoutManagedUser\" | \"riskScoringPersistence\" | \"riskScoringRoutesEnabled\" | \"esqlRulesDisabled\" | \"protectionUpdatesEnabled\" | \"disableTimelineSaveTour\" | \"riskEnginePrivilegesRouteEnabled\" | \"sentinelOneDataInAnalyzerEnabled\" | \"sentinelOneManualHostActionsEnabled\" | \"crowdstrikeDataInAnalyzerEnabled\" | \"jamfDataInAnalyzerEnabled\" | \"timelineEsqlTabDisabled\" | \"unifiedComponentsInTimelineDisabled\" | \"analyzerDatePickersAndSourcererDisabled\" | \"prebuiltRulesCustomizationEnabled\" | \"malwareOnWriteScanOptionAvailable\" | \"unifiedManifestEnabled\" | \"valueListItemsModalEnabled\" | \"manualRuleRunEnabled\" | \"filterProcessDescendantsForEventFiltersEnabled\" | \"dataIngestionHubEnabled\" | undefined" ], "path": "x-pack/plugins/security_solution/public/common/links/types.ts", "deprecated": false, @@ -1931,7 +1931,7 @@ "label": "experimentalFeatures", "description": [], "signature": [ - "{ readonly excludePoliciesInFilterEnabled: boolean; readonly kubernetesEnabled: boolean; readonly donutChartEmbeddablesEnabled: boolean; readonly previewTelemetryUrlEnabled: boolean; readonly extendedRuleExecutionLoggingEnabled: boolean; readonly socTrendsEnabled: boolean; readonly responseActionUploadEnabled: boolean; readonly automatedProcessActionsEnabled: boolean; readonly responseActionsSentinelOneV1Enabled: boolean; readonly responseActionsSentinelOneV2Enabled: boolean; readonly responseActionsSentinelOneGetFileEnabled: boolean; readonly responseActionsSentinelOneKillProcessEnabled: boolean; readonly responseActionsSentinelOneProcessesEnabled: boolean; readonly responseActionsCrowdstrikeManualHostIsolationEnabled: boolean; readonly securitySolutionNotesEnabled: boolean; readonly entityAlertPreviewDisabled: boolean; readonly assistantModelEvaluation: boolean; readonly assistantKnowledgeBaseByDefault: boolean; readonly assistantBedrockChat: boolean; readonly newUserDetailsFlyoutManagedUser: boolean; readonly riskScoringPersistence: boolean; readonly riskScoringRoutesEnabled: boolean; readonly esqlRulesDisabled: boolean; readonly protectionUpdatesEnabled: boolean; readonly disableTimelineSaveTour: boolean; readonly riskEnginePrivilegesRouteEnabled: boolean; readonly sentinelOneDataInAnalyzerEnabled: boolean; readonly sentinelOneManualHostActionsEnabled: boolean; readonly crowdstrikeDataInAnalyzerEnabled: boolean; readonly jamfDataInAnalyzerEnabled: boolean; readonly timelineEsqlTabDisabled: boolean; readonly unifiedComponentsInTimelineDisabled: boolean; readonly analyzerDatePickersAndSourcererDisabled: boolean; readonly prebuiltRulesCustomizationEnabled: boolean; readonly malwareOnWriteScanOptionAvailable: boolean; readonly unifiedManifestEnabled: boolean; readonly valueListItemsModalEnabled: boolean; readonly manualRuleRunEnabled: boolean; readonly filterProcessDescendantsForEventFiltersEnabled: boolean; readonly dataIngestionHubEnabled: boolean; }" + "{ readonly excludePoliciesInFilterEnabled: boolean; readonly kubernetesEnabled: boolean; readonly donutChartEmbeddablesEnabled: boolean; readonly previewTelemetryUrlEnabled: boolean; readonly extendedRuleExecutionLoggingEnabled: boolean; readonly socTrendsEnabled: boolean; readonly responseActionUploadEnabled: boolean; readonly automatedProcessActionsEnabled: boolean; readonly responseActionsSentinelOneV1Enabled: boolean; readonly responseActionsSentinelOneV2Enabled: boolean; readonly responseActionsSentinelOneGetFileEnabled: boolean; readonly responseActionsSentinelOneKillProcessEnabled: boolean; readonly responseActionsSentinelOneProcessesEnabled: boolean; readonly responseActionsCrowdstrikeManualHostIsolationEnabled: boolean; readonly securitySolutionNotesEnabled: boolean; readonly entityAlertPreviewDisabled: boolean; readonly assistantModelEvaluation: boolean; readonly assistantKnowledgeBaseByDefault: boolean; readonly newUserDetailsFlyoutManagedUser: boolean; readonly riskScoringPersistence: boolean; readonly riskScoringRoutesEnabled: boolean; readonly esqlRulesDisabled: boolean; readonly protectionUpdatesEnabled: boolean; readonly disableTimelineSaveTour: boolean; readonly riskEnginePrivilegesRouteEnabled: boolean; readonly sentinelOneDataInAnalyzerEnabled: boolean; readonly sentinelOneManualHostActionsEnabled: boolean; readonly crowdstrikeDataInAnalyzerEnabled: boolean; readonly jamfDataInAnalyzerEnabled: boolean; readonly timelineEsqlTabDisabled: boolean; readonly unifiedComponentsInTimelineDisabled: boolean; readonly analyzerDatePickersAndSourcererDisabled: boolean; readonly prebuiltRulesCustomizationEnabled: boolean; readonly malwareOnWriteScanOptionAvailable: boolean; readonly unifiedManifestEnabled: boolean; readonly valueListItemsModalEnabled: boolean; readonly manualRuleRunEnabled: boolean; readonly filterProcessDescendantsForEventFiltersEnabled: boolean; readonly dataIngestionHubEnabled: boolean; }" ], "path": "x-pack/plugins/security_solution/public/types.ts", "deprecated": false, @@ -3082,7 +3082,7 @@ "\nThe security solution generic experimental features" ], "signature": [ - "{ readonly excludePoliciesInFilterEnabled: boolean; readonly kubernetesEnabled: boolean; readonly donutChartEmbeddablesEnabled: boolean; readonly previewTelemetryUrlEnabled: boolean; readonly extendedRuleExecutionLoggingEnabled: boolean; readonly socTrendsEnabled: boolean; readonly responseActionUploadEnabled: boolean; readonly automatedProcessActionsEnabled: boolean; readonly responseActionsSentinelOneV1Enabled: boolean; readonly responseActionsSentinelOneV2Enabled: boolean; readonly responseActionsSentinelOneGetFileEnabled: boolean; readonly responseActionsSentinelOneKillProcessEnabled: boolean; readonly responseActionsSentinelOneProcessesEnabled: boolean; readonly responseActionsCrowdstrikeManualHostIsolationEnabled: boolean; readonly securitySolutionNotesEnabled: boolean; readonly entityAlertPreviewDisabled: boolean; readonly assistantModelEvaluation: boolean; readonly assistantKnowledgeBaseByDefault: boolean; readonly assistantBedrockChat: boolean; readonly newUserDetailsFlyoutManagedUser: boolean; readonly riskScoringPersistence: boolean; readonly riskScoringRoutesEnabled: boolean; readonly esqlRulesDisabled: boolean; readonly protectionUpdatesEnabled: boolean; readonly disableTimelineSaveTour: boolean; readonly riskEnginePrivilegesRouteEnabled: boolean; readonly sentinelOneDataInAnalyzerEnabled: boolean; readonly sentinelOneManualHostActionsEnabled: boolean; readonly crowdstrikeDataInAnalyzerEnabled: boolean; readonly jamfDataInAnalyzerEnabled: boolean; readonly timelineEsqlTabDisabled: boolean; readonly unifiedComponentsInTimelineDisabled: boolean; readonly analyzerDatePickersAndSourcererDisabled: boolean; readonly prebuiltRulesCustomizationEnabled: boolean; readonly malwareOnWriteScanOptionAvailable: boolean; readonly unifiedManifestEnabled: boolean; readonly valueListItemsModalEnabled: boolean; readonly manualRuleRunEnabled: boolean; readonly filterProcessDescendantsForEventFiltersEnabled: boolean; readonly dataIngestionHubEnabled: boolean; }" + "{ readonly excludePoliciesInFilterEnabled: boolean; readonly kubernetesEnabled: boolean; readonly donutChartEmbeddablesEnabled: boolean; readonly previewTelemetryUrlEnabled: boolean; readonly extendedRuleExecutionLoggingEnabled: boolean; readonly socTrendsEnabled: boolean; readonly responseActionUploadEnabled: boolean; readonly automatedProcessActionsEnabled: boolean; readonly responseActionsSentinelOneV1Enabled: boolean; readonly responseActionsSentinelOneV2Enabled: boolean; readonly responseActionsSentinelOneGetFileEnabled: boolean; readonly responseActionsSentinelOneKillProcessEnabled: boolean; readonly responseActionsSentinelOneProcessesEnabled: boolean; readonly responseActionsCrowdstrikeManualHostIsolationEnabled: boolean; readonly securitySolutionNotesEnabled: boolean; readonly entityAlertPreviewDisabled: boolean; readonly assistantModelEvaluation: boolean; readonly assistantKnowledgeBaseByDefault: boolean; readonly newUserDetailsFlyoutManagedUser: boolean; readonly riskScoringPersistence: boolean; readonly riskScoringRoutesEnabled: boolean; readonly esqlRulesDisabled: boolean; readonly protectionUpdatesEnabled: boolean; readonly disableTimelineSaveTour: boolean; readonly riskEnginePrivilegesRouteEnabled: boolean; readonly sentinelOneDataInAnalyzerEnabled: boolean; readonly sentinelOneManualHostActionsEnabled: boolean; readonly crowdstrikeDataInAnalyzerEnabled: boolean; readonly jamfDataInAnalyzerEnabled: boolean; readonly timelineEsqlTabDisabled: boolean; readonly unifiedComponentsInTimelineDisabled: boolean; readonly analyzerDatePickersAndSourcererDisabled: boolean; readonly prebuiltRulesCustomizationEnabled: boolean; readonly malwareOnWriteScanOptionAvailable: boolean; readonly unifiedManifestEnabled: boolean; readonly valueListItemsModalEnabled: boolean; readonly manualRuleRunEnabled: boolean; readonly filterProcessDescendantsForEventFiltersEnabled: boolean; readonly dataIngestionHubEnabled: boolean; }" ], "path": "x-pack/plugins/security_solution/server/plugin_contract.ts", "deprecated": false, @@ -3258,7 +3258,7 @@ "label": "ExperimentalFeatures", "description": [], "signature": [ - "{ readonly excludePoliciesInFilterEnabled: boolean; readonly kubernetesEnabled: boolean; readonly donutChartEmbeddablesEnabled: boolean; readonly previewTelemetryUrlEnabled: boolean; readonly extendedRuleExecutionLoggingEnabled: boolean; readonly socTrendsEnabled: boolean; readonly responseActionUploadEnabled: boolean; readonly automatedProcessActionsEnabled: boolean; readonly responseActionsSentinelOneV1Enabled: boolean; readonly responseActionsSentinelOneV2Enabled: boolean; readonly responseActionsSentinelOneGetFileEnabled: boolean; readonly responseActionsSentinelOneKillProcessEnabled: boolean; readonly responseActionsSentinelOneProcessesEnabled: boolean; readonly responseActionsCrowdstrikeManualHostIsolationEnabled: boolean; readonly securitySolutionNotesEnabled: boolean; readonly entityAlertPreviewDisabled: boolean; readonly assistantModelEvaluation: boolean; readonly assistantKnowledgeBaseByDefault: boolean; readonly assistantBedrockChat: boolean; readonly newUserDetailsFlyoutManagedUser: boolean; readonly riskScoringPersistence: boolean; readonly riskScoringRoutesEnabled: boolean; readonly esqlRulesDisabled: boolean; readonly protectionUpdatesEnabled: boolean; readonly disableTimelineSaveTour: boolean; readonly riskEnginePrivilegesRouteEnabled: boolean; readonly sentinelOneDataInAnalyzerEnabled: boolean; readonly sentinelOneManualHostActionsEnabled: boolean; readonly crowdstrikeDataInAnalyzerEnabled: boolean; readonly jamfDataInAnalyzerEnabled: boolean; readonly timelineEsqlTabDisabled: boolean; readonly unifiedComponentsInTimelineDisabled: boolean; readonly analyzerDatePickersAndSourcererDisabled: boolean; readonly prebuiltRulesCustomizationEnabled: boolean; readonly malwareOnWriteScanOptionAvailable: boolean; readonly unifiedManifestEnabled: boolean; readonly valueListItemsModalEnabled: boolean; readonly manualRuleRunEnabled: boolean; readonly filterProcessDescendantsForEventFiltersEnabled: boolean; readonly dataIngestionHubEnabled: boolean; }" + "{ readonly excludePoliciesInFilterEnabled: boolean; readonly kubernetesEnabled: boolean; readonly donutChartEmbeddablesEnabled: boolean; readonly previewTelemetryUrlEnabled: boolean; readonly extendedRuleExecutionLoggingEnabled: boolean; readonly socTrendsEnabled: boolean; readonly responseActionUploadEnabled: boolean; readonly automatedProcessActionsEnabled: boolean; readonly responseActionsSentinelOneV1Enabled: boolean; readonly responseActionsSentinelOneV2Enabled: boolean; readonly responseActionsSentinelOneGetFileEnabled: boolean; readonly responseActionsSentinelOneKillProcessEnabled: boolean; readonly responseActionsSentinelOneProcessesEnabled: boolean; readonly responseActionsCrowdstrikeManualHostIsolationEnabled: boolean; readonly securitySolutionNotesEnabled: boolean; readonly entityAlertPreviewDisabled: boolean; readonly assistantModelEvaluation: boolean; readonly assistantKnowledgeBaseByDefault: boolean; readonly newUserDetailsFlyoutManagedUser: boolean; readonly riskScoringPersistence: boolean; readonly riskScoringRoutesEnabled: boolean; readonly esqlRulesDisabled: boolean; readonly protectionUpdatesEnabled: boolean; readonly disableTimelineSaveTour: boolean; readonly riskEnginePrivilegesRouteEnabled: boolean; readonly sentinelOneDataInAnalyzerEnabled: boolean; readonly sentinelOneManualHostActionsEnabled: boolean; readonly crowdstrikeDataInAnalyzerEnabled: boolean; readonly jamfDataInAnalyzerEnabled: boolean; readonly timelineEsqlTabDisabled: boolean; readonly unifiedComponentsInTimelineDisabled: boolean; readonly analyzerDatePickersAndSourcererDisabled: boolean; readonly prebuiltRulesCustomizationEnabled: boolean; readonly malwareOnWriteScanOptionAvailable: boolean; readonly unifiedManifestEnabled: boolean; readonly valueListItemsModalEnabled: boolean; readonly manualRuleRunEnabled: boolean; readonly filterProcessDescendantsForEventFiltersEnabled: boolean; readonly dataIngestionHubEnabled: boolean; }" ], "path": "x-pack/plugins/security_solution/common/experimental_features.ts", "deprecated": false, @@ -3324,7 +3324,7 @@ "\nA list of allowed values that can be used in `xpack.securitySolution.enableExperimental`.\nThis object is then used to validate and parse the value entered." ], "signature": [ - "{ readonly excludePoliciesInFilterEnabled: false; readonly kubernetesEnabled: true; readonly donutChartEmbeddablesEnabled: false; readonly previewTelemetryUrlEnabled: false; readonly extendedRuleExecutionLoggingEnabled: false; readonly socTrendsEnabled: false; readonly responseActionUploadEnabled: true; readonly automatedProcessActionsEnabled: true; readonly responseActionsSentinelOneV1Enabled: true; readonly responseActionsSentinelOneV2Enabled: true; readonly responseActionsSentinelOneGetFileEnabled: true; readonly responseActionsSentinelOneKillProcessEnabled: true; readonly responseActionsSentinelOneProcessesEnabled: true; readonly responseActionsCrowdstrikeManualHostIsolationEnabled: true; readonly securitySolutionNotesEnabled: false; readonly entityAlertPreviewDisabled: false; readonly assistantModelEvaluation: false; readonly assistantKnowledgeBaseByDefault: false; readonly assistantBedrockChat: true; readonly newUserDetailsFlyoutManagedUser: false; readonly riskScoringPersistence: true; readonly riskScoringRoutesEnabled: true; readonly esqlRulesDisabled: false; readonly protectionUpdatesEnabled: true; readonly disableTimelineSaveTour: false; readonly riskEnginePrivilegesRouteEnabled: true; readonly sentinelOneDataInAnalyzerEnabled: true; readonly sentinelOneManualHostActionsEnabled: true; readonly crowdstrikeDataInAnalyzerEnabled: true; readonly jamfDataInAnalyzerEnabled: true; readonly timelineEsqlTabDisabled: false; readonly unifiedComponentsInTimelineDisabled: false; readonly analyzerDatePickersAndSourcererDisabled: false; readonly prebuiltRulesCustomizationEnabled: false; readonly malwareOnWriteScanOptionAvailable: true; readonly unifiedManifestEnabled: true; readonly valueListItemsModalEnabled: true; readonly manualRuleRunEnabled: false; readonly filterProcessDescendantsForEventFiltersEnabled: true; readonly dataIngestionHubEnabled: false; }" + "{ readonly excludePoliciesInFilterEnabled: false; readonly kubernetesEnabled: true; readonly donutChartEmbeddablesEnabled: false; readonly previewTelemetryUrlEnabled: false; readonly extendedRuleExecutionLoggingEnabled: false; readonly socTrendsEnabled: false; readonly responseActionUploadEnabled: true; readonly automatedProcessActionsEnabled: true; readonly responseActionsSentinelOneV1Enabled: true; readonly responseActionsSentinelOneV2Enabled: true; readonly responseActionsSentinelOneGetFileEnabled: true; readonly responseActionsSentinelOneKillProcessEnabled: true; readonly responseActionsSentinelOneProcessesEnabled: true; readonly responseActionsCrowdstrikeManualHostIsolationEnabled: true; readonly securitySolutionNotesEnabled: false; readonly entityAlertPreviewDisabled: false; readonly assistantModelEvaluation: false; readonly assistantKnowledgeBaseByDefault: false; readonly newUserDetailsFlyoutManagedUser: false; readonly riskScoringPersistence: true; readonly riskScoringRoutesEnabled: true; readonly esqlRulesDisabled: false; readonly protectionUpdatesEnabled: true; readonly disableTimelineSaveTour: false; readonly riskEnginePrivilegesRouteEnabled: true; readonly sentinelOneDataInAnalyzerEnabled: true; readonly sentinelOneManualHostActionsEnabled: true; readonly crowdstrikeDataInAnalyzerEnabled: true; readonly jamfDataInAnalyzerEnabled: true; readonly timelineEsqlTabDisabled: false; readonly unifiedComponentsInTimelineDisabled: false; readonly analyzerDatePickersAndSourcererDisabled: false; readonly prebuiltRulesCustomizationEnabled: false; readonly malwareOnWriteScanOptionAvailable: true; readonly unifiedManifestEnabled: true; readonly valueListItemsModalEnabled: true; readonly manualRuleRunEnabled: false; readonly filterProcessDescendantsForEventFiltersEnabled: true; readonly dataIngestionHubEnabled: false; }" ], "path": "x-pack/plugins/security_solution/common/experimental_features.ts", "deprecated": false, @@ -3333,4 +3333,4 @@ } ] } -} \ No newline at end of file +} diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/capabilities/index.ts b/x-pack/packages/kbn-elastic-assistant-common/impl/capabilities/index.ts index d97f2aef17b4b..c1c101fd74cd8 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/capabilities/index.ts +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/capabilities/index.ts @@ -21,5 +21,4 @@ export type AssistantFeatureKey = keyof AssistantFeatures; export const defaultAssistantFeatures = Object.freeze({ assistantKnowledgeBaseByDefault: false, assistantModelEvaluation: false, - assistantBedrockChat: true, }); diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/capabilities/get_capabilities_route.gen.ts b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/capabilities/get_capabilities_route.gen.ts index 55797f5d97847..b3ab7cca5bc02 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/capabilities/get_capabilities_route.gen.ts +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/capabilities/get_capabilities_route.gen.ts @@ -18,7 +18,6 @@ import { z } from '@kbn/zod'; export type GetCapabilitiesResponse = z.infer; export const GetCapabilitiesResponse = z.object({ - assistantBedrockChat: z.boolean(), assistantKnowledgeBaseByDefault: z.boolean(), assistantModelEvaluation: z.boolean(), }); diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/capabilities/get_capabilities_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/capabilities/get_capabilities_route.schema.yaml index 0f07d1f58afe5..01b5eb0e15823 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/capabilities/get_capabilities_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/capabilities/get_capabilities_route.schema.yaml @@ -20,14 +20,11 @@ paths: schema: type: object properties: - assistantBedrockChat: - type: boolean assistantKnowledgeBaseByDefault: type: boolean assistantModelEvaluation: type: boolean required: - - assistantBedrockChat - assistantKnowledgeBaseByDefault - assistantModelEvaluation '400': diff --git a/x-pack/plugins/elastic_assistant/server/lib/langchain/executors/types.ts b/x-pack/plugins/elastic_assistant/server/lib/langchain/executors/types.ts index 5761201849c09..3e573aff2f4c8 100644 --- a/x-pack/plugins/elastic_assistant/server/lib/langchain/executors/types.ts +++ b/x-pack/plugins/elastic_assistant/server/lib/langchain/executors/types.ts @@ -37,7 +37,6 @@ export interface AgentExecutorParams { abortSignal?: AbortSignal; alertsIndexPattern?: string; actionsClient: PublicMethodsOf; - bedrockChatEnabled: boolean; assistantTools?: AssistantTool[]; connectorId: string; conversationId?: string; diff --git a/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/graph.ts b/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/graph.ts index f8e21da57e5b9..4688caa176b56 100644 --- a/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/graph.ts +++ b/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/graph.ts @@ -86,10 +86,6 @@ export const getDefaultAssistantGraph = ({ value: (x: string, y?: string) => y ?? x, default: () => 'unknown', }, - bedrockChatEnabled: { - value: (x: boolean, y?: boolean) => y ?? x, - default: () => false, - }, isStream: { value: (x: boolean, y?: boolean) => y ?? x, default: () => false, diff --git a/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/helpers.test.ts b/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/helpers.test.ts index f15941e9931fe..d9ccd769592ff 100644 --- a/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/helpers.test.ts +++ b/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/helpers.test.ts @@ -49,6 +49,18 @@ describe('streamGraph', () => { streamEvents: mockStreamEvents, } as unknown as DefaultAssistantGraph; const mockOnLlmResponse = jest.fn().mockResolvedValue(null); + const requestArgs = { + apmTracer: mockApmTracer, + assistantGraph: mockAssistantGraph, + inputs: { + input: 'input', + responseLanguage: 'English', + llmType: 'openai', + }, + logger: mockLogger, + onLlmResponse: mockOnLlmResponse, + request: mockRequest, + }; beforeEach(() => { jest.clearAllMocks(); @@ -59,8 +71,8 @@ describe('streamGraph', () => { transaction: { ids: { 'transaction.id': 'transactionId' } }, }); }); - describe('ActionsClientChatOpenAI', () => { - it('should execute the graph in streaming mode', async () => { + describe('OpenAI Function Agent streaming', () => { + it('should execute the graph in streaming mode - OpenAI + isOssModel = false', async () => { mockStreamEvents.mockReturnValue({ next: jest .fn() @@ -93,19 +105,7 @@ describe('streamGraph', () => { return: jest.fn(), }); - const response = await streamGraph({ - apmTracer: mockApmTracer, - assistantGraph: mockAssistantGraph, - inputs: { - input: 'input', - bedrockChatEnabled: false, - llmType: 'openai', - responseLanguage: 'English', - }, - logger: mockLogger, - onLlmResponse: mockOnLlmResponse, - request: mockRequest, - }); + const response = await streamGraph(requestArgs); expect(response).toBe(mockResponseWithHeaders); expect(mockPush).toHaveBeenCalledWith({ payload: 'content', type: 'content' }); @@ -119,78 +119,49 @@ describe('streamGraph', () => { }); }); - describe('ActionsClientSimpleChatModel', () => { - it('should execute the graph in streaming mode', async () => { - mockStreamEvents.mockReturnValue({ - next: jest - .fn() - .mockResolvedValueOnce({ - value: { - name: 'ActionsClientSimpleChatModel', - event: 'on_llm_stream', - data: { - chunk: { - content: - '```json\n\n "action": "Final Answer",\n "action_input": "Look at these', - }, - }, - tags: [AGENT_NODE_TAG], + describe('Tool Calling Agent and Structured Chat Agent streaming', () => { + const mockAsyncIterator = { + async *[Symbol.asyncIterator]() { + yield { + event: 'on_chat_model_stream', + data: { + chunk: { + content: 'Look at these', }, - done: false, - }) - .mockResolvedValueOnce({ - value: { - name: 'ActionsClientSimpleChatModel', - event: 'on_llm_stream', - data: { - chunk: { - content: ' rare IP', - }, - }, - tags: [AGENT_NODE_TAG], + }, + tags: [AGENT_NODE_TAG], + }; + yield { + event: 'on_chat_model_stream', + data: { + chunk: { + content: ' rare IP', }, - done: false, - }) - .mockResolvedValueOnce({ - value: { - name: 'ActionsClientSimpleChatModel', - event: 'on_llm_stream', - data: { - chunk: { - content: ' addresses." }```', - }, - }, - tags: [AGENT_NODE_TAG], + }, + tags: [AGENT_NODE_TAG], + }; + yield { + event: 'on_chat_model_stream', + data: { + chunk: { + content: ' addresses.', }, - done: false, - }) - .mockResolvedValueOnce({ - value: { - name: 'ActionsClientSimpleChatModel', - event: 'on_llm_end', - tags: [AGENT_NODE_TAG], + }, + tags: [AGENT_NODE_TAG], + }; + yield { + event: 'on_chat_model_end', + data: { + output: { + content: 'Look at these rare IP addresses.', }, - }) - .mockResolvedValue({ - done: true, - }), - return: jest.fn(), - }); - - const response = await streamGraph({ - apmTracer: mockApmTracer, - assistantGraph: mockAssistantGraph, - inputs: { - input: 'input', - bedrockChatEnabled: false, - responseLanguage: 'English', - llmType: 'gemini', - }, - logger: mockLogger, - onLlmResponse: mockOnLlmResponse, - request: mockRequest, - }); + }, + tags: [AGENT_NODE_TAG], + }; + }, + }; + const expectConditions = async (response: unknown) => { expect(response).toBe(mockResponseWithHeaders); await waitFor(() => { @@ -203,6 +174,50 @@ describe('streamGraph', () => { false ); }); + }; + it('should execute the graph in streaming mode - Gemini', async () => { + const mockAssistantGraphAsyncIterator = { + streamEvents: () => mockAsyncIterator, + } as unknown as DefaultAssistantGraph; + const response = await streamGraph({ + ...requestArgs, + assistantGraph: mockAssistantGraphAsyncIterator, + inputs: { + ...requestArgs.inputs, + llmType: 'gemini', + }, + }); + + await expectConditions(response); + }); + it('should execute the graph in streaming mode - Bedrock', async () => { + const mockAssistantGraphAsyncIterator = { + streamEvents: () => mockAsyncIterator, + } as unknown as DefaultAssistantGraph; + const response = await streamGraph({ + ...requestArgs, + assistantGraph: mockAssistantGraphAsyncIterator, + inputs: { + ...requestArgs.inputs, + llmType: 'bedrock', + }, + }); + + await expectConditions(response); + }); + it('should execute the graph in streaming mode - OpenAI + isOssModel = false', async () => { + const mockAssistantGraphAsyncIterator = { + streamEvents: () => mockAsyncIterator, + } as unknown as DefaultAssistantGraph; + const response = await streamGraph({ + ...requestArgs, + assistantGraph: mockAssistantGraphAsyncIterator, + inputs: { + ...requestArgs.inputs, + isOssModel: true, + }, + }); + await expectConditions(response); }); }); }); diff --git a/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/helpers.ts b/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/helpers.ts index 840b2a9ac8ce0..d1b3514b15b73 100644 --- a/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/helpers.ts +++ b/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/helpers.ts @@ -24,7 +24,6 @@ interface StreamGraphParams { assistantGraph: DefaultAssistantGraph; inputs: GraphInputs; logger: Logger; - isOssModel?: boolean; onLlmResponse?: OnLlmResponse; request: KibanaRequest; traceOptions?: TraceOptions; @@ -37,7 +36,6 @@ interface StreamGraphParams { * @param assistantGraph * @param inputs * @param logger - * @param isOssModel * @param onLlmResponse * @param request * @param traceOptions @@ -47,7 +45,6 @@ export const streamGraph = async ({ assistantGraph, inputs, logger, - isOssModel, onLlmResponse, request, traceOptions, @@ -82,10 +79,8 @@ export const streamGraph = async ({ streamingSpan?.end(); }; - if ( - inputs.isOssModel || - ((inputs?.llmType === 'bedrock' || inputs?.llmType === 'gemini') && inputs?.bedrockChatEnabled) - ) { + // Stream is from tool calling agent or structured chat agent + if (inputs.isOssModel || inputs?.llmType === 'bedrock' || inputs?.llmType === 'gemini') { const stream = await assistantGraph.streamEvents( inputs, { @@ -104,7 +99,6 @@ export const streamGraph = async ({ if ((tags || []).includes(AGENT_NODE_TAG)) { if (event === 'on_chat_model_stream') { const msg = data.chunk as AIMessageChunk; - if (!didEnd && !msg.tool_call_chunks?.length && msg.content.length) { push({ payload: msg.content as string, type: 'content' }); } @@ -121,6 +115,8 @@ export const streamGraph = async ({ } return responseWithHeaders; } + + // Stream is from openai functions agent let finalMessage = ''; let conversationId: string | undefined; const stream = assistantGraph.streamEvents(inputs, { @@ -131,12 +127,6 @@ export const streamGraph = async ({ version: 'v1', }); - let currentOutput = ''; - let finalOutputIndex = -1; - const finalOutputStartToken = '"action":"FinalAnswer","action_input":"'; - let streamingFinished = false; - const finalOutputStopRegex = /(? { try { const { value, done } = await stream.next(); @@ -164,41 +154,6 @@ export const streamGraph = async ({ } } } - if (event.name === 'ActionsClientSimpleChatModel') { - if (event.event === 'on_llm_stream') { - const chunk = event.data?.chunk; - - const msg = chunk.content; - if (finalOutputIndex === -1) { - currentOutput += msg; - // Remove whitespace to simplify parsing - const noWhitespaceOutput = currentOutput.replace(/\s/g, ''); - if (noWhitespaceOutput.includes(finalOutputStartToken)) { - const nonStrippedToken = '"action_input": "'; - finalOutputIndex = currentOutput.indexOf(nonStrippedToken); - const contentStartIndex = finalOutputIndex + nonStrippedToken.length; - extraOutput = currentOutput.substring(contentStartIndex); - push({ payload: extraOutput, type: 'content' }); - finalMessage += extraOutput; - } - } else if (!streamingFinished && !didEnd) { - const finalOutputEndIndex = msg.search(finalOutputStopRegex); - if (finalOutputEndIndex !== -1) { - extraOutput = msg.substring(0, finalOutputEndIndex); - streamingFinished = true; - if (extraOutput.length > 0) { - push({ payload: extraOutput, type: 'content' }); - finalMessage += extraOutput; - } - } else { - push({ payload: chunk.content, type: 'content' }); - finalMessage += chunk.content; - } - } - } else if (event.event === 'on_llm_end' && streamingFinished && !didEnd) { - handleStreamEnd(finalMessage); - } - } } void processEvent(); diff --git a/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/index.ts b/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/index.ts index daec22b436474..ada5b8a421441 100644 --- a/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/index.ts +++ b/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/index.ts @@ -28,7 +28,6 @@ export const callAssistantGraph: AgentExecutor = async ({ actionsClient, alertsIndexPattern, assistantTools = [], - bedrockChatEnabled, connectorId, conversationId, dataClients, @@ -50,7 +49,7 @@ export const callAssistantGraph: AgentExecutor = async ({ }) => { const logger = parentLogger.get('defaultAssistantGraph'); const isOpenAI = llmType === 'openai' && !isOssModel; - const llmClass = getLlmClass(llmType, bedrockChatEnabled); + const llmClass = getLlmClass(llmType); /** * Creates a new instance of llmClass. @@ -133,7 +132,7 @@ export const callAssistantGraph: AgentExecutor = async ({ prompt: formatPrompt(systemPrompts.openai, systemPrompt), streamRunnable: isStream, }) - : llmType && ['bedrock', 'gemini'].includes(llmType) && bedrockChatEnabled + : llmType && ['bedrock', 'gemini'].includes(llmType) ? await createToolCallingAgent({ llm: createLlmInstance(), tools, @@ -143,7 +142,8 @@ export const callAssistantGraph: AgentExecutor = async ({ : formatPrompt(systemPrompts.gemini, systemPrompt), streamRunnable: isStream, }) - : await createStructuredChatAgent({ + : // used with OSS models + await createStructuredChatAgent({ llm: createLlmInstance(), tools, prompt: formatPromptStructured(systemPrompts.structuredChat, systemPrompt), @@ -162,7 +162,6 @@ export const callAssistantGraph: AgentExecutor = async ({ replacements, }); const inputs: GraphInputs = { - bedrockChatEnabled, responseLanguage, conversationId, llmType, @@ -177,7 +176,6 @@ export const callAssistantGraph: AgentExecutor = async ({ assistantGraph, inputs, logger, - isOssModel, onLlmResponse, request, traceOptions, diff --git a/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/nodes/model_input.ts b/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/nodes/model_input.ts index 5f46e1ad2a741..4e03b5be1bf3b 100644 --- a/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/nodes/model_input.ts +++ b/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/nodes/model_input.ts @@ -22,9 +22,7 @@ interface ModelInputParams extends NodeParamsBase { export function modelInput({ logger, state }: ModelInputParams): Partial { logger.debug(() => `${NodeType.MODEL_INPUT}: Node state:\n${JSON.stringify(state, null, 2)}`); - const hasRespondStep = - state.isStream && - (state.isOssModel || (state.bedrockChatEnabled && state.llmType === 'bedrock')); + const hasRespondStep = state.isStream && (state.isOssModel || state.llmType === 'bedrock'); return { hasRespondStep, diff --git a/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/types.ts b/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/types.ts index 69632be2ffdcd..344bd042cc036 100644 --- a/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/types.ts +++ b/x-pack/plugins/elastic_assistant/server/lib/langchain/graphs/default_assistant_graph/types.ts @@ -16,7 +16,6 @@ export interface AgentStateBase { } export interface GraphInputs { - bedrockChatEnabled?: boolean; conversationId?: string; llmType?: string; isStream?: boolean; @@ -33,7 +32,6 @@ export interface AgentState extends AgentStateBase { hasRespondStep: boolean; isStream: boolean; isOssModel: boolean; - bedrockChatEnabled: boolean; llmType: string; responseLanguage: string; conversation: ConversationResponse | undefined; diff --git a/x-pack/plugins/elastic_assistant/server/routes/evaluate/post_evaluate.ts b/x-pack/plugins/elastic_assistant/server/routes/evaluate/post_evaluate.ts index 59436070a7125..de154a1ddd96d 100644 --- a/x-pack/plugins/elastic_assistant/server/routes/evaluate/post_evaluate.ts +++ b/x-pack/plugins/elastic_assistant/server/routes/evaluate/post_evaluate.ts @@ -180,7 +180,7 @@ export const postEvaluateRoute = ( const llmType = getLlmType(connector.actionTypeId); const isOssModel = isOpenSourceModel(connector); const isOpenAI = llmType === 'openai' && !isOssModel; - const llmClass = getLlmClass(llmType, true); + const llmClass = getLlmClass(llmType); const createLlmInstance = () => new llmClass({ actionsClient, @@ -302,7 +302,6 @@ export const postEvaluateRoute = ( conversationId: undefined, responseLanguage: 'English', llmType, - bedrockChatEnabled: true, isStreaming: false, isOssModel, }, // TODO: Update to use the correct input format per dataset type diff --git a/x-pack/plugins/elastic_assistant/server/routes/helpers.ts b/x-pack/plugins/elastic_assistant/server/routes/helpers.ts index ebd9fd996dfe1..5c177410b0388 100644 --- a/x-pack/plugins/elastic_assistant/server/routes/helpers.ts +++ b/x-pack/plugins/elastic_assistant/server/routes/helpers.ts @@ -391,8 +391,6 @@ export const langChainExecute = async ({ (await assistantContext.getAIAssistantKnowledgeBaseDataClient({ v2KnowledgeBaseEnabled, })) ?? undefined; - const bedrockChatEnabled = - assistantContext.getRegisteredFeatures(pluginName).assistantBedrockChat; const dataClients: AssistantDataClients = { anonymizationFieldsDataClient: anonymizationFieldsDataClient ?? undefined, @@ -406,7 +404,6 @@ export const langChainExecute = async ({ dataClients, alertsIndexPattern: request.body.alertsIndexPattern, actionsClient, - bedrockChatEnabled, assistantTools, conversationId, connectorId, diff --git a/x-pack/plugins/elastic_assistant/server/routes/utils.ts b/x-pack/plugins/elastic_assistant/server/routes/utils.ts index 5811109b94ede..ea05fc814ec69 100644 --- a/x-pack/plugins/elastic_assistant/server/routes/utils.ts +++ b/x-pack/plugins/elastic_assistant/server/routes/utils.ts @@ -16,7 +16,6 @@ import type { import { ActionsClientChatOpenAI, ActionsClientBedrockChatModel, - ActionsClientSimpleChatModel, ActionsClientChatVertexAI, } from '@kbn/langchain/server'; import { Connector } from '@kbn/actions-plugin/server/application/connector/types'; @@ -186,14 +185,17 @@ export const getLlmType = (actionTypeId: string): string | undefined => { return llmTypeDictionary[actionTypeId]; }; -export const getLlmClass = (llmType?: string, bedrockChatEnabled?: boolean) => - llmType === 'openai' - ? ActionsClientChatOpenAI - : llmType === 'bedrock' && bedrockChatEnabled - ? ActionsClientBedrockChatModel - : llmType === 'gemini' && bedrockChatEnabled - ? ActionsClientChatVertexAI - : ActionsClientSimpleChatModel; +export const getLlmClass = (llmType?: string) => { + switch (llmType) { + case 'bedrock': + return ActionsClientBedrockChatModel; + case 'gemini': + return ActionsClientChatVertexAI; + case 'openai': + default: + return ActionsClientChatOpenAI; + } +}; export const isOpenSourceModel = (connector?: Connector): boolean => { if (connector == null) { diff --git a/x-pack/plugins/elastic_assistant/server/types.ts b/x-pack/plugins/elastic_assistant/server/types.ts index 9062bc5a434b1..3117295810877 100755 --- a/x-pack/plugins/elastic_assistant/server/types.ts +++ b/x-pack/plugins/elastic_assistant/server/types.ts @@ -42,7 +42,6 @@ import { ActionsClientChatVertexAI, ActionsClientGeminiChatModel, ActionsClientLlm, - ActionsClientSimpleChatModel, } from '@kbn/langchain/server'; import type { InferenceServerStart } from '@kbn/inference-plugin/server'; @@ -231,8 +230,7 @@ export type AssistantToolLlm = | ActionsClientBedrockChatModel | ActionsClientChatOpenAI | ActionsClientGeminiChatModel - | ActionsClientChatVertexAI - | ActionsClientSimpleChatModel; + | ActionsClientChatVertexAI; export interface AssistantToolParams { alertsIndexPattern?: string; diff --git a/x-pack/plugins/security_solution/common/experimental_features.ts b/x-pack/plugins/security_solution/common/experimental_features.ts index f50735eaf799c..9536e89f3cf21 100644 --- a/x-pack/plugins/security_solution/common/experimental_features.ts +++ b/x-pack/plugins/security_solution/common/experimental_features.ts @@ -118,11 +118,6 @@ export const allowedExperimentalValues = Object.freeze({ */ assistantKnowledgeBaseByDefault: false, - /** - * Enables the Assistant BedrockChat Langchain model, introduced in `8.15.0`. - */ - assistantBedrockChat: true, - /** * Enables the NaturalLanguageESQLTool and disables the ESQLKnowledgeBaseTool, introduced in `8.16.0`. */ diff --git a/x-pack/plugins/security_solution/server/plugin.ts b/x-pack/plugins/security_solution/server/plugin.ts index 623eaef59afc0..1becac2c75f71 100644 --- a/x-pack/plugins/security_solution/server/plugin.ts +++ b/x-pack/plugins/security_solution/server/plugin.ts @@ -543,7 +543,6 @@ export class Plugin implements ISecuritySolutionPlugin { }) ); const features = { - assistantBedrockChat: config.experimentalFeatures.assistantBedrockChat, assistantKnowledgeBaseByDefault: config.experimentalFeatures.assistantKnowledgeBaseByDefault, assistantModelEvaluation: config.experimentalFeatures.assistantModelEvaluation, };