@n8n/n8n-nodes-langchain 1.42.0 → 1.43.1

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 (51) hide show
  1. package/dist/build.tsbuildinfo +1 -1
  2. package/dist/nodes/agents/Agent/agents/ConversationalAgent/execute.js +2 -0
  3. package/dist/nodes/agents/Agent/agents/ConversationalAgent/execute.js.map +1 -1
  4. package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/execute.js +2 -0
  5. package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/execute.js.map +1 -1
  6. package/dist/nodes/agents/Agent/agents/ReActAgent/execute.js +2 -0
  7. package/dist/nodes/agents/Agent/agents/ReActAgent/execute.js.map +1 -1
  8. package/dist/nodes/code/Code.node.js +1 -0
  9. package/dist/nodes/code/Code.node.js.map +1 -1
  10. package/dist/nodes/output_parser/OutputParserStructured/OutputParserStructured.node.d.ts +1 -1
  11. package/dist/nodes/output_parser/OutputParserStructured/OutputParserStructured.node.js +51 -48
  12. package/dist/nodes/output_parser/OutputParserStructured/OutputParserStructured.node.js.map +1 -1
  13. package/dist/nodes/tools/ToolWorkflow/ToolWorkflow.node.js +74 -35
  14. package/dist/nodes/tools/ToolWorkflow/ToolWorkflow.node.js.map +1 -1
  15. package/dist/nodes/vendors/OpenAi/actions/assistant/create.operation.d.ts +1 -1
  16. package/dist/nodes/vendors/OpenAi/actions/assistant/create.operation.js +36 -4
  17. package/dist/nodes/vendors/OpenAi/actions/assistant/create.operation.js.map +1 -1
  18. package/dist/nodes/vendors/OpenAi/actions/assistant/deleteAssistant.operation.d.ts +1 -1
  19. package/dist/nodes/vendors/OpenAi/actions/assistant/deleteAssistant.operation.js +1 -1
  20. package/dist/nodes/vendors/OpenAi/actions/assistant/list.operation.d.ts +1 -1
  21. package/dist/nodes/vendors/OpenAi/actions/assistant/list.operation.js +1 -1
  22. package/dist/nodes/vendors/OpenAi/actions/assistant/message.operation.d.ts +1 -1
  23. package/dist/nodes/vendors/OpenAi/actions/assistant/message.operation.js +35 -3
  24. package/dist/nodes/vendors/OpenAi/actions/assistant/message.operation.js.map +1 -1
  25. package/dist/nodes/vendors/OpenAi/actions/assistant/update.operation.d.ts +1 -1
  26. package/dist/nodes/vendors/OpenAi/actions/assistant/update.operation.js +43 -8
  27. package/dist/nodes/vendors/OpenAi/actions/assistant/update.operation.js.map +1 -1
  28. package/dist/nodes/vendors/OpenAi/actions/audio/generate.operation.d.ts +1 -1
  29. package/dist/nodes/vendors/OpenAi/actions/audio/transcribe.operation.d.ts +1 -1
  30. package/dist/nodes/vendors/OpenAi/actions/audio/translate.operation.d.ts +1 -1
  31. package/dist/nodes/vendors/OpenAi/actions/file/deleteFile.operation.d.ts +1 -1
  32. package/dist/nodes/vendors/OpenAi/actions/file/list.operation.d.ts +1 -1
  33. package/dist/nodes/vendors/OpenAi/actions/file/upload.operation.d.ts +1 -1
  34. package/dist/nodes/vendors/OpenAi/actions/image/analyze.operation.d.ts +1 -1
  35. package/dist/nodes/vendors/OpenAi/actions/image/generate.operation.d.ts +1 -1
  36. package/dist/nodes/vendors/OpenAi/actions/text/classify.operation.d.ts +1 -1
  37. package/dist/nodes/vendors/OpenAi/actions/text/message.operation.d.ts +1 -1
  38. package/dist/nodes/vendors/OpenAi/actions/versionDescription.js +1 -0
  39. package/dist/nodes/vendors/OpenAi/actions/versionDescription.js.map +1 -1
  40. package/dist/nodes/vendors/OpenAi/methods/listSearch.js +1 -1
  41. package/dist/types/nodes.json +3 -3
  42. package/dist/types/zod.types.d.ts +2 -0
  43. package/dist/types/zod.types.js +3 -0
  44. package/dist/types/zod.types.js.map +1 -0
  45. package/dist/utils/descriptions.d.ts +3 -0
  46. package/dist/utils/descriptions.js +63 -1
  47. package/dist/utils/descriptions.js.map +1 -1
  48. package/dist/utils/schemaParsing.d.ts +6 -0
  49. package/dist/utils/schemaParsing.js +68 -0
  50. package/dist/utils/schemaParsing.js.map +1 -0
  51. package/package.json +5 -4
