Skip to content

Commit b5d4dd3

Browse files
New: Added the supported llm models for ragas evaluation
1 parent 245786d commit b5d4dd3

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

frontend/src/components/ChatBot/ChatInfoModal.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { Relationship } from '@neo4j-nvl/base';
2929
import { getChatMetrics } from '../../services/GetRagasMetric';
3030
import MetricsTab from './MetricsTab';
3131
import { Stack } from '@mui/material';
32+
import { capitalizeWithUnderscore } from '../../utils/Utils';
3233

3334
const ChatInfoModal: React.FC<chatInfoMessage> = ({
3435
sources,
@@ -263,14 +264,28 @@ const ChatInfoModal: React.FC<chatInfoMessage> = ({
263264
<Stack spacing={2}>
264265
<Stack spacing={2}>
265266
{!supportedLLmsForRagas.includes(metricmodel) && (
266-
<Banner type='warning'>LLM Model Not Supported ,Please Choose Different Model</Banner>
267+
<Banner
268+
type='warning'
269+
title='LLM Model Not Supported ,Please Choose Different Model'
270+
description={
271+
<Typography variant='body-medium'>
272+
Currently ragas evaluation works on{' '}
273+
{supportedLLmsForRagas.map((s, idx) => (
274+
<span className='font-bold'>
275+
{capitalizeWithUnderscore(s) + (idx != supportedLLmsForRagas.length - 1 ? ',' : '')}
276+
</span>
277+
))}
278+
.
279+
</Typography>
280+
}
281+
></Banner>
267282
)}
268283
<Box>
269284
<Typography variant='body-large'>
270285
We use several key metrics to assess the quality of our chat responses. Click the button below to view
271-
detailed scores for this interaction. These scores help us continuously improve the accuracy and
272-
helpfulness of our chatbots.This usually takes about <span className='font-bold'>20</span> seconds.
273-
You'll see detailed scores shortly.
286+
detailed scores for this interaction using <span className='font-bold'>ragas framework</span>. These
287+
scores help us continuously improve the accuracy and helpfulness of our chatbots.This usually takes
288+
about <span className='font-bold'>20 seconds</span> . You'll see detailed scores shortly.
274289
</Typography>
275290
</Box>
276291
<Stack>

frontend/src/components/ChatBot/Chatbot.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ const Chatbot: FC<ChatbotProps> = (props) => {
406406
handleSpeak(chat.modes[chat.currentMode]?.message, chat.id);
407407
}
408408
}, []);
409-
409+
410410
const downloadClickHandler = useCallback(function downloadClickHandler<Type>(JsonData: Type) {
411411
const textFile = new Blob([JSON.stringify(JsonData)], { type: 'application/json' });
412412
if (downloadLinkRef && downloadLinkRef.current) {

frontend/src/components/Dropdown.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Dropdown, Tip } from '@neo4j-ndl/react';
22
import { OptionType, ReusableDropdownProps } from '../types';
33
import { memo, useMemo, useReducer } from 'react';
4-
import { capitalize } from '../utils/Utils';
4+
import { capitalize, capitalizeWithUnderscore } from '../utils/Utils';
55

66
const DropdownComponent: React.FC<ReusableDropdownProps> = ({
77
options,
@@ -31,14 +31,7 @@ const DropdownComponent: React.FC<ReusableDropdownProps> = ({
3131
onChange: handleChange,
3232
options: allOptions?.map((option) => {
3333
const label =
34-
typeof option === 'string'
35-
? (option.includes('LLM_MODEL_CONFIG_')
36-
? capitalize(option.split('LLM_MODEL_CONFIG_').at(-1) as string)
37-
: capitalize(option)
38-
)
39-
.split('_')
40-
.join(' ')
41-
: capitalize(option.label);
34+
typeof option === 'string' ? capitalizeWithUnderscore(option) : capitalize(option.label);
4235
const value = typeof option === 'string' ? option : option.value;
4336
return {
4437
label,

frontend/src/components/FileTable.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ import { getSourceNodes } from '../services/GetFiles';
2929
import { v4 as uuidv4 } from 'uuid';
3030
import {
3131
statusCheck,
32-
capitalize,
3332
isFileCompleted,
3433
calculateProcessedCount,
3534
getFileSourceStatus,
3635
isProcessingFileValid,
36+
capitalizeWithUnderscore,
3737
} from '../utils/Utils';
3838
import { SourceNode, CustomFile, FileTableProps, UserCredentials, statusupdate, ChildRef } from '../types';
3939
import { useCredentials } from '../context/UserCredentials';
@@ -467,16 +467,7 @@ const FileTable = forwardRef<ChildRef, FileTableProps>((props, ref) => {
467467
id: 'model',
468468
cell: (info) => {
469469
const model = info.getValue();
470-
return (
471-
<i>
472-
{(model.includes('LLM_MODEL_CONFIG_')
473-
? capitalize(model.split('LLM_MODEL_CONFIG_').at(-1) as string)
474-
: capitalize(model)
475-
)
476-
.split('_')
477-
.join(' ')}
478-
</i>
479-
);
470+
return <i>{capitalizeWithUnderscore(model)}</i>;
480471
},
481472
header: () => <span>Model</span>,
482473
footer: (info) => info.column.id,

frontend/src/utils/Utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ export const capitalizeWithPlus = (s: string) => {
411411
.map((s) => capitalize(s))
412412
.join('+');
413413
};
414+
export const capitalizeWithUnderscore = (s: string) => capitalize(s).split('_').join(' ');
414415

415416
export const getDescriptionForChatMode = (mode: string): string => {
416417
switch (mode.toLowerCase()) {

0 commit comments

Comments
 (0)