@langchain/core 0.2.30-rc.0 → 0.2.30
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/tracers/console.cjs +11 -2
- package/dist/tracers/console.js +11 -2
- package/package.json +1 -1
package/dist/tracers/console.cjs
CHANGED
|
@@ -17,6 +17,15 @@ function tryJsonStringify(obj, fallback) {
|
|
|
17
17
|
return fallback;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
function formatKVMapItem(value) {
|
|
21
|
+
if (typeof value === "string") {
|
|
22
|
+
return value.trim();
|
|
23
|
+
}
|
|
24
|
+
if (value === null || value === undefined) {
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
return tryJsonStringify(value, value.toString());
|
|
28
|
+
}
|
|
20
29
|
function elapsed(run) {
|
|
21
30
|
if (!run.end_time)
|
|
22
31
|
return "";
|
|
@@ -163,7 +172,7 @@ class ConsoleCallbackHandler extends base_js_1.BaseTracer {
|
|
|
163
172
|
*/
|
|
164
173
|
onToolStart(run) {
|
|
165
174
|
const crumbs = this.getBreadcrumbs(run);
|
|
166
|
-
console.log(`${wrap(color.green, "[tool/start]")} [${crumbs}] Entering Tool run with input: "${run.inputs.input
|
|
175
|
+
console.log(`${wrap(color.green, "[tool/start]")} [${crumbs}] Entering Tool run with input: "${formatKVMapItem(run.inputs.input)}"`);
|
|
167
176
|
}
|
|
168
177
|
/**
|
|
169
178
|
* Method used to log the end of a tool run.
|
|
@@ -172,7 +181,7 @@ class ConsoleCallbackHandler extends base_js_1.BaseTracer {
|
|
|
172
181
|
*/
|
|
173
182
|
onToolEnd(run) {
|
|
174
183
|
const crumbs = this.getBreadcrumbs(run);
|
|
175
|
-
console.log(`${wrap(color.cyan, "[tool/end]")} [${crumbs}] [${elapsed(run)}] Exiting Tool run with output: "${run.outputs?.output
|
|
184
|
+
console.log(`${wrap(color.cyan, "[tool/end]")} [${crumbs}] [${elapsed(run)}] Exiting Tool run with output: "${formatKVMapItem(run.outputs?.output)}"`);
|
|
176
185
|
}
|
|
177
186
|
/**
|
|
178
187
|
* Method used to log any errors of a tool run.
|
package/dist/tracers/console.js
CHANGED
|
@@ -11,6 +11,15 @@ function tryJsonStringify(obj, fallback) {
|
|
|
11
11
|
return fallback;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
function formatKVMapItem(value) {
|
|
15
|
+
if (typeof value === "string") {
|
|
16
|
+
return value.trim();
|
|
17
|
+
}
|
|
18
|
+
if (value === null || value === undefined) {
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
return tryJsonStringify(value, value.toString());
|
|
22
|
+
}
|
|
14
23
|
function elapsed(run) {
|
|
15
24
|
if (!run.end_time)
|
|
16
25
|
return "";
|
|
@@ -157,7 +166,7 @@ export class ConsoleCallbackHandler extends BaseTracer {
|
|
|
157
166
|
*/
|
|
158
167
|
onToolStart(run) {
|
|
159
168
|
const crumbs = this.getBreadcrumbs(run);
|
|
160
|
-
console.log(`${wrap(color.green, "[tool/start]")} [${crumbs}] Entering Tool run with input: "${run.inputs.input
|
|
169
|
+
console.log(`${wrap(color.green, "[tool/start]")} [${crumbs}] Entering Tool run with input: "${formatKVMapItem(run.inputs.input)}"`);
|
|
161
170
|
}
|
|
162
171
|
/**
|
|
163
172
|
* Method used to log the end of a tool run.
|
|
@@ -166,7 +175,7 @@ export class ConsoleCallbackHandler extends BaseTracer {
|
|
|
166
175
|
*/
|
|
167
176
|
onToolEnd(run) {
|
|
168
177
|
const crumbs = this.getBreadcrumbs(run);
|
|
169
|
-
console.log(`${wrap(color.cyan, "[tool/end]")} [${crumbs}] [${elapsed(run)}] Exiting Tool run with output: "${run.outputs?.output
|
|
178
|
+
console.log(`${wrap(color.cyan, "[tool/end]")} [${crumbs}] [${elapsed(run)}] Exiting Tool run with output: "${formatKVMapItem(run.outputs?.output)}"`);
|
|
170
179
|
}
|
|
171
180
|
/**
|
|
172
181
|
* Method used to log any errors of a tool run.
|