langsmith 0.3.7 → 0.3.8
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/run_trees.cjs +22 -0
- package/dist/run_trees.d.ts +12 -0
- package/dist/run_trees.js +22 -0
- package/dist/traceable.cjs +14 -0
- package/dist/traceable.js +14 -0
- package/package.json +2 -2
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.
|
|
11
|
+
exports.__version__ = "0.3.8";
|
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.
|
|
5
|
+
export declare const __version__ = "0.3.8";
|
package/dist/index.js
CHANGED
package/dist/run_trees.cjs
CHANGED
|
@@ -432,6 +432,28 @@ class RunTree {
|
|
|
432
432
|
toJSON() {
|
|
433
433
|
return this._convertToCreate(this, undefined, false);
|
|
434
434
|
}
|
|
435
|
+
/**
|
|
436
|
+
* Add an event to the run tree.
|
|
437
|
+
* @param event - A single event or string to add
|
|
438
|
+
*/
|
|
439
|
+
addEvent(event) {
|
|
440
|
+
if (!this.events) {
|
|
441
|
+
this.events = [];
|
|
442
|
+
}
|
|
443
|
+
if (typeof event === "string") {
|
|
444
|
+
this.events.push({
|
|
445
|
+
name: "event",
|
|
446
|
+
time: new Date().toISOString(),
|
|
447
|
+
message: event,
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
this.events.push({
|
|
452
|
+
...event,
|
|
453
|
+
time: event.time ?? new Date().toISOString(),
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
}
|
|
435
457
|
static fromRunnableConfig(parentConfig, props) {
|
|
436
458
|
// We only handle the callback manager case for now
|
|
437
459
|
const callbackManager = parentConfig?.callbacks;
|
package/dist/run_trees.d.ts
CHANGED
|
@@ -87,6 +87,11 @@ export declare class RunTree implements BaseRun {
|
|
|
87
87
|
postRun(excludeChildRuns?: boolean): Promise<void>;
|
|
88
88
|
patchRun(): Promise<void>;
|
|
89
89
|
toJSON(): RunCreate;
|
|
90
|
+
/**
|
|
91
|
+
* Add an event to the run tree.
|
|
92
|
+
* @param event - A single event or string to add
|
|
93
|
+
*/
|
|
94
|
+
addEvent(event: RunEvent | string): void;
|
|
90
95
|
static fromRunnableConfig(parentConfig: RunnableConfigLike, props: RunTreeConfig): RunTree;
|
|
91
96
|
static fromDottedOrder(dottedOrder: string): RunTree | undefined;
|
|
92
97
|
static fromHeaders(headers: Record<string, string | string[]> | HeadersLike, inheritArgs?: RunTreeConfig): RunTree | undefined;
|
|
@@ -96,5 +101,12 @@ export declare class RunTree implements BaseRun {
|
|
|
96
101
|
};
|
|
97
102
|
}
|
|
98
103
|
export declare function isRunTree(x?: unknown): x is RunTree;
|
|
104
|
+
export interface RunEvent {
|
|
105
|
+
name?: string;
|
|
106
|
+
time?: string;
|
|
107
|
+
message?: string;
|
|
108
|
+
kwargs?: Record<string, unknown>;
|
|
109
|
+
[key: string]: unknown;
|
|
110
|
+
}
|
|
99
111
|
export declare function isRunnableConfigLike(x?: unknown): x is RunnableConfigLike;
|
|
100
112
|
export {};
|
package/dist/run_trees.js
CHANGED
|
@@ -405,6 +405,28 @@ export class RunTree {
|
|
|
405
405
|
toJSON() {
|
|
406
406
|
return this._convertToCreate(this, undefined, false);
|
|
407
407
|
}
|
|
408
|
+
/**
|
|
409
|
+
* Add an event to the run tree.
|
|
410
|
+
* @param event - A single event or string to add
|
|
411
|
+
*/
|
|
412
|
+
addEvent(event) {
|
|
413
|
+
if (!this.events) {
|
|
414
|
+
this.events = [];
|
|
415
|
+
}
|
|
416
|
+
if (typeof event === "string") {
|
|
417
|
+
this.events.push({
|
|
418
|
+
name: "event",
|
|
419
|
+
time: new Date().toISOString(),
|
|
420
|
+
message: event,
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
this.events.push({
|
|
425
|
+
...event,
|
|
426
|
+
time: event.time ?? new Date().toISOString(),
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
}
|
|
408
430
|
static fromRunnableConfig(parentConfig, props) {
|
|
409
431
|
// We only handle the callback manager case for now
|
|
410
432
|
const callbackManager = parentConfig?.callbacks;
|
package/dist/traceable.cjs
CHANGED
|
@@ -364,6 +364,13 @@ function traceable(wrappedFunc, config) {
|
|
|
364
364
|
break;
|
|
365
365
|
}
|
|
366
366
|
chunks.push(result.value);
|
|
367
|
+
// Add new_token event for streaming LLM runs
|
|
368
|
+
if (currentRunTree && currentRunTree.run_type === "llm") {
|
|
369
|
+
currentRunTree.addEvent({
|
|
370
|
+
name: "new_token",
|
|
371
|
+
kwargs: { token: result.value },
|
|
372
|
+
});
|
|
373
|
+
}
|
|
367
374
|
controller.enqueue(result.value);
|
|
368
375
|
}
|
|
369
376
|
},
|
|
@@ -390,6 +397,13 @@ function traceable(wrappedFunc, config) {
|
|
|
390
397
|
break;
|
|
391
398
|
}
|
|
392
399
|
chunks.push(value);
|
|
400
|
+
// Add new_token event for streaming LLM runs
|
|
401
|
+
if (currentRunTree && currentRunTree.run_type === "llm") {
|
|
402
|
+
currentRunTree.addEvent({
|
|
403
|
+
name: "new_token",
|
|
404
|
+
kwargs: { token: value },
|
|
405
|
+
});
|
|
406
|
+
}
|
|
393
407
|
yield value;
|
|
394
408
|
}
|
|
395
409
|
}
|
package/dist/traceable.js
CHANGED
|
@@ -361,6 +361,13 @@ export function traceable(wrappedFunc, config) {
|
|
|
361
361
|
break;
|
|
362
362
|
}
|
|
363
363
|
chunks.push(result.value);
|
|
364
|
+
// Add new_token event for streaming LLM runs
|
|
365
|
+
if (currentRunTree && currentRunTree.run_type === "llm") {
|
|
366
|
+
currentRunTree.addEvent({
|
|
367
|
+
name: "new_token",
|
|
368
|
+
kwargs: { token: result.value },
|
|
369
|
+
});
|
|
370
|
+
}
|
|
364
371
|
controller.enqueue(result.value);
|
|
365
372
|
}
|
|
366
373
|
},
|
|
@@ -387,6 +394,13 @@ export function traceable(wrappedFunc, config) {
|
|
|
387
394
|
break;
|
|
388
395
|
}
|
|
389
396
|
chunks.push(value);
|
|
397
|
+
// Add new_token event for streaming LLM runs
|
|
398
|
+
if (currentRunTree && currentRunTree.run_type === "llm") {
|
|
399
|
+
currentRunTree.addEvent({
|
|
400
|
+
name: "new_token",
|
|
401
|
+
kwargs: { token: value },
|
|
402
|
+
});
|
|
403
|
+
}
|
|
390
404
|
yield value;
|
|
391
405
|
}
|
|
392
406
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langsmith",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
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": [
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"typedoc": "^0.27.6",
|
|
163
163
|
"typedoc-plugin-expand-object-like-types": "^0.1.2",
|
|
164
164
|
"typescript": "^5.4.5",
|
|
165
|
-
"vitest": "^
|
|
165
|
+
"vitest": "^3.0.5",
|
|
166
166
|
"zod": "^3.23.8"
|
|
167
167
|
},
|
|
168
168
|
"peerDependencies": {
|