@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,131 @@
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 versionDescription_exports = {};
30
+ __export(versionDescription_exports, {
31
+ versionDescription: () => versionDescription
32
+ });
33
+ module.exports = __toCommonJS(versionDescription_exports);
34
+ var import_n8n_workflow = require("n8n-workflow");
35
+ var audio = __toESM(require("./audio"));
36
+ var document = __toESM(require("./document"));
37
+ var file = __toESM(require("./file"));
38
+ var image = __toESM(require("./image"));
39
+ var text = __toESM(require("./text"));
40
+ var video = __toESM(require("./video"));
41
+ const versionDescription = {
42
+ displayName: "Google Gemini",
43
+ name: "googleGemini",
44
+ icon: "file:gemini.svg",
45
+ group: ["transform"],
46
+ version: 1,
47
+ subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
48
+ description: "Interact with Google Gemini AI models",
49
+ defaults: {
50
+ name: "Google Gemini"
51
+ },
52
+ usableAsTool: true,
53
+ codex: {
54
+ alias: ["LangChain", "video", "document", "audio", "transcribe", "assistant"],
55
+ categories: ["AI"],
56
+ subcategories: {
57
+ AI: ["Agents", "Miscellaneous", "Root Nodes"]
58
+ },
59
+ resources: {
60
+ primaryDocumentation: [
61
+ {
62
+ url: "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-langchain.googlegemini/"
63
+ }
64
+ ]
65
+ }
66
+ },
67
+ inputs: `={{
68
+ (() => {
69
+ const resource = $parameter.resource;
70
+ const operation = $parameter.operation;
71
+ if (resource === 'text' && operation === 'message') {
72
+ return [{ type: 'main' }, { type: 'ai_tool', displayName: 'Tools' }];
73
+ }
74
+
75
+ return ['main'];
76
+ })()
77
+ }}`,
78
+ outputs: [import_n8n_workflow.NodeConnectionTypes.Main],
79
+ credentials: [
80
+ {
81
+ name: "googlePalmApi",
82
+ required: true
83
+ }
84
+ ],
85
+ properties: [
86
+ {
87
+ displayName: "Resource",
88
+ name: "resource",
89
+ type: "options",
90
+ noDataExpression: true,
91
+ options: [
92
+ {
93
+ name: "Audio",
94
+ value: "audio"
95
+ },
96
+ {
97
+ name: "Document",
98
+ value: "document"
99
+ },
100
+ {
101
+ name: "File",
102
+ value: "file"
103
+ },
104
+ {
105
+ name: "Image",
106
+ value: "image"
107
+ },
108
+ {
109
+ name: "Text",
110
+ value: "text"
111
+ },
112
+ {
113
+ name: "Video",
114
+ value: "video"
115
+ }
116
+ ],
117
+ default: "text"
118
+ },
119
+ ...audio.description,
120
+ ...document.description,
121
+ ...file.description,
122
+ ...image.description,
123
+ ...text.description,
124
+ ...video.description
125
+ ]
126
+ };
127
+ // Annotate the CommonJS export names for ESM import in node:
128
+ 0 && (module.exports = {
129
+ versionDescription
130
+ });
131
+ //# sourceMappingURL=versionDescription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/actions/versionDescription.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\nimport { NodeConnectionTypes, type INodeTypeDescription } from 'n8n-workflow';\n\nimport * as audio from './audio';\nimport * as document from './document';\nimport * as file from './file';\nimport * as image from './image';\nimport * as text from './text';\nimport * as video from './video';\n\nexport const versionDescription: INodeTypeDescription = {\n\tdisplayName: 'Google Gemini',\n\tname: 'googleGemini',\n\ticon: 'file:gemini.svg',\n\tgroup: ['transform'],\n\tversion: 1,\n\tsubtitle: '={{ $parameter[\"operation\"] + \": \" + $parameter[\"resource\"] }}',\n\tdescription: 'Interact with Google Gemini AI models',\n\tdefaults: {\n\t\tname: 'Google Gemini',\n\t},\n\tusableAsTool: true,\n\tcodex: {\n\t\talias: ['LangChain', 'video', 'document', 'audio', 'transcribe', 'assistant'],\n\t\tcategories: ['AI'],\n\t\tsubcategories: {\n\t\t\tAI: ['Agents', 'Miscellaneous', 'Root Nodes'],\n\t\t},\n\t\tresources: {\n\t\t\tprimaryDocumentation: [\n\t\t\t\t{\n\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-langchain.googlegemini/',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tinputs: `={{\n\t\t(() => {\n\t\t\tconst resource = $parameter.resource;\n\t \tconst operation = $parameter.operation;\n\t\t\tif (resource === 'text' && operation === 'message') {\n\t\t\t\treturn [{ type: 'main' }, { type: 'ai_tool', displayName: 'Tools' }];\n\t\t\t}\n\n\t\t\treturn ['main'];\n\t\t})()\n\t}}`,\n\toutputs: [NodeConnectionTypes.Main],\n\tcredentials: [\n\t\t{\n\t\t\tname: 'googlePalmApi',\n\t\t\trequired: true,\n\t\t},\n\t],\n\tproperties: [\n\t\t{\n\t\t\tdisplayName: 'Resource',\n\t\t\tname: 'resource',\n\t\t\ttype: 'options',\n\t\t\tnoDataExpression: true,\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Audio',\n\t\t\t\t\tvalue: 'audio',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Document',\n\t\t\t\t\tvalue: 'document',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'File',\n\t\t\t\t\tvalue: 'file',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Image',\n\t\t\t\t\tvalue: 'image',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Text',\n\t\t\t\t\tvalue: 'text',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Video',\n\t\t\t\t\tvalue: 'video',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'text',\n\t\t},\n\t\t...audio.description,\n\t\t...document.description,\n\t\t...file.description,\n\t\t...image.description,\n\t\t...text.description,\n\t\t...video.description,\n\t],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAA+D;AAE/D,YAAuB;AACvB,eAA0B;AAC1B,WAAsB;AACtB,YAAuB;AACvB,WAAsB;AACtB,YAAuB;AAEhB,MAAM,qBAA2C;AAAA,EACvD,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO,CAAC,WAAW;AAAA,EACnB,SAAS;AAAA,EACT,UAAU;AAAA,EACV,aAAa;AAAA,EACb,UAAU;AAAA,IACT,MAAM;AAAA,EACP;AAAA,EACA,cAAc;AAAA,EACd,OAAO;AAAA,IACN,OAAO,CAAC,aAAa,SAAS,YAAY,SAAS,cAAc,WAAW;AAAA,IAC5E,YAAY,CAAC,IAAI;AAAA,IACjB,eAAe;AAAA,MACd,IAAI,CAAC,UAAU,iBAAiB,YAAY;AAAA,IAC7C;AAAA,IACA,WAAW;AAAA,MACV,sBAAsB;AAAA,QACrB;AAAA,UACC,KAAK;AAAA,QACN;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWR,SAAS,CAAC,wCAAoB,IAAI;AAAA,EAClC,aAAa;AAAA,IACZ;AAAA,MACC,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AAAA,EACA,YAAY;AAAA,IACX;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,kBAAkB;AAAA,MAClB,SAAS;AAAA,QACR;AAAA,UACC,MAAM;AAAA,UACN,OAAO;AAAA,QACR;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,OAAO;AAAA,QACR;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,OAAO;AAAA,QACR;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,OAAO;AAAA,QACR;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,OAAO;AAAA,QACR;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,OAAO;AAAA,QACR;AAAA,MACD;AAAA,MACA,SAAS;AAAA,IACV;AAAA,IACA,GAAG,MAAM;AAAA,IACT,GAAG,SAAS;AAAA,IACZ,GAAG,KAAK;AAAA,IACR,GAAG,MAAM;AAAA,IACT,GAAG,KAAK;AAAA,IACR,GAAG,MAAM;AAAA,EACV;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 video?",
35
+ default: "What's in this video?",
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: "Video 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: "videoUrls",
59
+ type: "string",
60
+ placeholder: "e.g. https://example.com/video.mp4",
61
+ description: "URL(s) of the video(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 video(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 video 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: ["video"]
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, "videoUrls", "video/mp4");
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/video/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 video?\",\n\t\tdefault: \"What's in this video?\",\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: 'Video 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: 'videoUrls',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. https://example.com/video.mp4',\n\t\tdescription: 'URL(s) of the video(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 video(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 video 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: ['video'],\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, 'videoUrls', 'video/mp4');\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,M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qB,gBAAgB,UAAU;AAE1E,eAAsB,QAAiC,GAA0C;AAChG,SAAO,MAAM,+BAAY,KAAK,MAAM,GAAG,aAAa,WAAW;AAChE;","names":[]}
@@ -0,0 +1,88 @@
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 download_operation_exports = {};
20
+ __export(download_operation_exports, {
21
+ description: () => description,
22
+ execute: () => execute
23
+ });
24
+ module.exports = __toCommonJS(download_operation_exports);
25
+ var import_n8n_workflow = require("n8n-workflow");
26
+ var import_utils = require("../../helpers/utils");
27
+ const properties = [
28
+ {
29
+ displayName: "URL",
30
+ name: "url",
31
+ type: "string",
32
+ placeholder: "e.g. https://generativelanguage.googleapis.com/v1beta/files/abcdefg:download",
33
+ description: "The URL from Google Gemini API to download the video from",
34
+ default: ""
35
+ },
36
+ {
37
+ displayName: "Options",
38
+ name: "options",
39
+ placeholder: "Add Option",
40
+ type: "collection",
41
+ default: {},
42
+ options: [
43
+ {
44
+ displayName: "Put Output in Field",
45
+ name: "binaryPropertyOutput",
46
+ type: "string",
47
+ default: "data",
48
+ hint: "The name of the output field to put the binary file data in"
49
+ }
50
+ ]
51
+ }
52
+ ];
53
+ const displayOptions = {
54
+ show: {
55
+ operation: ["download"],
56
+ resource: ["video"]
57
+ }
58
+ };
59
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
60
+ async function execute(i) {
61
+ const url = this.getNodeParameter("url", i, "");
62
+ const binaryPropertyOutput = this.getNodeParameter(
63
+ "options.binaryPropertyOutput",
64
+ i,
65
+ "data"
66
+ );
67
+ const credentials = await this.getCredentials("googlePalmApi");
68
+ const { fileContent, mimeType } = await import_utils.downloadFile.call(this, url, "video/mp4", {
69
+ key: credentials.apiKey
70
+ });
71
+ const binaryData = await this.helpers.prepareBinaryData(fileContent, "video.mp4", mimeType);
72
+ return [
73
+ {
74
+ binary: { [binaryPropertyOutput]: binaryData },
75
+ json: {
76
+ ...binaryData,
77
+ data: void 0
78
+ },
79
+ pairedItem: { item: i }
80
+ }
81
+ ];
82
+ }
83
+ // Annotate the CommonJS export names for ESM import in node:
84
+ 0 && (module.exports = {
85
+ description,
86
+ execute
87
+ });
88
+ //# sourceMappingURL=download.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/video/download.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport { downloadFile } from '../../helpers/utils';\n\nconst properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'URL',\n\t\tname: 'url',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. https://generativelanguage.googleapis.com/v1beta/files/abcdefg:download',\n\t\tdescription: 'The URL from Google Gemini API to download the video from',\n\t\tdefault: '',\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: '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: ['download'],\n\t\tresource: ['video'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst url = this.getNodeParameter('url', 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\tconst credentials = await this.getCredentials('googlePalmApi');\n\tconst { fileContent, mimeType } = await downloadFile.call(this, url, 'video/mp4', {\n\t\tkey: credentials.apiKey as string,\n\t});\n\tconst binaryData = await this.helpers.prepareBinaryData(fileContent, 'video.mp4', mimeType);\n\treturn [\n\t\t{\n\t\t\tbinary: { [binaryPropertyOutput]: binaryData },\n\t\t\tjson: {\n\t\t\t\t...binaryData,\n\t\t\t\tdata: undefined,\n\t\t\t},\n\t\t\tpairedItem: { item: i },\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAErC,mBAA6B;AAE7B,MAAM,aAAgC;AAAA,EACrC;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,EACV;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,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,MAAM;AAAA,MACP;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,WAAW,CAAC,UAAU;AAAA,IACtB,UAAU,CAAC,OAAO;AAAA,EACnB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;AAE1E,eAAsB,QAAiC,GAA0C;AAChG,QAAM,MAAM,KAAK,iBAAiB,OAAO,GAAG,EAAE;AAC9C,QAAM,uBAAuB,KAAK;AAAA,IACjC;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,QAAM,cAAc,MAAM,KAAK,eAAe,eAAe;AAC7D,QAAM,EAAE,aAAa,SAAS,IAAI,MAAM,0BAAa,KAAK,MAAM,KAAK,aAAa;AAAA,IACjF,KAAK,YAAY;AAAA,EAClB,CAAC;AACD,QAAM,aAAa,MAAM,KAAK,QAAQ,kBAAkB,aAAa,aAAa,QAAQ;AAC1F,SAAO;AAAA,IACN;AAAA,MACC,QAAQ,EAAE,CAAC,oBAAoB,GAAG,WAAW;AAAA,MAC7C,MAAM;AAAA,QACL,GAAG;AAAA,QACH,MAAM;AAAA,MACP;AAAA,MACA,YAAY,EAAE,MAAM,EAAE;AAAA,IACvB;AAAA,EACD;AACD;","names":[]}
@@ -0,0 +1,228 @@
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_utils = require("../../helpers/utils");
27
+ var import_transport = require("../../transport");
28
+ var import_descriptions = require("../descriptions");
29
+ const properties = [
30
+ (0, import_descriptions.modelRLC)("videoGenerationModelSearch"),
31
+ {
32
+ displayName: "Prompt",
33
+ name: "prompt",
34
+ type: "string",
35
+ placeholder: "e.g. Panning wide shot of a calico kitten sleeping in the sunshine",
36
+ description: "A text description of the desired video",
37
+ default: "",
38
+ typeOptions: {
39
+ rows: 2
40
+ }
41
+ },
42
+ {
43
+ displayName: "Return As",
44
+ name: "returnAs",
45
+ type: "options",
46
+ options: [
47
+ {
48
+ name: "Video",
49
+ value: "video"
50
+ },
51
+ {
52
+ name: "URL",
53
+ value: "url"
54
+ }
55
+ ],
56
+ description: "Whether to return the video as a binary file or a URL that can be used to download the video later",
57
+ default: "video"
58
+ },
59
+ {
60
+ displayName: "Options",
61
+ name: "options",
62
+ placeholder: "Add Option",
63
+ type: "collection",
64
+ default: {},
65
+ options: [
66
+ {
67
+ displayName: "Number of Videos",
68
+ name: "sampleCount",
69
+ type: "number",
70
+ default: 1,
71
+ description: "How many videos to generate",
72
+ typeOptions: {
73
+ minValue: 1,
74
+ maxValue: 4
75
+ }
76
+ },
77
+ {
78
+ displayName: "Duration (Seconds)",
79
+ name: "durationSeconds",
80
+ type: "number",
81
+ default: 8,
82
+ description: "Length of the generated video in seconds",
83
+ typeOptions: {
84
+ minValue: 5,
85
+ maxValue: 8
86
+ }
87
+ },
88
+ {
89
+ displayName: "Aspect Ratio",
90
+ name: "aspectRatio",
91
+ type: "options",
92
+ options: [
93
+ {
94
+ name: "Widescreen (16:9)",
95
+ value: "16:9",
96
+ description: "Most common aspect ratio for televisions and monitors"
97
+ },
98
+ {
99
+ name: "Portrait (9:16)",
100
+ value: "9:16",
101
+ description: "Popular for short-form videos like YouTube Shorts"
102
+ }
103
+ ],
104
+ default: "16:9"
105
+ },
106
+ {
107
+ displayName: "Person Generation",
108
+ name: "personGeneration",
109
+ type: "options",
110
+ options: [
111
+ {
112
+ name: "Don't Allow",
113
+ value: "dont_allow",
114
+ description: "Prevent generation of people in the video"
115
+ },
116
+ {
117
+ name: "Allow Adult",
118
+ value: "allow_adult",
119
+ description: "Allow generation of adult people in the video"
120
+ },
121
+ {
122
+ name: "Allow All",
123
+ value: "allow_all",
124
+ description: "Allow generation of all people in the video"
125
+ }
126
+ ],
127
+ default: "dont_allow"
128
+ },
129
+ {
130
+ displayName: "Put Output in Field",
131
+ name: "binaryPropertyOutput",
132
+ type: "string",
133
+ default: "data",
134
+ hint: "The name of the output field to put the binary file data in"
135
+ }
136
+ ]
137
+ }
138
+ ];
139
+ const displayOptions = {
140
+ show: {
141
+ operation: ["generate"],
142
+ resource: ["video"]
143
+ }
144
+ };
145
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
146
+ async function execute(i) {
147
+ const model = this.getNodeParameter("modelId", i, "", { extractValue: true });
148
+ const prompt = this.getNodeParameter("prompt", i, "");
149
+ const returnAs = this.getNodeParameter("returnAs", i, "video");
150
+ const options = this.getNodeParameter("options", i, {});
151
+ const binaryPropertyOutput = this.getNodeParameter(
152
+ "options.binaryPropertyOutput",
153
+ i,
154
+ "data"
155
+ );
156
+ const credentials = await this.getCredentials("googlePalmApi");
157
+ if (!model.includes("veo")) {
158
+ throw new import_n8n_workflow.NodeOperationError(
159
+ this.getNode(),
160
+ `Model ${model} is not supported for video generation. Please use a Veo model`,
161
+ {
162
+ description: "Video generation is only supported by Veo models"
163
+ }
164
+ );
165
+ }
166
+ const body = {
167
+ instances: [
168
+ {
169
+ prompt
170
+ }
171
+ ],
172
+ parameters: {
173
+ aspectRatio: options.aspectRatio,
174
+ personGeneration: options.personGeneration,
175
+ sampleCount: options.sampleCount ?? 1,
176
+ durationSeconds: options.durationSeconds ?? 8
177
+ }
178
+ };
179
+ let response = await import_transport.apiRequest.call(this, "POST", `/v1beta/${model}:predictLongRunning`, {
180
+ body
181
+ });
182
+ while (!response.done) {
183
+ await new Promise((resolve) => setTimeout(resolve, 5e3));
184
+ response = await import_transport.apiRequest.call(this, "GET", `/v1beta/${response.name}`);
185
+ }
186
+ if (response.error) {
187
+ throw new import_n8n_workflow.NodeOperationError(this.getNode(), response.error.message, {
188
+ description: "Error generating video"
189
+ });
190
+ }
191
+ if (returnAs === "video") {
192
+ const promises = response.response.generateVideoResponse.generatedSamples.map(
193
+ async (sample) => {
194
+ const { fileContent, mimeType } = await import_utils.downloadFile.call(
195
+ this,
196
+ sample.video.uri,
197
+ "video/mp4",
198
+ {
199
+ key: credentials.apiKey
200
+ }
201
+ );
202
+ const binaryData = await this.helpers.prepareBinaryData(fileContent, "video.mp4", mimeType);
203
+ return {
204
+ binary: { [binaryPropertyOutput]: binaryData },
205
+ json: {
206
+ ...binaryData,
207
+ data: void 0
208
+ },
209
+ pairedItem: { item: i }
210
+ };
211
+ }
212
+ );
213
+ return await Promise.all(promises);
214
+ } else {
215
+ return response.response.generateVideoResponse.generatedSamples.map((sample) => ({
216
+ json: {
217
+ url: sample.video.uri
218
+ },
219
+ pairedItem: { item: i }
220
+ }));
221
+ }
222
+ }
223
+ // Annotate the CommonJS export names for ESM import in node:
224
+ 0 && (module.exports = {
225
+ description,
226
+ execute
227
+ });
228
+ //# sourceMappingURL=generate.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/video/generate.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { NodeOperationError, updateDisplayOptions } from 'n8n-workflow';\n\nimport type { VeoResponse } from '../../helpers/interfaces';\nimport { downloadFile } from '../../helpers/utils';\nimport { apiRequest } from '../../transport';\nimport { modelRLC } from '../descriptions';\n\nconst properties: INodeProperties[] = [\n\tmodelRLC('videoGenerationModelSearch'),\n\t{\n\t\tdisplayName: 'Prompt',\n\t\tname: 'prompt',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. Panning wide shot of a calico kitten sleeping in the sunshine',\n\t\tdescription: 'A text description of the desired video',\n\t\tdefault: '',\n\t\ttypeOptions: {\n\t\t\trows: 2,\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Return As',\n\t\tname: 'returnAs',\n\t\ttype: 'options',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Video',\n\t\t\t\tvalue: 'video',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'URL',\n\t\t\t\tvalue: 'url',\n\t\t\t},\n\t\t],\n\t\tdescription:\n\t\t\t'Whether to return the video as a binary file or a URL that can be used to download the video later',\n\t\tdefault: 'video',\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 Videos',\n\t\t\t\tname: 'sampleCount',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 1,\n\t\t\t\tdescription: 'How many videos to generate',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t\tmaxValue: 4,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Duration (Seconds)',\n\t\t\t\tname: 'durationSeconds',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 8,\n\t\t\t\tdescription: 'Length of the generated video in seconds',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 5,\n\t\t\t\t\tmaxValue: 8,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Aspect Ratio',\n\t\t\t\tname: 'aspectRatio',\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Widescreen (16:9)',\n\t\t\t\t\t\tvalue: '16:9',\n\t\t\t\t\t\tdescription: 'Most common aspect ratio for televisions and monitors',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Portrait (9:16)',\n\t\t\t\t\t\tvalue: '9:16',\n\t\t\t\t\t\tdescription: 'Popular for short-form videos like YouTube Shorts',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: '16:9',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Person Generation',\n\t\t\t\tname: 'personGeneration',\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Don't Allow\",\n\t\t\t\t\t\tvalue: 'dont_allow',\n\t\t\t\t\t\tdescription: 'Prevent generation of people in the video',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Allow Adult',\n\t\t\t\t\t\tvalue: 'allow_adult',\n\t\t\t\t\t\tdescription: 'Allow generation of adult people in the video',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Allow All',\n\t\t\t\t\t\tvalue: 'allow_all',\n\t\t\t\t\t\tdescription: 'Allow generation of all people in the video',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'dont_allow',\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: ['video'],\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 returnAs = this.getNodeParameter('returnAs', i, 'video');\n\tconst options = this.getNodeParameter('options', i, {});\n\tconst binaryPropertyOutput = this.getNodeParameter(\n\t\t'options.binaryPropertyOutput',\n\t\ti,\n\t\t'data',\n\t) as string;\n\tconst credentials = await this.getCredentials('googlePalmApi');\n\n\tif (!model.includes('veo')) {\n\t\tthrow new NodeOperationError(\n\t\t\tthis.getNode(),\n\t\t\t`Model ${model} is not supported for video generation. Please use a Veo model`,\n\t\t\t{\n\t\t\t\tdescription: 'Video generation is only supported by Veo models',\n\t\t\t},\n\t\t);\n\t}\n\n\tconst body = {\n\t\tinstances: [\n\t\t\t{\n\t\t\t\tprompt,\n\t\t\t},\n\t\t],\n\t\tparameters: {\n\t\t\taspectRatio: options.aspectRatio,\n\t\t\tpersonGeneration: options.personGeneration,\n\t\t\tsampleCount: options.sampleCount ?? 1,\n\t\t\tdurationSeconds: options.durationSeconds ?? 8,\n\t\t},\n\t};\n\tlet response = (await apiRequest.call(this, 'POST', `/v1beta/${model}:predictLongRunning`, {\n\t\tbody,\n\t})) as VeoResponse;\n\n\twhile (!response.done) {\n\t\tawait new Promise((resolve) => setTimeout(resolve, 5000));\n\t\tresponse = (await apiRequest.call(this, 'GET', `/v1beta/${response.name}`)) as VeoResponse;\n\t}\n\n\tif (response.error) {\n\t\tthrow new NodeOperationError(this.getNode(), response.error.message, {\n\t\t\tdescription: 'Error generating video',\n\t\t});\n\t}\n\n\tif (returnAs === 'video') {\n\t\tconst promises = response.response.generateVideoResponse.generatedSamples.map(\n\t\t\tasync (sample) => {\n\t\t\t\tconst { fileContent, mimeType } = await downloadFile.call(\n\t\t\t\t\tthis,\n\t\t\t\t\tsample.video.uri,\n\t\t\t\t\t'video/mp4',\n\t\t\t\t\t{\n\t\t\t\t\t\tkey: credentials.apiKey as string,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tconst binaryData = await this.helpers.prepareBinaryData(fileContent, 'video.mp4', mimeType);\n\t\t\t\treturn {\n\t\t\t\t\tbinary: { [binaryPropertyOutput]: binaryData },\n\t\t\t\t\tjson: {\n\t\t\t\t\t\t...binaryData,\n\t\t\t\t\t\tdata: undefined,\n\t\t\t\t\t},\n\t\t\t\t\tpairedItem: { item: i },\n\t\t\t\t};\n\t\t\t},\n\t\t);\n\n\t\treturn await Promise.all(promises);\n\t} else {\n\t\treturn response.response.generateVideoResponse.generatedSamples.map((sample) => ({\n\t\t\tjson: {\n\t\t\t\turl: sample.video.uri,\n\t\t\t},\n\t\t\tpairedItem: { item: i },\n\t\t}));\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAyD;AAGzD,mBAA6B;AAC7B,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,MAAM;AAAA,IACN,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,IACD;AAAA,IACA,aACC;AAAA,IACD,SAAS;AAAA,EACV;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,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,aAAa;AAAA,QACb,aAAa;AAAA,UACZ,UAAU;AAAA,UACV,UAAU;AAAA,QACX;AAAA,MACD;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,Q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