diff --git a/agenta-web/src/components/EvaluationTable/ABTestingEvaluationTable.tsx b/agenta-web/src/components/EvaluationTable/ABTestingEvaluationTable.tsx index fd357b6485..a47fcdb0c1 100644 --- a/agenta-web/src/components/EvaluationTable/ABTestingEvaluationTable.tsx +++ b/agenta-web/src/components/EvaluationTable/ABTestingEvaluationTable.tsx @@ -216,14 +216,14 @@ const ABTestingEvaluationTable: React.FC = ({ count: number = 1, showNotification: boolean = true, maxRetryCount: number, - retryDelay: number + retryDelay: number, ) => { let retryCount = 0 while (retryCount <= maxRetryCount) { try { await runEvaluation(id, count, showNotification) // If the evaluation is successful, break out of the retry loop - break; + break } catch (error) { console.error(`Error in evaluation for ID ${id}, retrying...`) retryCount++ @@ -238,22 +238,28 @@ const ABTestingEvaluationTable: React.FC = ({ } } - const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms)) + const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)) const runAllEvaluations = async () => { const batchSize = 10 // Number of evaluations to make in each batch const maxRetryCount = 3 // Maximum number of times to retry a failed evaluation const retryDelay = 3000 // Delay before retrying a failed evaluation (in milliseconds) const delayBetweenBatches = 5000 // Delay between batches (in milliseconds) - + setEvaluationStatus(EvaluationFlow.EVALUATION_STARTED) const runBatch = async (startIdx) => { const endIdx = Math.min(startIdx + batchSize, rows.length) const batchPromises = [] - + for (let index = startIdx; index < endIdx; index++) { batchPromises.push( - runEvaluationWithRetry(rows[index].id!, rows.length - 1, false, maxRetryCount, retryDelay) + runEvaluationWithRetry( + rows[index].id!, + rows.length - 1, + false, + maxRetryCount, + retryDelay, + ), ) } @@ -263,7 +269,7 @@ const ABTestingEvaluationTable: React.FC = ({ console.error("Error in batch:", err) // Handle the failure of the entire batch (if needed) } - + // Schedule the next batch with a delay const nextBatchStartIdx = endIdx if (nextBatchStartIdx < rows.length) { diff --git a/agenta-web/src/components/EvaluationTable/SingleModelEvaluationTable.tsx b/agenta-web/src/components/EvaluationTable/SingleModelEvaluationTable.tsx index 1ab2a1fda7..a27026b068 100644 --- a/agenta-web/src/components/EvaluationTable/SingleModelEvaluationTable.tsx +++ b/agenta-web/src/components/EvaluationTable/SingleModelEvaluationTable.tsx @@ -218,14 +218,14 @@ const SingleModelEvaluationTable: React.FC = ({ count: number = 1, showNotification: boolean = true, maxRetryCount: number, - retryDelay: number + retryDelay: number, ) => { let retryCount = 0 while (retryCount <= maxRetryCount) { try { await runEvaluation(id, count, showNotification) // If the evaluation is successful, break out of the retry loop - break; + break } catch (error) { console.error(`Error in evaluation for ID ${id}, retrying...`) retryCount++ @@ -240,22 +240,28 @@ const SingleModelEvaluationTable: React.FC = ({ } } - const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms)) + const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)) const runAllEvaluations = async () => { const batchSize = 10 // Number of evaluations to make in each batch const maxRetryCount = 3 // Maximum number of times to retry a failed evaluation const retryDelay = 3000 // Delay before retrying a failed evaluation (in milliseconds) const delayBetweenBatches = 5000 // Delay between batches (in milliseconds) - + setEvaluationStatus(EvaluationFlow.EVALUATION_STARTED) const runBatch = async (startIdx) => { const endIdx = Math.min(startIdx + batchSize, rows.length) const batchPromises = [] - + for (let index = startIdx; index < endIdx; index++) { batchPromises.push( - runEvaluationWithRetry(rows[index].id!, rows.length - 1, false, maxRetryCount, retryDelay) + runEvaluationWithRetry( + rows[index].id!, + rows.length - 1, + false, + maxRetryCount, + retryDelay, + ), ) } @@ -265,7 +271,7 @@ const SingleModelEvaluationTable: React.FC = ({ console.error("Error in batch:", err) // Handle the failure of the entire batch (if needed) } - + // Schedule the next batch with a delay const nextBatchStartIdx = endIdx if (nextBatchStartIdx < rows.length) { @@ -281,8 +287,6 @@ const SingleModelEvaluationTable: React.FC = ({ runBatch(0) } - - const runEvaluation = async ( id: string, count: number = 1, diff --git a/agenta-web/src/components/Playground/Views/TestView.tsx b/agenta-web/src/components/Playground/Views/TestView.tsx index 250e5d1ab6..7b7e785f7c 100644 --- a/agenta-web/src/components/Playground/Views/TestView.tsx +++ b/agenta-web/src/components/Playground/Views/TestView.tsx @@ -305,17 +305,17 @@ const App: React.FC = ({inputParams, optParams, variant, isChatVa } else { console.error(`Max retry count reached for request ${index + 1}.`) setResultForIndex( - `Error in request ${index + 1} after ${maxRetryCount} retries: ${getErrorMessage(error)}`, - index + `Error in request ${ + index + 1 + } after ${maxRetryCount} retries: ${getErrorMessage(error)}`, + index, ) } } } } - const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)) - - + const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)) const handleAddRow = () => { setTestList([...testList, {_id: randString(6)}])