From 2b1ebeee72f425c458ea742c40312d30775bc891 Mon Sep 17 00:00:00 2001 From: Garrett Spong Date: Wed, 25 Sep 2024 15:21:27 -0600 Subject: [PATCH] Add support for manually entering eval datasets --- .../evaluation_settings/evaluation_settings.tsx | 15 +++++++++++++++ .../settings/evaluation_settings/translations.ts | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/evaluation_settings/evaluation_settings.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/evaluation_settings/evaluation_settings.tsx index 319ee812a3cf3..9d544bd1bcba7 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/evaluation_settings/evaluation_settings.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/evaluation_settings/evaluation_settings.tsx @@ -95,6 +95,20 @@ export const EvaluationSettings: React.FC = React.memo(() => { }, [setSelectedDatasetOptions] ); + const onDatasetCreateOption = useCallback( + (searchValue = []) => { + const normalizedSearchValue = searchValue.trim().toLowerCase(); + if (!normalizedSearchValue) { + return; + } + const newOption = { + label: searchValue, + }; + + setSelectedDatasetOptions([newOption]); + }, + [setSelectedDatasetOptions] + ); // Predictions // Connectors / Models @@ -244,6 +258,7 @@ export const EvaluationSettings: React.FC = React.memo(() => { options={datasetOptions} selectedOptions={selectedDatasetOptions} onChange={onDatasetOptionsChange} + onCreateOption={onDatasetCreateOption} compressed={true} /> diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/evaluation_settings/translations.ts b/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/evaluation_settings/translations.ts index b1adb6296b2a1..62902d0f14095 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/evaluation_settings/translations.ts +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/evaluation_settings/translations.ts @@ -163,7 +163,8 @@ export const EVALUATOR_DATASET_LABEL = i18n.translate( export const LANGSMITH_DATASET_DESCRIPTION = i18n.translate( 'xpack.elasticAssistant.assistant.settings.evaluationSettings.langsmithDatasetDescription', { - defaultMessage: 'Name of dataset hosted on LangSmith to evaluate.', + defaultMessage: + 'Name of dataset hosted on LangSmith to evaluate. Must manually enter on cloud environments.', } );