@langchain/core 0.3.35 → 0.3.36

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.
@@ -19,13 +19,18 @@ class StructuredTool extends base_js_1.BaseLangChain {
19
19
  }
20
20
  constructor(fields) {
21
21
  super(fields ?? {});
22
+ /**
23
+ * Whether to return the tool's output directly.
24
+ *
25
+ * Setting this to true means that after the tool is called,
26
+ * an agent should stop looping.
27
+ */
22
28
  Object.defineProperty(this, "returnDirect", {
23
29
  enumerable: true,
24
30
  configurable: true,
25
31
  writable: true,
26
32
  value: false
27
33
  });
28
- // TODO: Make default in 0.3
29
34
  Object.defineProperty(this, "verboseParsingErrors", {
30
35
  enumerable: true,
31
36
  configurable: true,
@@ -74,6 +74,12 @@ export interface StructuredToolInterface<T extends ZodObjectAny = ZodObjectAny>
74
74
  * A description of the tool.
75
75
  */
76
76
  description: string;
77
+ /**
78
+ * Whether to return the tool's output directly.
79
+ *
80
+ * Setting this to true means that after the tool is called,
81
+ * an agent should stop looping.
82
+ */
77
83
  returnDirect: boolean;
78
84
  }
79
85
  /**
@@ -83,6 +89,12 @@ export declare abstract class StructuredTool<T extends ZodObjectAny = ZodObjectA
83
89
  abstract name: string;
84
90
  abstract description: string;
85
91
  abstract schema: T | z.ZodEffects<T>;
92
+ /**
93
+ * Whether to return the tool's output directly.
94
+ *
95
+ * Setting this to true means that after the tool is called,
96
+ * an agent should stop looping.
97
+ */
86
98
  returnDirect: boolean;
87
99
  verboseParsingErrors: boolean;
88
100
  get lc_namespace(): string[];
@@ -160,6 +172,12 @@ export declare abstract class Tool extends StructuredTool<ZodObjectAny> {
160
172
  export interface BaseDynamicToolInput extends ToolParams {
161
173
  name: string;
162
174
  description: string;
175
+ /**
176
+ * Whether to return the tool's output directly.
177
+ *
178
+ * Setting this to true means that after the tool is called,
179
+ * an agent should stop looping.
180
+ */
163
181
  returnDirect?: boolean;
164
182
  }
165
183
  /**
@@ -257,6 +275,13 @@ interface ToolWrapperParams<RunInput extends ZodObjectAny | z.ZodString | Record
257
275
  * @default "content"
258
276
  */
259
277
  responseFormat?: ResponseFormat;
278
+ /**
279
+ * Whether to return the tool's output directly.
280
+ *
281
+ * Setting this to true means that after the tool is called,
282
+ * an agent should stop looping.
283
+ */
284
+ returnDirect?: boolean;
260
285
  }
261
286
  /**
262
287
  * Creates a new StructuredTool instance with the provided function, name, description, and schema.
@@ -16,13 +16,18 @@ export class StructuredTool extends BaseLangChain {
16
16
  }
17
17
  constructor(fields) {
18
18
  super(fields ?? {});
19
+ /**
20
+ * Whether to return the tool's output directly.
21
+ *
22
+ * Setting this to true means that after the tool is called,
23
+ * an agent should stop looping.
24
+ */
19
25
  Object.defineProperty(this, "returnDirect", {
20
26
  enumerable: true,
21
27
  configurable: true,
22
28
  writable: true,
23
29
  value: false
24
30
  });
25
- // TODO: Make default in 0.3
26
31
  Object.defineProperty(this, "verboseParsingErrors", {
27
32
  enumerable: true,
28
33
  configurable: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/core",
3
- "version": "0.3.35",
3
+ "version": "0.3.36",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {