@n8n/n8n-nodes-langchain 1.101.2 → 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 (174) hide show
  1. package/dist/credentials/CohereApi.credentials.js +7 -1
  2. package/dist/credentials/CohereApi.credentials.js.map +1 -1
  3. package/dist/known/credentials.json +3 -0
  4. package/dist/known/nodes.json +16 -0
  5. package/dist/nodes/agents/Agent/Agent.node.js +1 -0
  6. package/dist/nodes/agents/Agent/Agent.node.js.map +1 -1
  7. package/dist/nodes/agents/Agent/AgentTool.node.js +57 -0
  8. package/dist/nodes/agents/Agent/AgentTool.node.js.map +1 -0
  9. package/dist/nodes/agents/Agent/V2/AgentToolV2.node.js +104 -0
  10. package/dist/nodes/agents/Agent/V2/AgentToolV2.node.js.map +1 -0
  11. package/dist/nodes/agents/Agent/V2/AgentV2.node.js +4 -66
  12. package/dist/nodes/agents/Agent/V2/AgentV2.node.js.map +1 -1
  13. package/dist/nodes/agents/Agent/V2/utils.js +92 -0
  14. package/dist/nodes/agents/Agent/V2/utils.js.map +1 -0
  15. package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/description.js +13 -10
  16. package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/description.js.map +1 -1
  17. package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/execute.js +14 -7
  18. package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/execute.js.map +1 -1
  19. package/dist/nodes/agents/Agent/agents/ToolsAgent/common.js.map +1 -1
  20. package/dist/nodes/chains/SentimentAnalysis/SentimentAnalysis.node.js +1 -1
  21. package/dist/nodes/chains/SentimentAnalysis/SentimentAnalysis.node.js.map +1 -1
  22. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +13 -2
  23. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js.map +1 -1
  24. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js +2 -2
  25. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js.map +1 -1
  26. package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js +2 -0
  27. package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js.map +1 -1
  28. package/dist/nodes/llms/LmChatCohere/LmChatCohere.node.js +181 -0
  29. package/dist/nodes/llms/LmChatCohere/LmChatCohere.node.js.map +1 -0
  30. package/dist/nodes/llms/LmChatCohere/cohere.dark.svg +5 -0
  31. package/dist/nodes/llms/LmChatCohere/cohere.svg +5 -0
  32. package/dist/nodes/llms/N8nLlmTracing.js +4 -4
  33. package/dist/nodes/llms/N8nLlmTracing.js.map +1 -1
  34. package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js +55 -5
  35. package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js.map +1 -1
  36. package/dist/nodes/mcp/McpClientTool/loadOptions.js +11 -2
  37. package/dist/nodes/mcp/McpClientTool/loadOptions.js.map +1 -1
  38. package/dist/nodes/mcp/McpClientTool/types.js.map +1 -1
  39. package/dist/nodes/mcp/McpClientTool/utils.js +21 -11
  40. package/dist/nodes/mcp/McpClientTool/utils.js.map +1 -1
  41. package/dist/nodes/mcp/McpTrigger/McpTrigger.node.js +1 -1
  42. package/dist/nodes/mcp/McpTrigger/McpTrigger.node.js.map +1 -1
  43. package/dist/nodes/tools/ToolCode/ToolCode.node.js +1 -2
  44. package/dist/nodes/tools/ToolCode/ToolCode.node.js.map +1 -1
  45. package/dist/nodes/tools/ToolThink/ToolThink.node.js +5 -2
  46. package/dist/nodes/tools/ToolThink/ToolThink.node.js.map +1 -1
  47. package/dist/nodes/tools/ToolVectorStore/ToolVectorStore.node.js +1 -2
  48. package/dist/nodes/tools/ToolVectorStore/ToolVectorStore.node.js.map +1 -1
  49. package/dist/nodes/tools/ToolWorkflow/v2/ToolWorkflowV2.node.js +2 -2
  50. package/dist/nodes/tools/ToolWorkflow/v2/ToolWorkflowV2.node.js.map +1 -1
  51. package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js +2 -1
  52. package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js.map +1 -1
  53. package/dist/nodes/trigger/ChatTrigger/templates.js +3 -1
  54. package/dist/nodes/trigger/ChatTrigger/templates.js.map +1 -1
  55. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js +2 -1
  56. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js.map +1 -1
  57. package/dist/nodes/vendors/Anthropic/Anthropic.node.js +42 -0
  58. package/dist/nodes/vendors/Anthropic/Anthropic.node.js.map +1 -0
  59. package/dist/nodes/vendors/Anthropic/actions/descriptions.js +52 -0
  60. package/dist/nodes/vendors/Anthropic/actions/descriptions.js.map +1 -0
  61. package/dist/nodes/vendors/Anthropic/actions/document/analyze.operation.js +125 -0
  62. package/dist/nodes/vendors/Anthropic/actions/document/analyze.operation.js.map +1 -0
  63. package/dist/nodes/vendors/Anthropic/actions/document/index.js +64 -0
  64. package/dist/nodes/vendors/Anthropic/actions/document/index.js.map +1 -0
  65. package/dist/nodes/vendors/Anthropic/actions/file/delete.operation.js +61 -0
  66. package/dist/nodes/vendors/Anthropic/actions/file/delete.operation.js.map +1 -0
  67. package/dist/nodes/vendors/Anthropic/actions/file/get.operation.js +63 -0
  68. package/dist/nodes/vendors/Anthropic/actions/file/get.operation.js.map +1 -0
  69. package/dist/nodes/vendors/Anthropic/actions/file/index.js +94 -0
  70. package/dist/nodes/vendors/Anthropic/actions/file/index.js.map +1 -0
  71. package/dist/nodes/vendors/Anthropic/actions/file/list.operation.js +108 -0
  72. package/dist/nodes/vendors/Anthropic/actions/file/list.operation.js.map +1 -0
  73. package/dist/nodes/vendors/Anthropic/actions/file/upload.operation.js +126 -0
  74. package/dist/nodes/vendors/Anthropic/actions/file/upload.operation.js.map +1 -0
  75. package/dist/nodes/vendors/Anthropic/actions/image/analyze.operation.js +125 -0
  76. package/dist/nodes/vendors/Anthropic/actions/image/analyze.operation.js.map +1 -0
  77. package/dist/nodes/vendors/Anthropic/actions/image/index.js +64 -0
  78. package/dist/nodes/vendors/Anthropic/actions/image/index.js.map +1 -0
  79. package/dist/nodes/vendors/Anthropic/actions/node.type.js +17 -0
  80. package/dist/nodes/vendors/Anthropic/actions/node.type.js.map +1 -0
  81. package/dist/nodes/vendors/Anthropic/actions/prompt/generate.operation.js +87 -0
  82. package/dist/nodes/vendors/Anthropic/actions/prompt/generate.operation.js.map +1 -0
  83. package/dist/nodes/vendors/Anthropic/actions/prompt/improve.operation.js +154 -0
  84. package/dist/nodes/vendors/Anthropic/actions/prompt/improve.operation.js.map +1 -0
  85. package/dist/nodes/vendors/Anthropic/actions/prompt/index.js +95 -0
  86. package/dist/nodes/vendors/Anthropic/actions/prompt/index.js.map +1 -0
  87. package/dist/nodes/vendors/Anthropic/actions/prompt/templatize.operation.js +146 -0
  88. package/dist/nodes/vendors/Anthropic/actions/prompt/templatize.operation.js.map +1 -0
  89. package/dist/nodes/vendors/Anthropic/actions/router.js +93 -0
  90. package/dist/nodes/vendors/Anthropic/actions/router.js.map +1 -0
  91. package/dist/nodes/vendors/Anthropic/actions/text/index.js +64 -0
  92. package/dist/nodes/vendors/Anthropic/actions/text/index.js.map +1 -0
  93. package/dist/nodes/vendors/Anthropic/actions/text/message.operation.js +540 -0
  94. package/dist/nodes/vendors/Anthropic/actions/text/message.operation.js.map +1 -0
  95. package/dist/nodes/vendors/Anthropic/actions/versionDescription.js +125 -0
  96. package/dist/nodes/vendors/Anthropic/actions/versionDescription.js.map +1 -0
  97. package/dist/nodes/vendors/Anthropic/anthropic.svg +1 -0
  98. package/dist/nodes/vendors/Anthropic/helpers/baseAnalyze.js +109 -0
  99. package/dist/nodes/vendors/Anthropic/helpers/baseAnalyze.js.map +1 -0
  100. package/dist/nodes/vendors/Anthropic/helpers/interfaces.js +17 -0
  101. package/dist/nodes/vendors/Anthropic/helpers/interfaces.js.map +1 -0
  102. package/dist/nodes/vendors/Anthropic/helpers/utils.js +84 -0
  103. package/dist/nodes/vendors/Anthropic/helpers/utils.js.map +1 -0
  104. package/dist/nodes/vendors/Anthropic/methods/index.js +39 -0
  105. package/dist/nodes/vendors/Anthropic/methods/index.js.map +1 -0
  106. package/dist/nodes/vendors/Anthropic/methods/listSearch.js +42 -0
  107. package/dist/nodes/vendors/Anthropic/methods/listSearch.js.map +1 -0
  108. package/dist/nodes/vendors/Anthropic/transport/index.js +57 -0
  109. package/dist/nodes/vendors/Anthropic/transport/index.js.map +1 -0
  110. package/dist/nodes/vendors/GoogleGemini/GoogleGemini.node.js +42 -0
  111. package/dist/nodes/vendors/GoogleGemini/GoogleGemini.node.js.map +1 -0
  112. package/dist/nodes/vendors/GoogleGemini/actions/audio/analyze.operation.js +125 -0
  113. package/dist/nodes/vendors/GoogleGemini/actions/audio/analyze.operation.js.map +1 -0
  114. package/dist/nodes/vendors/GoogleGemini/actions/audio/index.js +74 -0
  115. package/dist/nodes/vendors/GoogleGemini/actions/audio/index.js.map +1 -0
  116. package/dist/nodes/vendors/GoogleGemini/actions/audio/transcribe.operation.js +184 -0
  117. package/dist/nodes/vendors/GoogleGemini/actions/audio/transcribe.operation.js.map +1 -0
  118. package/dist/nodes/vendors/GoogleGemini/actions/descriptions.js +52 -0
  119. package/dist/nodes/vendors/GoogleGemini/actions/descriptions.js.map +1 -0
  120. package/dist/nodes/vendors/GoogleGemini/actions/document/analyze.operation.js +125 -0
  121. package/dist/nodes/vendors/GoogleGemini/actions/document/analyze.operation.js.map +1 -0
  122. package/dist/nodes/vendors/GoogleGemini/actions/document/index.js +64 -0
  123. package/dist/nodes/vendors/GoogleGemini/actions/document/index.js.map +1 -0
  124. package/dist/nodes/vendors/GoogleGemini/actions/file/index.js +64 -0
  125. package/dist/nodes/vendors/GoogleGemini/actions/file/index.js.map +1 -0
  126. package/dist/nodes/vendors/GoogleGemini/actions/file/upload.operation.js +119 -0
  127. package/dist/nodes/vendors/GoogleGemini/actions/file/upload.operation.js.map +1 -0
  128. package/dist/nodes/vendors/GoogleGemini/actions/image/analyze.operation.js +125 -0
  129. package/dist/nodes/vendors/GoogleGemini/actions/image/analyze.operation.js.map +1 -0
  130. package/dist/nodes/vendors/GoogleGemini/actions/image/generate.operation.js +167 -0
  131. package/dist/nodes/vendors/GoogleGemini/actions/image/generate.operation.js.map +1 -0
  132. package/dist/nodes/vendors/GoogleGemini/actions/image/index.js +74 -0
  133. package/dist/nodes/vendors/GoogleGemini/actions/image/index.js.map +1 -0
  134. package/dist/nodes/vendors/GoogleGemini/actions/node.type.js +17 -0
  135. package/dist/nodes/vendors/GoogleGemini/actions/node.type.js.map +1 -0
  136. package/dist/nodes/vendors/GoogleGemini/actions/router.js +97 -0
  137. package/dist/nodes/vendors/GoogleGemini/actions/router.js.map +1 -0
  138. package/dist/nodes/vendors/GoogleGemini/actions/text/index.js +64 -0
  139. package/dist/nodes/vendors/GoogleGemini/actions/text/index.js.map +1 -0
  140. package/dist/nodes/vendors/GoogleGemini/actions/text/message.operation.js +339 -0
  141. package/dist/nodes/vendors/GoogleGemini/actions/text/message.operation.js.map +1 -0
  142. package/dist/nodes/vendors/GoogleGemini/actions/versionDescription.js +131 -0
  143. package/dist/nodes/vendors/GoogleGemini/actions/versionDescription.js.map +1 -0
  144. package/dist/nodes/vendors/GoogleGemini/actions/video/analyze.operation.js +125 -0
  145. package/dist/nodes/vendors/GoogleGemini/actions/video/analyze.operation.js.map +1 -0
  146. package/dist/nodes/vendors/GoogleGemini/actions/video/download.operation.js +88 -0
  147. package/dist/nodes/vendors/GoogleGemini/actions/video/download.operation.js.map +1 -0
  148. package/dist/nodes/vendors/GoogleGemini/actions/video/generate.operation.js +228 -0
  149. package/dist/nodes/vendors/GoogleGemini/actions/video/generate.operation.js.map +1 -0
  150. package/dist/nodes/vendors/GoogleGemini/actions/video/index.js +84 -0
  151. package/dist/nodes/vendors/GoogleGemini/actions/video/index.js.map +1 -0
  152. package/dist/nodes/vendors/GoogleGemini/gemini.svg +1 -0
  153. package/dist/nodes/vendors/GoogleGemini/helpers/baseAnalyze.js +100 -0
  154. package/dist/nodes/vendors/GoogleGemini/helpers/baseAnalyze.js.map +1 -0
  155. package/dist/nodes/vendors/GoogleGemini/helpers/interfaces.js +17 -0
  156. package/dist/nodes/vendors/GoogleGemini/helpers/interfaces.js.map +1 -0
  157. package/dist/nodes/vendors/GoogleGemini/helpers/utils.js +91 -0
  158. package/dist/nodes/vendors/GoogleGemini/helpers/utils.js.map +1 -0
  159. package/dist/nodes/vendors/GoogleGemini/methods/index.js +39 -0
  160. package/dist/nodes/vendors/GoogleGemini/methods/index.js.map +1 -0
  161. package/dist/nodes/vendors/GoogleGemini/methods/listSearch.js +74 -0
  162. package/dist/nodes/vendors/GoogleGemini/methods/listSearch.js.map +1 -0
  163. package/dist/nodes/vendors/GoogleGemini/transport/index.js +48 -0
  164. package/dist/nodes/vendors/GoogleGemini/transport/index.js.map +1 -0
  165. package/dist/nodes/vendors/OpenAi/actions/router.js +1 -1
  166. package/dist/nodes/vendors/OpenAi/actions/router.js.map +1 -1
  167. package/dist/types/credentials.json +3 -3
  168. package/dist/types/nodes.json +9 -5
  169. package/dist/utils/descriptions.js +13 -2
  170. package/dist/utils/descriptions.js.map +1 -1
  171. package/dist/utils/helpers.js +2 -7
  172. package/dist/utils/helpers.js.map +1 -1
  173. package/dist/utils/output_parsers/N8nOutputParser.js.map +1 -1
  174. package/package.json +11 -6
