🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix: correctly retrieve scores for datasets (#4387)
Max Deichmann425202dd1e5a
diff --git a/web/src/__tests__/async/dataset-service.servertest.ts b/web/src/__tests__/async/dataset-service.servertest.tsindex 67e4bb53a6..35a1775987 100644--- a/web/src/__tests__/async/dataset-service.servertest.ts+++ b/web/src/__tests__/async/dataset-service.servertest.ts@@ -73,6 +73,7 @@ describe("Fetch datasets for UI presentation", () => {const traceId4 = v4();const scoreId = v4();const scoreId2 = v4();+ const scoreId3 = v4();const scoreName = v4();await prisma.datasetRunItems.create({@@ -174,7 +175,19 @@ describe("Fetch datasets for UI presentation", () => {value: 1,comment: "some other comment",});- await createScores([score, score2]);+ const observationId2 = v4(); // this one is not related to a run+ const anotherScoreName = v4();++ const score3 = createScore({+ id: scoreId3,+ observation_id: observationId2,+ trace_id: traceId,+ project_id: projectId,+ name: anotherScoreName,+ value: 1,+ comment: "some other comment for non run related score",+ });+ await createScores([score, score2, score3]);const runs = await createDatasetRunsTable({projectId,@@ -207,6 +220,12 @@ describe("Fetch datasets for UI presentation", () => {values: expect.arrayContaining([1, 100.5]),average: 50.75,},+ [`${anotherScoreName.replaceAll("-", "_")}-API-NUMERIC`]: {+ type: "NUMERIC",+ values: expect.arrayContaining([1]),+ average: 1,+ comment: "some other comment for non run related score",+ },};expect(firstRun.scores).toEqual(expectedObject);diff --git a/web/src/features/datasets/server/service.ts b/web/src/features/datasets/server/service.tsindex 790dd2c187..b8e77dd3bb 100644--- a/web/src/features/datasets/server/service.ts+++ b/web/src/features/datasets/server/service.ts@@ -231,7 +231,6 @@ const getScoresFromTempTable = async (WHERE s.project_id = {projectId: String}AND tmp.project_id = {projectId: String}AND tmp.dataset_id = {datasetId: String}- AND (tmp.observation_id = s.observation_id OR s.observation_id IS NULL)ORDER BY s.event_ts DESCLIMIT 1 BY s.id, s.project_id`;