langgraph-ui-components 0.0.7 → 0.0.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.es100.js +25 -157
- package/dist/index.es100.js.map +1 -1
- package/dist/index.es101.js +3130 -176
- package/dist/index.es101.js.map +1 -1
- package/dist/index.es102.js +36 -13
- package/dist/index.es102.js.map +1 -1
- package/dist/index.es103.js +5 -30
- package/dist/index.es103.js.map +1 -1
- package/dist/index.es104.js +69 -30
- package/dist/index.es104.js.map +1 -1
- package/dist/index.es105.js +28 -3148
- package/dist/index.es105.js.map +1 -1
- package/dist/index.es106.js +5 -16
- package/dist/index.es106.js.map +1 -1
- package/dist/index.es107.js +2 -7
- package/dist/index.es107.js.map +1 -1
- package/dist/index.es108.js +13 -2
- package/dist/index.es108.js.map +1 -1
- package/dist/index.es109.js +499 -9
- package/dist/index.es109.js.map +1 -1
- package/dist/index.es11.js +2 -2
- package/dist/index.es11.js.map +1 -1
- package/dist/index.es110.js +5 -501
- package/dist/index.es110.js.map +1 -1
- package/dist/index.es111.js +2 -7
- package/dist/index.es111.js.map +1 -1
- package/dist/index.es112.js +148 -2
- package/dist/index.es112.js.map +1 -1
- package/dist/index.es113.js +878 -118
- package/dist/index.es113.js.map +1 -1
- package/dist/index.es114.js +251 -877
- package/dist/index.es114.js.map +1 -1
- package/dist/index.es115.js +3 -281
- package/dist/index.es115.js.map +1 -1
- package/dist/index.es116.js +445 -3
- package/dist/index.es116.js.map +1 -1
- package/dist/index.es117.js +39 -437
- package/dist/index.es117.js.map +1 -1
- package/dist/index.es118.js +22 -46
- package/dist/index.es118.js.map +1 -1
- package/dist/index.es119.js +78 -21
- package/dist/index.es119.js.map +1 -1
- package/dist/index.es120.js +126 -76
- package/dist/index.es120.js.map +1 -1
- package/dist/index.es121.js +45 -125
- package/dist/index.es121.js.map +1 -1
- package/dist/index.es122.js +9 -48
- package/dist/index.es122.js.map +1 -1
- package/dist/index.es123.js +45 -10
- package/dist/index.es123.js.map +1 -1
- package/dist/index.es124.js +97 -43
- package/dist/index.es124.js.map +1 -1
- package/dist/index.es125.js +48 -94
- package/dist/index.es125.js.map +1 -1
- package/dist/index.es126.js +14 -51
- package/dist/index.es126.js.map +1 -1
- package/dist/index.es127.js +13 -162
- package/dist/index.es127.js.map +1 -1
- package/dist/index.es128.js +89 -2
- package/dist/index.es128.js.map +1 -1
- package/dist/index.es129.js +2 -15
- package/dist/index.es129.js.map +1 -1
- package/dist/index.es130.js +54 -87
- package/dist/index.es130.js.map +1 -1
- package/dist/index.es131.js +100 -2
- package/dist/index.es131.js.map +1 -1
- package/dist/index.es132.js +186 -51
- package/dist/index.es132.js.map +1 -1
- package/dist/index.es133.js +97 -87
- package/dist/index.es133.js.map +1 -1
- package/dist/index.es134.js +31 -187
- package/dist/index.es134.js.map +1 -1
- package/dist/index.es135.js +10 -110
- package/dist/index.es135.js.map +1 -1
- package/dist/index.es136.js +11 -35
- package/dist/index.es136.js.map +1 -1
- package/dist/index.es137.js +12 -10
- package/dist/index.es137.js.map +1 -1
- package/dist/index.es138.js +90 -10
- package/dist/index.es138.js.map +1 -1
- package/dist/index.es139.js +274 -11
- package/dist/index.es139.js.map +1 -1
- package/dist/index.es140.js +2 -91
- package/dist/index.es140.js.map +1 -1
- package/dist/index.es141.js +150 -261
- package/dist/index.es141.js.map +1 -1
- package/dist/index.es142.js +51 -2
- package/dist/index.es142.js.map +1 -1
- package/dist/index.es143.js +34 -158
- package/dist/index.es143.js.map +1 -1
- package/dist/index.es144.js +34 -50
- package/dist/index.es144.js.map +1 -1
- package/dist/index.es145.js +32 -32
- package/dist/index.es145.js.map +1 -1
- package/dist/index.es146.js +23 -34
- package/dist/index.es146.js.map +1 -1
- package/dist/index.es147.js +583 -32
- package/dist/index.es147.js.map +1 -1
- package/dist/index.es148.js +121 -20
- package/dist/index.es148.js.map +1 -1
- package/dist/index.es149.js +158 -585
- package/dist/index.es149.js.map +1 -1
- package/dist/index.es15.js +15 -15
- package/dist/index.es150.js +2 -125
- package/dist/index.es150.js.map +1 -1
- package/dist/index.es157.js +2 -2
- package/dist/index.es159.js +2 -2
- package/dist/index.es161.js +64 -25
- package/dist/index.es161.js.map +1 -1
- package/dist/index.es162.js +22 -12
- package/dist/index.es162.js.map +1 -1
- package/dist/index.es163.js +5 -53
- package/dist/index.es163.js.map +1 -1
- package/dist/index.es164.js +337 -52
- package/dist/index.es164.js.map +1 -1
- package/dist/index.es165.js +24 -21
- package/dist/index.es165.js.map +1 -1
- package/dist/index.es166.js +12 -6
- package/dist/index.es166.js.map +1 -1
- package/dist/index.es167.js +49 -344
- package/dist/index.es167.js.map +1 -1
- package/dist/index.es175.js +1 -1
- package/dist/index.es178.js +1 -1
- package/dist/index.es183.js +1 -1
- package/dist/index.es195.js +2 -2
- package/dist/index.es197.js +2 -2
- package/dist/index.es200.js +1 -1
- package/dist/index.es201.js +1 -1
- package/dist/index.es203.js +1 -1
- package/dist/index.es204.js +2 -2
- package/dist/index.es206.js +1 -1
- package/dist/index.es209.js +3 -3
- package/dist/index.es21.js +1 -1
- package/dist/index.es210.js +2 -2
- package/dist/index.es212.js +1 -1
- package/dist/index.es214.js +1 -1
- package/dist/index.es215.js +1 -1
- package/dist/index.es217.js +1 -1
- package/dist/index.es218.js +2 -2
- package/dist/index.es219.js +1 -1
- package/dist/index.es220.js +1 -1
- package/dist/index.es221.js +1 -1
- package/dist/index.es222.js +1 -1
- package/dist/index.es223.js +1 -1
- package/dist/index.es224.js +1 -1
- package/dist/index.es225.js +1 -1
- package/dist/index.es229.js +2 -2
- package/dist/index.es28.js +7 -7
- package/dist/index.es29.js +1 -1
- package/dist/index.es32.js +4 -4
- package/dist/index.es33.js +15 -1191
- package/dist/index.es33.js.map +1 -1
- package/dist/index.es34.js +117 -6
- package/dist/index.es34.js.map +1 -1
- package/dist/index.es35.js +70 -8
- package/dist/index.es35.js.map +1 -1
- package/dist/index.es36.js +19 -148
- package/dist/index.es36.js.map +1 -1
- package/dist/index.es37.js +255 -112
- package/dist/index.es37.js.map +1 -1
- package/dist/index.es38.js +40 -68
- package/dist/index.es38.js.map +1 -1
- package/dist/index.es39.js +214 -17
- package/dist/index.es39.js.map +1 -1
- package/dist/index.es40.js +53 -247
- package/dist/index.es40.js.map +1 -1
- package/dist/index.es41.js +123 -24
- package/dist/index.es41.js.map +1 -1
- package/dist/index.es42.js +14 -205
- package/dist/index.es42.js.map +1 -1
- package/dist/index.es43.js +221 -58
- package/dist/index.es43.js.map +1 -1
- package/dist/index.es44.js +7 -140
- package/dist/index.es44.js.map +1 -1
- package/dist/index.es45.js +1185 -17
- package/dist/index.es45.js.map +1 -1
- package/dist/index.es46.js +6 -229
- package/dist/index.es46.js.map +1 -1
- package/dist/index.es47.js +146 -15
- package/dist/index.es47.js.map +1 -1
- package/dist/index.es49.js +7 -90
- package/dist/index.es49.js.map +1 -1
- package/dist/index.es50.js +92 -6
- package/dist/index.es50.js.map +1 -1
- package/dist/index.es51.js +3 -14
- package/dist/index.es51.js.map +1 -1
- package/dist/index.es52.js +36 -8
- package/dist/index.es52.js.map +1 -1
- package/dist/index.es53.js +61 -83
- package/dist/index.es53.js.map +1 -1
- package/dist/index.es54.js +37 -3
- package/dist/index.es54.js.map +1 -1
- package/dist/index.es55.js +304 -34
- package/dist/index.es55.js.map +1 -1
- package/dist/index.es56.js +9 -72
- package/dist/index.es56.js.map +1 -1
- package/dist/index.es57.js +85 -32
- package/dist/index.es57.js.map +1 -1
- package/dist/index.es58.js +6 -304
- package/dist/index.es58.js.map +1 -1
- package/dist/index.es59.js +15 -9
- package/dist/index.es59.js.map +1 -1
- package/dist/index.es60.js +142 -5
- package/dist/index.es60.js.map +1 -1
- package/dist/index.es61.js +285 -148
- package/dist/index.es61.js.map +1 -1
- package/dist/index.es62.js +62 -668
- package/dist/index.es62.js.map +1 -1
- package/dist/index.es63.js +201 -131
- package/dist/index.es63.js.map +1 -1
- package/dist/index.es64.js +29 -295
- package/dist/index.es64.js.map +1 -1
- package/dist/index.es65.js +8 -65
- package/dist/index.es65.js.map +1 -1
- package/dist/index.es66.js +9 -210
- package/dist/index.es66.js.map +1 -1
- package/dist/index.es67.js +181 -28
- package/dist/index.es67.js.map +1 -1
- package/dist/index.es68.js +23 -8
- package/dist/index.es68.js.map +1 -1
- package/dist/index.es69.js +1397 -9
- package/dist/index.es69.js.map +1 -1
- package/dist/index.es70.js +9 -187
- package/dist/index.es70.js.map +1 -1
- package/dist/index.es71.js +8 -24
- package/dist/index.es71.js.map +1 -1
- package/dist/index.es72.js +5 -1399
- package/dist/index.es72.js.map +1 -1
- package/dist/index.es73.js +163 -9
- package/dist/index.es73.js.map +1 -1
- package/dist/index.es74.js +672 -8
- package/dist/index.es74.js.map +1 -1
- package/dist/index.es75.js +11 -36
- package/dist/index.es75.js.map +1 -1
- package/dist/index.es76.js +40 -5
- package/dist/index.es76.js.map +1 -1
- package/dist/index.es77.js +32 -71
- package/dist/index.es77.js.map +1 -1
- package/dist/index.es78.js +225 -30
- package/dist/index.es78.js.map +1 -1
- package/dist/index.es79.js +29 -11
- package/dist/index.es79.js.map +1 -1
- package/dist/index.es80.js +72 -37
- package/dist/index.es80.js.map +1 -1
- package/dist/index.es81.js +74 -32
- package/dist/index.es81.js.map +1 -1
- package/dist/index.es82.js +46 -226
- package/dist/index.es82.js.map +1 -1
- package/dist/index.es83.js +6 -6
- package/dist/index.es83.js.map +1 -1
- package/dist/index.es84.js +39 -71
- package/dist/index.es84.js.map +1 -1
- package/dist/index.es85.js +54 -73
- package/dist/index.es85.js.map +1 -1
- package/dist/index.es86.js +13 -52
- package/dist/index.es86.js.map +1 -1
- package/dist/index.es87.js +135 -28
- package/dist/index.es87.js.map +1 -1
- package/dist/index.es88.js +20 -42
- package/dist/index.es88.js.map +1 -1
- package/dist/index.es89.js +175 -50
- package/dist/index.es89.js.map +1 -1
- package/dist/index.es90.js +240 -12
- package/dist/index.es90.js.map +1 -1
- package/dist/index.es91.js +348 -130
- package/dist/index.es91.js.map +1 -1
- package/dist/index.es92.js +134 -18
- package/dist/index.es92.js.map +1 -1
- package/dist/index.es93.js +62 -174
- package/dist/index.es93.js.map +1 -1
- package/dist/index.es94.js +30 -234
- package/dist/index.es94.js.map +1 -1
- package/dist/index.es95.js +26 -344
- package/dist/index.es95.js.map +1 -1
- package/dist/index.es96.js +156 -127
- package/dist/index.es96.js.map +1 -1
- package/dist/index.es97.js +196 -63
- package/dist/index.es97.js.map +1 -1
- package/dist/index.es98.js +14 -37
- package/dist/index.es98.js.map +1 -1
- package/dist/index.es99.js +27 -34
- package/dist/index.es99.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es91.js
CHANGED
|
@@ -1,140 +1,358 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./index.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { AIMessageChunk } from "./index.es39.js";
|
|
2
|
+
import { BaseTracer } from "./index.es116.js";
|
|
3
|
+
import { IterableReadableStream } from "./index.es89.js";
|
|
4
|
+
import { GenerationChunk } from "./index.es117.js";
|
|
5
|
+
function assignName({ name, serialized }) {
|
|
6
|
+
if (name !== void 0) return name;
|
|
7
|
+
if (serialized?.name !== void 0) return serialized.name;
|
|
8
|
+
else if (serialized?.id !== void 0 && Array.isArray(serialized?.id)) return serialized.id[serialized.id.length - 1];
|
|
9
|
+
return "Unnamed";
|
|
7
10
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
11
|
+
const isStreamEventsHandler = (handler) => handler.name === "event_stream_tracer";
|
|
12
|
+
var EventStreamCallbackHandler = class extends BaseTracer {
|
|
13
|
+
autoClose = true;
|
|
14
|
+
includeNames;
|
|
15
|
+
includeTypes;
|
|
16
|
+
includeTags;
|
|
17
|
+
excludeNames;
|
|
18
|
+
excludeTypes;
|
|
19
|
+
excludeTags;
|
|
20
|
+
runInfoMap = /* @__PURE__ */ new Map();
|
|
21
|
+
tappedPromises = /* @__PURE__ */ new Map();
|
|
22
|
+
transformStream;
|
|
23
|
+
writer;
|
|
24
|
+
receiveStream;
|
|
25
|
+
readableStreamClosed = false;
|
|
26
|
+
name = "event_stream_tracer";
|
|
27
|
+
lc_prefer_streaming = true;
|
|
28
|
+
constructor(fields) {
|
|
29
|
+
super({
|
|
30
|
+
_awaitHandler: true,
|
|
31
|
+
...fields
|
|
32
|
+
});
|
|
33
|
+
this.autoClose = fields?.autoClose ?? true;
|
|
34
|
+
this.includeNames = fields?.includeNames;
|
|
35
|
+
this.includeTypes = fields?.includeTypes;
|
|
36
|
+
this.includeTags = fields?.includeTags;
|
|
37
|
+
this.excludeNames = fields?.excludeNames;
|
|
38
|
+
this.excludeTypes = fields?.excludeTypes;
|
|
39
|
+
this.excludeTags = fields?.excludeTags;
|
|
40
|
+
this.transformStream = new TransformStream({ flush: () => {
|
|
41
|
+
this.readableStreamClosed = true;
|
|
42
|
+
} });
|
|
43
|
+
this.writer = this.transformStream.writable.getWriter();
|
|
44
|
+
this.receiveStream = IterableReadableStream.fromReadableStream(this.transformStream.readable);
|
|
45
|
+
}
|
|
46
|
+
[Symbol.asyncIterator]() {
|
|
47
|
+
return this.receiveStream;
|
|
48
|
+
}
|
|
49
|
+
async persistRun(_run) {
|
|
50
|
+
}
|
|
51
|
+
_includeRun(run) {
|
|
52
|
+
const runTags = run.tags ?? [];
|
|
53
|
+
let include = this.includeNames === void 0 && this.includeTags === void 0 && this.includeTypes === void 0;
|
|
54
|
+
if (this.includeNames !== void 0) include = include || this.includeNames.includes(run.name);
|
|
55
|
+
if (this.includeTypes !== void 0) include = include || this.includeTypes.includes(run.runType);
|
|
56
|
+
if (this.includeTags !== void 0) include = include || runTags.find((tag) => this.includeTags?.includes(tag)) !== void 0;
|
|
57
|
+
if (this.excludeNames !== void 0) include = include && !this.excludeNames.includes(run.name);
|
|
58
|
+
if (this.excludeTypes !== void 0) include = include && !this.excludeTypes.includes(run.runType);
|
|
59
|
+
if (this.excludeTags !== void 0) include = include && runTags.every((tag) => !this.excludeTags?.includes(tag));
|
|
60
|
+
return include;
|
|
61
|
+
}
|
|
62
|
+
async *tapOutputIterable(runId, outputStream) {
|
|
63
|
+
const firstChunk = await outputStream.next();
|
|
64
|
+
if (firstChunk.done) return;
|
|
65
|
+
const runInfo = this.runInfoMap.get(runId);
|
|
66
|
+
if (runInfo === void 0) {
|
|
67
|
+
yield firstChunk.value;
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
function _formatOutputChunk(eventType, data) {
|
|
71
|
+
if (eventType === "llm" && typeof data === "string") return new GenerationChunk({ text: data });
|
|
72
|
+
return data;
|
|
37
73
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
74
|
+
let tappedPromise = this.tappedPromises.get(runId);
|
|
75
|
+
if (tappedPromise === void 0) {
|
|
76
|
+
let tappedPromiseResolver;
|
|
77
|
+
tappedPromise = new Promise((resolve) => {
|
|
78
|
+
tappedPromiseResolver = resolve;
|
|
79
|
+
});
|
|
80
|
+
this.tappedPromises.set(runId, tappedPromise);
|
|
81
|
+
try {
|
|
82
|
+
const event = {
|
|
83
|
+
event: `on_${runInfo.runType}_stream`,
|
|
84
|
+
run_id: runId,
|
|
85
|
+
name: runInfo.name,
|
|
86
|
+
tags: runInfo.tags,
|
|
87
|
+
metadata: runInfo.metadata,
|
|
88
|
+
data: {}
|
|
89
|
+
};
|
|
90
|
+
await this.send({
|
|
91
|
+
...event,
|
|
92
|
+
data: { chunk: _formatOutputChunk(runInfo.runType, firstChunk.value) }
|
|
93
|
+
}, runInfo);
|
|
94
|
+
yield firstChunk.value;
|
|
95
|
+
for await (const chunk of outputStream) {
|
|
96
|
+
if (runInfo.runType !== "tool" && runInfo.runType !== "retriever") await this.send({
|
|
97
|
+
...event,
|
|
98
|
+
data: { chunk: _formatOutputChunk(runInfo.runType, chunk) }
|
|
99
|
+
}, runInfo);
|
|
100
|
+
yield chunk;
|
|
101
|
+
}
|
|
102
|
+
} finally {
|
|
103
|
+
tappedPromiseResolver?.();
|
|
51
104
|
}
|
|
105
|
+
} else {
|
|
106
|
+
yield firstChunk.value;
|
|
107
|
+
for await (const chunk of outputStream) yield chunk;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async send(payload, run) {
|
|
111
|
+
if (this.readableStreamClosed) return;
|
|
112
|
+
if (this._includeRun(run)) await this.writer.write(payload);
|
|
113
|
+
}
|
|
114
|
+
async sendEndEvent(payload, run) {
|
|
115
|
+
const tappedPromise = this.tappedPromises.get(payload.run_id);
|
|
116
|
+
if (tappedPromise !== void 0) tappedPromise.then(() => {
|
|
117
|
+
this.send(payload, run);
|
|
52
118
|
});
|
|
53
|
-
|
|
54
|
-
const typedKey = key;
|
|
55
|
-
copy[typedKey] = options[typedKey] ?? copy[typedKey];
|
|
119
|
+
else await this.send(payload, run);
|
|
56
120
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
121
|
+
async onLLMStart(run) {
|
|
122
|
+
const runName = assignName(run);
|
|
123
|
+
const runType = run.inputs.messages !== void 0 ? "chat_model" : "llm";
|
|
124
|
+
const runInfo = {
|
|
125
|
+
tags: run.tags ?? [],
|
|
126
|
+
metadata: run.extra?.metadata ?? {},
|
|
127
|
+
name: runName,
|
|
128
|
+
runType,
|
|
129
|
+
inputs: run.inputs
|
|
130
|
+
};
|
|
131
|
+
this.runInfoMap.set(run.id, runInfo);
|
|
132
|
+
const eventName = `on_${runType}_start`;
|
|
133
|
+
await this.send({
|
|
134
|
+
event: eventName,
|
|
135
|
+
data: { input: run.inputs },
|
|
136
|
+
name: runName,
|
|
137
|
+
tags: run.tags ?? [],
|
|
138
|
+
run_id: run.id,
|
|
139
|
+
metadata: run.extra?.metadata ?? {}
|
|
140
|
+
}, runInfo);
|
|
141
|
+
}
|
|
142
|
+
async onLLMNewToken(run, token, kwargs) {
|
|
143
|
+
const runInfo = this.runInfoMap.get(run.id);
|
|
144
|
+
let chunk;
|
|
145
|
+
let eventName;
|
|
146
|
+
if (runInfo === void 0) throw new Error(`onLLMNewToken: Run ID ${run.id} not found in run map.`);
|
|
147
|
+
if (this.runInfoMap.size === 1) return;
|
|
148
|
+
if (runInfo.runType === "chat_model") {
|
|
149
|
+
eventName = "on_chat_model_stream";
|
|
150
|
+
if (kwargs?.chunk === void 0) chunk = new AIMessageChunk({
|
|
151
|
+
content: token,
|
|
152
|
+
id: `run-${run.id}`
|
|
153
|
+
});
|
|
154
|
+
else chunk = kwargs.chunk.message;
|
|
155
|
+
} else if (runInfo.runType === "llm") {
|
|
156
|
+
eventName = "on_llm_stream";
|
|
157
|
+
if (kwargs?.chunk === void 0) chunk = new GenerationChunk({ text: token });
|
|
158
|
+
else chunk = kwargs.chunk;
|
|
159
|
+
} else throw new Error(`Unexpected run type ${runInfo.runType}`);
|
|
160
|
+
await this.send({
|
|
161
|
+
event: eventName,
|
|
162
|
+
data: { chunk },
|
|
163
|
+
run_id: run.id,
|
|
164
|
+
name: runInfo.name,
|
|
165
|
+
tags: runInfo.tags,
|
|
166
|
+
metadata: runInfo.metadata
|
|
167
|
+
}, runInfo);
|
|
168
|
+
}
|
|
169
|
+
async onLLMEnd(run) {
|
|
170
|
+
const runInfo = this.runInfoMap.get(run.id);
|
|
171
|
+
this.runInfoMap.delete(run.id);
|
|
172
|
+
let eventName;
|
|
173
|
+
if (runInfo === void 0) throw new Error(`onLLMEnd: Run ID ${run.id} not found in run map.`);
|
|
174
|
+
const generations = run.outputs?.generations;
|
|
175
|
+
let output;
|
|
176
|
+
if (runInfo.runType === "chat_model") {
|
|
177
|
+
for (const generation of generations ?? []) {
|
|
178
|
+
if (output !== void 0) break;
|
|
179
|
+
output = generation[0]?.message;
|
|
180
|
+
}
|
|
181
|
+
eventName = "on_chat_model_end";
|
|
182
|
+
} else if (runInfo.runType === "llm") {
|
|
183
|
+
output = {
|
|
184
|
+
generations: generations?.map((generation) => {
|
|
185
|
+
return generation.map((chunk) => {
|
|
186
|
+
return {
|
|
187
|
+
text: chunk.text,
|
|
188
|
+
generationInfo: chunk.generationInfo
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
}),
|
|
192
|
+
llmOutput: run.outputs?.llmOutput ?? {}
|
|
193
|
+
};
|
|
194
|
+
eventName = "on_llm_end";
|
|
195
|
+
} else throw new Error(`onLLMEnd: Unexpected run type: ${runInfo.runType}`);
|
|
196
|
+
await this.sendEndEvent({
|
|
197
|
+
event: eventName,
|
|
198
|
+
data: {
|
|
199
|
+
output,
|
|
200
|
+
input: runInfo.inputs
|
|
201
|
+
},
|
|
202
|
+
run_id: run.id,
|
|
203
|
+
name: runInfo.name,
|
|
204
|
+
tags: runInfo.tags,
|
|
205
|
+
metadata: runInfo.metadata
|
|
206
|
+
}, runInfo);
|
|
207
|
+
}
|
|
208
|
+
async onChainStart(run) {
|
|
209
|
+
const runName = assignName(run);
|
|
210
|
+
const runType = run.run_type ?? "chain";
|
|
211
|
+
const runInfo = {
|
|
212
|
+
tags: run.tags ?? [],
|
|
213
|
+
metadata: run.extra?.metadata ?? {},
|
|
214
|
+
name: runName,
|
|
215
|
+
runType: run.run_type
|
|
216
|
+
};
|
|
217
|
+
let eventData = {};
|
|
218
|
+
if (run.inputs.input === "" && Object.keys(run.inputs).length === 1) {
|
|
219
|
+
eventData = {};
|
|
220
|
+
runInfo.inputs = {};
|
|
221
|
+
} else if (run.inputs.input !== void 0) {
|
|
222
|
+
eventData.input = run.inputs.input;
|
|
223
|
+
runInfo.inputs = run.inputs.input;
|
|
224
|
+
} else {
|
|
225
|
+
eventData.input = run.inputs;
|
|
226
|
+
runInfo.inputs = run.inputs;
|
|
87
227
|
}
|
|
228
|
+
this.runInfoMap.set(run.id, runInfo);
|
|
229
|
+
await this.send({
|
|
230
|
+
event: `on_${runType}_start`,
|
|
231
|
+
data: eventData,
|
|
232
|
+
name: runName,
|
|
233
|
+
tags: run.tags ?? [],
|
|
234
|
+
run_id: run.id,
|
|
235
|
+
metadata: run.extra?.metadata ?? {}
|
|
236
|
+
}, runInfo);
|
|
88
237
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
238
|
+
async onChainEnd(run) {
|
|
239
|
+
const runInfo = this.runInfoMap.get(run.id);
|
|
240
|
+
this.runInfoMap.delete(run.id);
|
|
241
|
+
if (runInfo === void 0) throw new Error(`onChainEnd: Run ID ${run.id} not found in run map.`);
|
|
242
|
+
const eventName = `on_${run.run_type}_end`;
|
|
243
|
+
const inputs = run.inputs ?? runInfo.inputs ?? {};
|
|
244
|
+
const outputs = run.outputs?.output ?? run.outputs;
|
|
245
|
+
const data = {
|
|
246
|
+
output: outputs,
|
|
247
|
+
input: inputs
|
|
248
|
+
};
|
|
249
|
+
if (inputs.input && Object.keys(inputs).length === 1) {
|
|
250
|
+
data.input = inputs.input;
|
|
251
|
+
runInfo.inputs = inputs.input;
|
|
252
|
+
}
|
|
253
|
+
await this.sendEndEvent({
|
|
254
|
+
event: eventName,
|
|
255
|
+
data,
|
|
256
|
+
run_id: run.id,
|
|
257
|
+
name: runInfo.name,
|
|
258
|
+
tags: runInfo.tags,
|
|
259
|
+
metadata: runInfo.metadata ?? {}
|
|
260
|
+
}, runInfo);
|
|
261
|
+
}
|
|
262
|
+
async onToolStart(run) {
|
|
263
|
+
const runName = assignName(run);
|
|
264
|
+
const runInfo = {
|
|
265
|
+
tags: run.tags ?? [],
|
|
266
|
+
metadata: run.extra?.metadata ?? {},
|
|
267
|
+
name: runName,
|
|
268
|
+
runType: "tool",
|
|
269
|
+
inputs: run.inputs ?? {}
|
|
270
|
+
};
|
|
271
|
+
this.runInfoMap.set(run.id, runInfo);
|
|
272
|
+
await this.send({
|
|
273
|
+
event: "on_tool_start",
|
|
274
|
+
data: { input: run.inputs ?? {} },
|
|
275
|
+
name: runName,
|
|
276
|
+
run_id: run.id,
|
|
277
|
+
tags: run.tags ?? [],
|
|
278
|
+
metadata: run.extra?.metadata ?? {}
|
|
279
|
+
}, runInfo);
|
|
280
|
+
}
|
|
281
|
+
async onToolEnd(run) {
|
|
282
|
+
const runInfo = this.runInfoMap.get(run.id);
|
|
283
|
+
this.runInfoMap.delete(run.id);
|
|
284
|
+
if (runInfo === void 0) throw new Error(`onToolEnd: Run ID ${run.id} not found in run map.`);
|
|
285
|
+
if (runInfo.inputs === void 0) throw new Error(`onToolEnd: Run ID ${run.id} is a tool call, and is expected to have traced inputs.`);
|
|
286
|
+
const output = run.outputs?.output === void 0 ? run.outputs : run.outputs.output;
|
|
287
|
+
await this.sendEndEvent({
|
|
288
|
+
event: "on_tool_end",
|
|
289
|
+
data: {
|
|
290
|
+
output,
|
|
291
|
+
input: runInfo.inputs
|
|
292
|
+
},
|
|
293
|
+
run_id: run.id,
|
|
294
|
+
name: runInfo.name,
|
|
295
|
+
tags: runInfo.tags,
|
|
296
|
+
metadata: runInfo.metadata
|
|
297
|
+
}, runInfo);
|
|
298
|
+
}
|
|
299
|
+
async onRetrieverStart(run) {
|
|
300
|
+
const runName = assignName(run);
|
|
301
|
+
const runType = "retriever";
|
|
302
|
+
const runInfo = {
|
|
303
|
+
tags: run.tags ?? [],
|
|
304
|
+
metadata: run.extra?.metadata ?? {},
|
|
305
|
+
name: runName,
|
|
306
|
+
runType,
|
|
307
|
+
inputs: { query: run.inputs.query }
|
|
308
|
+
};
|
|
309
|
+
this.runInfoMap.set(run.id, runInfo);
|
|
310
|
+
await this.send({
|
|
311
|
+
event: "on_retriever_start",
|
|
312
|
+
data: { input: { query: run.inputs.query } },
|
|
313
|
+
name: runName,
|
|
314
|
+
tags: run.tags ?? [],
|
|
315
|
+
run_id: run.id,
|
|
316
|
+
metadata: run.extra?.metadata ?? {}
|
|
317
|
+
}, runInfo);
|
|
318
|
+
}
|
|
319
|
+
async onRetrieverEnd(run) {
|
|
320
|
+
const runInfo = this.runInfoMap.get(run.id);
|
|
321
|
+
this.runInfoMap.delete(run.id);
|
|
322
|
+
if (runInfo === void 0) throw new Error(`onRetrieverEnd: Run ID ${run.id} not found in run map.`);
|
|
323
|
+
await this.sendEndEvent({
|
|
324
|
+
event: "on_retriever_end",
|
|
325
|
+
data: {
|
|
326
|
+
output: run.outputs?.documents ?? run.outputs,
|
|
327
|
+
input: runInfo.inputs
|
|
328
|
+
},
|
|
329
|
+
run_id: run.id,
|
|
330
|
+
name: runInfo.name,
|
|
331
|
+
tags: runInfo.tags,
|
|
332
|
+
metadata: runInfo.metadata
|
|
333
|
+
}, runInfo);
|
|
334
|
+
}
|
|
335
|
+
async handleCustomEvent(eventName, data, runId) {
|
|
336
|
+
const runInfo = this.runInfoMap.get(runId);
|
|
337
|
+
if (runInfo === void 0) throw new Error(`handleCustomEvent: Run ID ${runId} not found in run map.`);
|
|
338
|
+
await this.send({
|
|
339
|
+
event: "on_custom_event",
|
|
340
|
+
run_id: runId,
|
|
341
|
+
name: eventName,
|
|
342
|
+
tags: runInfo.tags,
|
|
343
|
+
metadata: runInfo.metadata,
|
|
344
|
+
data
|
|
345
|
+
}, runInfo);
|
|
346
|
+
}
|
|
347
|
+
async finish() {
|
|
348
|
+
const pendingPromises = [...this.tappedPromises.values()];
|
|
349
|
+
Promise.all(pendingPromises).finally(() => {
|
|
350
|
+
this.writer.close();
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
};
|
|
132
354
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
getCallbackManagerForConfig,
|
|
136
|
-
mergeConfigs,
|
|
137
|
-
patchConfig,
|
|
138
|
-
pickRunnableConfigKeys
|
|
355
|
+
EventStreamCallbackHandler,
|
|
356
|
+
isStreamEventsHandler
|
|
139
357
|
};
|
|
140
358
|
//# sourceMappingURL=index.es91.js.map
|
package/dist/index.es91.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es91.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/runnables/config.js"],"sourcesContent":["import { CallbackManager, ensureHandler } from \"../callbacks/manager.js\";\nimport { AsyncLocalStorageProviderSingleton } from \"../singletons/async_local_storage/index.js\";\nimport \"../singletons/index.js\";\n\n//#region src/runnables/config.ts\nconst DEFAULT_RECURSION_LIMIT = 25;\nasync function getCallbackManagerForConfig(config) {\n\treturn CallbackManager._configureSync(config?.callbacks, void 0, config?.tags, void 0, config?.metadata);\n}\nfunction mergeConfigs(...configs) {\n\tconst copy = {};\n\tfor (const options of configs.filter((c) => !!c)) for (const key of Object.keys(options)) if (key === \"metadata\") copy[key] = {\n\t\t...copy[key],\n\t\t...options[key]\n\t};\n\telse if (key === \"tags\") {\n\t\tconst baseKeys = copy[key] ?? [];\n\t\tcopy[key] = [...new Set(baseKeys.concat(options[key] ?? []))];\n\t} else if (key === \"configurable\") copy[key] = {\n\t\t...copy[key],\n\t\t...options[key]\n\t};\n\telse if (key === \"timeout\") {\n\t\tif (copy.timeout === void 0) copy.timeout = options.timeout;\n\t\telse if (options.timeout !== void 0) copy.timeout = Math.min(copy.timeout, options.timeout);\n\t} else if (key === \"signal\") {\n\t\tif (copy.signal === void 0) copy.signal = options.signal;\n\t\telse if (options.signal !== void 0) if (\"any\" in AbortSignal) copy.signal = AbortSignal.any([copy.signal, options.signal]);\n\t\telse copy.signal = options.signal;\n\t} else if (key === \"callbacks\") {\n\t\tconst baseCallbacks = copy.callbacks;\n\t\tconst providedCallbacks = options.callbacks;\n\t\tif (Array.isArray(providedCallbacks)) if (!baseCallbacks) copy.callbacks = providedCallbacks;\n\t\telse if (Array.isArray(baseCallbacks)) copy.callbacks = baseCallbacks.concat(providedCallbacks);\n\t\telse {\n\t\t\tconst manager = baseCallbacks.copy();\n\t\t\tfor (const callback of providedCallbacks) manager.addHandler(ensureHandler(callback), true);\n\t\t\tcopy.callbacks = manager;\n\t\t}\n\t\telse if (providedCallbacks) if (!baseCallbacks) copy.callbacks = providedCallbacks;\n\t\telse if (Array.isArray(baseCallbacks)) {\n\t\t\tconst manager = providedCallbacks.copy();\n\t\t\tfor (const callback of baseCallbacks) manager.addHandler(ensureHandler(callback), true);\n\t\t\tcopy.callbacks = manager;\n\t\t} else copy.callbacks = new CallbackManager(providedCallbacks._parentRunId, {\n\t\t\thandlers: baseCallbacks.handlers.concat(providedCallbacks.handlers),\n\t\t\tinheritableHandlers: baseCallbacks.inheritableHandlers.concat(providedCallbacks.inheritableHandlers),\n\t\t\ttags: Array.from(new Set(baseCallbacks.tags.concat(providedCallbacks.tags))),\n\t\t\tinheritableTags: Array.from(new Set(baseCallbacks.inheritableTags.concat(providedCallbacks.inheritableTags))),\n\t\t\tmetadata: {\n\t\t\t\t...baseCallbacks.metadata,\n\t\t\t\t...providedCallbacks.metadata\n\t\t\t}\n\t\t});\n\t} else {\n\t\tconst typedKey = key;\n\t\tcopy[typedKey] = options[typedKey] ?? copy[typedKey];\n\t}\n\treturn copy;\n}\nconst PRIMITIVES = new Set([\n\t\"string\",\n\t\"number\",\n\t\"boolean\"\n]);\n/**\n* Ensure that a passed config is an object with all required keys present.\n*/\nfunction ensureConfig(config) {\n\tconst implicitConfig = AsyncLocalStorageProviderSingleton.getRunnableConfig();\n\tlet empty = {\n\t\ttags: [],\n\t\tmetadata: {},\n\t\trecursionLimit: 25,\n\t\trunId: void 0\n\t};\n\tif (implicitConfig) {\n\t\tconst { runId, runName,...rest } = implicitConfig;\n\t\tempty = Object.entries(rest).reduce((currentConfig, [key, value]) => {\n\t\t\tif (value !== void 0) currentConfig[key] = value;\n\t\t\treturn currentConfig;\n\t\t}, empty);\n\t}\n\tif (config) empty = Object.entries(config).reduce((currentConfig, [key, value]) => {\n\t\tif (value !== void 0) currentConfig[key] = value;\n\t\treturn currentConfig;\n\t}, empty);\n\tif (empty?.configurable) {\n\t\tfor (const key of Object.keys(empty.configurable)) if (PRIMITIVES.has(typeof empty.configurable[key]) && !empty.metadata?.[key]) {\n\t\t\tif (!empty.metadata) empty.metadata = {};\n\t\t\tempty.metadata[key] = empty.configurable[key];\n\t\t}\n\t}\n\tif (empty.timeout !== void 0) {\n\t\tif (empty.timeout <= 0) throw new Error(\"Timeout must be a positive number\");\n\t\tconst originalTimeoutMs = empty.timeout;\n\t\tconst timeoutSignal = AbortSignal.timeout(originalTimeoutMs);\n\t\tif (!empty.metadata) empty.metadata = {};\n\t\tif (empty.metadata.timeoutMs === void 0) empty.metadata.timeoutMs = originalTimeoutMs;\n\t\tif (empty.signal !== void 0) {\n\t\t\tif (\"any\" in AbortSignal) empty.signal = AbortSignal.any([empty.signal, timeoutSignal]);\n\t\t} else empty.signal = timeoutSignal;\n\t\t/**\n\t\t* We are deleting the timeout key for the following reasons:\n\t\t* - Idempotent normalization: ensureConfig may be called multiple times down the stack. If timeout remains,\n\t\t* each call would synthesize new timeout signals and combine them, changing the effective timeout unpredictably.\n\t\t* - Single enforcement path: downstream code relies on signal to enforce cancellation. Leaving timeout means two\n\t\t* competing mechanisms (numeric timeout and signal) can be applied, sometimes with different semantics.\n\t\t* - Propagation to children: pickRunnableConfigKeys would keep forwarding timeout to nested runnables, causing\n\t\t* repeated re-normalization and stacked timeouts.\n\t\t* - Backward compatibility: a lot of components and tests assume ensureConfig removes timeout post-normalization;\n\t\t* changing that would be a breaking change.\n\t\t*/\n\t\tdelete empty.timeout;\n\t}\n\treturn empty;\n}\n/**\n* Helper function that patches runnable configs with updated properties.\n*/\nfunction patchConfig(config = {}, { callbacks, maxConcurrency, recursionLimit, runName, configurable, runId } = {}) {\n\tconst newConfig = ensureConfig(config);\n\tif (callbacks !== void 0) {\n\t\t/**\n\t\t* If we're replacing callbacks we need to unset runName\n\t\t* since that should apply only to the same run as the original callbacks\n\t\t*/\n\t\tdelete newConfig.runName;\n\t\tnewConfig.callbacks = callbacks;\n\t}\n\tif (recursionLimit !== void 0) newConfig.recursionLimit = recursionLimit;\n\tif (maxConcurrency !== void 0) newConfig.maxConcurrency = maxConcurrency;\n\tif (runName !== void 0) newConfig.runName = runName;\n\tif (configurable !== void 0) newConfig.configurable = {\n\t\t...newConfig.configurable,\n\t\t...configurable\n\t};\n\tif (runId !== void 0) delete newConfig.runId;\n\treturn newConfig;\n}\nfunction pickRunnableConfigKeys(config) {\n\tif (!config) return void 0;\n\treturn {\n\t\tconfigurable: config.configurable,\n\t\trecursionLimit: config.recursionLimit,\n\t\tcallbacks: config.callbacks,\n\t\ttags: config.tags,\n\t\tmetadata: config.metadata,\n\t\tmaxConcurrency: config.maxConcurrency,\n\t\ttimeout: config.timeout,\n\t\tsignal: config.signal,\n\t\tstore: config.store\n\t};\n}\n\n//#endregion\nexport { DEFAULT_RECURSION_LIMIT, ensureConfig, getCallbackManagerForConfig, mergeConfigs, patchConfig, pickRunnableConfigKeys };\n//# sourceMappingURL=config.js.map"],"names":[],"mappings":";;;AAKK,MAAC,0BAA0B;AAChC,eAAe,4BAA4B,QAAQ;AAClD,SAAO,gBAAgB,eAAe,QAAQ,WAAW,QAAQ,QAAQ,MAAM,QAAQ,QAAQ,QAAQ;AACxG;AACA,SAAS,gBAAgB,SAAS;AACjC,QAAM,OAAO,CAAA;AACb,aAAW,WAAW,QAAQ,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAG,YAAW,OAAO,OAAO,KAAK,OAAO,EAAG,KAAI,QAAQ,WAAY,MAAK,GAAG,IAAI;AAAA,IAC7H,GAAG,KAAK,GAAG;AAAA,IACX,GAAG,QAAQ,GAAG;AAAA,EAChB;AAAA,WACU,QAAQ,QAAQ;AACxB,UAAM,WAAW,KAAK,GAAG,KAAK,CAAA;AAC9B,SAAK,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,SAAS,OAAO,QAAQ,GAAG,KAAK,CAAA,CAAE,CAAC,CAAC;AAAA,EAC7D,WAAW,QAAQ,eAAgB,MAAK,GAAG,IAAI;AAAA,IAC9C,GAAG,KAAK,GAAG;AAAA,IACX,GAAG,QAAQ,GAAG;AAAA,EAChB;AAAA,WACU,QAAQ,WAAW;AAC3B,QAAI,KAAK,YAAY,OAAQ,MAAK,UAAU,QAAQ;AAAA,aAC3C,QAAQ,YAAY,OAAQ,MAAK,UAAU,KAAK,IAAI,KAAK,SAAS,QAAQ,OA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;AAC3D,QAAI,CAAC,MAAM,SAAU,OAAM,WAAW,CAAA;AACtC,QAAI,MAAM,SAAS,cAAc,OAAQ,OAAM,SAAS,YAAY;AACpE,QAAI,MAAM,WAAW,QAAQ;AAC5B,UAAI,SAAS,YAAa,OAAM,SAAS,YAAY,IAAI,CAAC,MAAM,QAAQ,aAAa,CAAC;AAAA,IACvF,MAAO,OAAM,SAAS;AAYtB,WAAO,MAAM;AAAA,EACd;AACA,SAAO;AACR;AAIA,SAAS,YAAY,SAAS,IAAI,EAAE,WAAW,gBAAgB,gBAAgB,SAAS,cAAc,MAAK,IAAK,CAAA,GAAI;AACnH,QAAM,YAAY,aAAa,MAAM;AACrC,MAAI,cAAc,QAAQ;AAKzB,WAAO,UAAU;AACjB,cAAU,YAAY;AAAA,EACvB;AACA,MAAI,mBAAmB,OAAQ,WAAU,iBAAiB;AAC1D,MAAI,mBAAmB,OAAQ,WAAU,iBAAiB;AAC1D,MAAI,YAAY,OAAQ,WAAU,UAAU;AAC5C,MAAI,iBAAiB,OAAQ,WAAU,eAAe;AAAA,IACrD,GAAG,UAAU;AAAA,IACb,GAAG;AAAA,EACL;AACC,MAAI,UAAU,OAAQ,QAAO,UAAU;AACvC,SAAO;AACR;AACA,SAAS,uBAAuB,QAAQ;AACvC,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO;AAAA,IACN,cAAc,OAAO;AAAA,IACrB,gBAAgB,OAAO;AAAA,IACvB,WAAW,OAAO;AAAA,IAClB,MAAM,OAAO;AAAA,IACb,UAAU,OAAO;AAAA,IACjB,gBAAgB,OAAO;AAAA,IACvB,SAAS,OAAO;AAAA,IAChB,QAAQ,OAAO;AAAA,IACf,OAAO,OAAO;AAAA,EAChB;AACA;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.es91.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/tracers/event_stream.js"],"sourcesContent":["import { AIMessageChunk } from \"../messages/ai.js\";\nimport { BaseTracer } from \"./base.js\";\nimport { IterableReadableStream } from \"../utils/stream.js\";\nimport { GenerationChunk } from \"../outputs.js\";\n\n//#region src/tracers/event_stream.ts\nfunction assignName({ name, serialized }) {\n\tif (name !== void 0) return name;\n\tif (serialized?.name !== void 0) return serialized.name;\n\telse if (serialized?.id !== void 0 && Array.isArray(serialized?.id)) return serialized.id[serialized.id.length - 1];\n\treturn \"Unnamed\";\n}\nconst isStreamEventsHandler = (handler) => handler.name === \"event_stream_tracer\";\n/**\n* Class that extends the `BaseTracer` class from the\n* `langchain.callbacks.tracers.base` module. It represents a callback\n* handler that logs the execution of runs and emits `RunLog` instances to a\n* `RunLogStream`.\n*/\nvar EventStreamCallbackHandler = class extends BaseTracer {\n\tautoClose = true;\n\tincludeNames;\n\tincludeTypes;\n\tincludeTags;\n\texcludeNames;\n\texcludeTypes;\n\texcludeTags;\n\trunInfoMap = /* @__PURE__ */ new Map();\n\ttappedPromises = /* @__PURE__ */ new Map();\n\ttransformStream;\n\twriter;\n\treceiveStream;\n\treadableStreamClosed = false;\n\tname = \"event_stream_tracer\";\n\tlc_prefer_streaming = true;\n\tconstructor(fields) {\n\t\tsuper({\n\t\t\t_awaitHandler: true,\n\t\t\t...fields\n\t\t});\n\t\tthis.autoClose = fields?.autoClose ?? true;\n\t\tthis.includeNames = fields?.includeNames;\n\t\tthis.includeTypes = fields?.includeTypes;\n\t\tthis.includeTags = fields?.includeTags;\n\t\tthis.excludeNames = fields?.excludeNames;\n\t\tthis.excludeTypes = fields?.excludeTypes;\n\t\tthis.excludeTags = fields?.excludeTags;\n\t\tthis.transformStream = new TransformStream({ flush: () => {\n\t\t\tthis.readableStreamClosed = true;\n\t\t} });\n\t\tthis.writer = this.transformStream.writable.getWriter();\n\t\tthis.receiveStream = IterableReadableStream.fromReadableStream(this.transformStream.readable);\n\t}\n\t[Symbol.asyncIterator]() {\n\t\treturn this.receiveStream;\n\t}\n\tasync persistRun(_run) {}\n\t_includeRun(run) {\n\t\tconst runTags = run.tags ?? [];\n\t\tlet include = this.includeNames === void 0 && this.includeTags === void 0 && this.includeTypes === void 0;\n\t\tif (this.includeNames !== void 0) include = include || this.includeNames.includes(run.name);\n\t\tif (this.includeTypes !== void 0) include = include || this.includeTypes.includes(run.runType);\n\t\tif (this.includeTags !== void 0) include = include || runTags.find((tag) => this.includeTags?.includes(tag)) !== void 0;\n\t\tif (this.excludeNames !== void 0) include = include && !this.excludeNames.includes(run.name);\n\t\tif (this.excludeTypes !== void 0) include = include && !this.excludeTypes.includes(run.runType);\n\t\tif (this.excludeTags !== void 0) include = include && runTags.every((tag) => !this.excludeTags?.includes(tag));\n\t\treturn include;\n\t}\n\tasync *tapOutputIterable(runId, outputStream) {\n\t\tconst firstChunk = await outputStream.next();\n\t\tif (firstChunk.done) return;\n\t\tconst runInfo = this.runInfoMap.get(runId);\n\t\tif (runInfo === void 0) {\n\t\t\tyield firstChunk.value;\n\t\t\treturn;\n\t\t}\n\t\tfunction _formatOutputChunk(eventType, data) {\n\t\t\tif (eventType === \"llm\" && typeof data === \"string\") return new GenerationChunk({ text: data });\n\t\t\treturn data;\n\t\t}\n\t\tlet tappedPromise = this.tappedPromises.get(runId);\n\t\tif (tappedPromise === void 0) {\n\t\t\tlet tappedPromiseResolver;\n\t\t\ttappedPromise = new Promise((resolve) => {\n\t\t\t\ttappedPromiseResolver = resolve;\n\t\t\t});\n\t\t\tthis.tappedPromises.set(runId, tappedPromise);\n\t\t\ttry {\n\t\t\t\tconst event = {\n\t\t\t\t\tevent: `on_${runInfo.runType}_stream`,\n\t\t\t\t\trun_id: runId,\n\t\t\t\t\tname: runInfo.name,\n\t\t\t\t\ttags: runInfo.tags,\n\t\t\t\t\tmetadata: runInfo.metadata,\n\t\t\t\t\tdata: {}\n\t\t\t\t};\n\t\t\t\tawait this.send({\n\t\t\t\t\t...event,\n\t\t\t\t\tdata: { chunk: _formatOutputChunk(runInfo.runType, firstChunk.value) }\n\t\t\t\t}, runInfo);\n\t\t\t\tyield firstChunk.value;\n\t\t\t\tfor await (const chunk of outputStream) {\n\t\t\t\t\tif (runInfo.runType !== \"tool\" && runInfo.runType !== \"retriever\") await this.send({\n\t\t\t\t\t\t...event,\n\t\t\t\t\t\tdata: { chunk: _formatOutputChunk(runInfo.runType, chunk) }\n\t\t\t\t\t}, runInfo);\n\t\t\t\t\tyield chunk;\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\ttappedPromiseResolver?.();\n\t\t\t}\n\t\t} else {\n\t\t\tyield firstChunk.value;\n\t\t\tfor await (const chunk of outputStream) yield chunk;\n\t\t}\n\t}\n\tasync send(payload, run) {\n\t\tif (this.readableStreamClosed) return;\n\t\tif (this._includeRun(run)) await this.writer.write(payload);\n\t}\n\tasync sendEndEvent(payload, run) {\n\t\tconst tappedPromise = this.tappedPromises.get(payload.run_id);\n\t\tif (tappedPromise !== void 0) tappedPromise.then(() => {\n\t\t\tthis.send(payload, run);\n\t\t});\n\t\telse await this.send(payload, run);\n\t}\n\tasync onLLMStart(run) {\n\t\tconst runName = assignName(run);\n\t\tconst runType = run.inputs.messages !== void 0 ? \"chat_model\" : \"llm\";\n\t\tconst runInfo = {\n\t\t\ttags: run.tags ?? [],\n\t\t\tmetadata: run.extra?.metadata ?? {},\n\t\t\tname: runName,\n\t\t\trunType,\n\t\t\tinputs: run.inputs\n\t\t};\n\t\tthis.runInfoMap.set(run.id, runInfo);\n\t\tconst eventName = `on_${runType}_start`;\n\t\tawait this.send({\n\t\t\tevent: eventName,\n\t\t\tdata: { input: run.inputs },\n\t\t\tname: runName,\n\t\t\ttags: run.tags ?? [],\n\t\t\trun_id: run.id,\n\t\t\tmetadata: run.extra?.metadata ?? {}\n\t\t}, runInfo);\n\t}\n\tasync onLLMNewToken(run, token, kwargs) {\n\t\tconst runInfo = this.runInfoMap.get(run.id);\n\t\tlet chunk;\n\t\tlet eventName;\n\t\tif (runInfo === void 0) throw new Error(`onLLMNewToken: Run ID ${run.id} not found in run map.`);\n\t\tif (this.runInfoMap.size === 1) return;\n\t\tif (runInfo.runType === \"chat_model\") {\n\t\t\teventName = \"on_chat_model_stream\";\n\t\t\tif (kwargs?.chunk === void 0) chunk = new AIMessageChunk({\n\t\t\t\tcontent: token,\n\t\t\t\tid: `run-${run.id}`\n\t\t\t});\n\t\t\telse chunk = kwargs.chunk.message;\n\t\t} else if (runInfo.runType === \"llm\") {\n\t\t\teventName = \"on_llm_stream\";\n\t\t\tif (kwargs?.chunk === void 0) chunk = new GenerationChunk({ text: token });\n\t\t\telse chunk = kwargs.chunk;\n\t\t} else throw new Error(`Unexpected run type ${runInfo.runType}`);\n\t\tawait this.send({\n\t\t\tevent: eventName,\n\t\t\tdata: { chunk },\n\t\t\trun_id: run.id,\n\t\t\tname: runInfo.name,\n\t\t\ttags: runInfo.tags,\n\t\t\tmetadata: runInfo.metadata\n\t\t}, runInfo);\n\t}\n\tasync onLLMEnd(run) {\n\t\tconst runInfo = this.runInfoMap.get(run.id);\n\t\tthis.runInfoMap.delete(run.id);\n\t\tlet eventName;\n\t\tif (runInfo === void 0) throw new Error(`onLLMEnd: Run ID ${run.id} not found in run map.`);\n\t\tconst generations = run.outputs?.generations;\n\t\tlet output;\n\t\tif (runInfo.runType === \"chat_model\") {\n\t\t\tfor (const generation of generations ?? []) {\n\t\t\t\tif (output !== void 0) break;\n\t\t\t\toutput = generation[0]?.message;\n\t\t\t}\n\t\t\teventName = \"on_chat_model_end\";\n\t\t} else if (runInfo.runType === \"llm\") {\n\t\t\toutput = {\n\t\t\t\tgenerations: generations?.map((generation) => {\n\t\t\t\t\treturn generation.map((chunk) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttext: chunk.text,\n\t\t\t\t\t\t\tgenerationInfo: chunk.generationInfo\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t}),\n\t\t\t\tllmOutput: run.outputs?.llmOutput ?? {}\n\t\t\t};\n\t\t\teventName = \"on_llm_end\";\n\t\t} else throw new Error(`onLLMEnd: Unexpected run type: ${runInfo.runType}`);\n\t\tawait this.sendEndEvent({\n\t\t\tevent: eventName,\n\t\t\tdata: {\n\t\t\t\toutput,\n\t\t\t\tinput: runInfo.inputs\n\t\t\t},\n\t\t\trun_id: run.id,\n\t\t\tname: runInfo.name,\n\t\t\ttags: runInfo.tags,\n\t\t\tmetadata: runInfo.metadata\n\t\t}, runInfo);\n\t}\n\tasync onChainStart(run) {\n\t\tconst runName = assignName(run);\n\t\tconst runType = run.run_type ?? \"chain\";\n\t\tconst runInfo = {\n\t\t\ttags: run.tags ?? [],\n\t\t\tmetadata: run.extra?.metadata ?? {},\n\t\t\tname: runName,\n\t\t\trunType: run.run_type\n\t\t};\n\t\tlet eventData = {};\n\t\tif (run.inputs.input === \"\" && Object.keys(run.inputs).length === 1) {\n\t\t\teventData = {};\n\t\t\trunInfo.inputs = {};\n\t\t} else if (run.inputs.input !== void 0) {\n\t\t\teventData.input = run.inputs.input;\n\t\t\trunInfo.inputs = run.inputs.input;\n\t\t} else {\n\t\t\teventData.input = run.inputs;\n\t\t\trunInfo.inputs = run.inputs;\n\t\t}\n\t\tthis.runInfoMap.set(run.id, runInfo);\n\t\tawait this.send({\n\t\t\tevent: `on_${runType}_start`,\n\t\t\tdata: eventData,\n\t\t\tname: runName,\n\t\t\ttags: run.tags ?? [],\n\t\t\trun_id: run.id,\n\t\t\tmetadata: run.extra?.metadata ?? {}\n\t\t}, runInfo);\n\t}\n\tasync onChainEnd(run) {\n\t\tconst runInfo = this.runInfoMap.get(run.id);\n\t\tthis.runInfoMap.delete(run.id);\n\t\tif (runInfo === void 0) throw new Error(`onChainEnd: Run ID ${run.id} not found in run map.`);\n\t\tconst eventName = `on_${run.run_type}_end`;\n\t\tconst inputs = run.inputs ?? runInfo.inputs ?? {};\n\t\tconst outputs = run.outputs?.output ?? run.outputs;\n\t\tconst data = {\n\t\t\toutput: outputs,\n\t\t\tinput: inputs\n\t\t};\n\t\tif (inputs.input && Object.keys(inputs).length === 1) {\n\t\t\tdata.input = inputs.input;\n\t\t\trunInfo.inputs = inputs.input;\n\t\t}\n\t\tawait this.sendEndEvent({\n\t\t\tevent: eventName,\n\t\t\tdata,\n\t\t\trun_id: run.id,\n\t\t\tname: runInfo.name,\n\t\t\ttags: runInfo.tags,\n\t\t\tmetadata: runInfo.metadata ?? {}\n\t\t}, runInfo);\n\t}\n\tasync onToolStart(run) {\n\t\tconst runName = assignName(run);\n\t\tconst runInfo = {\n\t\t\ttags: run.tags ?? [],\n\t\t\tmetadata: run.extra?.metadata ?? {},\n\t\t\tname: runName,\n\t\t\trunType: \"tool\",\n\t\t\tinputs: run.inputs ?? {}\n\t\t};\n\t\tthis.runInfoMap.set(run.id, runInfo);\n\t\tawait this.send({\n\t\t\tevent: \"on_tool_start\",\n\t\t\tdata: { input: run.inputs ?? {} },\n\t\t\tname: runName,\n\t\t\trun_id: run.id,\n\t\t\ttags: run.tags ?? [],\n\t\t\tmetadata: run.extra?.metadata ?? {}\n\t\t}, runInfo);\n\t}\n\tasync onToolEnd(run) {\n\t\tconst runInfo = this.runInfoMap.get(run.id);\n\t\tthis.runInfoMap.delete(run.id);\n\t\tif (runInfo === void 0) throw new Error(`onToolEnd: Run ID ${run.id} not found in run map.`);\n\t\tif (runInfo.inputs === void 0) throw new Error(`onToolEnd: Run ID ${run.id} is a tool call, and is expected to have traced inputs.`);\n\t\tconst output = run.outputs?.output === void 0 ? run.outputs : run.outputs.output;\n\t\tawait this.sendEndEvent({\n\t\t\tevent: \"on_tool_end\",\n\t\t\tdata: {\n\t\t\t\toutput,\n\t\t\t\tinput: runInfo.inputs\n\t\t\t},\n\t\t\trun_id: run.id,\n\t\t\tname: runInfo.name,\n\t\t\ttags: runInfo.tags,\n\t\t\tmetadata: runInfo.metadata\n\t\t}, runInfo);\n\t}\n\tasync onRetrieverStart(run) {\n\t\tconst runName = assignName(run);\n\t\tconst runType = \"retriever\";\n\t\tconst runInfo = {\n\t\t\ttags: run.tags ?? [],\n\t\t\tmetadata: run.extra?.metadata ?? {},\n\t\t\tname: runName,\n\t\t\trunType,\n\t\t\tinputs: { query: run.inputs.query }\n\t\t};\n\t\tthis.runInfoMap.set(run.id, runInfo);\n\t\tawait this.send({\n\t\t\tevent: \"on_retriever_start\",\n\t\t\tdata: { input: { query: run.inputs.query } },\n\t\t\tname: runName,\n\t\t\ttags: run.tags ?? [],\n\t\t\trun_id: run.id,\n\t\t\tmetadata: run.extra?.metadata ?? {}\n\t\t}, runInfo);\n\t}\n\tasync onRetrieverEnd(run) {\n\t\tconst runInfo = this.runInfoMap.get(run.id);\n\t\tthis.runInfoMap.delete(run.id);\n\t\tif (runInfo === void 0) throw new Error(`onRetrieverEnd: Run ID ${run.id} not found in run map.`);\n\t\tawait this.sendEndEvent({\n\t\t\tevent: \"on_retriever_end\",\n\t\t\tdata: {\n\t\t\t\toutput: run.outputs?.documents ?? run.outputs,\n\t\t\t\tinput: runInfo.inputs\n\t\t\t},\n\t\t\trun_id: run.id,\n\t\t\tname: runInfo.name,\n\t\t\ttags: runInfo.tags,\n\t\t\tmetadata: runInfo.metadata\n\t\t}, runInfo);\n\t}\n\tasync handleCustomEvent(eventName, data, runId) {\n\t\tconst runInfo = this.runInfoMap.get(runId);\n\t\tif (runInfo === void 0) throw new Error(`handleCustomEvent: Run ID ${runId} not found in run map.`);\n\t\tawait this.send({\n\t\t\tevent: \"on_custom_event\",\n\t\t\trun_id: runId,\n\t\t\tname: eventName,\n\t\t\ttags: runInfo.tags,\n\t\t\tmetadata: runInfo.metadata,\n\t\t\tdata\n\t\t}, runInfo);\n\t}\n\tasync finish() {\n\t\tconst pendingPromises = [...this.tappedPromises.values()];\n\t\tPromise.all(pendingPromises).finally(() => {\n\t\t\tthis.writer.close();\n\t\t});\n\t}\n};\n\n//#endregion\nexport { EventStreamCallbackHandler, isStreamEventsHandler };\n//# sourceMappingURL=event_stream.js.map"],"names":[],"mappings":";;;;AAMA,SAAS,WAAW,EAAE,MAAM,cAAc;AACzC,MAAI,SAAS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