@langchain/core 0.1.60 → 0.1.61

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.
@@ -220,7 +220,9 @@ class BaseLanguageModel extends BaseLangChain {
220
220
  * @param callOptions Call options for the model
221
221
  * @returns A unique cache key.
222
222
  */
223
- _getSerializedCacheKeyParametersForCall(callOptions) {
223
+ _getSerializedCacheKeyParametersForCall(
224
+ // TODO: Fix when we remove the RunnableLambda backwards compatibility shim.
225
+ { config, ...callOptions }) {
224
226
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
225
227
  const params = {
226
228
  ...this._identifyingParams(),
@@ -180,7 +180,9 @@ export declare abstract class BaseLanguageModel<RunOutput = any, CallOptions ext
180
180
  * @param callOptions Call options for the model
181
181
  * @returns A unique cache key.
182
182
  */
183
- protected _getSerializedCacheKeyParametersForCall(callOptions: CallOptions): string;
183
+ protected _getSerializedCacheKeyParametersForCall({ config, ...callOptions }: CallOptions & {
184
+ config?: RunnableConfig;
185
+ }): string;
184
186
  /**
185
187
  * @deprecated
186
188
  * Return a json-like object representing this LLM.
@@ -212,7 +212,9 @@ export class BaseLanguageModel extends BaseLangChain {
212
212
  * @param callOptions Call options for the model
213
213
  * @returns A unique cache key.
214
214
  */
215
- _getSerializedCacheKeyParametersForCall(callOptions) {
215
+ _getSerializedCacheKeyParametersForCall(
216
+ // TODO: Fix when we remove the RunnableLambda backwards compatibility shim.
217
+ { config, ...callOptions }) {
216
218
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
217
219
  const params = {
218
220
  ...this._identifyingParams(),
@@ -53,6 +53,8 @@ class BaseRetriever extends base_js_1.Runnable {
53
53
  return this.getRelevantDocuments(input, (0, config_js_1.ensureConfig)(options));
54
54
  }
55
55
  /**
56
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
57
+ *
56
58
  * Main method used to retrieve relevant documents. It takes a query
57
59
  * string and an optional configuration object, and returns a promise that
58
60
  * resolves to an array of `Document` objects. This method handles the
@@ -33,6 +33,8 @@ export declare abstract class BaseRetriever<Metadata extends Record<string, any>
33
33
  _getRelevantDocuments(_query: string, _callbacks?: CallbackManagerForRetrieverRun): Promise<DocumentInterface<Metadata>[]>;
34
34
  invoke(input: string, options?: RunnableConfig): Promise<DocumentInterface<Metadata>[]>;
35
35
  /**
36
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
37
+ *
36
38
  * Main method used to retrieve relevant documents. It takes a query
37
39
  * string and an optional configuration object, and returns a promise that
38
40
  * resolves to an array of `Document` objects. This method handles the
@@ -50,6 +50,8 @@ export class BaseRetriever extends Runnable {
50
50
  return this.getRelevantDocuments(input, ensureConfig(options));
51
51
  }
52
52
  /**
53
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
54
+ *
53
55
  * Main method used to retrieve relevant documents. It takes a query
54
56
  * string and an optional configuration object, and returns a promise that
55
57
  * resolves to an array of `Document` objects. This method handles the
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RunnableWithMessageHistory = exports.RunnableBranch = exports.RouterRunnable = exports.RunnablePassthrough = exports.ensureConfig = exports.patchConfig = exports.getCallbackManagerForConfig = exports._coerceToRunnable = exports.RunnablePick = exports.RunnableAssign = exports.RunnableWithFallbacks = exports.RunnableLambda = exports.RunnableParallel = exports.RunnableMap = exports.RunnableSequence = exports.RunnableRetry = exports.RunnableEach = exports.RunnableBinding = exports.Runnable = void 0;
3
+ exports.RunnableWithMessageHistory = exports.RunnableBranch = exports.RouterRunnable = exports.RunnablePassthrough = exports.mergeConfigs = exports.ensureConfig = exports.patchConfig = exports.getCallbackManagerForConfig = exports._coerceToRunnable = exports.RunnablePick = exports.RunnableAssign = exports.RunnableWithFallbacks = exports.RunnableLambda = exports.RunnableParallel = exports.RunnableMap = exports.RunnableSequence = exports.RunnableRetry = exports.RunnableEach = exports.RunnableBinding = exports.Runnable = void 0;
4
4
  var base_js_1 = require("./base.cjs");
5
5
  Object.defineProperty(exports, "Runnable", { enumerable: true, get: function () { return base_js_1.Runnable; } });
6
6
  Object.defineProperty(exports, "RunnableBinding", { enumerable: true, get: function () { return base_js_1.RunnableBinding; } });
@@ -18,6 +18,7 @@ var config_js_1 = require("./config.cjs");
18
18
  Object.defineProperty(exports, "getCallbackManagerForConfig", { enumerable: true, get: function () { return config_js_1.getCallbackManagerForConfig; } });
19
19
  Object.defineProperty(exports, "patchConfig", { enumerable: true, get: function () { return config_js_1.patchConfig; } });
20
20
  Object.defineProperty(exports, "ensureConfig", { enumerable: true, get: function () { return config_js_1.ensureConfig; } });
21
+ Object.defineProperty(exports, "mergeConfigs", { enumerable: true, get: function () { return config_js_1.mergeConfigs; } });
21
22
  var passthrough_js_1 = require("./passthrough.cjs");
22
23
  Object.defineProperty(exports, "RunnablePassthrough", { enumerable: true, get: function () { return passthrough_js_1.RunnablePassthrough; } });
23
24
  var router_js_1 = require("./router.cjs");
@@ -1,6 +1,6 @@
1
1
  export { type RunnableFunc, type RunnableLike, type RunnableRetryFailedAttemptHandler, Runnable, type RunnableBindingArgs, RunnableBinding, RunnableEach, RunnableRetry, RunnableSequence, RunnableMap, RunnableParallel, RunnableLambda, RunnableWithFallbacks, RunnableAssign, RunnablePick, _coerceToRunnable, } from "./base.js";
2
2
  export { type RunnableBatchOptions, type RunnableInterface, type RunnableIOSchema, } from "./types.js";
3
- export { type RunnableConfig, getCallbackManagerForConfig, patchConfig, ensureConfig, } from "./config.js";
3
+ export { type RunnableConfig, getCallbackManagerForConfig, patchConfig, ensureConfig, mergeConfigs, } from "./config.js";
4
4
  export { RunnablePassthrough } from "./passthrough.js";
5
5
  export { type RouterInput, RouterRunnable } from "./router.js";
6
6
  export { RunnableBranch, type Branch, type BranchLike } from "./branch.js";
@@ -1,5 +1,5 @@
1
1
  export { Runnable, RunnableBinding, RunnableEach, RunnableRetry, RunnableSequence, RunnableMap, RunnableParallel, RunnableLambda, RunnableWithFallbacks, RunnableAssign, RunnablePick, _coerceToRunnable, } from "./base.js";
2
- export { getCallbackManagerForConfig, patchConfig, ensureConfig, } from "./config.js";
2
+ export { getCallbackManagerForConfig, patchConfig, ensureConfig, mergeConfigs, } from "./config.js";
3
3
  export { RunnablePassthrough } from "./passthrough.js";
4
4
  export { RouterRunnable } from "./router.js";
5
5
  export { RunnableBranch } from "./branch.js";
package/dist/tools.cjs CHANGED
@@ -49,6 +49,8 @@ class StructuredTool extends base_js_1.BaseLangChain {
49
49
  return this.call(input, (0, config_js_1.ensureConfig)(config));
50
50
  }
51
51
  /**
52
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
53
+ *
52
54
  * Calls the tool with the provided argument, configuration, and tags. It
53
55
  * parses the input according to the schema, handles any errors, and
54
56
  * manages callbacks.
@@ -100,6 +102,8 @@ class Tool extends StructuredTool {
100
102
  });
101
103
  }
102
104
  /**
105
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
106
+ *
103
107
  * Calls the tool with the provided argument and callbacks. It handles
104
108
  * string inputs specifically.
105
109
  * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.
@@ -143,6 +147,9 @@ class DynamicTool extends Tool {
143
147
  this.func = fields.func;
144
148
  this.returnDirect = fields.returnDirect ?? this.returnDirect;
145
149
  }
150
+ /**
151
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
152
+ */
146
153
  async call(arg, configArg) {
147
154
  const config = (0, manager_js_1.parseCallbackConfigArg)(configArg);
148
155
  if (config.runName === undefined) {
@@ -198,6 +205,9 @@ class DynamicStructuredTool extends StructuredTool {
198
205
  this.returnDirect = fields.returnDirect ?? this.returnDirect;
199
206
  this.schema = fields.schema;
200
207
  }
208
+ /**
209
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
210
+ */
201
211
  async call(arg, configArg,
202
212
  /** @deprecated */
203
213
  tags) {
package/dist/tools.d.ts CHANGED
@@ -21,6 +21,8 @@ export interface StructuredToolInterface<T extends z.ZodObject<any, any, any, an
21
21
  lc_namespace: string[];
22
22
  schema: T | z.ZodEffects<T>;
23
23
  /**
24
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
25
+ *
24
26
  * Calls the tool with the provided argument, configuration, and tags. It
25
27
  * parses the input according to the schema, handles any errors, and
26
28
  * manages callbacks.
@@ -52,6 +54,8 @@ export declare abstract class StructuredTool<T extends z.ZodObject<any, any, any
52
54
  */
53
55
  invoke(input: (z.output<T> extends string ? string : never) | z.input<T>, config?: RunnableConfig): Promise<string>;
54
56
  /**
57
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
58
+ *
55
59
  * Calls the tool with the provided argument, configuration, and tags. It
56
60
  * parses the input according to the schema, handles any errors, and
57
61
  * manages callbacks.
@@ -69,6 +73,8 @@ export declare abstract class StructuredTool<T extends z.ZodObject<any, any, any
69
73
  }
70
74
  export interface ToolInterface extends StructuredToolInterface {
71
75
  /**
76
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
77
+ *
72
78
  * Calls the tool with the provided argument and callbacks. It handles
73
79
  * string inputs specifically.
74
80
  * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.
@@ -92,6 +98,8 @@ export declare abstract class Tool extends StructuredTool {
92
98
  }>;
93
99
  constructor(fields?: ToolParams);
94
100
  /**
101
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
102
+ *
95
103
  * Calls the tool with the provided argument and callbacks. It handles
96
104
  * string inputs specifically.
97
105
  * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.
@@ -127,6 +135,9 @@ export declare class DynamicTool extends Tool {
127
135
  description: string;
128
136
  func: DynamicToolInput["func"];
129
137
  constructor(fields: DynamicToolInput);
138
+ /**
139
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
140
+ */
130
141
  call(arg: string | undefined | z.input<this["schema"]>, configArg?: RunnableConfig | Callbacks): Promise<string>;
131
142
  /** @ignore */
132
143
  _call(input: string, runManager?: CallbackManagerForToolRun, config?: RunnableConfig): Promise<string>;
@@ -144,6 +155,9 @@ export declare class DynamicStructuredTool<T extends z.ZodObject<any, any, any,
144
155
  func: DynamicStructuredToolInput["func"];
145
156
  schema: T;
146
157
  constructor(fields: DynamicStructuredToolInput<T>);
158
+ /**
159
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
160
+ */
147
161
  call(arg: z.output<T>, configArg?: RunnableConfig | Callbacks,
148
162
  /** @deprecated */
149
163
  tags?: string[]): Promise<string>;
package/dist/tools.js CHANGED
@@ -45,6 +45,8 @@ export class StructuredTool extends BaseLangChain {
45
45
  return this.call(input, ensureConfig(config));
46
46
  }
47
47
  /**
48
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
49
+ *
48
50
  * Calls the tool with the provided argument, configuration, and tags. It
49
51
  * parses the input according to the schema, handles any errors, and
50
52
  * manages callbacks.
@@ -95,6 +97,8 @@ export class Tool extends StructuredTool {
95
97
  });
96
98
  }
97
99
  /**
100
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
101
+ *
98
102
  * Calls the tool with the provided argument and callbacks. It handles
99
103
  * string inputs specifically.
100
104
  * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.
@@ -137,6 +141,9 @@ export class DynamicTool extends Tool {
137
141
  this.func = fields.func;
138
142
  this.returnDirect = fields.returnDirect ?? this.returnDirect;
139
143
  }
144
+ /**
145
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
146
+ */
140
147
  async call(arg, configArg) {
141
148
  const config = parseCallbackConfigArg(configArg);
142
149
  if (config.runName === undefined) {
@@ -191,6 +198,9 @@ export class DynamicStructuredTool extends StructuredTool {
191
198
  this.returnDirect = fields.returnDirect ?? this.returnDirect;
192
199
  this.schema = fields.schema;
193
200
  }
201
+ /**
202
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
203
+ */
194
204
  async call(arg, configArg,
195
205
  /** @deprecated */
196
206
  tags) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/core",
3
- "version": "0.1.60",
3
+ "version": "0.1.61",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {