@langchain/core 0.1.33-rc.0 → 0.1.33-rc.2
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/runnables/base.cjs +24 -22
- package/dist/runnables/base.js +24 -22
- package/package.json +1 -1
package/dist/runnables/base.cjs
CHANGED
|
@@ -1321,33 +1321,35 @@ class RunnableLambda extends Runnable {
|
|
|
1321
1321
|
}
|
|
1322
1322
|
}
|
|
1323
1323
|
}
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1324
|
+
const output = await new Promise((resolve, reject) => {
|
|
1325
|
+
void index_js_1.AsyncLocalStorageProviderSingleton.getInstance().run(config, async () => {
|
|
1326
|
+
try {
|
|
1327
|
+
const res = await this.func(finalChunk, {
|
|
1328
|
+
...config,
|
|
1329
|
+
config,
|
|
1330
|
+
});
|
|
1331
|
+
resolve(res);
|
|
1331
1332
|
}
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
recursionLimit: (config?.recursionLimit ?? config_js_1.DEFAULT_RECURSION_LIMIT) - 1,
|
|
1335
|
-
}));
|
|
1336
|
-
for await (const chunk of stream) {
|
|
1337
|
-
yield chunk;
|
|
1333
|
+
catch (e) {
|
|
1334
|
+
reject(e);
|
|
1338
1335
|
}
|
|
1336
|
+
});
|
|
1337
|
+
});
|
|
1338
|
+
if (output && Runnable.isRunnable(output)) {
|
|
1339
|
+
if (config?.recursionLimit === 0) {
|
|
1340
|
+
throw new Error("Recursion limit reached.");
|
|
1339
1341
|
}
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
+
const stream = await output.stream(finalChunk, (0, config_js_1.patchConfig)(config, {
|
|
1343
|
+
callbacks: runManager?.getChild(),
|
|
1344
|
+
recursionLimit: (config?.recursionLimit ?? config_js_1.DEFAULT_RECURSION_LIMIT) - 1,
|
|
1345
|
+
}));
|
|
1346
|
+
for await (const chunk of stream) {
|
|
1347
|
+
yield chunk;
|
|
1342
1348
|
}
|
|
1343
1349
|
}
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
resolve(wrappedGenerator);
|
|
1348
|
-
});
|
|
1349
|
-
});
|
|
1350
|
-
yield* finalGenerator;
|
|
1350
|
+
else {
|
|
1351
|
+
yield output;
|
|
1352
|
+
}
|
|
1351
1353
|
}
|
|
1352
1354
|
transform(generator, options) {
|
|
1353
1355
|
return this._transformStreamWithConfig(generator, this._transform.bind(this), options ?? index_js_1.AsyncLocalStorageProviderSingleton.getInstance().getStore());
|
package/dist/runnables/base.js
CHANGED
|
@@ -1308,33 +1308,35 @@ export class RunnableLambda extends Runnable {
|
|
|
1308
1308
|
}
|
|
1309
1309
|
}
|
|
1310
1310
|
}
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1311
|
+
const output = await new Promise((resolve, reject) => {
|
|
1312
|
+
void AsyncLocalStorageProviderSingleton.getInstance().run(config, async () => {
|
|
1313
|
+
try {
|
|
1314
|
+
const res = await this.func(finalChunk, {
|
|
1315
|
+
...config,
|
|
1316
|
+
config,
|
|
1317
|
+
});
|
|
1318
|
+
resolve(res);
|
|
1318
1319
|
}
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
recursionLimit: (config?.recursionLimit ?? DEFAULT_RECURSION_LIMIT) - 1,
|
|
1322
|
-
}));
|
|
1323
|
-
for await (const chunk of stream) {
|
|
1324
|
-
yield chunk;
|
|
1320
|
+
catch (e) {
|
|
1321
|
+
reject(e);
|
|
1325
1322
|
}
|
|
1323
|
+
});
|
|
1324
|
+
});
|
|
1325
|
+
if (output && Runnable.isRunnable(output)) {
|
|
1326
|
+
if (config?.recursionLimit === 0) {
|
|
1327
|
+
throw new Error("Recursion limit reached.");
|
|
1326
1328
|
}
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
+
const stream = await output.stream(finalChunk, patchConfig(config, {
|
|
1330
|
+
callbacks: runManager?.getChild(),
|
|
1331
|
+
recursionLimit: (config?.recursionLimit ?? DEFAULT_RECURSION_LIMIT) - 1,
|
|
1332
|
+
}));
|
|
1333
|
+
for await (const chunk of stream) {
|
|
1334
|
+
yield chunk;
|
|
1329
1335
|
}
|
|
1330
1336
|
}
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
resolve(wrappedGenerator);
|
|
1335
|
-
});
|
|
1336
|
-
});
|
|
1337
|
-
yield* finalGenerator;
|
|
1337
|
+
else {
|
|
1338
|
+
yield output;
|
|
1339
|
+
}
|
|
1338
1340
|
}
|
|
1339
1341
|
transform(generator, options) {
|
|
1340
1342
|
return this._transformStreamWithConfig(generator, this._transform.bind(this), options ?? AsyncLocalStorageProviderSingleton.getInstance().getStore());
|