Skip to content
Snippets Groups Projects
Commit 8a4f4727 authored by deep1401's avatar deep1401
Browse files

Setting eval name using friendly name generator if run_name is not specified

parent 462ada1b
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,7 @@ import { ...@@ -35,6 +35,7 @@ import {
Trash2Icon, Trash2Icon,
XSquareIcon, XSquareIcon,
} from 'lucide-react'; } from 'lucide-react';
import { generateFriendlyName } from 'renderer/lib/utils';
import DynamicPluginForm from '../DynamicPluginForm'; import DynamicPluginForm from '../DynamicPluginForm';
import EvalJobsTable from './EvalJobsTable.tsx'; import EvalJobsTable from './EvalJobsTable.tsx';
...@@ -102,10 +103,10 @@ export default function Eval({ ...@@ -102,10 +103,10 @@ export default function Eval({
isLoading: pluginsIsLoading, isLoading: pluginsIsLoading,
} = useSWR( } = useSWR(
experimentInfo?.id && experimentInfo?.id &&
chatAPI.Endpoints.Experiment.ListScriptsOfType( chatAPI.Endpoints.Experiment.ListScriptsOfType(
experimentInfo?.id, experimentInfo?.id,
'evaluator' 'evaluator'
), ),
fetcher fetcher
); );
...@@ -120,7 +121,7 @@ export default function Eval({ ...@@ -120,7 +121,7 @@ export default function Eval({
method: 'POST', method: 'POST',
body: value, body: value,
} }
).then(() => {}); ).then(() => { });
} }
} }
...@@ -133,6 +134,9 @@ export default function Eval({ ...@@ -133,6 +134,9 @@ export default function Eval({
return 'No experiment selected'; return 'No experiment selected';
} }
console.log("ExperimentInfo", experimentInfo);
return ( return (
<> <>
<Sheet <Sheet
...@@ -164,12 +168,17 @@ export default function Eval({ ...@@ -164,12 +168,17 @@ export default function Eval({
/* The way evals are defined right now, they need a unique name. This is a hack /* The way evals are defined right now, they need a unique name. This is a hack
until we have a better solution */ until we have a better solution */
const nameOfThisEvaluation = let nameOfThisEvaluation;
selectedPlugin + '_' + JSON.stringify(formJson); if (formJson.run_name) {
nameOfThisEvaluation = formJson.run_name;
} else {
nameOfThisEvaluation = selectedPlugin + '_' + generateFriendlyName();
}
addEvaluation(selectedPlugin, nameOfThisEvaluation, formJson); addEvaluation(selectedPlugin, nameOfThisEvaluation, formJson);
setOpen(false); setOpen(false);
}} }}
> >
<Stack spacing={2}> <Stack spacing={2}>
<FormControl> <FormControl>
<FormLabel>Evaluation Plugin Template:</FormLabel> <FormLabel>Evaluation Plugin Template:</FormLabel>
...@@ -179,7 +188,6 @@ export default function Eval({ ...@@ -179,7 +188,6 @@ export default function Eval({
experimentInfo={experimentInfo} experimentInfo={experimentInfo}
plugin={selectedPlugin} plugin={selectedPlugin}
/> />
<Button type="submit">Submit</Button> <Button type="submit">Submit</Button>
</Stack> </Stack>
</form> </form>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment