Skip to content

Commit

Permalink
[8.x] [Security Assistant] Add support for manually entering eval dat…
Browse files Browse the repository at this point in the history
…asets (#194072) (#194207)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Assistant] Add support for manually entering eval datasets
(#194072)](#194072)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Garrett
Spong","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-26T18:17:50Z","message":"[Security
Assistant] Add support for manually entering eval datasets
(#194072)\n\n## Summary\r\n\r\nOn cloud environments we don't send the
LangSmith credentials through\r\nthe `GET /evaluate` route which returns
available datasets for\r\nselection, so the datasets are never
populated. Since the Dataset field\r\ndidn't allow custom options, this
means you couldn't perform evals in\r\ncloud environments.\r\n\r\nThis
PR updates the Dataset field to take custom options so that you
can\r\nmanually enter the dataset name in cloud environments:\r\n\r\n<p
align=\"center\">\r\n<img
width=\"500\"\r\nsrc=\"https://github.com/user-attachments/assets/4828e085-180c-42bb-9656-34bda57b74b5\"\r\n/>\r\n</p>
\r\n\r\n\r\nTo test, enable the below feature flag to show the
evaluation tab
under\r\nsettings:\r\n\r\n```\r\nxpack.securitySolution.enableExperimental:\r\n
-
\"assistantModelEvaluation\"\r\n```","sha":"1c0ec85b740789ba99c30f09a5b56bc66a9de897","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Feature:Security
Assistant","Team:Security Generative AI","Feature:Assistant
Evaluation","v8.16.0","backport:version"],"title":"[Security Assistant]
Add support for manually entering eval
datasets","number":194072,"url":"https://github.com/elastic/kibana/pull/194072","mergeCommit":{"message":"[Security
Assistant] Add support for manually entering eval datasets
(#194072)\n\n## Summary\r\n\r\nOn cloud environments we don't send the
LangSmith credentials through\r\nthe `GET /evaluate` route which returns
available datasets for\r\nselection, so the datasets are never
populated. Since the Dataset field\r\ndidn't allow custom options, this
means you couldn't perform evals in\r\ncloud environments.\r\n\r\nThis
PR updates the Dataset field to take custom options so that you
can\r\nmanually enter the dataset name in cloud environments:\r\n\r\n<p
align=\"center\">\r\n<img
width=\"500\"\r\nsrc=\"https://github.com/user-attachments/assets/4828e085-180c-42bb-9656-34bda57b74b5\"\r\n/>\r\n</p>
\r\n\r\n\r\nTo test, enable the below feature flag to show the
evaluation tab
under\r\nsettings:\r\n\r\n```\r\nxpack.securitySolution.enableExperimental:\r\n
-
\"assistantModelEvaluation\"\r\n```","sha":"1c0ec85b740789ba99c30f09a5b56bc66a9de897"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194072","number":194072,"mergeCommit":{"message":"[Security
Assistant] Add support for manually entering eval datasets
(#194072)\n\n## Summary\r\n\r\nOn cloud environments we don't send the
LangSmith credentials through\r\nthe `GET /evaluate` route which returns
available datasets for\r\nselection, so the datasets are never
populated. Since the Dataset field\r\ndidn't allow custom options, this
means you couldn't perform evals in\r\ncloud environments.\r\n\r\nThis
PR updates the Dataset field to take custom options so that you
can\r\nmanually enter the dataset name in cloud environments:\r\n\r\n<p
align=\"center\">\r\n<img
width=\"500\"\r\nsrc=\"https://github.com/user-attachments/assets/4828e085-180c-42bb-9656-34bda57b74b5\"\r\n/>\r\n</p>
\r\n\r\n\r\nTo test, enable the below feature flag to show the
evaluation tab
under\r\nsettings:\r\n\r\n```\r\nxpack.securitySolution.enableExperimental:\r\n
-
\"assistantModelEvaluation\"\r\n```","sha":"1c0ec85b740789ba99c30f09a5b56bc66a9de897"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Garrett Spong <[email protected]>
  • Loading branch information
kibanamachine and spong authored Sep 26, 2024
1 parent 2eba4b5 commit 1191860
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@ export const EvaluationSettings: React.FC = React.memo(() => {
},
[setSelectedDatasetOptions]
);
const onDatasetCreateOption = useCallback(
(searchValue: string) => {
const normalizedSearchValue = searchValue.trim().toLowerCase();
if (!normalizedSearchValue) {
return;
}
const newOption = {
label: searchValue,
};

setSelectedDatasetOptions([newOption]);
},
[setSelectedDatasetOptions]
);

// Predictions
// Connectors / Models
Expand Down Expand Up @@ -244,6 +258,7 @@ export const EvaluationSettings: React.FC = React.memo(() => {
options={datasetOptions}
selectedOptions={selectedDatasetOptions}
onChange={onDatasetOptionsChange}
onCreateOption={onDatasetCreateOption}
compressed={true}
/>
</EuiFormRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
}
);

Expand Down

0 comments on commit 1191860

Please sign in to comment.