From 34408f608c2769d889c2bcaf41d5e82957f56a3e Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:41:07 -0700 Subject: [PATCH] [JS] Fix summary evaluator result logging (#955) --- js/package.json | 2 +- js/src/evaluation/_runner.ts | 5 +++-- js/src/index.ts | 2 +- js/src/tests/evaluate.int.test.ts | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/js/package.json b/js/package.json index 565c83b71..12f97c49a 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "langsmith", - "version": "0.1.47", + "version": "0.1.48", "description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.", "packageManager": "yarn@1.22.19", "files": [ diff --git a/js/src/evaluation/_runner.ts b/js/src/evaluation/_runner.ts index bbdd0ead9..a73cc392d 100644 --- a/js/src/evaluation/_runner.ts +++ b/js/src/evaluation/_runner.ts @@ -673,11 +673,12 @@ export class _ExperimentManager { this.client._selectEvalResults(summaryEvalResult); aggregateFeedback.push(...flattenedResults); for (const result of flattenedResults) { - const { targetRunId, ...feedback } = result; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { targetRunId, key, ...feedback } = result; const evaluatorInfo = feedback.evaluatorInfo; delete feedback.evaluatorInfo; - await this.client.createFeedback(null, "key", { + await this.client.createFeedback(null, key, { ...feedback, projectId: projectId, sourceInfo: evaluatorInfo, diff --git a/js/src/index.ts b/js/src/index.ts index 011bb450e..2c28b5915 100644 --- a/js/src/index.ts +++ b/js/src/index.ts @@ -12,4 +12,4 @@ export type { export { RunTree, type RunTreeConfig } from "./run_trees.js"; // Update using yarn bump-version -export const __version__ = "0.1.47"; +export const __version__ = "0.1.48"; diff --git a/js/src/tests/evaluate.int.test.ts b/js/src/tests/evaluate.int.test.ts index 98ab6c6c8..4d68b920c 100644 --- a/js/src/tests/evaluate.int.test.ts +++ b/js/src/tests/evaluate.int.test.ts @@ -266,7 +266,7 @@ test("evaluate can evaluate with summary evaluators", async () => { const runIds = runs.map(({ id }) => id).join(", "); const exampleIds = examples?.map(({ id }) => id).join(", "); return Promise.resolve({ - key: "key", + key: "MyCustomScore", score: 1, comment: `Runs: ${runIds} Examples: ${exampleIds}`, }); @@ -279,7 +279,7 @@ test("evaluate can evaluate with summary evaluators", async () => { }); expect(evalRes.summaryResults.results).toHaveLength(1); - expect(evalRes.summaryResults.results[0].key).toBe("key"); + expect(evalRes.summaryResults.results[0].key).toBe("MyCustomScore"); expect(evalRes.summaryResults.results[0].score).toBe(1); const allRuns = evalRes.results.map(({ run }) => run); const allExamples = evalRes.results.map(({ example }) => example);