langsmith 0.3.0 → 0.3.1

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/index.cjs CHANGED
@@ -8,4 +8,4 @@ Object.defineProperty(exports, "RunTree", { enumerable: true, get: function () {
8
8
  var fetch_js_1 = require("./singletons/fetch.cjs");
9
9
  Object.defineProperty(exports, "overrideFetchImplementation", { enumerable: true, get: function () { return fetch_js_1.overrideFetchImplementation; } });
10
10
  // Update using yarn bump-version
11
- exports.__version__ = "0.3.0";
11
+ exports.__version__ = "0.3.1";
package/dist/index.d.ts CHANGED
@@ -2,4 +2,4 @@ export { Client, type ClientConfig, type LangSmithTracingClientInterface, } from
2
2
  export type { Dataset, Example, TracerSession, Run, Feedback, RetrieverOutput, } from "./schemas.js";
3
3
  export { RunTree, type RunTreeConfig } from "./run_trees.js";
4
4
  export { overrideFetchImplementation } from "./singletons/fetch.js";
5
- export declare const __version__ = "0.3.0";
5
+ export declare const __version__ = "0.3.1";
package/dist/index.js CHANGED
@@ -2,4 +2,4 @@ export { Client, } from "./client.js";
2
2
  export { RunTree } from "./run_trees.js";
3
3
  export { overrideFetchImplementation } from "./singletons/fetch.js";
4
4
  // Update using yarn bump-version
5
- export const __version__ = "0.3.0";
5
+ export const __version__ = "0.3.1";
@@ -2,8 +2,8 @@
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  import { Dataset, TracerSession, Example } from "../../schemas.js";
4
4
  import { Client, CreateProjectParams } from "../../client.js";
5
- import { EvaluationResult } from "../../evaluation/evaluator.js";
6
5
  import { RunTree } from "../../run_trees.js";
6
+ import { SimpleEvaluationResult } from "./types.js";
7
7
  export declare const DEFAULT_TEST_CLIENT: Client;
8
8
  export type TestWrapperAsyncLocalStorageData = {
9
9
  enableTestTracking?: boolean;
@@ -12,7 +12,7 @@ export type TestWrapperAsyncLocalStorageData = {
12
12
  projectConfig?: Partial<CreateProjectParams>;
13
13
  project?: TracerSession;
14
14
  setLoggedOutput?: (value: Record<string, unknown>) => void;
15
- onFeedbackLogged?: (feedback: EvaluationResult) => void;
15
+ onFeedbackLogged?: (feedback: SimpleEvaluationResult) => void;
16
16
  currentExample?: Partial<Example> & {
17
17
  syncPromise?: Promise<Example>;
18
18
  };
@@ -26,7 +26,7 @@ export declare const evaluatorLogFeedbackPromises: Set<unknown>;
26
26
  export declare const syncExamplePromises: Map<any, any>;
27
27
  export declare function _logTestFeedback(params: {
28
28
  exampleId?: string;
29
- feedback: EvaluationResult;
29
+ feedback: SimpleEvaluationResult;
30
30
  context: TestWrapperAsyncLocalStorageData;
31
31
  runTree?: RunTree;
32
32
  client: Client;
@@ -139,9 +139,9 @@ function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
139
139
  " Please try again.");
140
140
  }
141
141
  const datasetSetupInfo = new Map();
142
- function getExampleId(datasetName, inputs, outputs) {
142
+ function getExampleId(datasetId, inputs, outputs) {
143
143
  const identifier = JSON.stringify({
144
- datasetName,
144
+ datasetId,
145
145
  inputsHash: objectHash(inputs),
146
146
  outputsHash: objectHash(outputs ?? {}),
147
147
  });
@@ -432,7 +432,7 @@ function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
432
432
  .map((field) => `"${field}"`)
433
433
  .join(", ")} while syncing to LangSmith. Please contact us for help.`);
434
434
  }
435
- exampleId = getExampleId(dataset.name, inputs, referenceOutputs);
435
+ exampleId = getExampleId(dataset.id, inputs, referenceOutputs);
436
436
  // TODO: Create or update the example in the background
437
437
  // Currently run end time has to be after example modified time
438
438
  // for examples to render properly, so we must modify the example
@@ -1,11 +1,11 @@
1
1
  /// <reference types="jest" />
2
2
  import { KVMap } from "../../schemas.js";
3
3
  import { toBeRelativeCloseTo, toBeAbsoluteCloseTo, toBeSemanticCloseTo } from "./matchers.js";
4
- import { EvaluationResult } from "../../evaluation/evaluator.js";
4
+ import { SimpleEvaluationResult } from "./types.js";
5
5
  import type { LangSmithJestlikeWrapperConfig, LangSmithJestlikeWrapperParams, LangSmithJestDescribeWrapper } from "./types.js";
6
6
  export declare const STRIP_ANSI_REGEX: RegExp;
7
7
  export declare const TEST_ID_DELIMITER = ", test_id=";
8
- export declare function logFeedback(feedback: EvaluationResult, config?: {
8
+ export declare function logFeedback(feedback: SimpleEvaluationResult, config?: {
9
9
  sourceRunId?: string;
10
10
  }): void;
11
11
  export declare function logOutputs(output: Record<string, unknown>): void;
@@ -108,9 +108,9 @@ export function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
108
108
  " Please try again.");
109
109
  }
110
110
  const datasetSetupInfo = new Map();
111
- function getExampleId(datasetName, inputs, outputs) {
111
+ function getExampleId(datasetId, inputs, outputs) {
112
112
  const identifier = JSON.stringify({
113
- datasetName,
113
+ datasetId,
114
114
  inputsHash: objectHash(inputs),
115
115
  outputsHash: objectHash(outputs ?? {}),
116
116
  });
@@ -401,7 +401,7 @@ export function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
401
401
  .map((field) => `"${field}"`)
402
402
  .join(", ")} while syncing to LangSmith. Please contact us for help.`);
403
403
  }
404
- exampleId = getExampleId(dataset.name, inputs, referenceOutputs);
404
+ exampleId = getExampleId(dataset.id, inputs, referenceOutputs);
405
405
  // TODO: Create or update the example in the background
406
406
  // Currently run end time has to be after example modified time
407
407
  // for examples to render properly, so we must modify the example
@@ -1,3 +1,4 @@
1
+ import { EvaluationResult } from "../../evaluation/evaluator.js";
1
2
  import type { RunTreeConfig } from "../../run_trees.js";
2
3
  import type { SimpleEvaluator } from "./vendor/evaluatedBy.js";
3
4
  export { type SimpleEvaluator };
@@ -11,3 +12,8 @@ export type LangSmithJestlikeWrapperParams<I, O> = {
11
12
  config?: LangSmithJestlikeWrapperConfig;
12
13
  };
13
14
  export type LangSmithJestDescribeWrapper = (name: string, fn: () => void | Promise<void>, config?: Partial<RunTreeConfig>) => void;
15
+ export type SimpleEvaluationResult = {
16
+ key: EvaluationResult["key"];
17
+ score: NonNullable<EvaluationResult["score"]>;
18
+ comment?: EvaluationResult["comment"];
19
+ };
@@ -1,12 +1,12 @@
1
- import { EvaluationResult } from "../../../evaluation/evaluator.js";
1
+ import { SimpleEvaluationResult } from "../types.js";
2
2
  import { RunTreeConfig } from "../../../run_trees.js";
3
3
  export type SimpleEvaluatorParams = {
4
4
  inputs: Record<string, any>;
5
5
  referenceOutputs: Record<string, any>;
6
6
  outputs: Record<string, any>;
7
7
  };
8
- export type SimpleEvaluator = (params: SimpleEvaluatorParams) => EvaluationResult | Promise<EvaluationResult>;
9
- export declare function wrapEvaluator<I, O>(evaluator: (input: I) => O | Promise<O>): (input: I, config?: Partial<RunTreeConfig> & {
8
+ export type SimpleEvaluator = (params: SimpleEvaluatorParams) => SimpleEvaluationResult | Promise<SimpleEvaluationResult>;
9
+ export declare function wrapEvaluator<I>(evaluator: (input: I) => SimpleEvaluationResult | Promise<SimpleEvaluationResult>): (input: I, config?: Partial<RunTreeConfig> & {
10
10
  runId?: string;
11
- }) => Promise<O>;
12
- export declare function evaluatedBy(outputs: any, evaluator: SimpleEvaluator): Promise<import("../../../schemas.js").ScoreType | undefined>;
11
+ }) => Promise<SimpleEvaluationResult>;
12
+ export declare function evaluatedBy(outputs: any, evaluator: SimpleEvaluator): Promise<NonNullable<import("../../../schemas.js").ScoreType | undefined>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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": [