@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.
- package/dist/credentials/CohereApi.credentials.js +7 -1
- package/dist/credentials/CohereApi.credentials.js.map +1 -1
- package/dist/known/credentials.json +3 -0
- package/dist/known/nodes.json +16 -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 +13 -2
- 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/LmChatAwsBedrock/LmChatAwsBedrock.node.js +2 -0
- package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.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/McpClientTool/McpClientTool.node.js +55 -5
- package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js.map +1 -1
- package/dist/nodes/mcp/McpClientTool/loadOptions.js +11 -2
- package/dist/nodes/mcp/McpClientTool/loadOptions.js.map +1 -1
- package/dist/nodes/mcp/McpClientTool/types.js.map +1 -1
- package/dist/nodes/mcp/McpClientTool/utils.js +21 -11
- package/dist/nodes/mcp/McpClientTool/utils.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/ToolThink/ToolThink.node.js +5 -2
- package/dist/nodes/tools/ToolThink/ToolThink.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/Anthropic/Anthropic.node.js +42 -0
- package/dist/nodes/vendors/Anthropic/Anthropic.node.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/descriptions.js +52 -0
- package/dist/nodes/vendors/Anthropic/actions/descriptions.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/document/analyze.operation.js +125 -0
- package/dist/nodes/vendors/Anthropic/actions/document/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/document/index.js +64 -0
- package/dist/nodes/vendors/Anthropic/actions/document/index.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/file/delete.operation.js +61 -0
- package/dist/nodes/vendors/Anthropic/actions/file/delete.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/file/get.operation.js +63 -0
- package/dist/nodes/vendors/Anthropic/actions/file/get.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/file/index.js +94 -0
- package/dist/nodes/vendors/Anthropic/actions/file/index.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/file/list.operation.js +108 -0
- package/dist/nodes/vendors/Anthropic/actions/file/list.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/file/upload.operation.js +126 -0
- package/dist/nodes/vendors/Anthropic/actions/file/upload.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/image/analyze.operation.js +125 -0
- package/dist/nodes/vendors/Anthropic/actions/image/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/image/index.js +64 -0
- package/dist/nodes/vendors/Anthropic/actions/image/index.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/node.type.js +17 -0
- package/dist/nodes/vendors/Anthropic/actions/node.type.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/generate.operation.js +87 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/improve.operation.js +154 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/improve.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/index.js +95 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/index.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/templatize.operation.js +146 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/templatize.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/router.js +93 -0
- package/dist/nodes/vendors/Anthropic/actions/router.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/text/index.js +64 -0
- package/dist/nodes/vendors/Anthropic/actions/text/index.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/text/message.operation.js +540 -0
- package/dist/nodes/vendors/Anthropic/actions/text/message.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/versionDescription.js +125 -0
- package/dist/nodes/vendors/Anthropic/actions/versionDescription.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/anthropic.svg +1 -0
- package/dist/nodes/vendors/Anthropic/helpers/baseAnalyze.js +109 -0
- package/dist/nodes/vendors/Anthropic/helpers/baseAnalyze.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/helpers/interfaces.js +17 -0
- package/dist/nodes/vendors/Anthropic/helpers/interfaces.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/helpers/utils.js +84 -0
- package/dist/nodes/vendors/Anthropic/helpers/utils.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/methods/index.js +39 -0
- package/dist/nodes/vendors/Anthropic/methods/index.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/methods/listSearch.js +42 -0
- package/dist/nodes/vendors/Anthropic/methods/listSearch.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/transport/index.js +57 -0
- package/dist/nodes/vendors/Anthropic/transport/index.js.map +1 -0
- 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/nodes/vendors/OpenAi/actions/router.js +1 -1
- package/dist/nodes/vendors/OpenAi/actions/router.js.map +1 -1
- package/dist/types/credentials.json +3 -3
- package/dist/types/nodes.json +9 -5
- 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 +11 -6
|
@@ -0,0 +1,108 @@
|
|
|
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 list_operation_exports = {};
|
|
20
|
+
__export(list_operation_exports, {
|
|
21
|
+
description: () => description,
|
|
22
|
+
execute: () => execute,
|
|
23
|
+
properties: () => properties
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(list_operation_exports);
|
|
26
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
27
|
+
var import_utils = require("../../helpers/utils");
|
|
28
|
+
var import_transport = require("../../transport");
|
|
29
|
+
const properties = [
|
|
30
|
+
{
|
|
31
|
+
displayName: "Return All",
|
|
32
|
+
name: "returnAll",
|
|
33
|
+
type: "boolean",
|
|
34
|
+
default: false,
|
|
35
|
+
description: "Whether to return all results or only up to a given limit"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
displayName: "Limit",
|
|
39
|
+
name: "limit",
|
|
40
|
+
type: "number",
|
|
41
|
+
typeOptions: {
|
|
42
|
+
minValue: 1,
|
|
43
|
+
maxValue: 1e3
|
|
44
|
+
},
|
|
45
|
+
default: 50,
|
|
46
|
+
description: "Max number of results to return",
|
|
47
|
+
displayOptions: {
|
|
48
|
+
show: {
|
|
49
|
+
returnAll: [false]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
const displayOptions = {
|
|
55
|
+
show: {
|
|
56
|
+
operation: ["list"],
|
|
57
|
+
resource: ["file"]
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
|
|
61
|
+
async function execute(i) {
|
|
62
|
+
const returnAll = this.getNodeParameter("returnAll", i, false);
|
|
63
|
+
const limit = this.getNodeParameter("limit", i, 50);
|
|
64
|
+
const baseUrl = await import_utils.getBaseUrl.call(this);
|
|
65
|
+
if (returnAll) {
|
|
66
|
+
return await getAllFiles.call(this, baseUrl, i);
|
|
67
|
+
} else {
|
|
68
|
+
return await getFiles.call(this, baseUrl, i, limit);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function getAllFiles(baseUrl, i) {
|
|
72
|
+
let hasMore = true;
|
|
73
|
+
let lastId = void 0;
|
|
74
|
+
const files = [];
|
|
75
|
+
while (hasMore) {
|
|
76
|
+
const response = await import_transport.apiRequest.call(this, "GET", "/v1/files", {
|
|
77
|
+
qs: {
|
|
78
|
+
limit: 1e3,
|
|
79
|
+
after_id: lastId
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
hasMore = response.has_more;
|
|
83
|
+
lastId = response.last_id;
|
|
84
|
+
files.push(...response.data);
|
|
85
|
+
}
|
|
86
|
+
return files.map((file) => ({
|
|
87
|
+
json: { ...file, url: `${baseUrl}/v1/files/${file.id}` },
|
|
88
|
+
pairedItem: { item: i }
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
async function getFiles(baseUrl, i, limit) {
|
|
92
|
+
const response = await import_transport.apiRequest.call(this, "GET", "/v1/files", {
|
|
93
|
+
qs: {
|
|
94
|
+
limit
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return response.data.map((file) => ({
|
|
98
|
+
json: { ...file, url: `${baseUrl}/v1/files/${file.id}` },
|
|
99
|
+
pairedItem: { item: i }
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
+
0 && (module.exports = {
|
|
104
|
+
description,
|
|
105
|
+
execute,
|
|
106
|
+
properties
|
|
107
|
+
});
|
|
108
|
+
//# sourceMappingURL=list.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/file/list.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport type { File } from '../../helpers/interfaces';\nimport { getBaseUrl } from '../../helpers/utils';\nimport { apiRequest } from '../../transport';\n\ninterface FileListResponse {\n\tdata: File[];\n\tfirst_id: string;\n\tlast_id: string;\n\thas_more: boolean;\n}\n\nexport const properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Return All',\n\t\tname: 'returnAll',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription: 'Whether to return all results or only up to a given limit',\n\t},\n\t{\n\t\tdisplayName: 'Limit',\n\t\tname: 'limit',\n\t\ttype: 'number',\n\t\ttypeOptions: {\n\t\t\tminValue: 1,\n\t\t\tmaxValue: 1000,\n\t\t},\n\t\tdefault: 50,\n\t\tdescription: 'Max number of results to return',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\treturnAll: [false],\n\t\t\t},\n\t\t},\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['list'],\n\t\tresource: ['file'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst returnAll = this.getNodeParameter('returnAll', i, false);\n\tconst limit = this.getNodeParameter('limit', i, 50);\n\tconst baseUrl = await getBaseUrl.call(this);\n\tif (returnAll) {\n\t\treturn await getAllFiles.call(this, baseUrl, i);\n\t} else {\n\t\treturn await getFiles.call(this, baseUrl, i, limit);\n\t}\n}\n\nasync function getAllFiles(this: IExecuteFunctions, baseUrl: string, i: number) {\n\tlet hasMore = true;\n\tlet lastId: string | undefined = undefined;\n\tconst files: File[] = [];\n\twhile (hasMore) {\n\t\tconst response = (await apiRequest.call(this, 'GET', '/v1/files', {\n\t\t\tqs: {\n\t\t\t\tlimit: 1000,\n\t\t\t\tafter_id: lastId,\n\t\t\t},\n\t\t})) as FileListResponse;\n\n\t\thasMore = response.has_more;\n\t\tlastId = response.last_id;\n\t\tfiles.push(...response.data);\n\t}\n\n\treturn files.map((file) => ({\n\t\tjson: { ...file, url: `${baseUrl}/v1/files/${file.id}` },\n\t\tpairedItem: { item: i },\n\t}));\n}\n\nasync function getFiles(this: IExecuteFunctions, baseUrl: string, i: number, limit: number) {\n\tconst response = (await apiRequest.call(this, 'GET', '/v1/files', {\n\t\tqs: {\n\t\t\tlimit,\n\t\t},\n\t})) as FileListResponse;\n\n\treturn response.data.map((file) => ({\n\t\tjson: { ...file, url: `${baseUrl}/v1/files/${file.id}` },\n\t\tpairedItem: { item: i },\n\t}));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAGrC,mBAA2B;AAC3B,uBAA2B;AASpB,MAAM,aAAgC;AAAA,EAC5C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,EACd;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,MACZ,UAAU;AAAA,MACV,UAAU;AAAA,IACX;AAAA,IACA,SAAS;AAAA,IACT,aAAa;AAAA,IACb,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,KAAK;AAAA,MAClB;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,WAAW,CAAC,MAAM;AAAA,IAClB,UAAU,CAAC,MAAM;AAAA,EAClB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;AAE1E,eAAsB,QAAiC,GAA0C;AAChG,QAAM,YAAY,KAAK,iBAAiB,aAAa,GAAG,KAAK;AAC7D,QAAM,QAAQ,KAAK,iBAAiB,SAAS,GAAG,EAAE;AAClD,QAAM,UAAU,MAAM,wBAAW,KAAK,IAAI;AAC1C,MAAI,WAAW;AACd,WAAO,MAAM,YAAY,KAAK,MAAM,SAAS,CAAC;AAAA,EAC/C,OAAO;AACN,WAAO,MAAM,SAAS,KAAK,MAAM,SAAS,GAAG,KAAK;AAAA,EACnD;AACD;AAEA,eAAe,YAAqC,SAAiB,GAAW;AAC/E,MAAI,UAAU;AACd,MAAI,SAA6B;AACjC,QAAM,QAAgB,CAAC;AACvB,SAAO,SAAS;AACf,UAAM,WAAY,MAAM,4BAAW,KAAK,MAAM,OAAO,aAAa;AAAA,MACjE,IAAI;AAAA,QACH,OAAO;AAAA,QACP,UAAU;AAAA,MACX;AAAA,IACD,CAAC;AAED,cAAU,SAAS;AACnB,aAAS,SAAS;AAClB,UAAM,KAAK,GAAG,SAAS,IAAI;AAAA,EAC5B;AAEA,SAAO,MAAM,IAAI,CAAC,UAAU;AAAA,IAC3B,MAAM,EAAE,GAAG,MAAM,KAAK,GAAG,OAAO,aAAa,KAAK,EAAE,GAAG;AAAA,IACvD,YAAY,EAAE,MAAM,EAAE;AAAA,EACvB,EAAE;AACH;AAEA,eAAe,SAAkC,SAAiB,GAAW,OAAe;AAC3F,QAAM,WAAY,MAAM,4BAAW,KAAK,MAAM,OAAO,aAAa;AAAA,IACjE,IAAI;AAAA,MACH;AAAA,IACD;AAAA,EACD,CAAC;AAED,SAAO,SAAS,KAAK,IAAI,CAAC,UAAU;AAAA,IACnC,MAAM,EAAE,GAAG,MAAM,KAAK,GAAG,OAAO,aAAa,KAAK,EAAE,GAAG;AAAA,IACvD,YAAY,EAAE,MAAM,EAAE;AAAA,EACvB,EAAE;AACH;","names":[]}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var upload_operation_exports = {};
|
|
20
|
+
__export(upload_operation_exports, {
|
|
21
|
+
description: () => description,
|
|
22
|
+
execute: () => execute,
|
|
23
|
+
properties: () => properties
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(upload_operation_exports);
|
|
26
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
27
|
+
var import_utils = require("../../helpers/utils");
|
|
28
|
+
const properties = [
|
|
29
|
+
{
|
|
30
|
+
displayName: "Input Type",
|
|
31
|
+
name: "inputType",
|
|
32
|
+
type: "options",
|
|
33
|
+
default: "url",
|
|
34
|
+
options: [
|
|
35
|
+
{
|
|
36
|
+
name: "File URL",
|
|
37
|
+
value: "url"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "Binary File",
|
|
41
|
+
value: "binary"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
displayName: "URL",
|
|
47
|
+
name: "fileUrl",
|
|
48
|
+
type: "string",
|
|
49
|
+
placeholder: "e.g. https://example.com/file.pdf",
|
|
50
|
+
description: "URL of the file to upload",
|
|
51
|
+
default: "",
|
|
52
|
+
displayOptions: {
|
|
53
|
+
show: {
|
|
54
|
+
inputType: ["url"]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
displayName: "Input Data Field Name",
|
|
60
|
+
name: "binaryPropertyName",
|
|
61
|
+
type: "string",
|
|
62
|
+
default: "data",
|
|
63
|
+
placeholder: "e.g. data",
|
|
64
|
+
hint: "The name of the input field containing the binary file data to be processed",
|
|
65
|
+
description: "Name of the binary field which contains the file",
|
|
66
|
+
displayOptions: {
|
|
67
|
+
show: {
|
|
68
|
+
inputType: ["binary"]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
displayName: "Options",
|
|
74
|
+
name: "options",
|
|
75
|
+
type: "collection",
|
|
76
|
+
placeholder: "Add Option",
|
|
77
|
+
default: {},
|
|
78
|
+
options: [
|
|
79
|
+
{
|
|
80
|
+
displayName: "File Name",
|
|
81
|
+
name: "fileName",
|
|
82
|
+
type: "string",
|
|
83
|
+
description: "The file name to use for the uploaded file",
|
|
84
|
+
default: ""
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
];
|
|
89
|
+
const displayOptions = {
|
|
90
|
+
show: {
|
|
91
|
+
operation: ["upload"],
|
|
92
|
+
resource: ["file"]
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
|
|
96
|
+
async function execute(i) {
|
|
97
|
+
const inputType = this.getNodeParameter("inputType", i, "url");
|
|
98
|
+
const fileName = this.getNodeParameter("options.fileName", i, "file");
|
|
99
|
+
const baseUrl = await import_utils.getBaseUrl.call(this);
|
|
100
|
+
let response;
|
|
101
|
+
if (inputType === "url") {
|
|
102
|
+
const fileUrl = this.getNodeParameter("fileUrl", i, "");
|
|
103
|
+
const { fileContent, mimeType } = await import_utils.downloadFile.call(this, fileUrl);
|
|
104
|
+
response = await import_utils.uploadFile.call(this, fileContent, mimeType, fileName);
|
|
105
|
+
} else {
|
|
106
|
+
const binaryPropertyName = this.getNodeParameter("binaryPropertyName", i, "data");
|
|
107
|
+
const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
|
|
108
|
+
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
109
|
+
response = await import_utils.uploadFile.call(this, buffer, binaryData.mimeType, fileName);
|
|
110
|
+
}
|
|
111
|
+
return [
|
|
112
|
+
{
|
|
113
|
+
json: { ...response, url: `${baseUrl}/v1/files/${response.id}` },
|
|
114
|
+
pairedItem: {
|
|
115
|
+
item: i
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
121
|
+
0 && (module.exports = {
|
|
122
|
+
description,
|
|
123
|
+
execute,
|
|
124
|
+
properties
|
|
125
|
+
});
|
|
126
|
+
//# sourceMappingURL=upload.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/file/upload.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport type { File } from '../../helpers/interfaces';\nimport { downloadFile, getBaseUrl, uploadFile } from '../../helpers/utils';\n\nexport const properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Input Type',\n\t\tname: 'inputType',\n\t\ttype: 'options',\n\t\tdefault: 'url',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'File URL',\n\t\t\t\tvalue: 'url',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Binary File',\n\t\t\t\tvalue: 'binary',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'URL',\n\t\tname: 'fileUrl',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. https://example.com/file.pdf',\n\t\tdescription: 'URL of the file to upload',\n\t\tdefault: '',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tinputType: ['url'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Input Data Field Name',\n\t\tname: 'binaryPropertyName',\n\t\ttype: 'string',\n\t\tdefault: 'data',\n\t\tplaceholder: 'e.g. data',\n\t\thint: 'The name of the input field containing the binary file data to be processed',\n\t\tdescription: 'Name of the binary field which contains the file',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tinputType: ['binary'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Options',\n\t\tname: 'options',\n\t\ttype: 'collection',\n\t\tplaceholder: 'Add Option',\n\t\tdefault: {},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'File Name',\n\t\t\t\tname: 'fileName',\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription: 'The file name to use for the uploaded file',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['upload'],\n\t\tresource: ['file'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst inputType = this.getNodeParameter('inputType', i, 'url') as string;\n\tconst fileName = this.getNodeParameter('options.fileName', i, 'file') as string;\n\tconst baseUrl = await getBaseUrl.call(this);\n\n\tlet response: File;\n\tif (inputType === 'url') {\n\t\tconst fileUrl = this.getNodeParameter('fileUrl', i, '') as string;\n\t\tconst { fileContent, mimeType } = await downloadFile.call(this, fileUrl);\n\t\tresponse = await uploadFile.call(this, fileContent, mimeType, fileName);\n\t} else {\n\t\tconst binaryPropertyName = this.getNodeParameter('binaryPropertyName', i, 'data');\n\t\tconst binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);\n\t\tconst buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);\n\t\tresponse = await uploadFile.call(this, buffer, binaryData.mimeType, fileName);\n\t}\n\n\treturn [\n\t\t{\n\t\t\tjson: { ...response, url: `${baseUrl}/v1/files/${response.id}` },\n\t\t\tpairedItem: {\n\t\t\t\titem: i,\n\t\t\t},\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAGrC,mBAAqD;AAE9C,MAAM,aAAgC;AAAA,EAC5C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,KAAK;AAAA,MAClB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,QAAQ;AAAA,MACrB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS,CAAC;AAAA,IACV,SAAS;AAAA,MACR;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,aAAa;AAAA,QACb,SAAS;AAAA,MACV;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,WAAW,CAAC,QAAQ;AAAA,IACpB,UAAU,CAAC,MAAM;AAAA,EAClB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;AAE1E,eAAsB,QAAiC,GAA0C;AAChG,QAAM,YAAY,KAAK,iBAAiB,aAAa,GAAG,KAAK;AAC7D,QAAM,WAAW,KAAK,iBAAiB,oBAAoB,GAAG,MAAM;AACpE,QAAM,UAAU,MAAM,wBAAW,KAAK,IAAI;AAE1C,MAAI;AACJ,MAAI,cAAc,OAAO;AACxB,UAAM,UAAU,KAAK,iBAAiB,WAAW,GAAG,EAAE;AACtD,UAAM,EAAE,aAAa,SAAS,IAAI,MAAM,0BAAa,KAAK,MAAM,OAAO;AACvE,eAAW,MAAM,wBAAW,KAAK,MAAM,aAAa,UAAU,QAAQ;AAAA,EACvE,OAAO;AACN,UAAM,qBAAqB,KAAK,iBAAiB,sBAAsB,GAAG,MAAM;AAChF,UAAM,aAAa,KAAK,QAAQ,iBAAiB,GAAG,kBAAkB;AACtE,UAAM,SAAS,MAAM,KAAK,QAAQ,oBAAoB,GAAG,kBAAkB;AAC3E,eAAW,MAAM,wBAAW,KAAK,MAAM,QAAQ,WAAW,UAAU,QAAQ;AAAA,EAC7E;AAEA,SAAO;AAAA,IACN;AAAA,MACC,MAAM,EAAE,GAAG,UAAU,KAAK,GAAG,OAAO,aAAa,SAAS,EAAE,GAAG;AAAA,MAC/D,YAAY;AAAA,QACX,MAAM;AAAA,MACP;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var analyze_operation_exports = {};
|
|
20
|
+
__export(analyze_operation_exports, {
|
|
21
|
+
description: () => description,
|
|
22
|
+
execute: () => execute
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(analyze_operation_exports);
|
|
25
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
26
|
+
var import_baseAnalyze = require("../../helpers/baseAnalyze");
|
|
27
|
+
var import_descriptions = require("../descriptions");
|
|
28
|
+
const properties = [
|
|
29
|
+
import_descriptions.modelRLC,
|
|
30
|
+
{
|
|
31
|
+
displayName: "Text Input",
|
|
32
|
+
name: "text",
|
|
33
|
+
type: "string",
|
|
34
|
+
placeholder: "e.g. What's in this image?",
|
|
35
|
+
default: "What's in this image?",
|
|
36
|
+
typeOptions: {
|
|
37
|
+
rows: 2
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
displayName: "Input Type",
|
|
42
|
+
name: "inputType",
|
|
43
|
+
type: "options",
|
|
44
|
+
default: "url",
|
|
45
|
+
options: [
|
|
46
|
+
{
|
|
47
|
+
name: "Image URL(s)",
|
|
48
|
+
value: "url"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "Binary File(s)",
|
|
52
|
+
value: "binary"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
displayName: "URL(s)",
|
|
58
|
+
name: "imageUrls",
|
|
59
|
+
type: "string",
|
|
60
|
+
placeholder: "e.g. https://example.com/image.png",
|
|
61
|
+
description: "URL(s) of the image(s) to analyze, multiple URLs can be added separated by comma",
|
|
62
|
+
default: "",
|
|
63
|
+
displayOptions: {
|
|
64
|
+
show: {
|
|
65
|
+
inputType: ["url"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
displayName: "Input Data Field Name(s)",
|
|
71
|
+
name: "binaryPropertyName",
|
|
72
|
+
type: "string",
|
|
73
|
+
default: "data",
|
|
74
|
+
placeholder: "e.g. data",
|
|
75
|
+
hint: "The name of the input field containing the binary file data to be processed",
|
|
76
|
+
description: "Name of the binary field(s) which contains the image(s), seperate multiple field names with commas",
|
|
77
|
+
displayOptions: {
|
|
78
|
+
show: {
|
|
79
|
+
inputType: ["binary"]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
displayName: "Simplify Output",
|
|
85
|
+
name: "simplify",
|
|
86
|
+
type: "boolean",
|
|
87
|
+
default: true,
|
|
88
|
+
description: "Whether to simplify the response or not"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
displayName: "Options",
|
|
92
|
+
name: "options",
|
|
93
|
+
placeholder: "Add Option",
|
|
94
|
+
type: "collection",
|
|
95
|
+
default: {},
|
|
96
|
+
options: [
|
|
97
|
+
{
|
|
98
|
+
displayName: "Length of Description (Max Tokens)",
|
|
99
|
+
description: "Fewer tokens will result in shorter, less detailed image description",
|
|
100
|
+
name: "maxTokens",
|
|
101
|
+
type: "number",
|
|
102
|
+
default: 1024,
|
|
103
|
+
typeOptions: {
|
|
104
|
+
minValue: 1
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
const displayOptions = {
|
|
111
|
+
show: {
|
|
112
|
+
operation: ["analyze"],
|
|
113
|
+
resource: ["image"]
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
|
|
117
|
+
async function execute(i) {
|
|
118
|
+
return await import_baseAnalyze.baseAnalyze.call(this, i, "imageUrls", "image");
|
|
119
|
+
}
|
|
120
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
121
|
+
0 && (module.exports = {
|
|
122
|
+
description,
|
|
123
|
+
execute
|
|
124
|
+
});
|
|
125
|
+
//# sourceMappingURL=analyze.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/image/analyze.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport { baseAnalyze } from '../../helpers/baseAnalyze';\nimport { modelRLC } from '../descriptions';\n\nconst properties: INodeProperties[] = [\n\tmodelRLC,\n\t{\n\t\tdisplayName: 'Text Input',\n\t\tname: 'text',\n\t\ttype: 'string',\n\t\tplaceholder: \"e.g. What's in this image?\",\n\t\tdefault: \"What's in this image?\",\n\t\ttypeOptions: {\n\t\t\trows: 2,\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Input Type',\n\t\tname: 'inputType',\n\t\ttype: 'options',\n\t\tdefault: 'url',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Image URL(s)',\n\t\t\t\tvalue: 'url',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Binary File(s)',\n\t\t\t\tvalue: 'binary',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'URL(s)',\n\t\tname: 'imageUrls',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. https://example.com/image.png',\n\t\tdescription: 'URL(s) of the image(s) to analyze, multiple URLs can be added separated by comma',\n\t\tdefault: '',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tinputType: ['url'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Input Data Field Name(s)',\n\t\tname: 'binaryPropertyName',\n\t\ttype: 'string',\n\t\tdefault: 'data',\n\t\tplaceholder: 'e.g. data',\n\t\thint: 'The name of the input field containing the binary file data to be processed',\n\t\tdescription:\n\t\t\t'Name of the binary field(s) which contains the image(s), seperate multiple field names with commas',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tinputType: ['binary'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Simplify Output',\n\t\tname: 'simplify',\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t\tdescription: 'Whether to simplify the response or not',\n\t},\n\t{\n\t\tdisplayName: 'Options',\n\t\tname: 'options',\n\t\tplaceholder: 'Add Option',\n\t\ttype: 'collection',\n\t\tdefault: {},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Length of Description (Max Tokens)',\n\t\t\t\tdescription: 'Fewer tokens will result in shorter, less detailed image description',\n\t\t\t\tname: 'maxTokens',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 1024,\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['analyze'],\n\t\tresource: ['image'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\treturn await baseAnalyze.call(this, i, 'imageUrls', 'image');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAErC,yBAA4B;AAC5B,0BAAyB;AAEzB,MAAM,aAAgC;AAAA,EACrC;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS;AAAA,IACT,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,KAAK;AAAA,MAClB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM;AAAA,IACN,aACC;AAAA,IACD,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,QAAQ;AAAA,MACrB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,EACd;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,IACV,SAAS;AAAA,MACR;AAAA,QACC,aAAa;AAAA,QACb,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,aAAa;AAAA,UACZ,UAAU;AAAA,QACX;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,WAAW,CAAC,SAAS;AAAA,IACrB,UAAU,CAAC,OAAO;AAAA,EACnB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;AAE1E,eAAsB,QAAiC,GAA0C;AAChG,SAAO,MAAM,+BAAY,KAAK,MAAM,GAAG,aAAa,OAAO;AAC5D;","names":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var image_exports = {};
|
|
30
|
+
__export(image_exports, {
|
|
31
|
+
analyze: () => analyze,
|
|
32
|
+
description: () => description
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(image_exports);
|
|
35
|
+
var analyze = __toESM(require("./analyze.operation"));
|
|
36
|
+
const description = [
|
|
37
|
+
{
|
|
38
|
+
displayName: "Operation",
|
|
39
|
+
name: "operation",
|
|
40
|
+
type: "options",
|
|
41
|
+
noDataExpression: true,
|
|
42
|
+
options: [
|
|
43
|
+
{
|
|
44
|
+
name: "Analyze Image",
|
|
45
|
+
value: "analyze",
|
|
46
|
+
action: "Analyze image",
|
|
47
|
+
description: "Take in images and answer questions about them"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
default: "analyze",
|
|
51
|
+
displayOptions: {
|
|
52
|
+
show: {
|
|
53
|
+
resource: ["image"]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
...analyze.description
|
|
58
|
+
];
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
analyze,
|
|
62
|
+
description
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/image/index.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as analyze from './analyze.operation';\n\nexport { analyze };\n\nexport const description: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Operation',\n\t\tname: 'operation',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Analyze Image',\n\t\t\t\tvalue: 'analyze',\n\t\t\t\taction: 'Analyze image',\n\t\t\t\tdescription: 'Take in images and answer questions about them',\n\t\t\t},\n\t\t],\n\t\tdefault: 'analyze',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['image'],\n\t\t\t},\n\t\t},\n\t},\n\t...analyze.description,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,cAAyB;AAIlB,MAAM,cAAiC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,aAAa;AAAA,MACd;AAAA,IACD;AAAA,IACA,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,OAAO;AAAA,MACnB;AAAA,IACD;AAAA,EACD;AAAA,EACA,GAAG,QAAQ;AACZ;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var node_type_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(node_type_exports);
|
|
17
|
+
//# sourceMappingURL=node.type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/Anthropic/actions/node.type.ts"],"sourcesContent":["import type { AllEntities } from 'n8n-workflow';\n\ntype NodeMap = {\n\ttext: 'message';\n\timage: 'analyze';\n\tdocument: 'analyze';\n\tfile: 'upload' | 'deleteFile' | 'get' | 'list';\n\tprompt: 'generate' | 'improve' | 'templatize';\n};\n\nexport type AnthropicType = AllEntities<NodeMap>;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var generate_operation_exports = {};
|
|
20
|
+
__export(generate_operation_exports, {
|
|
21
|
+
description: () => description,
|
|
22
|
+
execute: () => execute
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(generate_operation_exports);
|
|
25
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
26
|
+
var import_transport = require("../../transport");
|
|
27
|
+
const properties = [
|
|
28
|
+
{
|
|
29
|
+
displayName: "Task",
|
|
30
|
+
name: "task",
|
|
31
|
+
type: "string",
|
|
32
|
+
description: "Description of the prompt's purpose",
|
|
33
|
+
placeholder: "e.g. A chef for a meal prep planning service",
|
|
34
|
+
default: "",
|
|
35
|
+
typeOptions: {
|
|
36
|
+
rows: 2
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
displayName: "Simplify Output",
|
|
41
|
+
name: "simplify",
|
|
42
|
+
type: "boolean",
|
|
43
|
+
default: true,
|
|
44
|
+
description: "Whether to return a simplified version of the response instead of the raw data"
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
const displayOptions = {
|
|
48
|
+
show: {
|
|
49
|
+
operation: ["generate"],
|
|
50
|
+
resource: ["prompt"]
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
|
|
54
|
+
async function execute(i) {
|
|
55
|
+
const task = this.getNodeParameter("task", i, "");
|
|
56
|
+
const simplify = this.getNodeParameter("simplify", i, true);
|
|
57
|
+
const body = {
|
|
58
|
+
task
|
|
59
|
+
};
|
|
60
|
+
const response = await import_transport.apiRequest.call(this, "POST", "/v1/experimental/generate_prompt", {
|
|
61
|
+
body,
|
|
62
|
+
enableAnthropicBetas: { promptTools: true }
|
|
63
|
+
});
|
|
64
|
+
if (simplify) {
|
|
65
|
+
return [
|
|
66
|
+
{
|
|
67
|
+
json: {
|
|
68
|
+
messages: response.messages,
|
|
69
|
+
system: response.system
|
|
70
|
+
},
|
|
71
|
+
pairedItem: { item: i }
|
|
72
|
+
}
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
return [
|
|
76
|
+
{
|
|
77
|
+
json: { ...response },
|
|
78
|
+
pairedItem: { item: i }
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
+
0 && (module.exports = {
|
|
84
|
+
description,
|
|
85
|
+
execute
|
|
86
|
+
});
|
|
87
|
+
//# sourceMappingURL=generate.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/prompt/generate.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport type { PromptResponse } from '../../helpers/interfaces';\nimport { apiRequest } from '../../transport';\n\nconst properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Task',\n\t\tname: 'task',\n\t\ttype: 'string',\n\t\tdescription: \"Description of the prompt's purpose\",\n\t\tplaceholder: 'e.g. A chef for a meal prep planning service',\n\t\tdefault: '',\n\t\ttypeOptions: {\n\t\t\trows: 2,\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Simplify Output',\n\t\tname: 'simplify',\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t\tdescription: 'Whether to return a simplified version of the response instead of the raw data',\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['generate'],\n\t\tresource: ['prompt'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst task = this.getNodeParameter('task', i, '') as string;\n\tconst simplify = this.getNodeParameter('simplify', i, true) as boolean;\n\n\tconst body = {\n\t\ttask,\n\t};\n\tconst response = (await apiRequest.call(this, 'POST', '/v1/experimental/generate_prompt', {\n\t\tbody,\n\t\tenableAnthropicBetas: { promptTools: true },\n\t})) as PromptResponse;\n\n\tif (simplify) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tjson: {\n\t\t\t\t\tmessages: response.messages,\n\t\t\t\t\tsystem: response.system,\n\t\t\t\t},\n\t\t\t\tpairedItem: { item: i },\n\t\t\t},\n\t\t];\n\t}\n\n\treturn [\n\t\t{\n\t\t\tjson: { ...response },\n\t\t\tpairedItem: { item: i },\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAGrC,uBAA2B;AAE3B,MAAM,aAAgC;AAAA,EACrC;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,IACT,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,EACd;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,WAAW,CAAC,UAAU;AAAA,IACtB,UAAU,CAAC,QAAQ;AAAA,EACpB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;AAE1E,eAAsB,QAAiC,GAA0C;AAChG,QAAM,OAAO,KAAK,iBAAiB,QAAQ,GAAG,EAAE;AAChD,QAAM,WAAW,KAAK,iBAAiB,YAAY,GAAG,IAAI;AAE1D,QAAM,OAAO;AAAA,IACZ;AAAA,EACD;AACA,QAAM,WAAY,MAAM,4BAAW,KAAK,MAAM,QAAQ,oCAAoC;AAAA,IACzF;AAAA,IACA,sBAAsB,EAAE,aAAa,KAAK;AAAA,EAC3C,CAAC;AAED,MAAI,UAAU;AACb,WAAO;AAAA,MACN;AAAA,QACC,MAAM;AAAA,UACL,UAAU,SAAS;AAAA,UACnB,QAAQ,SAAS;AAAA,QAClB;AAAA,QACA,YAAY,EAAE,MAAM,EAAE;AAAA,MACvB;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AAAA,IACN;AAAA,MACC,MAAM,EAAE,GAAG,SAAS;AAAA,MACpB,YAAY,EAAE,MAAM,EAAE;AAAA,IACvB;AAAA,EACD;AACD;","names":[]}
|