@langchain/core 0.3.7 → 0.3.8-rc.0

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.
@@ -156,9 +156,10 @@ class BaseLanguageModel extends BaseLangChain {
156
156
  return ["stop", "timeout", "signal", "tags", "metadata", "callbacks"];
157
157
  }
158
158
  constructor({ callbacks, callbackManager, ...params }) {
159
+ const { cache, ...rest } = params;
159
160
  super({
160
161
  callbacks: callbacks ?? callbackManager,
161
- ...params,
162
+ ...rest,
162
163
  });
163
164
  /**
164
165
  * The async caller should be used by subclasses to make any async calls,
@@ -182,10 +183,10 @@ class BaseLanguageModel extends BaseLangChain {
182
183
  writable: true,
183
184
  value: void 0
184
185
  });
185
- if (typeof params.cache === "object") {
186
- this.cache = params.cache;
186
+ if (typeof cache === "object") {
187
+ this.cache = cache;
187
188
  }
188
- else if (params.cache) {
189
+ else if (cache) {
189
190
  this.cache = base_js_1.InMemoryCache.global();
190
191
  }
191
192
  else {
@@ -147,9 +147,10 @@ export class BaseLanguageModel extends BaseLangChain {
147
147
  return ["stop", "timeout", "signal", "tags", "metadata", "callbacks"];
148
148
  }
149
149
  constructor({ callbacks, callbackManager, ...params }) {
150
+ const { cache, ...rest } = params;
150
151
  super({
151
152
  callbacks: callbacks ?? callbackManager,
152
- ...params,
153
+ ...rest,
153
154
  });
154
155
  /**
155
156
  * The async caller should be used by subclasses to make any async calls,
@@ -173,10 +174,10 @@ export class BaseLanguageModel extends BaseLangChain {
173
174
  writable: true,
174
175
  value: void 0
175
176
  });
176
- if (typeof params.cache === "object") {
177
- this.cache = params.cache;
177
+ if (typeof cache === "object") {
178
+ this.cache = cache;
178
179
  }
179
- else if (params.cache) {
180
+ else if (cache) {
180
181
  this.cache = InMemoryCache.global();
181
182
  }
182
183
  else {
@@ -479,7 +479,7 @@ export declare class RunnableSequence<RunInput = any, RunOutput = any> extends R
479
479
  last: Runnable<any, RunOutput>;
480
480
  name?: string;
481
481
  });
482
- get steps(): Runnable<any, any, RunnableConfig>[];
482
+ get steps(): Runnable<any, any, RunnableConfig<Record<string, any>>>[];
483
483
  invoke(input: RunInput, options?: RunnableConfig): Promise<RunOutput>;
484
484
  batch(inputs: RunInput[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions & {
485
485
  returnExceptions?: false;
@@ -593,7 +593,7 @@ export declare class RunnableWithFallbacks<RunInput, RunOutput> extends Runnable
593
593
  runnable: Runnable<RunInput, RunOutput>;
594
594
  fallbacks: Runnable<RunInput, RunOutput>[];
595
595
  });
596
- runnables(): Generator<Runnable<RunInput, RunOutput, RunnableConfig>, void, unknown>;
596
+ runnables(): Generator<Runnable<RunInput, RunOutput, RunnableConfig<Record<string, any>>>, void, unknown>;
597
597
  invoke(input: RunInput, options?: Partial<RunnableConfig>): Promise<RunOutput>;
598
598
  _streamIterator(input: RunInput, options?: Partial<RunnableConfig> | undefined): AsyncGenerator<RunOutput>;
599
599
  batch(inputs: RunInput[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions & {
@@ -19,7 +19,7 @@ export declare class Graph {
19
19
  */
20
20
  extend(graph: Graph, prefix?: string): ({
21
21
  id: string;
22
- data: RunnableIOSchema | RunnableInterface<any, any, import("./types.js").RunnableConfig>;
22
+ data: RunnableIOSchema | RunnableInterface<any, any, import("./types.js").RunnableConfig<Record<string, any>>>;
23
23
  } | undefined)[];
24
24
  trimFirstNode(): void;
25
25
  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 {};
@@ -43,12 +43,12 @@ export interface Node {
43
43
  data: RunnableIOSchema | RunnableInterface;
44
44
  metadata?: Record<string, any>;
45
45
  }
46
- export interface RunnableConfig extends BaseCallbackConfig {
46
+ export interface RunnableConfig<ConfigurableFieldType extends Record<string, any> = Record<string, any>> extends BaseCallbackConfig {
47
47
  /**
48
48
  * Runtime values for attributes previously made configurable on this Runnable,
49
49
  * or sub-Runnables.
50
50
  */
51
- configurable?: Record<string, any>;
51
+ configurable?: ConfigurableFieldType;
52
52
  /**
53
53
  * Maximum number of times a call can recurse. If not provided, defaults to 25.
54
54
  */
@@ -309,8 +309,14 @@ class FakeListChatModel extends chat_models_js_1.BaseChatModel {
309
309
  static lc_name() {
310
310
  return "FakeListChatModel";
311
311
  }
312
- constructor({ responses, sleep, emitCustomEvent }) {
313
- super({});
312
+ constructor(params) {
313
+ super(params);
314
+ Object.defineProperty(this, "lc_serializable", {
315
+ enumerable: true,
316
+ configurable: true,
317
+ writable: true,
318
+ value: true
319
+ });
314
320
  Object.defineProperty(this, "responses", {
315
321
  enumerable: true,
316
322
  configurable: true,
@@ -335,6 +341,7 @@ class FakeListChatModel extends chat_models_js_1.BaseChatModel {
335
341
  writable: true,
336
342
  value: false
337
343
  });
344
+ const { responses, sleep, emitCustomEvent } = params;
338
345
  this.responses = responses;
339
346
  this.sleep = sleep;
340
347
  this.emitCustomEvent = emitCustomEvent ?? this.emitCustomEvent;
@@ -116,11 +116,12 @@ export interface FakeListChatModelCallOptions extends BaseChatModelCallOptions {
116
116
  */
117
117
  export declare class FakeListChatModel extends BaseChatModel<FakeListChatModelCallOptions> {
118
118
  static lc_name(): string;
119
+ lc_serializable: boolean;
119
120
  responses: string[];
120
121
  i: number;
121
122
  sleep?: number;
122
123
  emitCustomEvent: boolean;
123
- constructor({ responses, sleep, emitCustomEvent }: FakeChatInput);
124
+ constructor(params: FakeChatInput);
124
125
  _combineLLMOutput(): never[];
125
126
  _llmType(): string;
126
127
  _generate(_messages: BaseMessage[], options?: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
@@ -299,8 +299,14 @@ export class FakeListChatModel extends BaseChatModel {
299
299
  static lc_name() {
300
300
  return "FakeListChatModel";
301
301
  }
302
- constructor({ responses, sleep, emitCustomEvent }) {
303
- super({});
302
+ constructor(params) {
303
+ super(params);
304
+ Object.defineProperty(this, "lc_serializable", {
305
+ enumerable: true,
306
+ configurable: true,
307
+ writable: true,
308
+ value: true
309
+ });
304
310
  Object.defineProperty(this, "responses", {
305
311
  enumerable: true,
306
312
  configurable: true,
@@ -325,6 +331,7 @@ export class FakeListChatModel extends BaseChatModel {
325
331
  writable: true,
326
332
  value: false
327
333
  });
334
+ const { responses, sleep, emitCustomEvent } = params;
328
335
  this.responses = responses;
329
336
  this.sleep = sleep;
330
337
  this.emitCustomEvent = emitCustomEvent ?? this.emitCustomEvent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/core",
3
- "version": "0.3.7",
3
+ "version": "0.3.8-rc.0",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {