@langchain/core 0.3.1 → 0.3.3
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
CHANGED
|
@@ -433,7 +433,7 @@ class Runnable extends serializable_js_1.Serializable {
|
|
|
433
433
|
}
|
|
434
434
|
else {
|
|
435
435
|
const copiedCallbacks = callbacks.copy();
|
|
436
|
-
copiedCallbacks.
|
|
436
|
+
copiedCallbacks.addHandler(logStreamCallbackHandler, true);
|
|
437
437
|
// eslint-disable-next-line no-param-reassign
|
|
438
438
|
config.callbacks = copiedCallbacks;
|
|
439
439
|
}
|
|
@@ -503,7 +503,7 @@ class Runnable extends serializable_js_1.Serializable {
|
|
|
503
503
|
}
|
|
504
504
|
else {
|
|
505
505
|
const copiedCallbacks = callbacks.copy();
|
|
506
|
-
copiedCallbacks.
|
|
506
|
+
copiedCallbacks.addHandler(eventStreamer, true);
|
|
507
507
|
// eslint-disable-next-line no-param-reassign
|
|
508
508
|
config.callbacks = copiedCallbacks;
|
|
509
509
|
}
|
|
@@ -1530,7 +1530,6 @@ class RunnableLambda extends Runnable {
|
|
|
1530
1530
|
try {
|
|
1531
1531
|
let output = await this.func(input, {
|
|
1532
1532
|
...childConfig,
|
|
1533
|
-
config: childConfig,
|
|
1534
1533
|
});
|
|
1535
1534
|
if (output && Runnable.isRunnable(output)) {
|
|
1536
1535
|
if (config?.recursionLimit === 0) {
|
package/dist/runnables/base.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export declare abstract class Runnable<RunInput = any, RunOutput = any, CallOpti
|
|
|
52
52
|
* @param config New configuration parameters to attach to the new runnable.
|
|
53
53
|
* @returns A new RunnableBinding with a config matching what's passed.
|
|
54
54
|
*/
|
|
55
|
-
withConfig(config: RunnableConfig):
|
|
55
|
+
withConfig(config: RunnableConfig): Runnable<RunInput, RunOutput, CallOptions>;
|
|
56
56
|
/**
|
|
57
57
|
* Create a new runnable from the current one that will try invoking
|
|
58
58
|
* other passed fallback runnables if the initial invocation fails.
|
|
@@ -330,7 +330,7 @@ export declare class RunnableBinding<RunInput, RunOutput, CallOptions extends Ru
|
|
|
330
330
|
getName(suffix?: string | undefined): string;
|
|
331
331
|
_mergeConfig(...options: (Partial<CallOptions> | RunnableConfig | undefined)[]): Promise<Partial<CallOptions>>;
|
|
332
332
|
bind(kwargs: Partial<CallOptions>): RunnableBinding<RunInput, RunOutput, CallOptions>;
|
|
333
|
-
withConfig(config: RunnableConfig):
|
|
333
|
+
withConfig(config: RunnableConfig): Runnable<RunInput, RunOutput, CallOptions>;
|
|
334
334
|
withRetry(fields?: {
|
|
335
335
|
stopAfterAttempt?: number;
|
|
336
336
|
onFailedAttempt?: RunnableRetryFailedAttemptHandler;
|
package/dist/runnables/base.js
CHANGED
|
@@ -426,7 +426,7 @@ export class Runnable extends Serializable {
|
|
|
426
426
|
}
|
|
427
427
|
else {
|
|
428
428
|
const copiedCallbacks = callbacks.copy();
|
|
429
|
-
copiedCallbacks.
|
|
429
|
+
copiedCallbacks.addHandler(logStreamCallbackHandler, true);
|
|
430
430
|
// eslint-disable-next-line no-param-reassign
|
|
431
431
|
config.callbacks = copiedCallbacks;
|
|
432
432
|
}
|
|
@@ -496,7 +496,7 @@ export class Runnable extends Serializable {
|
|
|
496
496
|
}
|
|
497
497
|
else {
|
|
498
498
|
const copiedCallbacks = callbacks.copy();
|
|
499
|
-
copiedCallbacks.
|
|
499
|
+
copiedCallbacks.addHandler(eventStreamer, true);
|
|
500
500
|
// eslint-disable-next-line no-param-reassign
|
|
501
501
|
config.callbacks = copiedCallbacks;
|
|
502
502
|
}
|
|
@@ -1516,7 +1516,6 @@ export class RunnableLambda extends Runnable {
|
|
|
1516
1516
|
try {
|
|
1517
1517
|
let output = await this.func(input, {
|
|
1518
1518
|
...childConfig,
|
|
1519
|
-
config: childConfig,
|
|
1520
1519
|
});
|
|
1521
1520
|
if (output && Runnable.isRunnable(output)) {
|
|
1522
1521
|
if (config?.recursionLimit === 0) {
|
package/dist/tools/index.cjs
CHANGED
|
@@ -322,7 +322,7 @@ function tool(func, fields) {
|
|
|
322
322
|
const childConfig = (0, config_js_1.patchConfig)(config, {
|
|
323
323
|
callbacks: runManager?.getChild(),
|
|
324
324
|
});
|
|
325
|
-
void index_js_1.AsyncLocalStorageProviderSingleton.
|
|
325
|
+
void index_js_1.AsyncLocalStorageProviderSingleton.runWithConfig(childConfig, async () => {
|
|
326
326
|
try {
|
|
327
327
|
// TS doesn't restrict the type here based on the guard above
|
|
328
328
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
package/dist/tools/index.js
CHANGED
|
@@ -314,7 +314,7 @@ export function tool(func, fields) {
|
|
|
314
314
|
const childConfig = patchConfig(config, {
|
|
315
315
|
callbacks: runManager?.getChild(),
|
|
316
316
|
});
|
|
317
|
-
void AsyncLocalStorageProviderSingleton.
|
|
317
|
+
void AsyncLocalStorageProviderSingleton.runWithConfig(childConfig, async () => {
|
|
318
318
|
try {
|
|
319
319
|
// TS doesn't restrict the type here based on the guard above
|
|
320
320
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -273,7 +273,7 @@ class EventStreamCallbackHandler extends base_js_1.BaseTracer {
|
|
|
273
273
|
throw new Error(`onLLMNewToken: Run ID ${run.id} not found in run map.`);
|
|
274
274
|
}
|
|
275
275
|
// Top-level streaming events are covered by tapOutputIterable
|
|
276
|
-
if (
|
|
276
|
+
if (this.runInfoMap.size === 1) {
|
|
277
277
|
return;
|
|
278
278
|
}
|
|
279
279
|
if (runInfo.runType === "chat_model") {
|
|
@@ -269,7 +269,7 @@ export class EventStreamCallbackHandler extends BaseTracer {
|
|
|
269
269
|
throw new Error(`onLLMNewToken: Run ID ${run.id} not found in run map.`);
|
|
270
270
|
}
|
|
271
271
|
// Top-level streaming events are covered by tapOutputIterable
|
|
272
|
-
if (
|
|
272
|
+
if (this.runInfoMap.size === 1) {
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
275
|
if (runInfo.runType === "chat_model") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Core LangChain.js abstractions and schemas",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"camelcase": "6",
|
|
38
38
|
"decamelize": "1.2.0",
|
|
39
39
|
"js-tiktoken": "^1.0.12",
|
|
40
|
-
"langsmith": "^0.1.56
|
|
40
|
+
"langsmith": "^0.1.56",
|
|
41
41
|
"mustache": "^4.2.0",
|
|
42
42
|
"p-queue": "^6.6.2",
|
|
43
43
|
"p-retry": "4",
|