diff --git a/agenta-web/src/components/EvaluationTable/AICritiqueEvaluationTable.tsx b/agenta-web/src/components/EvaluationTable/AICritiqueEvaluationTable.tsx index b6ab986f4..286b702d8 100644 --- a/agenta-web/src/components/EvaluationTable/AICritiqueEvaluationTable.tsx +++ b/agenta-web/src/components/EvaluationTable/AICritiqueEvaluationTable.tsx @@ -216,7 +216,7 @@ Answer ONLY with one of the given grading or evaluation options. const handleInputChange = ( e: React.ChangeEvent, - rowIndex: any, + rowIndex: number, inputFieldKey: number, ) => { const newRows = [...rows] @@ -276,19 +276,20 @@ Answer ONLY with one of the given grading or evaluation options. if (evaluation_scenario_id) { const data = { outputs: [{variant_id: variants[0].variantId, variant_output: outputVariantX}], + inputs: rows[rowNumber].inputs, } const aiCritiqueScoreResponse = await evaluateAICritiqueForEvalScenario({ correct_answer: rows[rowNumber].correctAnswer, llm_app_prompt_template: evaluation.llmAppPromptTemplate, - inputs: rows[rowNumber].inputs, + inputs: data.inputs, outputs: data.outputs, evaluation_prompt_template: evaluationPromptTemplate, open_ai_key: getApikeys(), }) try { - const responseData = await updateEvaluationScenario( + await updateEvaluationScenario( evaluation.id, evaluation_scenario_id, {...data, score: aiCritiqueScoreResponse.data}, @@ -346,13 +347,16 @@ Answer ONLY with one of the given grading or evaluation options. ) { return } + + if (text) return text + if (record.outputs && record.outputs.length > 0) { const outputValue = record.outputs.find( (output: any) => output.variant_id === variants[i].variantId, )?.variant_output return
{outputValue}
} - return text + return "" }, } }, @@ -386,7 +390,7 @@ Answer ONLY with one of the given grading or evaluation options. handleInputChange(e, record.id, index)} + onChange={(e) => handleInputChange(e, rowIndex, index)} /> ))} diff --git a/agenta-web/src/components/EvaluationTable/CustomCodeRunEvaluationTable.tsx b/agenta-web/src/components/EvaluationTable/CustomCodeRunEvaluationTable.tsx index e378bd2f0..f08e2adeb 100644 --- a/agenta-web/src/components/EvaluationTable/CustomCodeRunEvaluationTable.tsx +++ b/agenta-web/src/components/EvaluationTable/CustomCodeRunEvaluationTable.tsx @@ -211,7 +211,7 @@ const CustomCodeRunEvaluationTable: React.FC = ( const handleInputChange = ( e: React.ChangeEvent, - rowIndex: any, + rowIndex: number, inputFieldKey: number, ) => { const newRows = [...rows] @@ -384,13 +384,14 @@ const CustomCodeRunEvaluationTable: React.FC = ( ) } + if (text) return text if (record.outputs && record.outputs.length > 0) { const outputValue = record.outputs.find( (output: any) => output.variant_id === variants[i].variantId, )?.variant_output return
{outputValue}
} - return text + return "" }, } }, @@ -424,7 +425,7 @@ const CustomCodeRunEvaluationTable: React.FC = ( handleInputChange(e, record.id, index)} + onChange={(e) => handleInputChange(e, rowIndex, index)} /> ))} diff --git a/agenta-web/src/components/EvaluationTable/ExactMatchEvaluationTable.tsx b/agenta-web/src/components/EvaluationTable/ExactMatchEvaluationTable.tsx index 0377c2075..db8a58b75 100644 --- a/agenta-web/src/components/EvaluationTable/ExactMatchEvaluationTable.tsx +++ b/agenta-web/src/components/EvaluationTable/ExactMatchEvaluationTable.tsx @@ -154,7 +154,7 @@ const ExactMatchEvaluationTable: React.FC = ({ const handleInputChange = ( e: React.ChangeEvent, - rowIndex: any, + rowIndex: number, inputFieldKey: number, ) => { const newRows = [...rows] @@ -236,6 +236,7 @@ const ExactMatchEvaluationTable: React.FC = ({ const data = { score: isCorrect ? "correct" : "wrong", outputs: [{variant_id: variants[0].variantId, variant_output: outputVariantX}], + inputs: rows[rowNumber].inputs, } updateEvaluationScenario( @@ -286,13 +287,14 @@ const ExactMatchEvaluationTable: React.FC = ({ key: columnKey, width: "25%", render: (text: any, record: ExactMatchEvaluationTableRow, rowIndex: number) => { + if (text) return text if (record.outputs && record.outputs.length > 0) { const outputValue = record.outputs.find( (output: any) => output.variant_id === variants[i].variantId, )?.variant_output return
{outputValue}
} - return text + return "" }, } }, @@ -326,7 +328,7 @@ const ExactMatchEvaluationTable: React.FC = ({ handleInputChange(e, record.id, index)} + onChange={(e) => handleInputChange(e, rowIndex, index)} /> ))} diff --git a/agenta-web/src/components/EvaluationTable/RegexEvaluationTable.tsx b/agenta-web/src/components/EvaluationTable/RegexEvaluationTable.tsx index 348acba9c..f127f3778 100644 --- a/agenta-web/src/components/EvaluationTable/RegexEvaluationTable.tsx +++ b/agenta-web/src/components/EvaluationTable/RegexEvaluationTable.tsx @@ -166,7 +166,7 @@ const RegexEvaluationTable: React.FC = ({ const handleInputChange = ( e: React.ChangeEvent, - rowIndex: any, + rowIndex: number, inputFieldKey: number, ) => { const newRows = [...rows] @@ -241,6 +241,7 @@ const RegexEvaluationTable: React.FC = ({ { score, outputs: [{variant_id: variants[0].variantId, variant_output: result}], + inputs: rows[rowIndex].inputs, }, evaluation.evaluationType, ) @@ -296,7 +297,7 @@ const RegexEvaluationTable: React.FC = ({ render: (value: any, record: RegexEvaluationTableRow, ix: number) => { if (loading[ix]) return "Loading..." - let outputValue = value + let outputValue if (record.outputs && record.outputs.length > 0) { outputValue = record.outputs.find( (output: any) => output.variant_id === variants[i].variantId, @@ -305,7 +306,7 @@ const RegexEvaluationTable: React.FC = ({ return ( ) @@ -342,7 +343,7 @@ const RegexEvaluationTable: React.FC = ({ handleInputChange(e, record.id, index)} + onChange={(e) => handleInputChange(e, rowIndex, index)} /> ))} diff --git a/agenta-web/src/components/EvaluationTable/SimilarityMatchEvaluationTable.tsx b/agenta-web/src/components/EvaluationTable/SimilarityMatchEvaluationTable.tsx index 70d138f4a..a682b7fa7 100644 --- a/agenta-web/src/components/EvaluationTable/SimilarityMatchEvaluationTable.tsx +++ b/agenta-web/src/components/EvaluationTable/SimilarityMatchEvaluationTable.tsx @@ -168,7 +168,7 @@ const SimilarityMatchEvaluationTable: React.FC, - rowIndex: any, + rowIndex: number, inputFieldKey: number, ) => { const newRows = [...rows] @@ -237,6 +237,7 @@ const SimilarityMatchEvaluationTable: React.FC { if (loading[ix]) return "Loading..." + if (text) return text if (record.outputs && record.outputs.length > 0) { const outputValue = record.outputs.find( @@ -294,7 +296,7 @@ const SimilarityMatchEvaluationTable: React.FC{outputValue} } - return text + return "" }, } }, @@ -328,7 +330,7 @@ const SimilarityMatchEvaluationTable: React.FC handleInputChange(e, record.id, index)} + onChange={(e) => handleInputChange(e, rowIndex, index)} /> ))} diff --git a/agenta-web/src/components/EvaluationTable/WebhookEvaluationTable.tsx b/agenta-web/src/components/EvaluationTable/WebhookEvaluationTable.tsx index 9f8001f65..c4af9b863 100644 --- a/agenta-web/src/components/EvaluationTable/WebhookEvaluationTable.tsx +++ b/agenta-web/src/components/EvaluationTable/WebhookEvaluationTable.tsx @@ -146,7 +146,7 @@ const WebhookEvaluationTable: React.FC = ({ const handleInputChange = ( e: React.ChangeEvent, - rowIndex: any, + rowIndex: number, inputFieldKey: number, ) => { const newRows = [...rows] @@ -223,6 +223,7 @@ const WebhookEvaluationTable: React.FC = ({ { score, outputs: [{variant_id: variants[0].variantId, variant_output: result}], + inputs: rows[rowIndex].inputs, }, evaluation.evaluationType, ) @@ -273,14 +274,14 @@ const WebhookEvaluationTable: React.FC = ({ render: (value: any, record: WebhookEvaluationTableRow, ix: number) => { if (loading[ix]) return "Loading..." - let outputValue = value + let outputValue if (record.outputs && record.outputs.length > 0) { outputValue = record.outputs.find( (output: any) => output.variant_id === variants[i].variantId, )?.variant_output } - return outputValue + return value || outputValue || "" }, } }, @@ -314,7 +315,7 @@ const WebhookEvaluationTable: React.FC = ({ handleInputChange(e, record.id, index)} + onChange={(e) => handleInputChange(e, rowIndex, index)} /> ))}