@langchain/core 0.1.28 → 0.1.29-rc.0
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.
|
@@ -52,55 +52,22 @@ class LangChainTracer extends base_js_1.BaseTracer {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
async persistRun(_run) { }
|
|
55
|
-
async
|
|
55
|
+
async onRunCreate(run) {
|
|
56
56
|
const persistedRun = await this._convertToCreate(run, this.exampleId);
|
|
57
57
|
await this.client.createRun(persistedRun);
|
|
58
58
|
}
|
|
59
|
-
async
|
|
59
|
+
async onRunUpdate(run) {
|
|
60
60
|
const runUpdate = {
|
|
61
61
|
end_time: run.end_time,
|
|
62
62
|
error: run.error,
|
|
63
63
|
outputs: run.outputs,
|
|
64
64
|
events: run.events,
|
|
65
65
|
inputs: run.inputs,
|
|
66
|
+
trace_id: run.trace_id,
|
|
67
|
+
dotted_order: run.dotted_order,
|
|
68
|
+
parent_run_id: run.parent_run_id,
|
|
66
69
|
};
|
|
67
70
|
await this.client.updateRun(run.id, runUpdate);
|
|
68
71
|
}
|
|
69
|
-
async onRetrieverStart(run) {
|
|
70
|
-
await this._persistRunSingle(run);
|
|
71
|
-
}
|
|
72
|
-
async onRetrieverEnd(run) {
|
|
73
|
-
await this._updateRunSingle(run);
|
|
74
|
-
}
|
|
75
|
-
async onRetrieverError(run) {
|
|
76
|
-
await this._updateRunSingle(run);
|
|
77
|
-
}
|
|
78
|
-
async onLLMStart(run) {
|
|
79
|
-
await this._persistRunSingle(run);
|
|
80
|
-
}
|
|
81
|
-
async onLLMEnd(run) {
|
|
82
|
-
await this._updateRunSingle(run);
|
|
83
|
-
}
|
|
84
|
-
async onLLMError(run) {
|
|
85
|
-
await this._updateRunSingle(run);
|
|
86
|
-
}
|
|
87
|
-
async onChainStart(run) {
|
|
88
|
-
await this._persistRunSingle(run);
|
|
89
|
-
}
|
|
90
|
-
async onChainEnd(run) {
|
|
91
|
-
await this._updateRunSingle(run);
|
|
92
|
-
}
|
|
93
|
-
async onChainError(run) {
|
|
94
|
-
await this._updateRunSingle(run);
|
|
95
|
-
}
|
|
96
|
-
async onToolStart(run) {
|
|
97
|
-
await this._persistRunSingle(run);
|
|
98
|
-
}
|
|
99
|
-
async onToolEnd(run) {
|
|
100
|
-
await this._updateRunSingle(run);
|
|
101
|
-
}
|
|
102
|
-
async onToolError(run) {
|
|
103
|
-
await this._updateRunSingle(run);
|
|
104
|
-
}
|
|
105
72
|
}
|
|
106
73
|
exports.LangChainTracer = LangChainTracer;
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { Client } from "langsmith";
|
|
2
|
-
import { BaseRun, RunUpdate as BaseRunUpdate, KVMap } from "langsmith/schemas";
|
|
2
|
+
import { BaseRun, RunCreate, RunUpdate as BaseRunUpdate, KVMap } from "langsmith/schemas";
|
|
3
3
|
import { BaseTracer } from "./base.js";
|
|
4
4
|
import { BaseCallbackHandlerInput } from "../callbacks/base.js";
|
|
5
5
|
export interface Run extends BaseRun {
|
|
6
6
|
id: string;
|
|
7
7
|
child_runs: this[];
|
|
8
8
|
child_execution_order: number;
|
|
9
|
+
dotted_order?: string;
|
|
10
|
+
trace_id?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface RunCreate2 extends RunCreate {
|
|
13
|
+
trace_id?: string;
|
|
14
|
+
dotted_order?: string;
|
|
9
15
|
}
|
|
10
16
|
export interface RunUpdate extends BaseRunUpdate {
|
|
11
17
|
events: BaseRun["events"];
|
|
12
18
|
inputs: KVMap;
|
|
19
|
+
trace_id?: string;
|
|
20
|
+
dotted_order?: string;
|
|
13
21
|
}
|
|
14
22
|
export interface LangChainTracerFields extends BaseCallbackHandlerInput {
|
|
15
23
|
exampleId?: string;
|
|
@@ -24,18 +32,6 @@ export declare class LangChainTracer extends BaseTracer implements LangChainTrac
|
|
|
24
32
|
constructor(fields?: LangChainTracerFields);
|
|
25
33
|
private _convertToCreate;
|
|
26
34
|
protected persistRun(_run: Run): Promise<void>;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
onRetrieverStart(run: Run): Promise<void>;
|
|
30
|
-
onRetrieverEnd(run: Run): Promise<void>;
|
|
31
|
-
onRetrieverError(run: Run): Promise<void>;
|
|
32
|
-
onLLMStart(run: Run): Promise<void>;
|
|
33
|
-
onLLMEnd(run: Run): Promise<void>;
|
|
34
|
-
onLLMError(run: Run): Promise<void>;
|
|
35
|
-
onChainStart(run: Run): Promise<void>;
|
|
36
|
-
onChainEnd(run: Run): Promise<void>;
|
|
37
|
-
onChainError(run: Run): Promise<void>;
|
|
38
|
-
onToolStart(run: Run): Promise<void>;
|
|
39
|
-
onToolEnd(run: Run): Promise<void>;
|
|
40
|
-
onToolError(run: Run): Promise<void>;
|
|
35
|
+
onRunCreate(run: Run): Promise<void>;
|
|
36
|
+
onRunUpdate(run: Run): Promise<void>;
|
|
41
37
|
}
|
|
@@ -49,54 +49,21 @@ export class LangChainTracer extends BaseTracer {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
async persistRun(_run) { }
|
|
52
|
-
async
|
|
52
|
+
async onRunCreate(run) {
|
|
53
53
|
const persistedRun = await this._convertToCreate(run, this.exampleId);
|
|
54
54
|
await this.client.createRun(persistedRun);
|
|
55
55
|
}
|
|
56
|
-
async
|
|
56
|
+
async onRunUpdate(run) {
|
|
57
57
|
const runUpdate = {
|
|
58
58
|
end_time: run.end_time,
|
|
59
59
|
error: run.error,
|
|
60
60
|
outputs: run.outputs,
|
|
61
61
|
events: run.events,
|
|
62
62
|
inputs: run.inputs,
|
|
63
|
+
trace_id: run.trace_id,
|
|
64
|
+
dotted_order: run.dotted_order,
|
|
65
|
+
parent_run_id: run.parent_run_id,
|
|
63
66
|
};
|
|
64
67
|
await this.client.updateRun(run.id, runUpdate);
|
|
65
68
|
}
|
|
66
|
-
async onRetrieverStart(run) {
|
|
67
|
-
await this._persistRunSingle(run);
|
|
68
|
-
}
|
|
69
|
-
async onRetrieverEnd(run) {
|
|
70
|
-
await this._updateRunSingle(run);
|
|
71
|
-
}
|
|
72
|
-
async onRetrieverError(run) {
|
|
73
|
-
await this._updateRunSingle(run);
|
|
74
|
-
}
|
|
75
|
-
async onLLMStart(run) {
|
|
76
|
-
await this._persistRunSingle(run);
|
|
77
|
-
}
|
|
78
|
-
async onLLMEnd(run) {
|
|
79
|
-
await this._updateRunSingle(run);
|
|
80
|
-
}
|
|
81
|
-
async onLLMError(run) {
|
|
82
|
-
await this._updateRunSingle(run);
|
|
83
|
-
}
|
|
84
|
-
async onChainStart(run) {
|
|
85
|
-
await this._persistRunSingle(run);
|
|
86
|
-
}
|
|
87
|
-
async onChainEnd(run) {
|
|
88
|
-
await this._updateRunSingle(run);
|
|
89
|
-
}
|
|
90
|
-
async onChainError(run) {
|
|
91
|
-
await this._updateRunSingle(run);
|
|
92
|
-
}
|
|
93
|
-
async onToolStart(run) {
|
|
94
|
-
await this._persistRunSingle(run);
|
|
95
|
-
}
|
|
96
|
-
async onToolEnd(run) {
|
|
97
|
-
await this._updateRunSingle(run);
|
|
98
|
-
}
|
|
99
|
-
async onToolError(run) {
|
|
100
|
-
await this._updateRunSingle(run);
|
|
101
|
-
}
|
|
102
69
|
}
|