@n8n/n8n-nodes-langchain 1.101.2 → 1.102.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.
- package/dist/credentials/CohereApi.credentials.js +7 -1
- package/dist/credentials/CohereApi.credentials.js.map +1 -1
- package/dist/known/credentials.json +2 -0
- package/dist/known/nodes.json +12 -0
- package/dist/nodes/agents/Agent/Agent.node.js +1 -0
- package/dist/nodes/agents/Agent/Agent.node.js.map +1 -1
- package/dist/nodes/agents/Agent/AgentTool.node.js +57 -0
- package/dist/nodes/agents/Agent/AgentTool.node.js.map +1 -0
- package/dist/nodes/agents/Agent/V2/AgentToolV2.node.js +104 -0
- package/dist/nodes/agents/Agent/V2/AgentToolV2.node.js.map +1 -0
- package/dist/nodes/agents/Agent/V2/AgentV2.node.js +4 -66
- package/dist/nodes/agents/Agent/V2/AgentV2.node.js.map +1 -1
- package/dist/nodes/agents/Agent/V2/utils.js +92 -0
- package/dist/nodes/agents/Agent/V2/utils.js.map +1 -0
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/description.js +13 -10
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/description.js.map +1 -1
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/execute.js +14 -7
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/execute.js.map +1 -1
- package/dist/nodes/agents/Agent/agents/ToolsAgent/common.js.map +1 -1
- package/dist/nodes/chains/SentimentAnalysis/SentimentAnalysis.node.js +1 -1
- package/dist/nodes/chains/SentimentAnalysis/SentimentAnalysis.node.js.map +1 -1
- package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +6 -0
- package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js.map +1 -1
- package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js +2 -2
- package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js.map +1 -1
- package/dist/nodes/llms/LmChatCohere/LmChatCohere.node.js +181 -0
- package/dist/nodes/llms/LmChatCohere/LmChatCohere.node.js.map +1 -0
- package/dist/nodes/llms/LmChatCohere/cohere.dark.svg +5 -0
- package/dist/nodes/llms/LmChatCohere/cohere.svg +5 -0
- package/dist/nodes/llms/N8nLlmTracing.js +4 -4
- package/dist/nodes/llms/N8nLlmTracing.js.map +1 -1
- package/dist/nodes/mcp/McpTrigger/McpTrigger.node.js +1 -1
- package/dist/nodes/mcp/McpTrigger/McpTrigger.node.js.map +1 -1
- package/dist/nodes/tools/ToolCode/ToolCode.node.js +1 -2
- package/dist/nodes/tools/ToolCode/ToolCode.node.js.map +1 -1
- package/dist/nodes/tools/ToolVectorStore/ToolVectorStore.node.js +1 -2
- package/dist/nodes/tools/ToolVectorStore/ToolVectorStore.node.js.map +1 -1
- package/dist/nodes/tools/ToolWorkflow/v2/ToolWorkflowV2.node.js +2 -2
- package/dist/nodes/tools/ToolWorkflow/v2/ToolWorkflowV2.node.js.map +1 -1
- package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js +2 -1
- package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js.map +1 -1
- package/dist/nodes/trigger/ChatTrigger/templates.js +3 -1
- package/dist/nodes/trigger/ChatTrigger/templates.js.map +1 -1
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js +2 -1
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js.map +1 -1
- package/dist/nodes/vendors/GoogleGemini/GoogleGemini.node.js +42 -0
- package/dist/nodes/vendors/GoogleGemini/GoogleGemini.node.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/audio/analyze.operation.js +125 -0
- package/dist/nodes/vendors/GoogleGemini/actions/audio/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/audio/index.js +74 -0
- package/dist/nodes/vendors/GoogleGemini/actions/audio/index.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/audio/transcribe.operation.js +184 -0
- package/dist/nodes/vendors/GoogleGemini/actions/audio/transcribe.operation.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/descriptions.js +52 -0
- package/dist/nodes/vendors/GoogleGemini/actions/descriptions.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/document/analyze.operation.js +125 -0
- package/dist/nodes/vendors/GoogleGemini/actions/document/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/document/index.js +64 -0
- package/dist/nodes/vendors/GoogleGemini/actions/document/index.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/file/index.js +64 -0
- package/dist/nodes/vendors/GoogleGemini/actions/file/index.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/file/upload.operation.js +119 -0
- package/dist/nodes/vendors/GoogleGemini/actions/file/upload.operation.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/image/analyze.operation.js +125 -0
- package/dist/nodes/vendors/GoogleGemini/actions/image/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/image/generate.operation.js +167 -0
- package/dist/nodes/vendors/GoogleGemini/actions/image/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/image/index.js +74 -0
- package/dist/nodes/vendors/GoogleGemini/actions/image/index.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/node.type.js +17 -0
- package/dist/nodes/vendors/GoogleGemini/actions/node.type.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/router.js +97 -0
- package/dist/nodes/vendors/GoogleGemini/actions/router.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/text/index.js +64 -0
- package/dist/nodes/vendors/GoogleGemini/actions/text/index.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/text/message.operation.js +339 -0
- package/dist/nodes/vendors/GoogleGemini/actions/text/message.operation.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/versionDescription.js +131 -0
- package/dist/nodes/vendors/GoogleGemini/actions/versionDescription.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/video/analyze.operation.js +125 -0
- package/dist/nodes/vendors/GoogleGemini/actions/video/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/video/download.operation.js +88 -0
- package/dist/nodes/vendors/GoogleGemini/actions/video/download.operation.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/video/generate.operation.js +228 -0
- package/dist/nodes/vendors/GoogleGemini/actions/video/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/actions/video/index.js +84 -0
- package/dist/nodes/vendors/GoogleGemini/actions/video/index.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/gemini.svg +1 -0
- package/dist/nodes/vendors/GoogleGemini/helpers/baseAnalyze.js +100 -0
- package/dist/nodes/vendors/GoogleGemini/helpers/baseAnalyze.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/helpers/interfaces.js +17 -0
- package/dist/nodes/vendors/GoogleGemini/helpers/interfaces.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/helpers/utils.js +91 -0
- package/dist/nodes/vendors/GoogleGemini/helpers/utils.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/methods/index.js +39 -0
- package/dist/nodes/vendors/GoogleGemini/methods/index.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/methods/listSearch.js +74 -0
- package/dist/nodes/vendors/GoogleGemini/methods/listSearch.js.map +1 -0
- package/dist/nodes/vendors/GoogleGemini/transport/index.js +48 -0
- package/dist/nodes/vendors/GoogleGemini/transport/index.js.map +1 -0
- package/dist/types/credentials.json +2 -2
- package/dist/types/nodes.json +4 -1
- package/dist/utils/descriptions.js +13 -2
- package/dist/utils/descriptions.js.map +1 -1
- package/dist/utils/helpers.js +2 -7
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/output_parsers/N8nOutputParser.js.map +1 -1
- package/package.json +10 -6
|
@@ -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;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__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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O;AACN,WAAO,SAAS,SAAS,sBAAsB,iBAAiB,IAAI,CAAC,YAAY;AAAA,MAChF,MAAM;AAAA,QACL,KAAK,OAAO,MAAM;AAAA,MACnB;AAAA,MACA,YAAY,EAAE,MAAM,EAAE;AAAA,IACvB,EAAE;AAAA,EACH;AACD;","names":[]}
|
|
@@ -0,0 +1,84 @@
|
|
|
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 video_exports = {};
|
|
30
|
+
__export(video_exports, {
|
|
31
|
+
analyze: () => analyze,
|
|
32
|
+
description: () => description,
|
|
33
|
+
download: () => download,
|
|
34
|
+
generate: () => generate
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(video_exports);
|
|
37
|
+
var analyze = __toESM(require("./analyze.operation"));
|
|
38
|
+
var download = __toESM(require("./download.operation"));
|
|
39
|
+
var generate = __toESM(require("./generate.operation"));
|
|
40
|
+
const description = [
|
|
41
|
+
{
|
|
42
|
+
displayName: "Operation",
|
|
43
|
+
name: "operation",
|
|
44
|
+
type: "options",
|
|
45
|
+
noDataExpression: true,
|
|
46
|
+
options: [
|
|
47
|
+
{
|
|
48
|
+
name: "Analyze Video",
|
|
49
|
+
value: "analyze",
|
|
50
|
+
action: "Analyze video",
|
|
51
|
+
description: "Take in videos and answer questions about them"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "Generate a Video",
|
|
55
|
+
value: "generate",
|
|
56
|
+
action: "Generate a video",
|
|
57
|
+
description: "Creates a video from a text prompt"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "Download Video",
|
|
61
|
+
value: "download",
|
|
62
|
+
action: "Download a video",
|
|
63
|
+
description: "Download a generated video from the Google Gemini API using a URL"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
default: "generate",
|
|
67
|
+
displayOptions: {
|
|
68
|
+
show: {
|
|
69
|
+
resource: ["video"]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
...analyze.description,
|
|
74
|
+
...download.description,
|
|
75
|
+
...generate.description
|
|
76
|
+
];
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
analyze,
|
|
80
|
+
description,
|
|
81
|
+
download,
|
|
82
|
+
generate
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/video/index.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as analyze from './analyze.operation';\nimport * as download from './download.operation';\nimport * as generate from './generate.operation';\n\nexport { analyze, download, 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 Video',\n\t\t\t\tvalue: 'analyze',\n\t\t\t\taction: 'Analyze video',\n\t\t\t\tdescription: 'Take in videos and answer questions about them',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Generate a Video',\n\t\t\t\tvalue: 'generate',\n\t\t\t\taction: 'Generate a video',\n\t\t\t\tdescription: 'Creates a video from a text prompt',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Download Video',\n\t\t\t\tvalue: 'download',\n\t\t\t\taction: 'Download a video',\n\t\t\t\tdescription: 'Download a generated video from the Google Gemini API using a URL',\n\t\t\t},\n\t\t],\n\t\tdefault: 'generate',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['video'],\n\t\t\t},\n\t\t},\n\t},\n\t...analyze.description,\n\t...download.description,\n\t...generate.description,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,cAAyB;AACzB,eAA0B;AAC1B,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,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;AAAA,EACZ,GAAG,SAAS;AACb;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg class="_footerSpark_98udt_151" width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M57.0667 28.6103C52.1359 26.4878 47.8217 23.576 44.1223 19.8784C40.4247 16.1808 37.5128 11.8649 35.3902 6.9342C34.5754 5.04449 33.9206 3.10204 33.4186 1.11049C33.2549 0.459368 32.6711 0.0010376 32 0.0010376C31.3288 0.0010376 30.745 0.459368 30.5813 1.11049C30.0793 3.10204 29.4246 5.04267 28.6097 6.9342C26.4872 11.8649 23.5753 16.1808 19.8777 19.8784C16.18 23.576 11.864 26.4878 6.93327 28.6103C5.04353 29.4251 3.10105 30.0799 1.10947 30.5819C0.458338 30.7456 0 31.3294 0 32.0005C0 32.6716 0.458338 33.2555 1.10947 33.4191C3.10105 33.9211 5.04172 34.5759 6.93327 35.3907C11.864 37.5132 16.1782 40.4251 19.8777 44.1226C23.5771 47.8202 26.4872 52.1361 28.6097 57.0668C29.4246 58.9565 30.0793 60.899 30.5813 62.8905C30.745 63.5416 31.3288 64 32 64C32.6711 64 33.2549 63.5416 33.4186 62.8905C33.9206 60.899 34.5754 58.9583 35.3902 57.0668C37.5128 52.1361 40.4247 47.822 44.1223 44.1226C47.8199 40.4251 52.1359 37.5132 57.0667 35.3907C58.9564 34.5759 60.8989 33.9211 62.8905 33.4191C63.5416 33.2555 64 32.6716 64 32.0005C64 31.3294 63.5416 30.7456 62.8905 30.5819C60.8989 30.0799 58.9582 29.4251 57.0667 28.6103Z" fill="white"></path><mask id="mask0_10859_4894" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="64" height="64"><path d="M32 0C32.6711 1.144e-05 33.2553 0.458263 33.4189 1.10938C33.9209 3.10093 34.5758 5.04389 35.3906 6.93359C37.5131 11.8639 40.4247 16.1796 44.1221 19.877C47.8215 23.5745 52.1357 26.4869 57.0664 28.6094C58.958 29.4242 60.899 30.0791 62.8906 30.5811C63.5415 30.7448 63.9998 31.3281 64 31.999C64 32.6701 63.5417 33.2542 62.8906 33.418C60.899 33.9199 58.9561 34.5748 57.0664 35.3896C52.1358 37.5121 47.8196 40.4237 44.1221 44.1211C40.4246 47.8204 37.5131 52.1349 35.3906 57.0654C34.5758 58.957 33.9209 60.8981 33.4189 62.8896C33.2552 63.5407 32.6711 63.999 32 63.999C31.3289 63.999 30.7448 63.5407 30.5811 62.8896C30.0791 60.8981 29.4242 58.9551 28.6094 57.0654C26.4869 52.1349 23.5773 47.8186 19.8779 44.1211C16.1786 40.4237 11.8642 37.5121 6.93359 35.3896C5.04204 34.5748 3.10096 33.9199 1.10938 33.418C0.458309 33.2542 0 32.6701 0 31.999C0.000201548 31.3281 0.458463 30.7448 1.10938 30.5811C3.10096 30.0791 5.04386 29.4242 6.93359 28.6094C11.8643 26.4869 16.1804 23.5745 19.8779 19.877C23.5753 16.1796 26.4869 11.8639 28.6094 6.93359C29.4242 5.04207 30.0791 3.10093 30.5811 1.10938C30.7448 0.45826 31.3289 0 32 0Z" fill="black"></path><path d="M32 0C32.6711 1.144e-05 33.2553 0.458263 33.4189 1.10938C33.9209 3.10093 34.5758 5.04389 35.3906 6.93359C37.5131 11.8639 40.4247 16.1796 44.1221 19.877C47.8215 23.5745 52.1357 26.4869 57.0664 28.6094C58.958 29.4242 60.899 30.0791 62.8906 30.5811C63.5415 30.7448 63.9998 31.3281 64 31.999C64 32.6701 63.5417 33.2542 62.8906 33.418C60.899 33.9199 58.9561 34.5748 57.0664 35.3896C52.1358 37.5121 47.8196 40.4237 44.1221 44.1211C40.4246 47.8204 37.5131 52.1349 35.3906 57.0654C34.5758 58.957 33.9209 60.8981 33.4189 62.8896C33.2552 63.5407 32.6711 63.999 32 63.999C31.3289 63.999 30.7448 63.5407 30.5811 62.8896C30.0791 60.8981 29.4242 58.9551 28.6094 57.0654C26.4869 52.1349 23.5773 47.8186 19.8779 44.1211C16.1786 40.4237 11.8642 37.5121 6.93359 35.3896C5.04204 34.5748 3.10096 33.9199 1.10938 33.418C0.458309 33.2542 0 32.6701 0 31.999C0.000201548 31.3281 0.458463 30.7448 1.10938 30.5811C3.10096 30.0791 5.04386 29.4242 6.93359 28.6094C11.8643 26.4869 16.1804 23.5745 19.8779 19.877C23.5753 16.1796 26.4869 11.8639 28.6094 6.93359C29.4242 5.04207 30.0791 3.10093 30.5811 1.10938C30.7448 0.45826 31.3289 0 32 0Z" fill="url(#paint0_linear_10859_4894)"></path></mask><g mask="url(#mask0_10859_4894)"><g filter="url(#filter0_f_10859_4894)"><ellipse cx="14.2084" cy="16.7164" rx="14.2084" ry="16.7164" transform="matrix(0.942343 0.334649 -0.334656 0.94234 -7.979 13.7735)" fill="#FFE432"></ellipse></g><g filter="url(#filter1_f_10859_4894)"><ellipse cx="27.0543" cy="2.55114" rx="18.3944" ry="18.7985" fill="#FC413D"></ellipse></g><g filter="url(#filter2_f_10859_4894)"><ellipse cx="19.2245" cy="24.9042" rx="19.2245" ry="24.9042" transform="matrix(0.998807 -0.0488254 0.0488266 0.998807 -1.72778 32.6573)" fill="#00B95C"></ellipse></g><g filter="url(#filter3_f_10859_4894)"><ellipse cx="19.2245" cy="24.9042" rx="19.2245" ry="24.9042" transform="matrix(0.998807 -0.0488254 0.0488266 0.998807 -1.72778 32.6573)" fill="#00B95C"></ellipse></g><g filter="url(#filter4_f_10859_4894)"><ellipse cx="18.8429" cy="20.7441" rx="18.8429" ry="20.7441" transform="matrix(0.854301 -0.519779 0.51979 0.854294 -7.13574 47.5078)" fill="#00B95C"></ellipse></g><g filter="url(#filter5_f_10859_4894)"><ellipse cx="66.4617" cy="24.977" rx="18.0933" ry="17.4229" fill="#3186FF"></ellipse></g><g filter="url(#filter6_f_10859_4894)"><ellipse cx="20.9292" cy="22.0752" rx="20.9292" ry="22.0752" transform="matrix(0.79599 0.60531 -0.60532 0.795982 -2.81885 -7.43323)" fill="#FBBC04"></ellipse></g><g filter="url(#filter7_f_10859_4894)"><ellipse cx="24.1311" cy="22.2919" rx="24.1311" ry="22.2919" transform="matrix(0.824037 0.566536 -0.566546 0.82403 39.6338 0.310608)" fill="#3186FF"></ellipse></g><g filter="url(#filter8_f_10859_4894)"><path d="M54.2255 -2.30403C57.0195 1.49462 53.4294 8.8804 46.2068 14.1926C38.9842 19.5048 30.8642 20.7318 28.0702 16.9331C25.2762 13.1345 28.8663 5.74867 36.0889 0.436486C43.3115 -4.8757 51.4315 -6.10267 54.2255 -2.30403Z" fill="#749BFF"></path></g><g filter="url(#filter9_f_10859_4894)"><ellipse cx="27.5853" cy="17.1478" rx="27.5853" ry="17.1478" transform="matrix(0.733166 -0.680049 0.680061 0.733155 -12.2583 9.49695)" fill="#FC413D"></ellipse></g><g filter="url(#filter10_f_10859_4894)"><ellipse cx="14.7819" cy="8.59637" rx="14.7819" ry="8.59637" transform="matrix(0.813186 0.582004 -0.582016 0.813177 6.37842 30.511)" fill="#FFEE48"></ellipse></g></g><defs><filter id="filter0_f_10859_4894" x="-19.618" y="12.9027" width="38.8681" height="42.7562" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="2.45965" result="effect1_foregroundBlur_10859_4894"></feGaussianBlur></filter><filter id="filter1_f_10859_4894" x="-15.1223" y="-40.0296" width="84.3533" height="85.1615" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="11.8911" result="effect1_foregroundBlur_10859_4894"></feGaussianBlur></filter><filter id="filter2_f_10859_4894" x="-20.7682" y="11.4835" width="78.9161" height="90.2196" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="10.1086" result="effect1_foregroundBlur_10859_4894"></feGaussianBlur></filter><filter id="filter3_f_10859_4894" x="-20.7682" y="11.4835" width="78.9161" height="90.2196" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="10.1086" result="effect1_foregroundBlur_10859_4894"></feGaussianBlur></filter><filter id="filter4_f_10859_4894" x="-19.85" y="14.9664" width="79.1886" height="80.9378" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="10.1086" result="effect1_foregroundBlur_10859_4894"></feGaussianBlur></filter><filter id="filter5_f_10859_4894" x="29.1561" y="-11.6582" width="74.6111" height="73.2703" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="9.60613" result="effect1_foregroundBlur_10859_4894"></feGaussianBlur></filter><filter id="filter6_f_10859_4894" x="-38.291" y="-16.2687" width="77.538" height="78.1513" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="8.70591" result="effect1_foregroundBlur_10859_4894"></feGaussianBlur></filter><filter id="filter7_f_10859_4894" x="7.78038" y="-6.0981" width="78.2181" height="76.8982" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="7.77473" result="effect1_foregroundBlur_10859_4894"></feGaussianBlur></filter><filter id="filter8_f_10859_4894" x="13.2082" y="-18.425" width="55.8793" height="51.4791" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="6.95694" result="effect1_foregroundBlur_10859_4894"></feGaussianBlur></filter><filter id="filter9_f_10859_4894" x="-15.4739" y="-31.0272" width="70.2034" height="68.6735" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="5.87598" result="effect1_foregroundBlur_10859_4894"></feGaussianBlur></filter><filter id="filter10_f_10859_4894" x="-14.173" y="20.474" width="55.1373" height="51.261" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="7.27253" result="effect1_foregroundBlur_10859_4894"></feGaussianBlur></filter><linearGradient id="paint0_linear_10859_4894" x1="18.1931" y1="42.821" x2="51.4335" y2="14.7959" gradientUnits="userSpaceOnUse"><stop stop-color="#4893FC"></stop><stop offset="0.27" stop-color="#4893FC"></stop><stop offset="0.776981" stop-color="#969DFF"></stop><stop offset="1" stop-color="#BD99FE"></stop></linearGradient></defs></svg>
|
|
@@ -0,0 +1,100 @@
|
|
|
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 baseAnalyze_exports = {};
|
|
20
|
+
__export(baseAnalyze_exports, {
|
|
21
|
+
baseAnalyze: () => baseAnalyze
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(baseAnalyze_exports);
|
|
24
|
+
var import_utils = require("./utils");
|
|
25
|
+
var import_transport = require("../transport");
|
|
26
|
+
async function baseAnalyze(i, urlsPropertyName, fallbackMimeType) {
|
|
27
|
+
const model = this.getNodeParameter("modelId", i, "", { extractValue: true });
|
|
28
|
+
const inputType = this.getNodeParameter("inputType", i, "url");
|
|
29
|
+
const text = this.getNodeParameter("text", i, "");
|
|
30
|
+
const simplify = this.getNodeParameter("simplify", i, true);
|
|
31
|
+
const options = this.getNodeParameter("options", i, {});
|
|
32
|
+
const generationConfig = {
|
|
33
|
+
maxOutputTokens: options.maxOutputTokens
|
|
34
|
+
};
|
|
35
|
+
let contents;
|
|
36
|
+
if (inputType === "url") {
|
|
37
|
+
const urls = this.getNodeParameter(urlsPropertyName, i, "");
|
|
38
|
+
const filesDataPromises = urls.split(",").map((url) => url.trim()).filter((url) => url).map(async (url) => {
|
|
39
|
+
if (url.startsWith("https://generativelanguage.googleapis.com")) {
|
|
40
|
+
const { mimeType } = await import_transport.apiRequest.call(this, "GET", "", {
|
|
41
|
+
option: { url }
|
|
42
|
+
});
|
|
43
|
+
return { fileUri: url, mimeType };
|
|
44
|
+
} else {
|
|
45
|
+
const { fileContent, mimeType } = await import_utils.downloadFile.call(this, url, fallbackMimeType);
|
|
46
|
+
return await import_utils.uploadFile.call(this, fileContent, mimeType);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const filesData = await Promise.all(filesDataPromises);
|
|
50
|
+
contents = [
|
|
51
|
+
{
|
|
52
|
+
role: "user",
|
|
53
|
+
parts: filesData.map((fileData) => ({
|
|
54
|
+
fileData
|
|
55
|
+
}))
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
} else {
|
|
59
|
+
const binaryPropertyNames = this.getNodeParameter("binaryPropertyName", i, "data");
|
|
60
|
+
const promises = binaryPropertyNames.split(",").map((binaryPropertyName) => binaryPropertyName.trim()).filter((binaryPropertyName) => binaryPropertyName).map(async (binaryPropertyName) => {
|
|
61
|
+
const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
|
|
62
|
+
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
63
|
+
return await import_utils.uploadFile.call(this, buffer, binaryData.mimeType);
|
|
64
|
+
});
|
|
65
|
+
const filesData = await Promise.all(promises);
|
|
66
|
+
contents = [
|
|
67
|
+
{
|
|
68
|
+
role: "user",
|
|
69
|
+
parts: filesData.map((fileData) => ({
|
|
70
|
+
fileData
|
|
71
|
+
}))
|
|
72
|
+
}
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
contents[0].parts.push({ text });
|
|
76
|
+
const body = {
|
|
77
|
+
contents,
|
|
78
|
+
generationConfig
|
|
79
|
+
};
|
|
80
|
+
const response = await import_transport.apiRequest.call(this, "POST", `/v1beta/${model}:generateContent`, {
|
|
81
|
+
body
|
|
82
|
+
});
|
|
83
|
+
if (simplify) {
|
|
84
|
+
return response.candidates.map((candidate) => ({
|
|
85
|
+
json: candidate,
|
|
86
|
+
pairedItem: { item: i }
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
return [
|
|
90
|
+
{
|
|
91
|
+
json: { ...response },
|
|
92
|
+
pairedItem: { item: i }
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
}
|
|
96
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
+
0 && (module.exports = {
|
|
98
|
+
baseAnalyze
|
|
99
|
+
});
|
|
100
|
+
//# sourceMappingURL=baseAnalyze.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/helpers/baseAnalyze.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';\n\nimport type { Content, GenerateContentResponse } from './interfaces';\nimport { downloadFile, uploadFile } from './utils';\nimport { apiRequest } from '../transport';\n\nexport async function baseAnalyze(\n\tthis: IExecuteFunctions,\n\ti: number,\n\turlsPropertyName: string,\n\tfallbackMimeType: string,\n): Promise<INodeExecutionData[]> {\n\tconst model = this.getNodeParameter('modelId', i, '', { extractValue: true }) as string;\n\tconst inputType = this.getNodeParameter('inputType', i, 'url') as string;\n\tconst text = this.getNodeParameter('text', i, '') as string;\n\tconst simplify = this.getNodeParameter('simplify', i, true) as boolean;\n\tconst options = this.getNodeParameter('options', i, {});\n\n\tconst generationConfig = {\n\t\tmaxOutputTokens: options.maxOutputTokens,\n\t};\n\n\tlet contents: Content[];\n\tif (inputType === 'url') {\n\t\tconst urls = this.getNodeParameter(urlsPropertyName, i, '') as string;\n\t\tconst filesDataPromises = urls\n\t\t\t.split(',')\n\t\t\t.map((url) => url.trim())\n\t\t\t.filter((url) => url)\n\t\t\t.map(async (url) => {\n\t\t\t\tif (url.startsWith('https://generativelanguage.googleapis.com')) {\n\t\t\t\t\tconst { mimeType } = (await apiRequest.call(this, 'GET', '', {\n\t\t\t\t\t\toption: { url },\n\t\t\t\t\t})) as { mimeType: string };\n\t\t\t\t\treturn { fileUri: url, mimeType };\n\t\t\t\t} else {\n\t\t\t\t\tconst { fileContent, mimeType } = await downloadFile.call(this, url, fallbackMimeType);\n\t\t\t\t\treturn await uploadFile.call(this, fileContent, mimeType);\n\t\t\t\t}\n\t\t\t});\n\n\t\tconst filesData = await Promise.all(filesDataPromises);\n\t\tcontents = [\n\t\t\t{\n\t\t\t\trole: 'user',\n\t\t\t\tparts: filesData.map((fileData) => ({\n\t\t\t\t\tfileData,\n\t\t\t\t})),\n\t\t\t},\n\t\t];\n\t} else {\n\t\tconst binaryPropertyNames = this.getNodeParameter('binaryPropertyName', i, 'data');\n\t\tconst promises = binaryPropertyNames\n\t\t\t.split(',')\n\t\t\t.map((binaryPropertyName) => binaryPropertyName.trim())\n\t\t\t.filter((binaryPropertyName) => binaryPropertyName)\n\t\t\t.map(async (binaryPropertyName) => {\n\t\t\t\tconst binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);\n\t\t\t\tconst buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);\n\t\t\t\treturn await uploadFile.call(this, buffer, binaryData.mimeType);\n\t\t\t});\n\n\t\tconst filesData = await Promise.all(promises);\n\t\tcontents = [\n\t\t\t{\n\t\t\t\trole: 'user',\n\t\t\t\tparts: filesData.map((fileData) => ({\n\t\t\t\t\tfileData,\n\t\t\t\t})),\n\t\t\t},\n\t\t];\n\t}\n\n\tcontents[0].parts.push({ text });\n\n\tconst body = {\n\t\tcontents,\n\t\tgenerationConfig,\n\t};\n\n\tconst response = (await apiRequest.call(this, 'POST', `/v1beta/${model}:generateContent`, {\n\t\tbody,\n\t})) as GenerateContentResponse;\n\n\tif (simplify) {\n\t\treturn response.candidates.map((candidate) => ({\n\t\t\tjson: candidate,\n\t\t\tpairedItem: { item: i },\n\t\t}));\n\t}\n\n\treturn [\n\t\t{\n\t\t\tjson: { ...response },\n\t\t\tpairedItem: { item: i },\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAyC;AACzC,uBAA2B;AAE3B,eAAsB,YAErB,GACA,kBACA,kBACgC;AAChC,QAAM,QAAQ,KAAK,iBAAiB,WAAW,GAAG,IAAI,EAAE,cAAc,KAAK,CAAC;AAC5E,QAAM,YAAY,KAAK,iBAAiB,aAAa,GAAG,KAAK;AAC7D,QAAM,OAAO,KAAK,iBAAiB,QAAQ,GAAG,EAAE;AAChD,QAAM,WAAW,KAAK,iBAAiB,YAAY,GAAG,IAAI;AAC1D,QAAM,UAAU,KAAK,iBAAiB,WAAW,GAAG,CAAC,CAAC;AAEtD,QAAM,mBAAmB;AAAA,IACxB,iBAAiB,QAAQ;AAAA,EAC1B;AAEA,MAAI;AACJ,MAAI,cAAc,OAAO;AACxB,UAAM,OAAO,KAAK,iBAAiB,kBAAkB,GAAG,EAAE;AAC1D,UAAM,oBAAoB,KACxB,MAAM,GAAG,EACT,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,EACvB,OAAO,CAAC,QAAQ,GAAG,EACnB,IAAI,OAAO,QAAQ;AACnB,UAAI,IAAI,WAAW,2CAA2C,GAAG;AAChE,cAAM,EAAE,SAAS,IAAK,MAAM,4BAAW,KAAK,MAAM,OAAO,IAAI;AAAA,UAC5D,QAAQ,EAAE,IAAI;AAAA,QACf,CAAC;AACD,eAAO,EAAE,SAAS,KAAK,SAAS;AAAA,MACjC,OAAO;AACN,cAAM,EAAE,aAAa,SAAS,I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AAAA,EACH;AAEA,SAAO;AAAA,IACN;AAAA,MACC,MAAM,EAAE,GAAG,SAAS;AAAA,MACpB,YAAY,EAAE,MAAM,EAAE;AAAA,IACvB;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var interfaces_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(interfaces_exports);
|
|
17
|
+
//# sourceMappingURL=interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/helpers/interfaces.ts"],"sourcesContent":["import type { IDataObject } from 'n8n-workflow';\n\nexport interface GenerateContentResponse {\n\tcandidates: Array<{\n\t\tcontent: Content;\n\t}>;\n}\n\nexport interface Content {\n\tparts: Part[];\n\trole: string;\n}\n\nexport type Part =\n\t| { text: string }\n\t| {\n\t\t\tinlineData: {\n\t\t\t\tmimeType: string;\n\t\t\t\tdata: string;\n\t\t\t};\n\t }\n\t| {\n\t\t\tfunctionCall: {\n\t\t\t\tid?: string;\n\t\t\t\tname: string;\n\t\t\t\targs?: IDataObject;\n\t\t\t};\n\t }\n\t| {\n\t\t\tfunctionResponse: {\n\t\t\t\tid?: string;\n\t\t\t\tname: string;\n\t\t\t\tresponse: IDataObject;\n\t\t\t};\n\t }\n\t| {\n\t\t\tfileData?: {\n\t\t\t\tmimeType?: string;\n\t\t\t\tfileUri?: string;\n\t\t\t};\n\t };\n\nexport interface ImagenResponse {\n\tpredictions: Array<{\n\t\tbytesBase64Encoded: string;\n\t\tmimeType: string;\n\t}>;\n}\n\nexport interface VeoResponse {\n\tname: string;\n\tdone: boolean;\n\terror?: {\n\t\tmessage: string;\n\t};\n\tresponse: {\n\t\tgenerateVideoResponse: {\n\t\t\tgeneratedSamples: Array<{\n\t\t\t\tvideo: {\n\t\t\t\t\turi: string;\n\t\t\t\t};\n\t\t\t}>;\n\t\t};\n\t};\n}\n\nexport interface Tool {\n\tfunctionDeclarations?: Array<{\n\t\tname: string;\n\t\tdescription: string;\n\t\tparameters: IDataObject;\n\t}>;\n\tcodeExecution?: object;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|