@langchain/core 0.2.24 → 0.2.26
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.
|
@@ -113,7 +113,7 @@ export type BaseLanguageModelInput = BasePromptValueInterface | string | BaseMes
|
|
|
113
113
|
export type StructuredOutputType = z.infer<z.ZodObject<any, any, any, any>>;
|
|
114
114
|
export type StructuredOutputMethodOptions<IncludeRaw extends boolean = false> = {
|
|
115
115
|
name?: string;
|
|
116
|
-
method?: "functionCalling" | "jsonMode";
|
|
116
|
+
method?: "functionCalling" | "jsonMode" | "jsonSchema" | string;
|
|
117
117
|
includeRaw?: IncludeRaw;
|
|
118
118
|
};
|
|
119
119
|
/** @deprecated Use StructuredOutputMethodOptions instead */
|
package/dist/tools/index.cjs
CHANGED
|
@@ -250,7 +250,7 @@ class DynamicStructuredTool extends StructuredTool {
|
|
|
250
250
|
this.description = fields.description;
|
|
251
251
|
this.func = fields.func;
|
|
252
252
|
this.returnDirect = fields.returnDirect ?? this.returnDirect;
|
|
253
|
-
this.schema = ((0, is_zod_schema_js_1.isZodSchema)(fields.schema) ? fields.schema : zod_1.z.object({}));
|
|
253
|
+
this.schema = ((0, is_zod_schema_js_1.isZodSchema)(fields.schema) ? fields.schema : zod_1.z.object({}).passthrough());
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
256
256
|
* @deprecated Use .invoke() instead. Will be removed in 0.3.0.
|
|
@@ -283,7 +283,9 @@ class BaseToolkit {
|
|
|
283
283
|
exports.BaseToolkit = BaseToolkit;
|
|
284
284
|
function tool(func, fields) {
|
|
285
285
|
// If the schema is not provided, or it's a string schema, create a DynamicTool
|
|
286
|
-
if (!fields.schema ||
|
|
286
|
+
if (!fields.schema ||
|
|
287
|
+
((0, is_zod_schema_js_1.isZodSchema)(fields.schema) &&
|
|
288
|
+
(!("shape" in fields.schema) || !fields.schema.shape))) {
|
|
287
289
|
return new DynamicTool({
|
|
288
290
|
...fields,
|
|
289
291
|
description: fields.description ??
|
package/dist/tools/index.js
CHANGED
|
@@ -244,7 +244,7 @@ export class DynamicStructuredTool extends StructuredTool {
|
|
|
244
244
|
this.description = fields.description;
|
|
245
245
|
this.func = fields.func;
|
|
246
246
|
this.returnDirect = fields.returnDirect ?? this.returnDirect;
|
|
247
|
-
this.schema = (isZodSchema(fields.schema) ? fields.schema : z.object({}));
|
|
247
|
+
this.schema = (isZodSchema(fields.schema) ? fields.schema : z.object({}).passthrough());
|
|
248
248
|
}
|
|
249
249
|
/**
|
|
250
250
|
* @deprecated Use .invoke() instead. Will be removed in 0.3.0.
|
|
@@ -275,7 +275,9 @@ export class BaseToolkit {
|
|
|
275
275
|
}
|
|
276
276
|
export function tool(func, fields) {
|
|
277
277
|
// If the schema is not provided, or it's a string schema, create a DynamicTool
|
|
278
|
-
if (!fields.schema ||
|
|
278
|
+
if (!fields.schema ||
|
|
279
|
+
(isZodSchema(fields.schema) &&
|
|
280
|
+
(!("shape" in fields.schema) || !fields.schema.shape))) {
|
|
279
281
|
return new DynamicTool({
|
|
280
282
|
...fields,
|
|
281
283
|
description: fields.description ??
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.26",
|
|
4
4
|
"description": "Core LangChain.js abstractions and schemas",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@jest/globals": "^29.5.0",
|
|
58
|
-
"@langchain/scripts": "
|
|
58
|
+
"@langchain/scripts": "^0.0.21",
|
|
59
59
|
"@swc/core": "^1.3.90",
|
|
60
60
|
"@swc/jest": "^0.2.29",
|
|
61
61
|
"@types/decamelize": "^1.2.0",
|