Skip to content

Commit

Permalink
[ML] Removing token list from text expansion model testing (#164560)
Browse files Browse the repository at this point in the history
The tokens listed could contain sensitive words which we do not want to
display to the user, in case they cause offence.
For now we can just hide this list, in case a future version of the API
contains a sanitised list of tokens.

(cherry picked from commit 323878e)
  • Loading branch information
jgowdyelastic committed Aug 24, 2023
1 parent 1e077b1 commit e3cc794
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e3cc794

Please sign in to comment.