Skip to content

Commit

Permalink
Wait for runs to be stored in LangSmith
Browse files Browse the repository at this point in the history
  • Loading branch information
dqbd committed May 10, 2024
1 parent 2428ba9 commit 4718dab
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions js/src/tests/evaluate_comparative.int.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { evaluate } from "../evaluation/_runner.js";
import { evaluateComparative } from "../evaluation/evaluate_comparative.js";
import { Client } from "../index.js";
import { waitUntilRunFound } from "./utils.js";

const TESTING_DATASET_NAME = "test_evaluate_comparative_js";

Expand All @@ -21,13 +22,15 @@ beforeAll(async () => {
});

afterAll(async () => {
console.log("Deleting dataset")
console.log("Deleting dataset");
// const client = new Client();
// await client.deleteDataset({ datasetName: TESTING_DATASET_NAME });
});

describe("evaluate comparative", () => {
test("basic", async () => {
const client = new Client();

const firstEval = await evaluate(
(input) => ({ foo: `first:${input.input}` }),
{ data: TESTING_DATASET_NAME }
Expand All @@ -38,7 +41,11 @@ describe("evaluate comparative", () => {
{ data: TESTING_DATASET_NAME }
);

console.log("Pairwise starting")
await Promise.all(
[firstEval, secondEval].flatMap(({ results }) =>
results.flatMap(({ run }) => waitUntilRunFound(client, run.id))
)
);

const pairwise = await evaluateComparative(
[firstEval.experimentName, secondEval.experimentName],
Expand All @@ -52,8 +59,6 @@ describe("evaluate comparative", () => {
}
);

console.log("Pairwise completed")

// TODO: we should a) wait for runs to be persisted, b) allow passing runnables / traceables directly
expect(pairwise.results.length).toBeGreaterThanOrEqual(1);
});
Expand Down

0 comments on commit 4718dab

Please sign in to comment.