🪢 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
chore: add aggregateScores tests (#4580)
Max Deichmannf9be079d62ea
diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.ymlindex 35f590d3db..73460565d3 100644--- a/.github/workflows/pipeline.yml+++ b/.github/workflows/pipeline.yml@@ -139,6 +139,8 @@ jobs:LANGFUSE_INIT_USER_PASSWORD: "password"- name: run test-syncrun: pnpm --filter=web run test-sync+ - name: run test-client+ run: pnpm --filter=web run test-clienttests-web-async:timeout-minutes: 20diff --git a/web/package.json b/web/package.jsonindex fc34db9de4..e3bef491eb 100644--- a/web/package.json+++ b/web/package.json@@ -16,6 +16,7 @@"start": "dotenv -e ../.env -- sh -c 'NEXT_MANUAL_SIG_HANDLE=true next start'","test": "dotenv -e ../.env -- jest --silent false --verbose false --runInBand --detectOpenHandles --selectProjects async-server","test-sync": "dotenv -e ../.env -- jest --silent false --verbose false --runInBand --detectOpenHandles --selectProjects sync-server",+ "test-client": "dotenv -e ../.env -- jest --silent false --verbose false --runInBand --detectOpenHandles --selectProjects client","test:watch": "dotenv -e ../.env -- jest --watch --runInBand","test:e2e": "dotenv -e ../.env -- playwright test","test:e2e:server": "dotenv -e ../.env -- jest --runInBand --detectOpenHandles --verbose --selectProjects e2e-server",diff --git a/web/src/__tests__/aggregateScores.clienttest.ts b/web/src/__tests__/aggregateScores.clienttest.tsindex ed7872f3e4..9d2d53d4a6 100644--- a/web/src/__tests__/aggregateScores.clienttest.ts+++ b/web/src/__tests__/aggregateScores.clienttest.ts@@ -54,6 +54,33 @@ describe("aggregateScores", () => {});});+ it("should correctly aggregate multiple numeric scores with the same key and value", () => {+ const scores = [+ {+ name: "test",+ source: "API",+ dataType: "NUMERIC",+ value: 5,+ comment: "test comment",+ },+ {+ name: "test",+ source: "API",+ dataType: "NUMERIC",+ value: 5,+ comment: "another comment",+ },+ ] as APIScore[];+ expect(aggregateScores(scores)).toEqual({+ "test-API-NUMERIC": {+ type: "NUMERIC",+ values: [5, 5],+ average: 5,+ comment: undefined,+ },+ });+ });+it("should correctly aggregate scores with different keys", () => {const scores: APIScore[] = [{diff --git a/web/src/features/datasets/server/service.ts b/web/src/features/datasets/server/service.tsindex 35b5ec3443..279ec28974 100644--- a/web/src/features/datasets/server/service.ts+++ b/web/src/features/datasets/server/service.ts@@ -100,9 +100,8 @@ export const createDatasetRunsTable = async (input: DatasetRunsTableInput) => {tableName,clickhouseSession,);-logger.info(- `Fetched ${scores.length} scores for dataset runs with ids ${scores.map((s) => s.id).join(", ")}`,+ `Fetched ${scores.length} scores for dataset runs with ids ${scores.map((s) => JSON.stringify({ id: s.id, runId: s.run_id, v: s.value, tr: s.traceId })).join(", ")}`,);const obsAgg = await getObservationLatencyAndCostForDataset(