@@ -1,6 +1,68 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.textInput = exports.promptTypeOptions = void 0;
3
+ exports.textInput = exports.promptTypeOptions = exports.inputSchemaField = exports.jsonSchemaExampleField = exports.schemaTypeField = void 0;
4
+ exports.schemaTypeField = {
5
+ displayName: 'Schema Type',
6
+ name: 'schemaType',
7
+ type: 'options',
8
+ noDataExpression: true,
9
+ options: [
10
+ {
11
+ name: 'Generate From JSON Example',
12
+ value: 'fromJson',
13
+ description: 'Generate a schema from an example JSON object',
14
+ },
15
+ {
16
+ name: 'Define Below',
17
+ value: 'manual',
18
+ description: 'Define the JSON schema manually',
19
+ },
20
+ ],
21
+ default: 'fromJson',
22
+ description: 'How to specify the schema for the function',
23
+ };
24
+ exports.jsonSchemaExampleField = {
25
+ displayName: 'JSON Example',
26
+ name: 'jsonSchemaExample',
27
+ type: 'json',
28
+ default: `{
29
+ "some_input": "some_value"
30
+ }`,
31
+ noDataExpression: true,
32
+ typeOptions: {
33
+ rows: 10,
34
+ },
35
+ displayOptions: {
36
+ show: {
37
+ schemaType: ['fromJson'],
38
+ },
39
+ },
40
+ description: 'Example JSON object to use to generate the schema',
41
+ };
42
+ exports.inputSchemaField = {
43
+ displayName: 'Input Schema',
44
+ name: 'inputSchema',
45
+ type: 'json',
46
+ default: `{
47
+ "type": "object",
48
+ "properties": {
49
+ "some_input": {
50
+ "type": "string",
51
+ "description": "Some input to the function"
52
+ }
53
+ }
54
+ }`,
55
+ noDataExpression: true,
56
+ typeOptions: {
57
+ rows: 10,
58
+ },
59
+ displayOptions: {
60
+ show: {
61
+ schemaType: ['manual'],
62
+ },
63
+ },
64
+ description: 'Schema to use for the function',
65
+ };
4
66
  exports.promptTypeOptions = {
5
67
  displayName: 'Prompt',
6
68
  name: 'promptType',
@@ -1 +1 @@
1
- {"version":3,"file":"descriptions.js","sourceRoot":"","sources":["../../utils/descriptions.ts"],"names":[],"mappings":";;;AAEa,QAAA,iBAAiB,GAAoB;IACjD,WAAW,EAAE,QAAQ;IACrB,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE;QACR;YAEC,IAAI,EAAE,uCAAuC;YAC7C,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,2CAA2C;SACxD;QACD;YAEC,IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,4EAA4E;SACzF;KACD;IACD,OAAO,EAAE,MAAM;CACf,CAAC;AAEW,QAAA,SAAS,GAAoB;IACzC,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,EAAE;IACX,WAAW,EAAE,kCAAkC;IAC/C,WAAW,EAAE;QACZ,IAAI,EAAE,CAAC;KACP;CACD,CAAC"}
1
+ {"version":3,"file":"descriptions.js","sourceRoot":"","sources":["../../utils/descriptions.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAoB;IAC/C,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE;QACR;YACC,IAAI,EAAE,4BAA4B;YAClC,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,+CAA+C;SAC5D;QACD;YACC,IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,iCAAiC;SAC9C;KACD;IACD,OAAO,EAAE,UAAU;IACnB,WAAW,EAAE,4CAA4C;CACzD,CAAC;AAEW,QAAA,sBAAsB,GAAoB;IACtD,WAAW,EAAE,cAAc;IAC3B,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE;;EAER;IACD,gBAAgB,EAAE,IAAI;IACtB,WAAW,EAAE;QACZ,IAAI,EAAE,EAAE;KACR;IACD,cAAc,EAAE;QACf,IAAI,EAAE;YACL,UAAU,EAAE,CAAC,UAAU,CAAC;SACxB;KACD;IACD,WAAW,EAAE,mDAAmD;CAChE,CAAC;AAEW,QAAA,gBAAgB,GAAoB;IAChD,WAAW,EAAE,cAAc;IAC3B,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE;;;;;;;;EAQR;IACD,gBAAgB,EAAE,IAAI;IACtB,WAAW,EAAE;QACZ,IAAI,EAAE,EAAE;KACR;IACD,cAAc,EAAE;QACf,IAAI,EAAE;YACL,UAAU,EAAE,CAAC,QAAQ,CAAC;SACtB;KACD;IACD,WAAW,EAAE,gCAAgC;CAC7C,CAAC;AAEW,QAAA,iBAAiB,GAAoB;IACjD,WAAW,EAAE,QAAQ;IACrB,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE;QACR;YAEC,IAAI,EAAE,uCAAuC;YAC7C,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,2CAA2C;SACxD;QACD;YAEC,IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,4EAA4E;SACzF;KACD;IACD,OAAO,EAAE,MAAM;CACf,CAAC;AAEW,QAAA,SAAS,GAAoB;IACzC,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,EAAE;IACX,WAAW,EAAE,kCAAkC;IAC/C,WAAW,EAAE;QACZ,IAAI,EAAE,CAAC;KACP;CACD,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { JSONSchema7 } from 'json-schema';
2
+ import { JavaScriptSandbox } from 'n8n-nodes-base/dist/nodes/Code/JavaScriptSandbox';
3
+ import type { IExecuteFunctions } from 'n8n-workflow';
4
+ export declare function getSandboxWithZod(ctx: IExecuteFunctions, schema: JSONSchema7, itemIndex: number): JavaScriptSandbox;
5
+ export declare function generateSchema(schemaString: string): JSONSchema7;
6
+ export declare function throwIfToolSchema(ctx: IExecuteFunctions, error: Error): void;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.throwIfToolSchema = exports.generateSchema = exports.getSandboxWithZod = void 0;
4
+ const vm2_1 = require("@n8n/vm2");
5
+ const generate_schema_1 = require("generate-schema");
6
+ const JavaScriptSandbox_1 = require("n8n-nodes-base/dist/nodes/Code/JavaScriptSandbox");
7
+ const Sandbox_1 = require("n8n-nodes-base/dist/nodes/Code/Sandbox");
8
+ const n8n_workflow_1 = require("n8n-workflow");
9
+ const vmResolver = (0, vm2_1.makeResolverFromLegacyOptions)({
10
+ external: {
11
+ modules: ['json-schema-to-zod', 'zod'],
12
+ transitive: false,
13
+ },
14
+ resolve(moduleName, parentDirname) {
15
+ if (moduleName === 'json-schema-to-zod') {
16
+ return require.resolve('@n8n/n8n-nodes-langchain/node_modules/json-schema-to-zod/dist/cjs/jsonSchemaToZod.js', {
17
+ paths: [parentDirname],
18
+ });
19
+ }
20
+ if (moduleName === 'zod') {
21
+ return require.resolve('@n8n/n8n-nodes-langchain/node_modules/zod.cjs', {
22
+ paths: [parentDirname],
23
+ });
24
+ }
25
+ return;
26
+ },
27
+ builtin: [],
28
+ });
29
+ function getSandboxWithZod(ctx, schema, itemIndex) {
30
+ var _a;
31
+ const context = Sandbox_1.getSandboxContext.call(ctx, itemIndex);
32
+ let itemSchema = schema;
33
+ try {
34
+ if (itemSchema.type === undefined) {
35
+ itemSchema = {
36
+ type: 'object',
37
+ properties: (_a = itemSchema.properties) !== null && _a !== void 0 ? _a : itemSchema,
38
+ };
39
+ }
40
+ }
41
+ catch (error) {
42
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'Error during parsing of JSON Schema.');
43
+ }
44
+ const { description, ...restOfSchema } = itemSchema;
45
+ const sandboxedSchema = new JavaScriptSandbox_1.JavaScriptSandbox(context, `
46
+ const { z } = require('zod');
47
+ const { parseSchema } = require('json-schema-to-zod');
48
+ const zodSchema = parseSchema(${JSON.stringify(restOfSchema)});
49
+ const itemSchema = new Function('z', 'return (' + zodSchema + ')')(z)
50
+ return itemSchema
51
+ `, itemIndex, ctx.helpers, { resolver: vmResolver });
52
+ return sandboxedSchema;
53
+ }
54
+ exports.getSandboxWithZod = getSandboxWithZod;
55
+ function generateSchema(schemaString) {
56
+ const parsedSchema = (0, n8n_workflow_1.jsonParse)(schemaString);
57
+ return (0, generate_schema_1.json)(parsedSchema);
58
+ }
59
+ exports.generateSchema = generateSchema;
60
+ function throwIfToolSchema(ctx, error) {
61
+ var _a;
62
+ if ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('tool input did not match expected schema')) {
63
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `${error.message}.
64
+ This is most likely because some of your tools are configured to require a specific schema. This is not supported by Conversational Agent. Remove the schema from the tool configuration or use Tools agent instead.`);
65
+ }
66
+ }
67
+ exports.throwIfToolSchema = throwIfToolSchema;
68
+ //# sourceMappingURL=schemaParsing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaParsing.js","sourceRoot":"","sources":["../../utils/schemaParsing.ts"],"names":[],"mappings":";;;AAAA,kCAAyD;AACzD,qDAA6D;AAG7D,wFAAqF;AACrF,oEAA2E;AAE3E,+CAA6D;AAE7D,MAAM,UAAU,GAAG,IAAA,mCAA6B,EAAC;IAChD,QAAQ,EAAE;QACT,OAAO,EAAE,CAAC,oBAAoB,EAAE,KAAK,CAAC;QACtC,UAAU,EAAE,KAAK;KACjB;IACD,OAAO,CAAC,UAAU,EAAE,aAAa;QAChC,IAAI,UAAU,KAAK,oBAAoB,EAAE,CAAC;YACzC,OAAO,OAAO,CAAC,OAAO,CACrB,sFAAsF,EACtF;gBACC,KAAK,EAAE,CAAC,aAAa,CAAC;aACtB,CACD,CAAC;QACH,CAAC;QACD,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;YAC1B,OAAO,OAAO,CA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,KAAK,uBAAL,KAAK,CAAE,OAAO,0CAAE,QAAQ,CAAC,0CAA0C,CAAC,EAAE,CAAC;QAC1E,MAAM,IAAI,iCAAkB,CAC3B,GAAG,CAAC,OAAO,EAAE,EACb,GAAG,KAAK,CAAC,OAAO;wNACqM,CACrN,CAAC;IACH,CAAC;AACF,CAAC;AARD,8CAQC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n8n/n8n-nodes-langchain",
3
- "version": "1.42.0",
3
+ "version": "1.43.1",
4
4
  "description": "",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "homepage": "https://n8n.io",
