@langchain/core 0.3.10 → 0.3.11
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/context.d.ts +2 -2
- package/dist/tools/index.cjs +17 -3
- package/dist/tools/index.js +17 -3
- package/package.json +2 -2
package/dist/context.d.ts
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
* @param name The name of the context variable.
|
|
49
49
|
* @param value The value to set.
|
|
50
50
|
*/
|
|
51
|
-
export declare function setContextVariable(name: PropertyKey, value:
|
|
51
|
+
export declare function setContextVariable<T>(name: PropertyKey, value: T): void;
|
|
52
52
|
/**
|
|
53
53
|
* Get the value of a previously set context variable. Context variables
|
|
54
54
|
* are scoped to any child runnables called by the current runnable,
|
|
@@ -98,4 +98,4 @@ export declare function setContextVariable(name: PropertyKey, value: any): void;
|
|
|
98
98
|
*
|
|
99
99
|
* @param name The name of the context variable.
|
|
100
100
|
*/
|
|
101
|
-
export declare function getContextVariable(name: PropertyKey):
|
|
101
|
+
export declare function getContextVariable<T = any>(name: PropertyKey): T | undefined;
|
package/dist/tools/index.cjs
CHANGED
|
@@ -305,9 +305,23 @@ function tool(func, fields) {
|
|
|
305
305
|
description: fields.description ??
|
|
306
306
|
fields.schema?.description ??
|
|
307
307
|
`${fields.name} tool`,
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
308
|
+
func: async (input, runManager, config) => {
|
|
309
|
+
return new Promise((resolve, reject) => {
|
|
310
|
+
const childConfig = (0, config_js_1.patchConfig)(config, {
|
|
311
|
+
callbacks: runManager?.getChild(),
|
|
312
|
+
});
|
|
313
|
+
void index_js_1.AsyncLocalStorageProviderSingleton.runWithConfig(childConfig, async () => {
|
|
314
|
+
try {
|
|
315
|
+
// TS doesn't restrict the type here based on the guard above
|
|
316
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
317
|
+
resolve(func(input, childConfig));
|
|
318
|
+
}
|
|
319
|
+
catch (e) {
|
|
320
|
+
reject(e);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
},
|
|
311
325
|
});
|
|
312
326
|
}
|
|
313
327
|
const description = fields.description ?? fields.schema.description ?? `${fields.name} tool`;
|
package/dist/tools/index.js
CHANGED
|
@@ -297,9 +297,23 @@ export function tool(func, fields) {
|
|
|
297
297
|
description: fields.description ??
|
|
298
298
|
fields.schema?.description ??
|
|
299
299
|
`${fields.name} tool`,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
300
|
+
func: async (input, runManager, config) => {
|
|
301
|
+
return new Promise((resolve, reject) => {
|
|
302
|
+
const childConfig = patchConfig(config, {
|
|
303
|
+
callbacks: runManager?.getChild(),
|
|
304
|
+
});
|
|
305
|
+
void AsyncLocalStorageProviderSingleton.runWithConfig(childConfig, async () => {
|
|
306
|
+
try {
|
|
307
|
+
// TS doesn't restrict the type here based on the guard above
|
|
308
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
309
|
+
resolve(func(input, childConfig));
|
|
310
|
+
}
|
|
311
|
+
catch (e) {
|
|
312
|
+
reject(e);
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
},
|
|
303
317
|
});
|
|
304
318
|
}
|
|
305
319
|
const description = fields.description ?? fields.schema.description ?? `${fields.name} tool`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "Core LangChain.js abstractions and schemas",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"rimraf": "^5.0.1",
|
|
69
69
|
"ts-jest": "^29.1.0",
|
|
70
70
|
"typescript": "~5.1.6",
|
|
71
|
-
"web-streams-polyfill": "^
|
|
71
|
+
"web-streams-polyfill": "^4.0.0"
|
|
72
72
|
},
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|