Skip to content

Commit

Permalink
chore(weave): Low hanging fruit for eval compare page performance (#3271
Browse files Browse the repository at this point in the history
)

* init

* done

* lint
  • Loading branch information
tssweeney authored Dec 17, 2024
1 parent 588012f commit 33aef16
Showing 1 changed file with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,35 @@ const fetchEvaluationComparisonData = async (
});

// Kick off the trace query to get the actual trace data
// Note: we split this into 2 steps to ensure we only get level 2 children
// of the evaluations. This avoids massive overhead of fetching gigantic traces
// for every evaluation.
const evalTraceIds = evalRes.calls.map(call => call.trace_id);
const evalTraceResProm = traceServerClient.callsStreamQuery({
project_id: projectId,
filter: {trace_ids: evalTraceIds},
});
// First, get all the children of the evaluations (predictAndScoreCalls + summary)
const evalTraceResProm = traceServerClient
.callsStreamQuery({
project_id: projectId,
filter: {trace_ids: evalTraceIds, parent_ids: evaluationCallIds},
})
.then(predictAndScoreCallRes => {
// Then, get all the children of those calls (predictions + scores)
const predictAndScoreIds = predictAndScoreCallRes.calls.map(
call => call.id
);
return traceServerClient
.callsStreamQuery({
project_id: projectId,
filter: {trace_ids: evalTraceIds, parent_ids: predictAndScoreIds},
})
.then(predictionsAndScoresCallsRes => {
return {
calls: [
...predictAndScoreCallRes.calls,
...predictionsAndScoresCallsRes.calls,
],
};
});
});

const evaluationCallCache: {[callId: string]: EvaluationEvaluateCallSchema} =
Object.fromEntries(
Expand Down

0 comments on commit 33aef16

Please sign in to comment.