@@ -114,7 +114,7 @@
114
114
  "@types/json-schema": "^7.0.15",
115
115
  "@types/temp": "^0.9.1",
116
116
  "eslint-plugin-n8n-nodes-base": "^1.16.0",
117
- "n8n-core": "1.42.0"
117
+ "n8n-core": "1.43.1"
118
118
  },
119
119
  "dependencies": {
120
120
  "@aws-sdk/client-bedrock-runtime": "3.549.0",
@@ -144,6 +144,7 @@
144
144
  "d3-dsv": "2.0.0",
145
145
  "epub2": "3.0.2",
146
146
  "form-data": "4.0.0",
147
+ "generate-schema": "^2.6.0",
147
148
  "html-to-text": "9.0.5",
148
149
  "jest-mock-extended": "^3.0.4",
149
150
  "json-schema-to-zod": "2.0.14",
@@ -159,8 +160,8 @@
159
160
  "tmp-promise": "3.0.3",
160
161
  "zod": "3.22.4",
161
162
  "zod-to-json-schema": "3.22.4",
162
- "n8n-workflow": "1.41.0",
163
- "n8n-nodes-base": "1.42.0"
163
+ "n8n-workflow": "1.42.1",
164
+ "n8n-nodes-base": "1.43.1"
164
165
  },
165
166
  "scripts": {
166
167
  "clean": "rimraf dist .turbo",