@n8n/n8n-nodes-langchain 1.102.0 → 1.103.0

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 (73) hide show
  1. package/dist/known/credentials.json +1 -0
  2. package/dist/known/nodes.json +4 -0
  3. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +7 -2
  4. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js.map +1 -1
  5. package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js +2 -0
  6. package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js.map +1 -1
  7. package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js +55 -5
  8. package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js.map +1 -1
  9. package/dist/nodes/mcp/McpClientTool/loadOptions.js +11 -2
  10. package/dist/nodes/mcp/McpClientTool/loadOptions.js.map +1 -1
  11. package/dist/nodes/mcp/McpClientTool/types.js.map +1 -1
  12. package/dist/nodes/mcp/McpClientTool/utils.js +21 -11
  13. package/dist/nodes/mcp/McpClientTool/utils.js.map +1 -1
  14. package/dist/nodes/tools/ToolThink/ToolThink.node.js +5 -2
  15. package/dist/nodes/tools/ToolThink/ToolThink.node.js.map +1 -1
  16. package/dist/nodes/vendors/Anthropic/Anthropic.node.js +42 -0
  17. package/dist/nodes/vendors/Anthropic/Anthropic.node.js.map +1 -0
  18. package/dist/nodes/vendors/Anthropic/actions/descriptions.js +52 -0
  19. package/dist/nodes/vendors/Anthropic/actions/descriptions.js.map +1 -0
  20. package/dist/nodes/vendors/Anthropic/actions/document/analyze.operation.js +125 -0
  21. package/dist/nodes/vendors/Anthropic/actions/document/analyze.operation.js.map +1 -0
  22. package/dist/nodes/vendors/Anthropic/actions/document/index.js +64 -0
  23. package/dist/nodes/vendors/Anthropic/actions/document/index.js.map +1 -0
  24. package/dist/nodes/vendors/Anthropic/actions/file/delete.operation.js +61 -0
  25. package/dist/nodes/vendors/Anthropic/actions/file/delete.operation.js.map +1 -0
  26. package/dist/nodes/vendors/Anthropic/actions/file/get.operation.js +63 -0
  27. package/dist/nodes/vendors/Anthropic/actions/file/get.operation.js.map +1 -0
  28. package/dist/nodes/vendors/Anthropic/actions/file/index.js +94 -0
  29. package/dist/nodes/vendors/Anthropic/actions/file/index.js.map +1 -0
  30. package/dist/nodes/vendors/Anthropic/actions/file/list.operation.js +108 -0
  31. package/dist/nodes/vendors/Anthropic/actions/file/list.operation.js.map +1 -0
  32. package/dist/nodes/vendors/Anthropic/actions/file/upload.operation.js +126 -0
  33. package/dist/nodes/vendors/Anthropic/actions/file/upload.operation.js.map +1 -0
  34. package/dist/nodes/vendors/Anthropic/actions/image/analyze.operation.js +125 -0
  35. package/dist/nodes/vendors/Anthropic/actions/image/analyze.operation.js.map +1 -0
  36. package/dist/nodes/vendors/Anthropic/actions/image/index.js +64 -0
  37. package/dist/nodes/vendors/Anthropic/actions/image/index.js.map +1 -0
  38. package/dist/nodes/vendors/Anthropic/actions/node.type.js +17 -0
  39. package/dist/nodes/vendors/Anthropic/actions/node.type.js.map +1 -0
  40. package/dist/nodes/vendors/Anthropic/actions/prompt/generate.operation.js +87 -0
  41. package/dist/nodes/vendors/Anthropic/actions/prompt/generate.operation.js.map +1 -0
  42. package/dist/nodes/vendors/Anthropic/actions/prompt/improve.operation.js +154 -0
  43. package/dist/nodes/vendors/Anthropic/actions/prompt/improve.operation.js.map +1 -0
  44. package/dist/nodes/vendors/Anthropic/actions/prompt/index.js +95 -0
  45. package/dist/nodes/vendors/Anthropic/actions/prompt/index.js.map +1 -0
  46. package/dist/nodes/vendors/Anthropic/actions/prompt/templatize.operation.js +146 -0
  47. package/dist/nodes/vendors/Anthropic/actions/prompt/templatize.operation.js.map +1 -0
  48. package/dist/nodes/vendors/Anthropic/actions/router.js +93 -0
  49. package/dist/nodes/vendors/Anthropic/actions/router.js.map +1 -0
  50. package/dist/nodes/vendors/Anthropic/actions/text/index.js +64 -0
  51. package/dist/nodes/vendors/Anthropic/actions/text/index.js.map +1 -0
  52. package/dist/nodes/vendors/Anthropic/actions/text/message.operation.js +540 -0
  53. package/dist/nodes/vendors/Anthropic/actions/text/message.operation.js.map +1 -0
  54. package/dist/nodes/vendors/Anthropic/actions/versionDescription.js +125 -0
  55. package/dist/nodes/vendors/Anthropic/actions/versionDescription.js.map +1 -0
  56. package/dist/nodes/vendors/Anthropic/anthropic.svg +1 -0
  57. package/dist/nodes/vendors/Anthropic/helpers/baseAnalyze.js +109 -0
  58. package/dist/nodes/vendors/Anthropic/helpers/baseAnalyze.js.map +1 -0
  59. package/dist/nodes/vendors/Anthropic/helpers/interfaces.js +17 -0
  60. package/dist/nodes/vendors/Anthropic/helpers/interfaces.js.map +1 -0
  61. package/dist/nodes/vendors/Anthropic/helpers/utils.js +84 -0
  62. package/dist/nodes/vendors/Anthropic/helpers/utils.js.map +1 -0
  63. package/dist/nodes/vendors/Anthropic/methods/index.js +39 -0
  64. package/dist/nodes/vendors/Anthropic/methods/index.js.map +1 -0
  65. package/dist/nodes/vendors/Anthropic/methods/listSearch.js +42 -0
  66. package/dist/nodes/vendors/Anthropic/methods/listSearch.js.map +1 -0
  67. package/dist/nodes/vendors/Anthropic/transport/index.js +57 -0
  68. package/dist/nodes/vendors/Anthropic/transport/index.js.map +1 -0
  69. package/dist/nodes/vendors/OpenAi/actions/router.js +1 -1
  70. package/dist/nodes/vendors/OpenAi/actions/router.js.map +1 -1
  71. package/dist/types/credentials.json +1 -1
  72. package/dist/types/nodes.json +5 -4
  73. package/package.json +5 -4
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var upload_operation_exports = {};
20
+ __export(upload_operation_exports, {
21
+ description: () => description,
22
+ execute: () => execute,
23
+ properties: () => properties
24
+ });
25
+ module.exports = __toCommonJS(upload_operation_exports);
26
+ var import_n8n_workflow = require("n8n-workflow");
27
+ var import_utils = require("../../helpers/utils");
28
+ const properties = [
29
+ {
30
+ displayName: "Input Type",
31
+ name: "inputType",
32
+ type: "options",
33
+ default: "url",
34
+ options: [
35
+ {
36
+ name: "File URL",
37
+ value: "url"
38
+ },
39
+ {
40
+ name: "Binary File",
41
+ value: "binary"
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ displayName: "URL",
47
+ name: "fileUrl",
48
+ type: "string",
49
+ placeholder: "e.g. https://example.com/file.pdf",
50
+ description: "URL of the file to upload",
51
+ default: "",
52
+ displayOptions: {
53
+ show: {
54
+ inputType: ["url"]
55
+ }
56
+ }
57
+ },
58
+ {
59
+ displayName: "Input Data Field Name",
60
+ name: "binaryPropertyName",
61
+ type: "string",
62
+ default: "data",
63
+ placeholder: "e.g. data",
64
+ hint: "The name of the input field containing the binary file data to be processed",
65
+ description: "Name of the binary field which contains the file",
66
+ displayOptions: {
67
+ show: {
68
+ inputType: ["binary"]
69
+ }
70
+ }
71
+ },
72
+ {
73
+ displayName: "Options",
74
+ name: "options",
75
+ type: "collection",
76
+ placeholder: "Add Option",
77
+ default: {},
78
+ options: [
79
+ {
80
+ displayName: "File Name",
81
+ name: "fileName",
82
+ type: "string",
83
+ description: "The file name to use for the uploaded file",
84
+ default: ""
85
+ }
86
+ ]
87
+ }
88
+ ];
89
+ const displayOptions = {
90
+ show: {
91
+ operation: ["upload"],
92
+ resource: ["file"]
93
+ }
94
+ };
95
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
96
+ async function execute(i) {
97
+ const inputType = this.getNodeParameter("inputType", i, "url");
98
+ const fileName = this.getNodeParameter("options.fileName", i, "file");
99
+ const baseUrl = await import_utils.getBaseUrl.call(this);
100
+ let response;
101
+ if (inputType === "url") {
102
+ const fileUrl = this.getNodeParameter("fileUrl", i, "");
103
+ const { fileContent, mimeType } = await import_utils.downloadFile.call(this, fileUrl);
104
+ response = await import_utils.uploadFile.call(this, fileContent, mimeType, fileName);
105
+ } else {
106
+ const binaryPropertyName = this.getNodeParameter("binaryPropertyName", i, "data");
107
+ const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
108
+ const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
109
+ response = await import_utils.uploadFile.call(this, buffer, binaryData.mimeType, fileName);
110
+ }
111
+ return [
112
+ {
113
+ json: { ...response, url: `${baseUrl}/v1/files/${response.id}` },
114
+ pairedItem: {
115
+ item: i
116
+ }
117
+ }
118
+ ];
119
+ }
120
+ // Annotate the CommonJS export names for ESM import in node:
121
+ 0 && (module.exports = {
122
+ description,
123
+ execute,
124
+ properties
125
+ });
126
+ //# sourceMappingURL=upload.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/file/upload.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport type { File } from '../../helpers/interfaces';\nimport { downloadFile, getBaseUrl, uploadFile } from '../../helpers/utils';\n\nexport const properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Input Type',\n\t\tname: 'inputType',\n\t\ttype: 'options',\n\t\tdefault: 'url',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'File URL',\n\t\t\t\tvalue: 'url',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Binary File',\n\t\t\t\tvalue: 'binary',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'URL',\n\t\tname: 'fileUrl',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. https://example.com/file.pdf',\n\t\tdescription: 'URL of the file to upload',\n\t\tdefault: '',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tinputType: ['url'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Input Data Field Name',\n\t\tname: 'binaryPropertyName',\n\t\ttype: 'string',\n\t\tdefault: 'data',\n\t\tplaceholder: 'e.g. data',\n\t\thint: 'The name of the input field containing the binary file data to be processed',\n\t\tdescription: 'Name of the binary field which contains the file',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tinputType: ['binary'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Options',\n\t\tname: 'options',\n\t\ttype: 'collection',\n\t\tplaceholder: 'Add Option',\n\t\tdefault: {},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'File Name',\n\t\t\t\tname: 'fileName',\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription: 'The file name to use for the uploaded file',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['upload'],\n\t\tresource: ['file'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst inputType = this.getNodeParameter('inputType', i, 'url') as string;\n\tconst fileName = this.getNodeParameter('options.fileName', i, 'file') as string;\n\tconst baseUrl = await getBaseUrl.call(this);\n\n\tlet response: File;\n\tif (inputType === 'url') {\n\t\tconst fileUrl = this.getNodeParameter('fileUrl', i, '') as string;\n\t\tconst { fileContent, mimeType } = await downloadFile.call(this, fileUrl);\n\t\tresponse = await uploadFile.call(this, fileContent, mimeType, fileName);\n\t} else {\n\t\tconst binaryPropertyName = this.getNodeParameter('binaryPropertyName', i, 'data');\n\t\tconst binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);\n\t\tconst buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);\n\t\tresponse = await uploadFile.call(this, buffer, binaryData.mimeType, fileName);\n\t}\n\n\treturn [\n\t\t{\n\t\t\tjson: { ...response, url: `${baseUrl}/v1/files/${response.id}` },\n\t\t\tpairedItem: {\n\t\t\t\titem: i,\n\t\t\t},\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAGrC,mBAAqD;AAE9C,MAAM,aAAgC;AAAA,EAC5C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,KAAK;AAAA,MAClB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,QAAQ;AAAA,MACrB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAA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
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var analyze_operation_exports = {};
20
+ __export(analyze_operation_exports, {
21
+ description: () => description,
22
+ execute: () => execute
23
+ });
24
+ module.exports = __toCommonJS(analyze_operation_exports);
25
+ var import_n8n_workflow = require("n8n-workflow");
26
+ var import_baseAnalyze = require("../../helpers/baseAnalyze");
27
+ var import_descriptions = require("../descriptions");
28
+ const properties = [
29
+ import_descriptions.modelRLC,
30
+ {
31
+ displayName: "Text Input",
32
+ name: "text",
33
+ type: "string",
34
+ placeholder: "e.g. What's in this image?",
35
+ default: "What's in this image?",
36
+ typeOptions: {
37
+ rows: 2
38
+ }
39
+ },
40
+ {
41
+ displayName: "Input Type",
42
+ name: "inputType",
43
+ type: "options",
44
+ default: "url",
45
+ options: [
46
+ {
47
+ name: "Image URL(s)",
48
+ value: "url"
49
+ },
50
+ {
51
+ name: "Binary File(s)",
52
+ value: "binary"
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ displayName: "URL(s)",
58
+ name: "imageUrls",
59
+ type: "string",
60
+ placeholder: "e.g. https://example.com/image.png",
61
+ description: "URL(s) of the image(s) to analyze, multiple URLs can be added separated by comma",
62
+ default: "",
63
+ displayOptions: {
64
+ show: {
65
+ inputType: ["url"]
66
+ }
67
+ }
68
+ },
69
+ {
70
+ displayName: "Input Data Field Name(s)",
71
+ name: "binaryPropertyName",
72
+ type: "string",
73
+ default: "data",
74
+ placeholder: "e.g. data",
75
+ hint: "The name of the input field containing the binary file data to be processed",
76
+ description: "Name of the binary field(s) which contains the image(s), seperate multiple field names with commas",
77
+ displayOptions: {
78
+ show: {
79
+ inputType: ["binary"]
80
+ }
81
+ }
82
+ },
83
+ {
84
+ displayName: "Simplify Output",
85
+ name: "simplify",
86
+ type: "boolean",
87
+ default: true,
88
+ description: "Whether to simplify the response or not"
89
+ },
90
+ {
91
+ displayName: "Options",
92
+ name: "options",
93
+ placeholder: "Add Option",
94
+ type: "collection",
95
+ default: {},
96
+ options: [
97
+ {
98
+ displayName: "Length of Description (Max Tokens)",
99
+ description: "Fewer tokens will result in shorter, less detailed image description",
100
+ name: "maxTokens",
101
+ type: "number",
102
+ default: 1024,
103
+ typeOptions: {
104
+ minValue: 1
105
+ }
106
+ }
107
+ ]
108
+ }
109
+ ];
110
+ const displayOptions = {
111
+ show: {
112
+ operation: ["analyze"],
113
+ resource: ["image"]
114
+ }
115
+ };
116
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
117
+ async function execute(i) {
118
+ return await import_baseAnalyze.baseAnalyze.call(this, i, "imageUrls", "image");
119
+ }
120
+ // Annotate the CommonJS export names for ESM import in node:
121
+ 0 && (module.exports = {
122
+ description,
123
+ execute
124
+ });
125
+ //# sourceMappingURL=analyze.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/image/analyze.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport { baseAnalyze } from '../../helpers/baseAnalyze';\nimport { modelRLC } from '../descriptions';\n\nconst properties: INodeProperties[] = [\n\tmodelRLC,\n\t{\n\t\tdisplayName: 'Text Input',\n\t\tname: 'text',\n\t\ttype: 'string',\n\t\tplaceholder: \"e.g. What's in this image?\",\n\t\tdefault: \"What's in this image?\",\n\t\ttypeOptions: {\n\t\t\trows: 2,\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Input Type',\n\t\tname: 'inputType',\n\t\ttype: 'options',\n\t\tdefault: 'url',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Image URL(s)',\n\t\t\t\tvalue: 'url',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Binary File(s)',\n\t\t\t\tvalue: 'binary',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'URL(s)',\n\t\tname: 'imageUrls',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. https://example.com/image.png',\n\t\tdescription: 'URL(s) of the image(s) to analyze, multiple URLs can be added separated by comma',\n\t\tdefault: '',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tinputType: ['url'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Input Data Field Name(s)',\n\t\tname: 'binaryPropertyName',\n\t\ttype: 'string',\n\t\tdefault: 'data',\n\t\tplaceholder: 'e.g. data',\n\t\thint: 'The name of the input field containing the binary file data to be processed',\n\t\tdescription:\n\t\t\t'Name of the binary field(s) which contains the image(s), seperate multiple field names with commas',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tinputType: ['binary'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Simplify Output',\n\t\tname: 'simplify',\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t\tdescription: 'Whether to simplify the response or not',\n\t},\n\t{\n\t\tdisplayName: 'Options',\n\t\tname: 'options',\n\t\tplaceholder: 'Add Option',\n\t\ttype: 'collection',\n\t\tdefault: {},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Length of Description (Max Tokens)',\n\t\t\t\tdescription: 'Fewer tokens will result in shorter, less detailed image description',\n\t\t\t\tname: 'maxTokens',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 1024,\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['analyze'],\n\t\tresource: ['image'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\treturn await baseAnalyze.call(this, i, 'imageUrls', 'image');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAErC,yBAA4B;AAC5B,0BAAyB;AAEzB,MAAM,aAAgC;AAAA,EACrC;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS;AAAA,IACT,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,KAAK;AAAA,MAClB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM;AAAA,IACN,aACC;AAAA,IACD,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,QAAQ;AAAA,MACrB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,EACd;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,IACV,SAAS;AAAA,MACR;AAAA,QACC,aAAa;AAAA,QACb,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,aAAa;AAAA,UACZ,UAAU;AAAA,QACX;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,WAAW,CAAC,SAAS;AAAA,IACrB,UAAU,CAAC,OAAO;AAAA,EACnB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;AAE1E,eAAsB,QAAiC,GAA0C;AAChG,SAAO,MAAM,+BAAY,KAAK,MAAM,GAAG,aAAa,OAAO;AAC5D;","names":[]}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var image_exports = {};
30
+ __export(image_exports, {
31
+ analyze: () => analyze,
32
+ description: () => description
33
+ });
34
+ module.exports = __toCommonJS(image_exports);
35
+ var analyze = __toESM(require("./analyze.operation"));
36
+ const description = [
37
+ {
38
+ displayName: "Operation",
39
+ name: "operation",
40
+ type: "options",
41
+ noDataExpression: true,
42
+ options: [
43
+ {
44
+ name: "Analyze Image",
45
+ value: "analyze",
46
+ action: "Analyze image",
47
+ description: "Take in images and answer questions about them"
48
+ }
49
+ ],
50
+ default: "analyze",
51
+ displayOptions: {
52
+ show: {
53
+ resource: ["image"]
54
+ }
55
+ }
56
+ },
57
+ ...analyze.description
58
+ ];
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ analyze,
62
+ description
63
+ });
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/image/index.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as analyze from './analyze.operation';\n\nexport { analyze };\n\nexport const description: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Operation',\n\t\tname: 'operation',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Analyze Image',\n\t\t\t\tvalue: 'analyze',\n\t\t\t\taction: 'Analyze image',\n\t\t\t\tdescription: 'Take in images and answer questions about them',\n\t\t\t},\n\t\t],\n\t\tdefault: 'analyze',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['image'],\n\t\t\t},\n\t\t},\n\t},\n\t...analyze.description,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,cAAyB;AAIlB,MAAM,cAAiC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,aAAa;AAAA,MACd;AAAA,IACD;AAAA,IACA,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,OAAO;AAAA,MACnB;AAAA,IACD;AAAA,EACD;AAAA,EACA,GAAG,QAAQ;AACZ;","names":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var node_type_exports = {};
16
+ module.exports = __toCommonJS(node_type_exports);
17
+ //# sourceMappingURL=node.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../nodes/vendors/Anthropic/actions/node.type.ts"],"sourcesContent":["import type { AllEntities } from 'n8n-workflow';\n\ntype NodeMap = {\n\ttext: 'message';\n\timage: 'analyze';\n\tdocument: 'analyze';\n\tfile: 'upload' | 'deleteFile' | 'get' | 'list';\n\tprompt: 'generate' | 'improve' | 'templatize';\n};\n\nexport type AnthropicType = AllEntities<NodeMap>;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var generate_operation_exports = {};
20
+ __export(generate_operation_exports, {
21
+ description: () => description,
22
+ execute: () => execute
23
+ });
24
+ module.exports = __toCommonJS(generate_operation_exports);
25
+ var import_n8n_workflow = require("n8n-workflow");
26
+ var import_transport = require("../../transport");
27
+ const properties = [
28
+ {
29
+ displayName: "Task",
30
+ name: "task",
31
+ type: "string",
32
+ description: "Description of the prompt's purpose",
33
+ placeholder: "e.g. A chef for a meal prep planning service",
34
+ default: "",
35
+ typeOptions: {
36
+ rows: 2
37
+ }
38
+ },
39
+ {
40
+ displayName: "Simplify Output",
41
+ name: "simplify",
42
+ type: "boolean",
43
+ default: true,
44
+ description: "Whether to return a simplified version of the response instead of the raw data"
45
+ }
46
+ ];
47
+ const displayOptions = {
48
+ show: {
49
+ operation: ["generate"],
50
+ resource: ["prompt"]
51
+ }
52
+ };
53
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
54
+ async function execute(i) {
55
+ const task = this.getNodeParameter("task", i, "");
56
+ const simplify = this.getNodeParameter("simplify", i, true);
57
+ const body = {
58
+ task
59
+ };
60
+ const response = await import_transport.apiRequest.call(this, "POST", "/v1/experimental/generate_prompt", {
61
+ body,
62
+ enableAnthropicBetas: { promptTools: true }
63
+ });
64
+ if (simplify) {
65
+ return [
66
+ {
67
+ json: {
68
+ messages: response.messages,
69
+ system: response.system
70
+ },
71
+ pairedItem: { item: i }
72
+ }
73
+ ];
74
+ }
75
+ return [
76
+ {
77
+ json: { ...response },
78
+ pairedItem: { item: i }
79
+ }
80
+ ];
81
+ }
82
+ // Annotate the CommonJS export names for ESM import in node:
83
+ 0 && (module.exports = {
84
+ description,
85
+ execute
86
+ });
87
+ //# sourceMappingURL=generate.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/prompt/generate.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport type { PromptResponse } from '../../helpers/interfaces';\nimport { apiRequest } from '../../transport';\n\nconst properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Task',\n\t\tname: 'task',\n\t\ttype: 'string',\n\t\tdescription: \"Description of the prompt's purpose\",\n\t\tplaceholder: 'e.g. A chef for a meal prep planning service',\n\t\tdefault: '',\n\t\ttypeOptions: {\n\t\t\trows: 2,\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Simplify Output',\n\t\tname: 'simplify',\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t\tdescription: 'Whether to return a simplified version of the response instead of the raw data',\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['generate'],\n\t\tresource: ['prompt'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst task = this.getNodeParameter('task', i, '') as string;\n\tconst simplify = this.getNodeParameter('simplify', i, true) as boolean;\n\n\tconst body = {\n\t\ttask,\n\t};\n\tconst response = (await apiRequest.call(this, 'POST', '/v1/experimental/generate_prompt', {\n\t\tbody,\n\t\tenableAnthropicBetas: { promptTools: true },\n\t})) as PromptResponse;\n\n\tif (simplify) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tjson: {\n\t\t\t\t\tmessages: response.messages,\n\t\t\t\t\tsystem: response.system,\n\t\t\t\t},\n\t\t\t\tpairedItem: { item: i },\n\t\t\t},\n\t\t];\n\t}\n\n\treturn [\n\t\t{\n\t\t\tjson: { ...response },\n\t\t\tpairedItem: { item: i },\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAGrC,uBAA2B;AAE3B,MAAM,aAAgC;AAAA,EACrC;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,IACT,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,EACd;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,WAAW,CAAC,UAAU;AAAA,IACtB,UAAU,CAAC,QAAQ;AAAA,EACpB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;AAE1E,eAAsB,QAAiC,GAA0C;AAChG,QAAM,OAAO,KAAK,iBAAiB,QAAQ,GAAG,EAAE;AAChD,QAAM,WAAW,KAAK,iBAAiB,YAAY,GAAG,IAAI;AAE1D,QAAM,OAAO;AAAA,IACZ;AAAA,EACD;AACA,QAAM,WAAY,MAAM,4BAAW,KAAK,MAAM,QAAQ,oCAAoC;AAAA,IACzF;AAAA,IACA,sBAAsB,EAAE,aAAa,KAAK;AAAA,EAC3C,CAAC;AAED,MAAI,UAAU;AACb,WAAO;AAAA,MACN;AAAA,QACC,MAAM;AAAA,UACL,UAAU,SAAS;AAAA,UACnB,QAAQ,SAAS;AAAA,QAClB;AAAA,QACA,YAAY,EAAE,MAAM,EAAE;AAAA,MACvB;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AAAA,IACN;AAAA,MACC,MAAM,EAAE,GAAG,SAAS;AAAA,MACpB,YAAY,EAAE,MAAM,EAAE;AAAA,IACvB;AAAA,EACD;AACD;","names":[]}
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var improve_operation_exports = {};
20
+ __export(improve_operation_exports, {
21
+ description: () => description,
22
+ execute: () => execute
23
+ });
24
+ module.exports = __toCommonJS(improve_operation_exports);
25
+ var import_n8n_workflow = require("n8n-workflow");
26
+ var import_transport = require("../../transport");
27
+ const properties = [
28
+ {
29
+ displayName: "Messages",
30
+ name: "messages",
31
+ type: "fixedCollection",
32
+ typeOptions: {
33
+ sortable: true,
34
+ multipleValues: true
35
+ },
36
+ description: "Messages that constitute the prompt to be improved",
37
+ placeholder: "Add Message",
38
+ default: { values: [{ content: "", role: "user" }] },
39
+ options: [
40
+ {
41
+ displayName: "Values",
42
+ name: "values",
43
+ values: [
44
+ {
45
+ displayName: "Prompt",
46
+ name: "content",
47
+ type: "string",
48
+ description: "The content of the message to be sent",
49
+ default: "",
50
+ placeholder: "e.g. Concise instructions for a meal prep service",
51
+ typeOptions: {
52
+ rows: 2
53
+ }
54
+ },
55
+ {
56
+ displayName: "Role",
57
+ name: "role",
58
+ type: "options",
59
+ description: "Role in shaping the model's response, it tells the model how it should behave and interact with the user",
60
+ options: [
61
+ {
62
+ name: "User",
63
+ value: "user",
64
+ description: "Send a message as a user and get a response from the model"
65
+ },
66
+ {
67
+ name: "Assistant",
68
+ value: "assistant",
69
+ description: "Tell the model to adopt a specific tone or personality"
70
+ }
71
+ ],
72
+ default: "user"
73
+ }
74
+ ]
75
+ }
76
+ ]
77
+ },
78
+ {
79
+ displayName: "Simplify Output",
80
+ name: "simplify",
81
+ type: "boolean",
82
+ default: true,
83
+ description: "Whether to return a simplified version of the response instead of the raw data"
84
+ },
85
+ {
86
+ displayName: "Options",
87
+ name: "options",
88
+ placeholder: "Add Option",
89
+ type: "collection",
90
+ default: {},
91
+ options: [
92
+ {
93
+ displayName: "System Message",
94
+ name: "system",
95
+ type: "string",
96
+ description: "The existing system prompt to incorporate, if any",
97
+ default: "",
98
+ placeholder: "e.g. You are a professional meal prep chef"
99
+ },
100
+ {
101
+ displayName: "Feedback",
102
+ name: "feedback",
103
+ type: "string",
104
+ description: "Feedback for improving the prompt",
105
+ default: "",
106
+ placeholder: "e.g. Make it more detailed and include cooking times"
107
+ }
108
+ ]
109
+ }
110
+ ];
111
+ const displayOptions = {
112
+ show: {
113
+ operation: ["improve"],
114
+ resource: ["prompt"]
115
+ }
116
+ };
117
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
118
+ async function execute(i) {
119
+ const messages = this.getNodeParameter("messages.values", i, []);
120
+ const simplify = this.getNodeParameter("simplify", i, true);
121
+ const options = this.getNodeParameter("options", i, {});
122
+ const body = {
123
+ messages,
124
+ system: options.system,
125
+ feedback: options.feedback
126
+ };
127
+ const response = await import_transport.apiRequest.call(this, "POST", "/v1/experimental/improve_prompt", {
128
+ body,
129
+ enableAnthropicBetas: { promptTools: true }
130
+ });
131
+ if (simplify) {
132
+ return [
133
+ {
134
+ json: {
135
+ messages: response.messages,
136
+ system: response.system
137
+ },
138
+ pairedItem: { item: i }
139
+ }
140
+ ];
141
+ }
142
+ return [
143
+ {
144
+ json: { ...response },
145
+ pairedItem: { item: i }
146
+ }
147
+ ];
148
+ }
149
+ // Annotate the CommonJS export names for ESM import in node:
150
+ 0 && (module.exports = {
151
+ description,
152
+ execute
153
+ });
154
+ //# sourceMappingURL=improve.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/prompt/improve.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport type { Message, PromptResponse } from '../../helpers/interfaces';\nimport { apiRequest } from '../../transport';\n\nconst properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Messages',\n\t\tname: 'messages',\n\t\ttype: 'fixedCollection',\n\t\ttypeOptions: {\n\t\t\tsortable: true,\n\t\t\tmultipleValues: true,\n\t\t},\n\t\tdescription: 'Messages that constitute the prompt to be improved',\n\t\tplaceholder: 'Add Message',\n\t\tdefault: { values: [{ content: '', role: 'user' }] },\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Values',\n\t\t\t\tname: 'values',\n\t\t\t\tvalues: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Prompt',\n\t\t\t\t\t\tname: 'content',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'The content of the message to be sent',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\tplaceholder: 'e.g. Concise instructions for a meal prep service',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\trows: 2,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Role',\n\t\t\t\t\t\tname: 'role',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\"Role in shaping the model's response, it tells the model how it should behave and interact with the user\",\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'User',\n\t\t\t\t\t\t\t\tvalue: 'user',\n\t\t\t\t\t\t\t\tdescription: 'Send a message as a user and get a response from the model',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Assistant',\n\t\t\t\t\t\t\t\tvalue: 'assistant',\n\t\t\t\t\t\t\t\tdescription: 'Tell the model to adopt a specific tone or personality',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tdefault: 'user',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'Simplify Output',\n\t\tname: 'simplify',\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t\tdescription: 'Whether to return a simplified version of the response instead of the raw data',\n\t},\n\t{\n\t\tdisplayName: 'Options',\n\t\tname: 'options',\n\t\tplaceholder: 'Add Option',\n\t\ttype: 'collection',\n\t\tdefault: {},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'System Message',\n\t\t\t\tname: 'system',\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription: 'The existing system prompt to incorporate, if any',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. You are a professional meal prep chef',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Feedback',\n\t\t\t\tname: 'feedback',\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription: 'Feedback for improving the prompt',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. Make it more detailed and include cooking times',\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['improve'],\n\t\tresource: ['prompt'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst messages = this.getNodeParameter('messages.values', i, []) as Message[];\n\tconst simplify = this.getNodeParameter('simplify', i, true) as boolean;\n\tconst options = this.getNodeParameter('options', i, {});\n\n\tconst body = {\n\t\tmessages,\n\t\tsystem: options.system,\n\t\tfeedback: options.feedback,\n\t};\n\tconst response = (await apiRequest.call(this, 'POST', '/v1/experimental/improve_prompt', {\n\t\tbody,\n\t\tenableAnthropicBetas: { promptTools: true },\n\t})) as PromptResponse;\n\n\tif (simplify) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tjson: {\n\t\t\t\t\tmessages: response.messages,\n\t\t\t\t\tsystem: response.system,\n\t\t\t\t},\n\t\t\t\tpairedItem: { item: i },\n\t\t\t},\n\t\t];\n\t}\n\n\treturn [\n\t\t{\n\t\t\tjson: { ...response },\n\t\t\tpairedItem: { item: i },\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAGrC,uBAA2B;AAE3B,MAAM,aAAgC;AAAA,EACrC;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,MACZ,UAAU;AAAA,MACV,gBAAgB;AAAA,IACjB;AAAA,IACA,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS,EAAE,QAAQ,CAAC,EAAE,SAAS,IAAI,MAAM,OAAO,CAAC,EAAE;AAAA,IACnD,SAAS;AAAA,MACR;AA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