langsmith 0.1.60 → 0.1.61

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.1.60";
11
+ exports.__version__ = "0.1.61";
package/dist/index.d.ts CHANGED
@@ -2,4 +2,4 @@ export { Client, type ClientConfig } from "./client.js";
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.1.60";
5
+ export declare const __version__ = "0.1.61";
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.1.60";
5
+ export const __version__ = "0.1.61";
@@ -364,31 +364,41 @@ class RunTree {
364
364
  return persistedRun;
365
365
  }
366
366
  async postRun(excludeChildRuns = true) {
367
- const runtimeEnv = await (0, env_js_1.getRuntimeEnvironment)();
368
- const runCreate = await this._convertToCreate(this, runtimeEnv, true);
369
- await this.client.createRun(runCreate);
370
- if (!excludeChildRuns) {
371
- (0, warn_js_1.warnOnce)("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");
372
- for (const childRun of this.child_runs) {
373
- await childRun.postRun(false);
367
+ try {
368
+ const runtimeEnv = await (0, env_js_1.getRuntimeEnvironment)();
369
+ const runCreate = await this._convertToCreate(this, runtimeEnv, true);
370
+ await this.client.createRun(runCreate);
371
+ if (!excludeChildRuns) {
372
+ (0, warn_js_1.warnOnce)("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");
373
+ for (const childRun of this.child_runs) {
374
+ await childRun.postRun(false);
375
+ }
374
376
  }
375
377
  }
378
+ catch (error) {
379
+ console.error(`Error in postRun for run ${this.id}:`, error);
380
+ }
376
381
  }
377
382
  async patchRun() {
378
- const runUpdate = {
379
- end_time: this.end_time,
380
- error: this.error,
381
- inputs: this.inputs,
382
- outputs: this.outputs,
383
- parent_run_id: this.parent_run?.id,
384
- reference_example_id: this.reference_example_id,
385
- extra: this.extra,
386
- events: this.events,
387
- dotted_order: this.dotted_order,
388
- trace_id: this.trace_id,
389
- tags: this.tags,
390
- };
391
- await this.client.updateRun(this.id, runUpdate);
383
+ try {
384
+ const runUpdate = {
385
+ end_time: this.end_time,
386
+ error: this.error,
387
+ inputs: this.inputs,
388
+ outputs: this.outputs,
389
+ parent_run_id: this.parent_run?.id,
390
+ reference_example_id: this.reference_example_id,
391
+ extra: this.extra,
392
+ events: this.events,
393
+ dotted_order: this.dotted_order,
394
+ trace_id: this.trace_id,
395
+ tags: this.tags,
396
+ };
397
+ await this.client.updateRun(this.id, runUpdate);
398
+ }
399
+ catch (error) {
400
+ console.error(`Error in patchRun for run ${this.id}`, error);
401
+ }
392
402
  }
393
403
  toJSON() {
394
404
  return this._convertToCreate(this, undefined, false);
package/dist/run_trees.js CHANGED
@@ -337,31 +337,41 @@ export class RunTree {
337
337
  return persistedRun;
338
338
  }
339
339
  async postRun(excludeChildRuns = true) {
340
- const runtimeEnv = await getRuntimeEnvironment();
341
- const runCreate = await this._convertToCreate(this, runtimeEnv, true);
342
- await this.client.createRun(runCreate);
343
- if (!excludeChildRuns) {
344
- warnOnce("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");
345
- for (const childRun of this.child_runs) {
346
- await childRun.postRun(false);
340
+ try {
341
+ const runtimeEnv = await getRuntimeEnvironment();
342
+ const runCreate = await this._convertToCreate(this, runtimeEnv, true);
343
+ await this.client.createRun(runCreate);
344
+ if (!excludeChildRuns) {
345
+ warnOnce("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");
346
+ for (const childRun of this.child_runs) {
347
+ await childRun.postRun(false);
348
+ }
347
349
  }
348
350
  }
351
+ catch (error) {
352
+ console.error(`Error in postRun for run ${this.id}:`, error);
353
+ }
349
354
  }
350
355
  async patchRun() {
351
- const runUpdate = {
352
- end_time: this.end_time,
353
- error: this.error,
354
- inputs: this.inputs,
355
- outputs: this.outputs,
356
- parent_run_id: this.parent_run?.id,
357
- reference_example_id: this.reference_example_id,
358
- extra: this.extra,
359
- events: this.events,
360
- dotted_order: this.dotted_order,
361
- trace_id: this.trace_id,
362
- tags: this.tags,
363
- };
364
- await this.client.updateRun(this.id, runUpdate);
356
+ try {
357
+ const runUpdate = {
358
+ end_time: this.end_time,
359
+ error: this.error,
360
+ inputs: this.inputs,
361
+ outputs: this.outputs,
362
+ parent_run_id: this.parent_run?.id,
363
+ reference_example_id: this.reference_example_id,
364
+ extra: this.extra,
365
+ events: this.events,
366
+ dotted_order: this.dotted_order,
367
+ trace_id: this.trace_id,
368
+ tags: this.tags,
369
+ };
370
+ await this.client.updateRun(this.id, runUpdate);
371
+ }
372
+ catch (error) {
373
+ console.error(`Error in patchRun for run ${this.id}`, error);
374
+ }
365
375
  }
366
376
  toJSON() {
367
377
  return this._convertToCreate(this, undefined, false);
@@ -428,13 +428,18 @@ function traceable(wrappedFunc, config) {
428
428
  }
429
429
  if ((0, asserts_js_1.isGenerator)(wrappedFunc) && (0, asserts_js_1.isIteratorLike)(rawOutput)) {
430
430
  const chunks = gatherAll(rawOutput);
431
- await currentRunTree?.end(handleRunOutputs(await handleChunks(chunks.reduce((memo, { value, done }) => {
432
- if (!done || typeof value !== "undefined") {
433
- memo.push(value);
434
- }
435
- return memo;
436
- }, []))));
437
- await handleEnd();
431
+ try {
432
+ await currentRunTree?.end(handleRunOutputs(await handleChunks(chunks.reduce((memo, { value, done }) => {
433
+ if (!done || typeof value !== "undefined") {
434
+ memo.push(value);
435
+ }
436
+ return memo;
437
+ }, []))));
438
+ await handleEnd();
439
+ }
440
+ catch (e) {
441
+ console.error("Error occurred during handleEnd:", e);
442
+ }
438
443
  return (function* () {
439
444
  for (const ret of chunks) {
440
445
  if (ret.done)
package/dist/traceable.js CHANGED
@@ -425,13 +425,18 @@ export function traceable(wrappedFunc, config) {
425
425
  }
426
426
  if (isGenerator(wrappedFunc) && isIteratorLike(rawOutput)) {
427
427
  const chunks = gatherAll(rawOutput);
428
- await currentRunTree?.end(handleRunOutputs(await handleChunks(chunks.reduce((memo, { value, done }) => {
429
- if (!done || typeof value !== "undefined") {
430
- memo.push(value);
431
- }
432
- return memo;
433
- }, []))));
434
- await handleEnd();
428
+ try {
429
+ await currentRunTree?.end(handleRunOutputs(await handleChunks(chunks.reduce((memo, { value, done }) => {
430
+ if (!done || typeof value !== "undefined") {
431
+ memo.push(value);
432
+ }
433
+ return memo;
434
+ }, []))));
435
+ await handleEnd();
436
+ }
437
+ catch (e) {
438
+ console.error("Error occurred during handleEnd:", e);
439
+ }
435
440
  return (function* () {
436
441
  for (const ret of chunks) {
437
442
  if (ret.done)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.1.60",
3
+ "version": "0.1.61",
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": [