@langchain/core 0.1.59 → 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.
Files changed (38) hide show
  1. package/dist/chat_history.cjs +49 -1
  2. package/dist/chat_history.d.ts +27 -0
  3. package/dist/chat_history.js +47 -0
  4. package/dist/language_models/base.cjs +3 -1
  5. package/dist/language_models/base.d.ts +3 -1
  6. package/dist/language_models/base.js +3 -1
  7. package/dist/retrievers/index.cjs +2 -0
  8. package/dist/retrievers/index.d.ts +2 -0
  9. package/dist/retrievers/index.js +2 -0
  10. package/dist/runnables/index.cjs +2 -1
  11. package/dist/runnables/index.d.ts +1 -1
  12. package/dist/runnables/index.js +1 -1
  13. package/dist/stores.cjs +81 -1
  14. package/dist/stores.d.ts +48 -0
  15. package/dist/stores.js +79 -0
  16. package/dist/structured_query/base.cjs +139 -0
  17. package/dist/structured_query/base.d.ts +69 -0
  18. package/dist/structured_query/base.js +134 -0
  19. package/dist/structured_query/functional.cjs +198 -0
  20. package/dist/structured_query/functional.d.ts +87 -0
  21. package/dist/structured_query/functional.js +194 -0
  22. package/dist/structured_query/index.cjs +20 -0
  23. package/dist/structured_query/index.d.ts +4 -0
  24. package/dist/structured_query/index.js +4 -0
  25. package/dist/structured_query/ir.cjs +141 -0
  26. package/dist/structured_query/ir.d.ts +138 -0
  27. package/dist/structured_query/ir.js +132 -0
  28. package/dist/structured_query/utils.cjs +94 -0
  29. package/dist/structured_query/utils.d.ts +29 -0
  30. package/dist/structured_query/utils.js +85 -0
  31. package/dist/tools.cjs +22 -1
  32. package/dist/tools.d.ts +23 -0
  33. package/dist/tools.js +20 -0
  34. package/package.json +14 -1
  35. package/structured_query.cjs +1 -0
  36. package/structured_query.d.cts +1 -0
  37. package/structured_query.d.ts +1 -0
  38. package/structured_query.js +1 -0
package/dist/tools.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DynamicStructuredTool = exports.DynamicTool = exports.Tool = exports.StructuredTool = exports.ToolInputParsingException = void 0;
3
+ exports.BaseToolkit = exports.DynamicStructuredTool = exports.DynamicTool = exports.Tool = exports.StructuredTool = exports.ToolInputParsingException = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const manager_js_1 = require("./callbacks/manager.cjs");
6
6
  const base_js_1 = require("./language_models/base.cjs");
@@ -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) {
@@ -212,3 +222,14 @@ class DynamicStructuredTool extends StructuredTool {
212
222
  }
213
223
  }
214
224
  exports.DynamicStructuredTool = DynamicStructuredTool;
225
+ /**
226
+ * Abstract base class for toolkits in LangChain. Toolkits are collections
227
+ * of tools that agents can use. Subclasses must implement the `tools`
228
+ * property to provide the specific tools for the toolkit.
229
+ */
230
+ class BaseToolkit {
231
+ getTools() {
232
+ return this.tools;
233
+ }
234
+ }
235
+ exports.BaseToolkit = BaseToolkit;
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,8 +155,20 @@ 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>;
150
164
  protected _call(arg: z.output<T>, runManager?: CallbackManagerForToolRun, config?: RunnableConfig): Promise<string>;
151
165
  }
166
+ /**
167
+ * Abstract base class for toolkits in LangChain. Toolkits are collections
168
+ * of tools that agents can use. Subclasses must implement the `tools`
169
+ * property to provide the specific tools for the toolkit.
170
+ */
171
+ export declare abstract class BaseToolkit {
172
+ abstract tools: StructuredToolInterface[];
173
+ getTools(): StructuredToolInterface[];
174
+ }
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) {
@@ -204,3 +214,13 @@ export class DynamicStructuredTool extends StructuredTool {
204
214
  return this.func(arg, runManager, config);
205
215
  }
206
216
  }
217
+ /**
218
+ * Abstract base class for toolkits in LangChain. Toolkits are collections
219
+ * of tools that agents can use. Subclasses must implement the `tools`
220
+ * property to provide the specific tools for the toolkit.
221
+ */
222
+ export class BaseToolkit {
223
+ getTools() {
224
+ return this.tools;
225
+ }
226
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/core",
3
- "version": "0.1.59",
3
+ "version": "0.1.61",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {
@@ -356,6 +356,15 @@
356
356
  "import": "./stores.js",
357
357
  "require": "./stores.cjs"
358
358
  },
359
+ "./structured_query": {
360
+ "types": {
361
+ "import": "./structured_query.d.ts",
362
+ "require": "./structured_query.d.cts",
363
+ "default": "./structured_query.d.ts"
364
+ },
365
+ "import": "./structured_query.js",
366
+ "require": "./structured_query.cjs"
367
+ },
359
368
  "./tools": {
360
369
  "types": {
361
370
  "import": "./tools.d.ts",
@@ -683,6 +692,10 @@
683
692
  "stores.js",
684
693
  "stores.d.ts",
685
694
  "stores.d.cts",
695
+ "structured_query.cjs",
696
+ "structured_query.js",
697
+ "structured_query.d.ts",
698
+ "structured_query.d.cts",
686
699
  "tools.cjs",
687
700
  "tools.js",
688
701
  "tools.d.ts",
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/structured_query/index.cjs');
@@ -0,0 +1 @@
1
+ export * from './dist/structured_query/index.js'
@@ -0,0 +1 @@
1
+ export * from './dist/structured_query/index.js'
@@ -0,0 +1 @@
1
+ export * from './dist/structured_query/index.js'