@@ -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 document_exports = {};
30
+ __export(document_exports, {
31
+ analyze: () => analyze,
32
+ description: () => description
33
+ });
34
+ module.exports = __toCommonJS(document_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 Document",
45
+ value: "analyze",
46
+ action: "Analyze document",
47
+ description: "Take in documents and answer questions about them"
48
+ }
49
+ ],
50
+ default: "analyze",
51
+ displayOptions: {
52
+ show: {
53
+ resource: ["document"]
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/GoogleGemini/actions/document/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 Document',\n\t\t\t\tvalue: 'analyze',\n\t\t\t\taction: 'Analyze document',\n\t\t\t\tdescription: 'Take in documents 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: ['document'],\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,UAAU;AAAA,MACtB;AAAA,IACD;AAAA,EACD;AAAA,EACA,GAAG,QAAQ;AACZ;","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 file_exports = {};
30
+ __export(file_exports, {
31
+ description: () => description,
32
+ upload: () => upload
33
+ });
34
+ module.exports = __toCommonJS(file_exports);
35
+ var upload = __toESM(require("./upload.operation"));
36
+ const description = [
37
+ {
38
+ displayName: "Operation",
39
+ name: "operation",
40
+ type: "options",
41
+ noDataExpression: true,
42
+ options: [
43
+ {
44
+ name: "Upload File",
45
+ value: "upload",
46
+ action: "Upload a file",
47
+ description: "Upload a file to the Google Gemini API for later use"
48
+ }
49
+ ],
50
+ default: "upload",
51
+ displayOptions: {
52
+ show: {
53
+ resource: ["file"]
54
+ }
55
+ }
56
+ },
57
+ ...upload.description
58
+ ];
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ description,
62
+ upload
63
+ });
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/file/index.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as upload from './upload.operation';\n\nexport { upload };\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: 'Upload File',\n\t\t\t\tvalue: 'upload',\n\t\t\t\taction: 'Upload a file',\n\t\t\t\tdescription: 'Upload a file to the Google Gemini API for later use',\n\t\t\t},\n\t\t],\n\t\tdefault: 'upload',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['file'],\n\t\t\t},\n\t\t},\n\t},\n\t...upload.description,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,aAAwB;AAIjB,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,MAAM;AAAA,MAClB;AAAA,IACD;AAAA,EACD;AAAA,EACA,GAAG,OAAO;AACX;","names":[]}
@@ -0,0 +1,119 @@
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 property which contains the file",
66
+ displayOptions: {
67
+ show: {
68
+ inputType: ["binary"]
69
+ }
70
+ }
71
+ }
72
+ ];
73
+ const displayOptions = {
74
+ show: {
75
+ operation: ["upload"],
76
+ resource: ["file"]
77
+ }
78
+ };
79
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
80
+ async function execute(i) {
81
+ const inputType = this.getNodeParameter("inputType", i, "url");
82
+ if (inputType === "url") {
83
+ const fileUrl = this.getNodeParameter("fileUrl", i, "");
84
+ const { fileContent, mimeType } = await import_utils.downloadFile.call(
85
+ this,
86
+ fileUrl,
87
+ "application/octet-stream"
88
+ );
89
+ const response = await import_utils.uploadFile.call(this, fileContent, mimeType);
90
+ return [
91
+ {
92
+ json: response,
93
+ pairedItem: {
94
+ item: i
95
+ }
96
+ }
97
+ ];
98
+ } else {
99
+ const binaryPropertyName = this.getNodeParameter("binaryPropertyName", i, "data");
100
+ const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
101
+ const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
102
+ const response = await import_utils.uploadFile.call(this, buffer, binaryData.mimeType);
103
+ return [
104
+ {
105
+ json: response,
106
+ pairedItem: {
107
+ item: i
108
+ }
109
+ }
110
+ ];
111
+ }
112
+ }
113
+ // Annotate the CommonJS export names for ESM import in node:
114
+ 0 && (module.exports = {
115
+ description,
116
+ execute,
117
+ properties
118
+ });
119
+ //# sourceMappingURL=upload.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/file/upload.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport { downloadFile, 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 property 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];\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\tif (inputType === 'url') {\n\t\tconst fileUrl = this.getNodeParameter('fileUrl', i, '') as string;\n\t\tconst { fileContent, mimeType } = await downloadFile.call(\n\t\t\tthis,\n\t\t\tfileUrl,\n\t\t\t'application/octet-stream',\n\t\t);\n\t\tconst response = await uploadFile.call(this, fileContent, mimeType);\n\t\treturn [\n\t\t\t{\n\t\t\t\tjson: response,\n\t\t\t\tpairedItem: {\n\t\t\t\t\titem: i,\n\t\t\t\t},\n\t\t\t},\n\t\t];\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\tconst response = await uploadFile.call(this, buffer, binaryData.mimeType);\n\t\treturn [\n\t\t\t{\n\t\t\t\tjson: response,\n\t\t\t\tpairedItem: {\n\t\t\t\t\titem: i,\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAErC,mBAAyC;AAElC,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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AAA,MACN;AAAA,QACC,MAAM;AAAA,QACN,YAAY;AAAA,UACX,MAAM;AAAA,QACP;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
@@ -0,0 +1,125 @@
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 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
+ (0, import_descriptions.modelRLC)("modelSearch"),
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), separate 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: "maxOutputTokens",
101
+ type: "number",
102
+ default: 300,
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/png");
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/GoogleGemini/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('modelSearch'),\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), separate 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: 'maxOutputTokens',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 300,\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/png');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAErC,yBAA4B;AAC5B,0BAAyB;AAEzB,MAAM,aAAgC;AAAA,MACrC,8BAAS,aAAa;AAAA,EACtB;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,WAAW;AAChE;","names":[]}
@@ -0,0 +1,167 @@
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
+ var import_descriptions = require("../descriptions");
28
+ const properties = [
29
+ (0, import_descriptions.modelRLC)("imageGenerationModelSearch"),
30
+ {
31
+ displayName: "Prompt",
32
+ name: "prompt",
33
+ type: "string",
34
+ placeholder: "e.g. A cute cat eating a dinosaur",
35
+ description: "A text description of the desired image(s)",
36
+ default: "",
37
+ typeOptions: {
38
+ rows: 2
39
+ }
40
+ },
41
+ {
42
+ displayName: "Options",
43
+ name: "options",
44
+ placeholder: "Add Option",
45
+ type: "collection",
46
+ default: {},
47
+ options: [
48
+ {
49
+ displayName: "Number of Images",
50
+ name: "sampleCount",
51
+ default: 1,
52
+ description: "Number of images to generate. Not supported by Gemini models, supported by Imagen models.",
53
+ type: "number",
54
+ typeOptions: {
55
+ minValue: 1
56
+ }
57
+ },
58
+ {
59
+ displayName: "Put Output in Field",
60
+ name: "binaryPropertyOutput",
61
+ type: "string",
62
+ default: "data",
63
+ hint: "The name of the output field to put the binary file data in"
64
+ }
65
+ ]
66
+ }
67
+ ];
68
+ const displayOptions = {
69
+ show: {
70
+ operation: ["generate"],
71
+ resource: ["image"]
72
+ }
73
+ };
74
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
75
+ async function execute(i) {
76
+ const model = this.getNodeParameter("modelId", i, "", { extractValue: true });
77
+ const prompt = this.getNodeParameter("prompt", i, "");
78
+ const binaryPropertyOutput = this.getNodeParameter(
79
+ "options.binaryPropertyOutput",
80
+ i,
81
+ "data"
82
+ );
83
+ if (model.includes("gemini")) {
84
+ const generationConfig = {
85
+ responseModalities: ["IMAGE", "TEXT"]
86
+ };
87
+ const body = {
88
+ contents: [
89
+ {
90
+ role: "user",
91
+ parts: [{ text: prompt }]
92
+ }
93
+ ],
94
+ generationConfig
95
+ };
96
+ const response = await import_transport.apiRequest.call(this, "POST", `/v1beta/${model}:generateContent`, {
97
+ body
98
+ });
99
+ const promises = response.candidates.map(async (candidate) => {
100
+ const imagePart = candidate.content.parts.find((part) => "inlineData" in part);
101
+ const buffer = Buffer.from(imagePart?.inlineData.data ?? "", "base64");
102
+ const binaryData = await this.helpers.prepareBinaryData(
103
+ buffer,
104
+ "image.png",
105
+ imagePart?.inlineData.mimeType
106
+ );
107
+ return {
108
+ binary: {
109
+ [binaryPropertyOutput]: binaryData
110
+ },
111
+ json: {
112
+ ...binaryData,
113
+ data: void 0
114
+ },
115
+ pairedItem: { item: i }
116
+ };
117
+ });
118
+ return await Promise.all(promises);
119
+ } else if (model.includes("imagen")) {
120
+ const sampleCount = this.getNodeParameter("options.sampleCount", i, 1);
121
+ const body = {
122
+ instances: [
123
+ {
124
+ prompt
125
+ }
126
+ ],
127
+ parameters: {
128
+ sampleCount
129
+ }
130
+ };
131
+ const response = await import_transport.apiRequest.call(this, "POST", `/v1beta/${model}:predict`, {
132
+ body
133
+ });
134
+ const promises = response.predictions.map(async (prediction) => {
135
+ const buffer = Buffer.from(prediction.bytesBase64Encoded ?? "", "base64");
136
+ const binaryData = await this.helpers.prepareBinaryData(
137
+ buffer,
138
+ "image.png",
139
+ prediction.mimeType
140
+ );
141
+ return {
142
+ binary: {
143
+ [binaryPropertyOutput]: binaryData
144
+ },
145
+ json: {
146
+ ...binaryData,
147
+ data: void 0
148
+ },
149
+ pairedItem: { item: i }
150
+ };
151
+ });
152
+ return await Promise.all(promises);
153
+ }
154
+ throw new import_n8n_workflow.NodeOperationError(
155
+ this.getNode(),
156
+ `Model ${model} is not supported for image generation`,
157
+ {
158
+ description: "Please check the model ID and try again."
159
+ }
160
+ );
161
+ }
162
+ // Annotate the CommonJS export names for ESM import in node:
163
+ 0 && (module.exports = {
164
+ description,
165
+ execute
166
+ });
167
+ //# sourceMappingURL=generate.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/image/generate.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { NodeOperationError, updateDisplayOptions } from 'n8n-workflow';\n\nimport type { GenerateContentResponse, ImagenResponse } from '../../helpers/interfaces';\nimport { apiRequest } from '../../transport';\nimport { modelRLC } from '../descriptions';\n\nconst properties: INodeProperties[] = [\n\tmodelRLC('imageGenerationModelSearch'),\n\t{\n\t\tdisplayName: 'Prompt',\n\t\tname: 'prompt',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. A cute cat eating a dinosaur',\n\t\tdescription: 'A text description of the desired image(s)',\n\t\tdefault: '',\n\t\ttypeOptions: {\n\t\t\trows: 2,\n\t\t},\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: 'Number of Images',\n\t\t\t\tname: 'sampleCount',\n\t\t\t\tdefault: 1,\n\t\t\t\tdescription:\n\t\t\t\t\t'Number of images to generate. Not supported by Gemini models, supported by Imagen models.',\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Put Output in Field',\n\t\t\t\tname: 'binaryPropertyOutput',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: 'data',\n\t\t\t\thint: 'The name of the output field to put the binary file data in',\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['generate'],\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\tconst model = this.getNodeParameter('modelId', i, '', { extractValue: true }) as string;\n\tconst prompt = this.getNodeParameter('prompt', i, '') as string;\n\tconst binaryPropertyOutput = this.getNodeParameter(\n\t\t'options.binaryPropertyOutput',\n\t\ti,\n\t\t'data',\n\t) as string;\n\n\tif (model.includes('gemini')) {\n\t\tconst generationConfig = {\n\t\t\tresponseModalities: ['IMAGE', 'TEXT'],\n\t\t};\n\t\tconst body = {\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\trole: 'user',\n\t\t\t\t\tparts: [{ text: prompt }],\n\t\t\t\t},\n\t\t\t],\n\t\t\tgenerationConfig,\n\t\t};\n\n\t\tconst response = (await apiRequest.call(this, 'POST', `/v1beta/${model}:generateContent`, {\n\t\t\tbody,\n\t\t})) as GenerateContentResponse;\n\t\tconst promises = response.candidates.map(async (candidate) => {\n\t\t\tconst imagePart = candidate.content.parts.find((part) => 'inlineData' in part);\n\t\t\tconst buffer = Buffer.from(imagePart?.inlineData.data ?? '', 'base64');\n\t\t\tconst binaryData = await this.helpers.prepareBinaryData(\n\t\t\t\tbuffer,\n\t\t\t\t'image.png',\n\t\t\t\timagePart?.inlineData.mimeType,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tbinary: {\n\t\t\t\t\t[binaryPropertyOutput]: binaryData,\n\t\t\t\t},\n\t\t\t\tjson: {\n\t\t\t\t\t...binaryData,\n\t\t\t\t\tdata: undefined,\n\t\t\t\t},\n\t\t\t\tpairedItem: { item: i },\n\t\t\t};\n\t\t});\n\n\t\treturn await Promise.all(promises);\n\t} else if (model.includes('imagen')) {\n\t\t// Imagen models use a different endpoint and request/response structure\n\t\tconst sampleCount = this.getNodeParameter('options.sampleCount', i, 1) as number;\n\t\tconst body = {\n\t\t\tinstances: [\n\t\t\t\t{\n\t\t\t\t\tprompt,\n\t\t\t\t},\n\t\t\t],\n\t\t\tparameters: {\n\t\t\t\tsampleCount,\n\t\t\t},\n\t\t};\n\t\tconst response = (await apiRequest.call(this, 'POST', `/v1beta/${model}:predict`, {\n\t\t\tbody,\n\t\t})) as ImagenResponse;\n\n\t\tconst promises = response.predictions.map(async (prediction) => {\n\t\t\tconst buffer = Buffer.from(prediction.bytesBase64Encoded ?? '', 'base64');\n\t\t\tconst binaryData = await this.helpers.prepareBinaryData(\n\t\t\t\tbuffer,\n\t\t\t\t'image.png',\n\t\t\t\tprediction.mimeType,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tbinary: {\n\t\t\t\t\t[binaryPropertyOutput]: binaryData,\n\t\t\t\t},\n\t\t\t\tjson: {\n\t\t\t\t\t...binaryData,\n\t\t\t\t\tdata: undefined,\n\t\t\t\t},\n\t\t\t\tpairedItem: { item: i },\n\t\t\t};\n\t\t});\n\n\t\treturn await Promise.all(promises);\n\t}\n\n\tthrow new NodeOperationError(\n\t\tthis.getNode(),\n\t\t`Model ${model} is not supported for image generation`,\n\t\t{\n\t\t\tdescription: 'Please check the model ID and try again.',\n\t\t},\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAyD;AAGzD,uBAA2B;AAC3B,0BAAyB;AAEzB,MAAM,aAAgC;AAAA,MACrC,8BAAS,4BAA4B;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,aAAa;AAAA,IACb,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,IACV,SAAS;AAAA,MACR;AAAA,QACC,aAAa;AAAA,QACb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ty;
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
+ generate: () => generate
34
+ });
35
+ module.exports = __toCommonJS(image_exports);
36
+ var analyze = __toESM(require("./analyze.operation"));
37
+ var generate = __toESM(require("./generate.operation"));
38
+ const description = [
39
+ {
40
+ displayName: "Operation",
41
+ name: "operation",
42
+ type: "options",
43
+ noDataExpression: true,
44
+ options: [
45
+ {
46
+ name: "Analyze Image",
47
+ value: "analyze",
48
+ action: "Analyze image",
49
+ description: "Take in images and answer questions about them"
50
+ },
51
+ {
52
+ name: "Generate an Image",
53
+ value: "generate",
54
+ action: "Generate an image",
55
+ description: "Creates an image from a text prompt"
56
+ }
57
+ ],
58
+ default: "generate",
59
+ displayOptions: {
60
+ show: {
61
+ resource: ["image"]
62
+ }
63
+ }
64
+ },
65
+ ...analyze.description,
66
+ ...generate.description
67
+ ];
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ analyze,
71
+ description,
72
+ generate
73
+ });
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/image/index.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as analyze from './analyze.operation';\nimport * as generate from './generate.operation';\n\nexport { analyze, generate };\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\t{\n\t\t\t\tname: 'Generate an Image',\n\t\t\t\tvalue: 'generate',\n\t\t\t\taction: 'Generate an image',\n\t\t\t\tdescription: 'Creates an image from a text prompt',\n\t\t\t},\n\t\t],\n\t\tdefault: 'generate',\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\t...generate.description,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,cAAyB;AACzB,eAA0B;AAInB,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,MACA;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;AAAA,EACX,GAAG,SAAS;AACb;","names":[]}