Skip to content

Commit

Permalink
modified table to add score, expected answer and notes
Browse files Browse the repository at this point in the history
  • Loading branch information
bekossy committed Jan 16, 2024
1 parent f5f4c02 commit 25218d2
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 128 deletions.
121 changes: 60 additions & 61 deletions agenta-web/src/components/EvaluationTable/ABTestingEvaluationTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,70 +382,69 @@ const ABTestingEvaluationTable: React.FC<EvaluationTableProps> = ({
},
...dynamicColumns,
{
title: "Evaluate",
dataIndex: "evaluate",
key: "evaluate",
width: 300,
title: "Score",
dataIndex: "score",
key: "score",
render: (text: any, record: any, rowIndex: number) => {
return (
<>
<div className={classes.sideBar}>
<Typography.Title level={4}>Submit your feedback</Typography.Title>

{record.outputs.length > 0 &&
record.outputs.every((item: any) => !!item.variant_output) && (
<Space direction="vertical">
<Typography.Text strong>
Which response is better?
</Typography.Text>
{
<EvaluationVotePanel
type="comparison"
value={record.vote || ""}
variants={variants}
onChange={(vote) =>
handleVoteClick(record.id, vote)
}
loading={record.vote === "loading"}
vertical
key={record.id}
/>
}
</Space>
)}

<Space direction="vertical">
<Typography.Text strong>Expected Answer</Typography.Text>
<Input.TextArea
defaultValue={record.correctAnswer}
autoSize={{minRows: 3, maxRows: 5}}
onChange={(e) =>
depouncedUpdateEvaluationScenario(
{
correctAnswer: e.target.value,
},
record.id,
)
}
key={record.id}
/>
</Space>

<Space direction="vertical">
<Typography.Text strong>Additional Notes</Typography.Text>
<Input.TextArea
defaultValue={record?.note || ""}
autoSize={{minRows: 3, maxRows: 5}}
onChange={(e) =>
depouncedUpdateEvaluationScenario(
{note: e.target.value},
record.id,
)
}
key={record.id}
/>
</Space>
</div>
{
<EvaluationVotePanel
type="comparison"
value={record.vote || ""}
variants={variants}
onChange={(vote) => handleVoteClick(record.id, vote)}
loading={record.vote === "loading"}
vertical
key={record.id}
/>
}
</>
)
},
},
{
title: "Expected Answer",
dataIndex: "expectedAnswer",
key: "expectedAnswer",
render: (text: any, record: any, rowIndex: number) => {
let correctAnswer =
record.correctAnswer || evaluation.testset.csvdata[rowIndex].correct_answer

return (
<>
<Input.TextArea
defaultValue={correctAnswer}
autoSize={{minRows: 3, maxRows: 5}}
onChange={(e) =>
depouncedUpdateEvaluationScenario(
{
correctAnswer: e.target.value,
},
record.id,
)
}
key={record.id}
/>
</>
)
},
},
{
title: "Additional Note",
dataIndex: "additionalNote",
key: "additionalNote",
render: (text: any, record: any, rowIndex: number) => {
return (
<>
<Input.TextArea
defaultValue={record?.note || ""}
autoSize={{minRows: 3, maxRows: 5}}
onChange={(e) =>
depouncedUpdateEvaluationScenario({note: e.target.value}, record.id)
}
key={record.id}
/>
</>
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,76 +428,76 @@ const SingleModelEvaluationTable: React.FC<EvaluationTableProps> = ({
},
...dynamicColumns,
{
title: "Evaluate",
dataIndex: "evaluate",
key: "evaluate",
width: 300,
title: "Score",
dataIndex: "score",
key: "score",
render: (text: any, record: any, rowIndex: number) => {
return (
<>
<div className={classes.sideBar}>
<Typography.Title level={4}>Submit your feedback</Typography.Title>

{record.outputs.length > 0 &&
record.outputs.every((item: any) => !!item.variant_output) && (
<Space direction="vertical">
<Typography.Text strong>Rate the response</Typography.Text>
{
<EvaluationVotePanel
type="numeric"
value={[
{
variantId: variants[0].variantId,
score: record.score as number,
},
]}
variants={variants}
onChange={(val) =>
depouncedHandleScoreChange(
record.id,
val[0].score as number,
)
}
loading={record.score === "loading"}
showVariantName={false}
key={record.id}
/>
}
</Space>
)}

<Space direction="vertical">
<Typography.Text strong>Expected Answer</Typography.Text>
<Input.TextArea
defaultValue={record.correctAnswer}
autoSize={{minRows: 3, maxRows: 5}}
onChange={(e) =>
depouncedUpdateEvaluationScenario(
{
correctAnswer: e.target.value,
},
record.id,
)
}
key={record.id}
/>
</Space>

<Space direction="vertical">
<Typography.Text strong>Additional Notes</Typography.Text>
<Input.TextArea
defaultValue={record?.note || ""}
autoSize={{minRows: 3, maxRows: 5}}
onChange={(e) =>
depouncedUpdateEvaluationScenario(
{note: e.target.value},
record.id,
)
}
key={record.id}
/>
</Space>
</div>
{
<EvaluationVotePanel
type="numeric"
value={[
{
variantId: variants[0].variantId,
score: record.score as number,
},
]}
variants={variants}
onChange={(val) =>
depouncedHandleScoreChange(record.id, val[0].score as number)
}
loading={record.score === "loading"}
showVariantName={false}
key={record.id}
/>
}
</>
)
},
},
{
title: "Expected Answer",
dataIndex: "expectedAnswer",
key: "expectedAnswer",
render: (text: any, record: any, rowIndex: number) => {
let correctAnswer =
record.correctAnswer || evaluation.testset.csvdata[rowIndex].correct_answer

return (
<>
<Input.TextArea
defaultValue={correctAnswer}
autoSize={{minRows: 3, maxRows: 5}}
onChange={(e) =>
depouncedUpdateEvaluationScenario(
{
correctAnswer: e.target.value,
},
record.id,
)
}
key={record.id}
/>
</>
)
},
},
{
title: "Additional Note",
dataIndex: "additionalNote",
key: "additionalNote",
render: (text: any, record: any, rowIndex: number) => {
return (
<>
<Input.TextArea
defaultValue={record?.note || ""}
autoSize={{minRows: 3, maxRows: 5}}
onChange={(e) =>
depouncedUpdateEvaluationScenario({note: e.target.value}, record.id)
}
key={record.id}
/>
</>
)
},
Expand Down

0 comments on commit 25218d2

Please sign in to comment.