[8.10] [ML] Removing token list from text expansion model testing (#164560) (#164669)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[ML] Removing token list from text expansion model testing
(#164560)](https://github.com/elastic/kibana/pull/164560)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"James
Gowdy","email":"jgowdy@elastic.co"},"sourceCommit":{"committedDate":"2023-08-24T08:17:41Z","message":"[ML]
Removing token list from text expansion model testing (#164560)\n\nThe
tokens listed could contain sensitive words which we do not want
to\r\ndisplay to the user, in case they cause offence.\r\nFor now we can
just hide this list, in case a future version of the API\r\ncontains a
sanitised list of
tokens.","sha":"323878e746116550b23f25269b9d65d86552fc03","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["non-issue",":ml","release_note:skip","Feature:3rd
Party
Models","v8.10.0","v8.11.0"],"number":164560,"url":"https://github.com/elastic/kibana/pull/164560","mergeCommit":{"message":"[ML]
Removing token list from text expansion model testing (#164560)\n\nThe
tokens listed could contain sensitive words which we do not want
to\r\ndisplay to the user, in case they cause offence.\r\nFor now we can
just hide this list, in case a future version of the API\r\ncontains a
sanitised list of
tokens.","sha":"323878e746116550b23f25269b9d65d86552fc03"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/164560","number":164560,"mergeCommit":{"message":"[ML]
Removing token list from text expansion model testing (#164560)\n\nThe
tokens listed could contain sensitive words which we do not want
to\r\ndisplay to the user, in case they cause offence.\r\nFor now we can
just hide this list, in case a future version of the API\r\ncontains a
sanitised list of
tokens.","sha":"323878e746116550b23f25269b9d65d86552fc03"}}]}]
BACKPORT-->

Co-authored-by: James Gowdy <jgowdy@elastic.co>
This commit is contained in:
Kibana Machine 2023-08-24 05:27:47 -04:00 committed by GitHub
parent 1b81bfb8a4
commit b8f9d4a8e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,6 +63,44 @@ export const TextExpansionOutput: FC<{
export const DocumentResult: FC<{
response: FormattedTextExpansionResponse;
}> = ({ response }) => {
const statInfo = useResultStatFormatting(response);
return (
<>
{response.text !== undefined ? (
<>
<EuiStat
title={roundToDecimalPlace(response.score, 3)}
textAlign="left"
titleColor={statInfo.color}
description={
<EuiTextColor color={statInfo.color}>
<span>
{statInfo.icon !== null ? (
<EuiIcon type={statInfo.icon} color={statInfo.color} />
) : null}
{statInfo.text}
</span>
</EuiTextColor>
}
/>
<EuiSpacer size="s" />
<span css={{ color: statInfo.textColor }}>{response.text}</span>
<EuiSpacer size="s" />
</>
) : null}
</>
);
};
/*
* Currently not used. Tokens could contain sensitive words, so need to be hidden from the user.
* This may change in the future, in which case this function will be used.
*/
export const DocumentResultWithTokens: FC<{
response: FormattedTextExpansionResponse;
}> = ({ response }) => {
const tokens = response.adjustedTokenWeights
.filter(({ value }) => value > 0)