langsmith 0.1.24 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.cjs CHANGED
@@ -907,8 +907,23 @@ class Client {
907
907
  select: select ? select : default_select,
908
908
  is_root: isRoot,
909
909
  };
910
+ let runsYielded = 0;
910
911
  for await (const runs of this._getCursorPaginatedList("/runs/query", body)) {
911
- yield* runs;
912
+ if (limit) {
913
+ if (runsYielded >= limit) {
914
+ break;
915
+ }
916
+ if (runs.length + runsYielded > limit) {
917
+ const newRuns = runs.slice(0, limit - runsYielded);
918
+ yield* newRuns;
919
+ break;
920
+ }
921
+ runsYielded += runs.length;
922
+ yield* runs;
923
+ }
924
+ else {
925
+ yield* runs;
926
+ }
912
927
  }
913
928
  }
914
929
  async shareRun(runId, { shareId } = {}) {
package/dist/client.js CHANGED
@@ -880,8 +880,23 @@ export class Client {
880
880
  select: select ? select : default_select,
881
881
  is_root: isRoot,
882
882
  };
883
+ let runsYielded = 0;
883
884
  for await (const runs of this._getCursorPaginatedList("/runs/query", body)) {
884
- yield* runs;
885
+ if (limit) {
886
+ if (runsYielded >= limit) {
887
+ break;
888
+ }
889
+ if (runs.length + runsYielded > limit) {
890
+ const newRuns = runs.slice(0, limit - runsYielded);
891
+ yield* newRuns;
892
+ break;
893
+ }
894
+ runsYielded += runs.length;
895
+ yield* runs;
896
+ }
897
+ else {
898
+ yield* runs;
899
+ }
885
900
  }
886
901
  }
887
902
  async shareRun(runId, { shareId } = {}) {
@@ -377,7 +377,7 @@ class _ExperimentManager {
377
377
  try {
378
378
  const options = {
379
379
  reference_example_id: example.id,
380
- project_name: fields.experimentName,
380
+ project_name: "evaluators",
381
381
  metadata: {
382
382
  example_version: example.modified_at
383
383
  ? new Date(example.modified_at).toISOString()
@@ -410,7 +410,6 @@ class _ExperimentManager {
410
410
  if (maxConcurrency === 0) {
411
411
  for await (const currentResults of this.getResults()) {
412
412
  yield this._runEvaluators(evaluators, currentResults, {
413
- experimentName: this.experimentName,
414
413
  client: this.client,
415
414
  });
416
415
  }
@@ -422,7 +421,6 @@ class _ExperimentManager {
422
421
  const futures = [];
423
422
  for await (const currentResults of this.getResults()) {
424
423
  futures.push(caller.call(this._runEvaluators, evaluators, currentResults, {
425
- experimentName: this.experimentName,
426
424
  client: this.client,
427
425
  }));
428
426
  }
@@ -125,7 +125,6 @@ declare class _ExperimentManager {
125
125
  maxConcurrency?: number;
126
126
  }): AsyncGenerator<_ForwardResults>;
127
127
  _runEvaluators(evaluators: Array<RunEvaluator>, currentResults: ExperimentResultRow, fields: {
128
- experimentName: string;
129
128
  client: Client;
130
129
  }): Promise<ExperimentResultRow>;
131
130
  /**
@@ -373,7 +373,7 @@ class _ExperimentManager {
373
373
  try {
374
374
  const options = {
375
375
  reference_example_id: example.id,
376
- project_name: fields.experimentName,
376
+ project_name: "evaluators",
377
377
  metadata: {
378
378
  example_version: example.modified_at
379
379
  ? new Date(example.modified_at).toISOString()
@@ -406,7 +406,6 @@ class _ExperimentManager {
406
406
  if (maxConcurrency === 0) {
407
407
  for await (const currentResults of this.getResults()) {
408
408
  yield this._runEvaluators(evaluators, currentResults, {
409
- experimentName: this.experimentName,
410
409
  client: this.client,
411
410
  });
412
411
  }
@@ -418,7 +417,6 @@ class _ExperimentManager {
418
417
  const futures = [];
419
418
  for await (const currentResults of this.getResults()) {
420
419
  futures.push(caller.call(this._runEvaluators, evaluators, currentResults, {
421
- experimentName: this.experimentName,
422
420
  client: this.client,
423
421
  }));
424
422
  }
@@ -59,7 +59,12 @@ class DynamicRunEvaluator {
59
59
  if (typeof this.func !== "function") {
60
60
  throw new Error("Target must be runnable function");
61
61
  }
62
- const wrappedTraceableFunc = (0, traceable_js_1.traceable)(this.func, { project_name: "evaluators", name: "evaluator", ...options });
62
+ const wrappedTraceableFunc = (0, traceable_js_1.traceable)(this.func, {
63
+ project_name: "evaluators",
64
+ name: "evaluator",
65
+ id: sourceRunId,
66
+ ...options,
67
+ });
63
68
  const result = (await wrappedTraceableFunc(
64
69
  // Pass data via `langSmithRunAndExample` key to avoid conflicts with other
65
70
  // inputs. This key is extracted in the wrapped function, with `run` and
@@ -56,7 +56,12 @@ export class DynamicRunEvaluator {
56
56
  if (typeof this.func !== "function") {
57
57
  throw new Error("Target must be runnable function");
58
58
  }
59
- const wrappedTraceableFunc = traceable(this.func, { project_name: "evaluators", name: "evaluator", ...options });
59
+ const wrappedTraceableFunc = traceable(this.func, {
60
+ project_name: "evaluators",
61
+ name: "evaluator",
62
+ id: sourceRunId,
63
+ ...options,
64
+ });
60
65
  const result = (await wrappedTraceableFunc(
61
66
  // Pass data via `langSmithRunAndExample` key to avoid conflicts with other
62
67
  // inputs. This key is extracted in the wrapped function, with `run` and
package/dist/index.cjs CHANGED
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "Client", { enumerable: true, get: function () {
6
6
  var run_trees_js_1 = require("./run_trees.cjs");
7
7
  Object.defineProperty(exports, "RunTree", { enumerable: true, get: function () { return run_trees_js_1.RunTree; } });
8
8
  // Update using yarn bump-version
9
- exports.__version__ = "0.1.24";
9
+ exports.__version__ = "0.1.25";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { Client } from "./client.js";
2
2
  export type { Dataset, Example, TracerSession, Run, Feedback, } from "./schemas.js";
3
3
  export { RunTree, type RunTreeConfig } from "./run_trees.js";
4
- export declare const __version__ = "0.1.24";
4
+ export declare const __version__ = "0.1.25";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export { Client } from "./client.js";
2
2
  export { RunTree } from "./run_trees.js";
3
3
  // Update using yarn bump-version
4
- export const __version__ = "0.1.24";
4
+ export const __version__ = "0.1.25";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.",
5
5
  "packageManager": "yarn@1.22.19",
6
6
  "files": [
@@ -85,6 +85,7 @@
85
85
  },
86
86
  "devDependencies": {
87
87
  "@babel/preset-env": "^7.22.4",
88
+ "@faker-js/faker": "^8.4.1",
88
89
  "@jest/globals": "^29.5.0",
89
90
  "@langchain/core": "^0.1.32",
90
91
  "@langchain/langgraph": "^0.0.8",