@langchain/core 0.2.33 → 0.2.35

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.
@@ -433,7 +433,7 @@ class Runnable extends serializable_js_1.Serializable {
433
433
  }
434
434
  else {
435
435
  const copiedCallbacks = callbacks.copy();
436
- copiedCallbacks.inheritableHandlers.push(logStreamCallbackHandler);
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.inheritableHandlers.push(eventStreamer);
506
+ copiedCallbacks.addHandler(eventStreamer, true);
507
507
  // eslint-disable-next-line no-param-reassign
508
508
  config.callbacks = copiedCallbacks;
509
509
  }
@@ -485,7 +485,7 @@ export declare class RunnableSequence<RunInput = any, RunOutput = any> extends R
485
485
  last: Runnable<any, RunOutput>;
486
486
  name?: string;
487
487
  });
488
- get steps(): Runnable<any, any, RunnableConfig>[];
488
+ get steps(): Runnable<any, any, RunnableConfig<Record<string, any>>>[];
489
489
  invoke(input: RunInput, options?: RunnableConfig): Promise<RunOutput>;
490
490
  batch(inputs: RunInput[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions & {
491
491
  returnExceptions?: false;
@@ -599,7 +599,7 @@ export declare class RunnableWithFallbacks<RunInput, RunOutput> extends Runnable
599
599
  runnable: Runnable<RunInput, RunOutput>;
600
600
  fallbacks: Runnable<RunInput, RunOutput>[];
601
601
  });
602
- runnables(): Generator<Runnable<RunInput, RunOutput, RunnableConfig>, void, unknown>;
602
+ runnables(): Generator<Runnable<RunInput, RunOutput, RunnableConfig<Record<string, any>>>, void, unknown>;
603
603
  invoke(input: RunInput, options?: Partial<RunnableConfig>): Promise<RunOutput>;
604
604
  _streamIterator(input: RunInput, options?: Partial<RunnableConfig> | undefined): AsyncGenerator<RunOutput>;
605
605
  batch(inputs: RunInput[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions & {
@@ -426,7 +426,7 @@ export class Runnable extends Serializable {
426
426
  }
427
427
  else {
428
428
  const copiedCallbacks = callbacks.copy();
429
- copiedCallbacks.inheritableHandlers.push(logStreamCallbackHandler);
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.inheritableHandlers.push(eventStreamer);
499
+ copiedCallbacks.addHandler(eventStreamer, true);
500
500
  // eslint-disable-next-line no-param-reassign
501
501
  config.callbacks = copiedCallbacks;
502
502
  }
@@ -15,7 +15,7 @@ export declare class Graph {
15
15
  */
16
16
  extend(graph: Graph, prefix?: string): ({
17
17
  id: string;
18
- data: RunnableIOSchema | RunnableInterface<any, any, import("./types.js").RunnableConfig>;
18
+ data: RunnableIOSchema | RunnableInterface<any, any, import("./types.js").RunnableConfig<Record<string, any>>>;
19
19
  } | undefined)[];
20
20
  trimFirstNode(): void;
21
21
  trimLastNode(): void;
@@ -87,6 +87,6 @@ export declare class RunnableWithMessageHistory<RunInput, RunOutput> extends Run
87
87
  _getOutputMessages(outputValue: string | BaseMessage | Array<BaseMessage> | Record<string, any>): Array<BaseMessage>;
88
88
  _enterHistory(input: any, kwargs?: RunnableConfig): Promise<BaseMessage[]>;
89
89
  _exitHistory(run: Run, config: RunnableConfig): Promise<void>;
90
- _mergeConfig(...configs: Array<RunnableConfig | undefined>): Promise<Partial<RunnableConfig>>;
90
+ _mergeConfig(...configs: Array<RunnableConfig | undefined>): Promise<Partial<RunnableConfig<Record<string, any>>>>;
91
91
  }
92
92
  export {};
@@ -41,12 +41,12 @@ export interface Node {
41
41
  id: string;
42
42
  data: RunnableIOSchema | RunnableInterface;
43
43
  }
44
- export interface RunnableConfig extends BaseCallbackConfig {
44
+ export interface RunnableConfig<ConfigurableFieldType extends Record<string, any> = Record<string, any>> extends BaseCallbackConfig {
45
45
  /**
46
46
  * Runtime values for attributes previously made configurable on this Runnable,
47
47
  * or sub-Runnables.
48
48
  */
49
- configurable?: Record<string, any>;
49
+ configurable?: ConfigurableFieldType;
50
50
  /**
51
51
  * Maximum number of times a call can recurse. If not provided, defaults to 25.
52
52
  */
@@ -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 (run.parent_run_id === undefined) {
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 (run.parent_run_id === undefined) {
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.2.33",
3
+ "version": "0.2.35",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {