@langchain/core 0.3.51 → 0.3.52
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.
- package/dist/tools/index.cjs +6 -1
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +1 -0
- package/dist/tools/types.cjs +6 -1
- package/dist/tools/types.js +6 -1
- package/package.json +1 -1
package/dist/tools/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tool = exports.BaseToolkit = exports.DynamicStructuredTool = exports.DynamicTool = exports.Tool = exports.StructuredTool = exports.ToolInputParsingException = void 0;
|
|
3
|
+
exports.tool = exports.BaseToolkit = exports.DynamicStructuredTool = exports.DynamicTool = exports.Tool = exports.StructuredTool = exports.ToolInputParsingException = exports.isStructuredToolParams = exports.isStructuredTool = exports.isRunnableToolLike = exports.isLangChainTool = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const json_schema_1 = require("@cfworker/json-schema");
|
|
6
6
|
const manager_js_1 = require("../callbacks/manager.cjs");
|
|
@@ -12,6 +12,11 @@ const utils_js_1 = require("./utils.cjs");
|
|
|
12
12
|
Object.defineProperty(exports, "ToolInputParsingException", { enumerable: true, get: function () { return utils_js_1.ToolInputParsingException; } });
|
|
13
13
|
const is_zod_schema_js_1 = require("../utils/types/is_zod_schema.cjs");
|
|
14
14
|
const json_schema_js_1 = require("../utils/json_schema.cjs");
|
|
15
|
+
var types_js_1 = require("./types.cjs");
|
|
16
|
+
Object.defineProperty(exports, "isLangChainTool", { enumerable: true, get: function () { return types_js_1.isLangChainTool; } });
|
|
17
|
+
Object.defineProperty(exports, "isRunnableToolLike", { enumerable: true, get: function () { return types_js_1.isRunnableToolLike; } });
|
|
18
|
+
Object.defineProperty(exports, "isStructuredTool", { enumerable: true, get: function () { return types_js_1.isStructuredTool; } });
|
|
19
|
+
Object.defineProperty(exports, "isStructuredToolParams", { enumerable: true, get: function () { return types_js_1.isStructuredToolParams; } });
|
|
15
20
|
/**
|
|
16
21
|
* Base class for Tools that accept input of any shape defined by a Zod schema.
|
|
17
22
|
*/
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ import { ToolCall } from "../messages/tool.js";
|
|
|
7
7
|
import { ToolInputParsingException } from "./utils.js";
|
|
8
8
|
import type { StructuredToolCallInput, ToolInputSchemaBase, ToolReturnType, ResponseFormat, ToolInputSchemaInputType, ToolInputSchemaOutputType, ToolParams, ToolRunnableConfig, StructuredToolInterface, DynamicToolInput, DynamicStructuredToolInput, ZodObjectAny } from "./types.js";
|
|
9
9
|
import { type JSONSchema } from "../utils/json_schema.js";
|
|
10
|
-
export type { BaseDynamicToolInput, ContentAndArtifact, DynamicToolInput, DynamicStructuredToolInput,
|
|
10
|
+
export type { BaseDynamicToolInput, ContentAndArtifact, DynamicToolInput, DynamicStructuredToolInput, ResponseFormat, StructuredToolCallInput, StructuredToolInterface, StructuredToolParams, ToolInterface, ToolParams, ToolReturnType, ToolRunnableConfig, ToolInputSchemaBase as ToolSchemaBase, } from "./types.js";
|
|
11
|
+
export { isLangChainTool, isRunnableToolLike, isStructuredTool, isStructuredToolParams, } from "./types.js";
|
|
11
12
|
export { ToolInputParsingException };
|
|
12
13
|
/**
|
|
13
14
|
* Base class for Tools that accept input of any shape defined by a Zod schema.
|
package/dist/tools/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { AsyncLocalStorageProviderSingleton } from "../singletons/index.js";
|
|
|
8
8
|
import { _isToolCall, ToolInputParsingException } from "./utils.js";
|
|
9
9
|
import { isZodSchema } from "../utils/types/is_zod_schema.js";
|
|
10
10
|
import { validatesOnlyStrings } from "../utils/json_schema.js";
|
|
11
|
+
export { isLangChainTool, isRunnableToolLike, isStructuredTool, isStructuredToolParams, } from "./types.js";
|
|
11
12
|
export { ToolInputParsingException };
|
|
12
13
|
/**
|
|
13
14
|
* Base class for Tools that accept input of any shape defined by a Zod schema.
|
package/dist/tools/types.cjs
CHANGED
|
@@ -40,7 +40,12 @@ function isStructuredToolParams(tool) {
|
|
|
40
40
|
"name" in tool &&
|
|
41
41
|
"schema" in tool &&
|
|
42
42
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
-
(0, is_zod_schema_js_1.isZodSchema)(tool.schema)
|
|
43
|
+
((0, is_zod_schema_js_1.isZodSchema)(tool.schema) ||
|
|
44
|
+
(tool.schema != null &&
|
|
45
|
+
typeof tool.schema === "object" &&
|
|
46
|
+
"type" in tool.schema &&
|
|
47
|
+
typeof tool.schema.type === "string" &&
|
|
48
|
+
["null", "boolean", "object", "array", "number", "string"].includes(tool.schema.type))));
|
|
44
49
|
}
|
|
45
50
|
exports.isStructuredToolParams = isStructuredToolParams;
|
|
46
51
|
/**
|
package/dist/tools/types.js
CHANGED
|
@@ -35,7 +35,12 @@ export function isStructuredToolParams(tool) {
|
|
|
35
35
|
"name" in tool &&
|
|
36
36
|
"schema" in tool &&
|
|
37
37
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
-
isZodSchema(tool.schema)
|
|
38
|
+
(isZodSchema(tool.schema) ||
|
|
39
|
+
(tool.schema != null &&
|
|
40
|
+
typeof tool.schema === "object" &&
|
|
41
|
+
"type" in tool.schema &&
|
|
42
|
+
typeof tool.schema.type === "string" &&
|
|
43
|
+
["null", "boolean", "object", "array", "number", "string"].includes(tool.schema.type))));
|
|
39
44
|
}
|
|
40
45
|
/**
|
|
41
46
|
* Whether or not the tool is one of StructuredTool, RunnableTool or StructuredToolParams.
|