@n8n/n8n-nodes-langchain 1.102.1 → 1.103.1
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/known/credentials.json +1 -0
- package/dist/known/nodes.json +4 -0
- package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +7 -2
- package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.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/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/tools/ToolThink/ToolThink.node.js +5 -2
- package/dist/nodes/tools/ToolThink/ToolThink.node.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/types/credentials.json +1 -1
- package/dist/types/nodes.json +5 -4
- package/package.json +6 -5
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var versionDescription_exports = {};
|
|
30
|
+
__export(versionDescription_exports, {
|
|
31
|
+
versionDescription: () => versionDescription
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(versionDescription_exports);
|
|
34
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
35
|
+
var document = __toESM(require("./document"));
|
|
36
|
+
var file = __toESM(require("./file"));
|
|
37
|
+
var image = __toESM(require("./image"));
|
|
38
|
+
var prompt = __toESM(require("./prompt"));
|
|
39
|
+
var text = __toESM(require("./text"));
|
|
40
|
+
const versionDescription = {
|
|
41
|
+
displayName: "Anthropic",
|
|
42
|
+
name: "anthropic",
|
|
43
|
+
icon: "file:anthropic.svg",
|
|
44
|
+
group: ["transform"],
|
|
45
|
+
version: 1,
|
|
46
|
+
subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
|
|
47
|
+
description: "Interact with Anthropic AI models",
|
|
48
|
+
defaults: {
|
|
49
|
+
name: "Anthropic"
|
|
50
|
+
},
|
|
51
|
+
usableAsTool: true,
|
|
52
|
+
codex: {
|
|
53
|
+
alias: ["LangChain", "document", "image", "assistant"],
|
|
54
|
+
categories: ["AI"],
|
|
55
|
+
subcategories: {
|
|
56
|
+
AI: ["Agents", "Miscellaneous", "Root Nodes"]
|
|
57
|
+
},
|
|
58
|
+
resources: {
|
|
59
|
+
primaryDocumentation: [
|
|
60
|
+
{
|
|
61
|
+
url: "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-langchain.anthropic/"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
inputs: `={{
|
|
67
|
+
(() => {
|
|
68
|
+
const resource = $parameter.resource;
|
|
69
|
+
const operation = $parameter.operation;
|
|
70
|
+
if (resource === 'text' && operation === 'message') {
|
|
71
|
+
return [{ type: 'main' }, { type: 'ai_tool', displayName: 'Tools' }];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return ['main'];
|
|
75
|
+
})()
|
|
76
|
+
}}`,
|
|
77
|
+
outputs: [import_n8n_workflow.NodeConnectionTypes.Main],
|
|
78
|
+
credentials: [
|
|
79
|
+
{
|
|
80
|
+
name: "anthropicApi",
|
|
81
|
+
required: true
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
properties: [
|
|
85
|
+
{
|
|
86
|
+
displayName: "Resource",
|
|
87
|
+
name: "resource",
|
|
88
|
+
type: "options",
|
|
89
|
+
noDataExpression: true,
|
|
90
|
+
options: [
|
|
91
|
+
{
|
|
92
|
+
name: "Document",
|
|
93
|
+
value: "document"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "File",
|
|
97
|
+
value: "file"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "Image",
|
|
101
|
+
value: "image"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "Prompt",
|
|
105
|
+
value: "prompt"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "Text",
|
|
109
|
+
value: "text"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
default: "text"
|
|
113
|
+
},
|
|
114
|
+
...document.description,
|
|
115
|
+
...file.description,
|
|
116
|
+
...image.description,
|
|
117
|
+
...prompt.description,
|
|
118
|
+
...text.description
|
|
119
|
+
]
|
|
120
|
+
};
|
|
121
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
122
|
+
0 && (module.exports = {
|
|
123
|
+
versionDescription
|
|
124
|
+
});
|
|
125
|
+
//# sourceMappingURL=versionDescription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/Anthropic/actions/versionDescription.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\nimport { NodeConnectionTypes, type INodeTypeDescription } from 'n8n-workflow';\n\nimport * as document from './document';\nimport * as file from './file';\nimport * as image from './image';\nimport * as prompt from './prompt';\nimport * as text from './text';\n\nexport const versionDescription: INodeTypeDescription = {\n\tdisplayName: 'Anthropic',\n\tname: 'anthropic',\n\ticon: 'file:anthropic.svg',\n\tgroup: ['transform'],\n\tversion: 1,\n\tsubtitle: '={{ $parameter[\"operation\"] + \": \" + $parameter[\"resource\"] }}',\n\tdescription: 'Interact with Anthropic AI models',\n\tdefaults: {\n\t\tname: 'Anthropic',\n\t},\n\tusableAsTool: true,\n\tcodex: {\n\t\talias: ['LangChain', 'document', 'image', 'assistant'],\n\t\tcategories: ['AI'],\n\t\tsubcategories: {\n\t\t\tAI: ['Agents', 'Miscellaneous', 'Root Nodes'],\n\t\t},\n\t\tresources: {\n\t\t\tprimaryDocumentation: [\n\t\t\t\t{\n\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-langchain.anthropic/',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tinputs: `={{\n\t\t(() => {\n\t\t\tconst resource = $parameter.resource;\n\t \tconst operation = $parameter.operation;\n\t\t\tif (resource === 'text' && operation === 'message') {\n\t\t\t\treturn [{ type: 'main' }, { type: 'ai_tool', displayName: 'Tools' }];\n\t\t\t}\n\n\t\t\treturn ['main'];\n\t\t})()\n\t}}`,\n\toutputs: [NodeConnectionTypes.Main],\n\tcredentials: [\n\t\t{\n\t\t\tname: 'anthropicApi',\n\t\t\trequired: true,\n\t\t},\n\t],\n\tproperties: [\n\t\t{\n\t\t\tdisplayName: 'Resource',\n\t\t\tname: 'resource',\n\t\t\ttype: 'options',\n\t\t\tnoDataExpression: true,\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Document',\n\t\t\t\t\tvalue: 'document',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'File',\n\t\t\t\t\tvalue: 'file',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Image',\n\t\t\t\t\tvalue: 'image',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Prompt',\n\t\t\t\t\tvalue: 'prompt',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Text',\n\t\t\t\t\tvalue: 'text',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'text',\n\t\t},\n\t\t...document.description,\n\t\t...file.description,\n\t\t...image.description,\n\t\t...prompt.description,\n\t\t...text.description,\n\t],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAA+D;AAE/D,eAA0B;AAC1B,WAAsB;AACtB,YAAuB;AACvB,aAAwB;AACxB,WAAsB;AAEf,MAAM,qBAA2C;AAAA,EACvD,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO,CAAC,WAAW;AAAA,EACnB,SAAS;AAAA,EACT,UAAU;AAAA,EACV,aAAa;AAAA,EACb,UAAU;AAAA,IACT,MAAM;AAAA,EACP;AAAA,EACA,cAAc;AAAA,EACd,OAAO;AAAA,IACN,OAAO,CAAC,aAAa,YAAY,SAAS,WAAW;AAAA,IACrD,YAAY,CAAC,IAAI;AAAA,IACjB,eAAe;AAAA,MACd,IAAI,CAAC,UAAU,iBAAiB,YAAY;AAAA,IAC7C;AAAA,IACA,WAAW;AAAA,MACV,sBAAsB;AAAA,QACrB;AAAA,UACC,KAAK;AAAA,QACN;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWR,SAAS,CAAC,wCAAoB,IAAI;AAAA,EAClC,aAAa;AAAA,IACZ;AAAA,MACC,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AAAA,EACA,YAAY;AAAA,IACX;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,kBAAkB;AAAA,MAClB,SAAS;AAAA,QACR;AAAA,UACC,MAAM;AAAA,UACN,OAAO;AAAA,QACR;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,OAAO;AAAA,QACR;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,OAAO;AAAA,QACR;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,OAAO;AAAA,QACR;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,OAAO;AAAA,QACR;AAAA,MACD;AAAA,MACA,SAAS;AAAA,IACV;AAAA,IACA,GAAG,SAAS;AAAA,IACZ,GAAG,KAAK;AAAA,IACR,GAAG,MAAM;AAAA,IACT,GAAG,OAAO;AAAA,IACV,GAAG,KAAK;AAAA,EACT;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="46" height="32" fill="none"><path fill="#7D7D87" d="M32.73 0h-6.945L38.45 32h6.945zM12.665 0 0 32h7.082l2.59-6.72h13.25l2.59 6.72h7.082L19.929 0zm-.702 19.337 4.334-11.246 4.334 11.246z"/></svg>
|
|
@@ -0,0 +1,109 @@
|
|
|
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, type) {
|
|
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 baseUrl = await import_utils.getBaseUrl.call(this);
|
|
33
|
+
const fileUrlPrefix = `${baseUrl}/v1/files/`;
|
|
34
|
+
let content;
|
|
35
|
+
if (inputType === "url") {
|
|
36
|
+
const urls = this.getNodeParameter(urlsPropertyName, i, "");
|
|
37
|
+
content = (0, import_utils.splitByComma)(urls).map((url) => {
|
|
38
|
+
if (url.startsWith(fileUrlPrefix)) {
|
|
39
|
+
return {
|
|
40
|
+
type,
|
|
41
|
+
source: {
|
|
42
|
+
type: "file",
|
|
43
|
+
file_id: url.replace(fileUrlPrefix, "")
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
} else {
|
|
47
|
+
return {
|
|
48
|
+
type,
|
|
49
|
+
source: {
|
|
50
|
+
type: "url",
|
|
51
|
+
url
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
const binaryPropertyNames = this.getNodeParameter("binaryPropertyName", i, "data");
|
|
58
|
+
const promises = (0, import_utils.splitByComma)(binaryPropertyNames).map(async (binaryPropertyName) => {
|
|
59
|
+
const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
|
|
60
|
+
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
61
|
+
const fileBase64 = buffer.toString("base64");
|
|
62
|
+
return {
|
|
63
|
+
type,
|
|
64
|
+
source: {
|
|
65
|
+
type: "base64",
|
|
66
|
+
media_type: binaryData.mimeType,
|
|
67
|
+
data: fileBase64
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
content = await Promise.all(promises);
|
|
72
|
+
}
|
|
73
|
+
content.push({
|
|
74
|
+
type: "text",
|
|
75
|
+
text
|
|
76
|
+
});
|
|
77
|
+
const body = {
|
|
78
|
+
model,
|
|
79
|
+
max_tokens: options.maxTokens ?? 1024,
|
|
80
|
+
messages: [
|
|
81
|
+
{
|
|
82
|
+
role: "user",
|
|
83
|
+
content
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
const response = await import_transport.apiRequest.call(this, "POST", "/v1/messages", {
|
|
88
|
+
body
|
|
89
|
+
});
|
|
90
|
+
if (simplify) {
|
|
91
|
+
return [
|
|
92
|
+
{
|
|
93
|
+
json: { content: response.content },
|
|
94
|
+
pairedItem: { item: i }
|
|
95
|
+
}
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
return [
|
|
99
|
+
{
|
|
100
|
+
json: { ...response },
|
|
101
|
+
pairedItem: { item: i }
|
|
102
|
+
}
|
|
103
|
+
];
|
|
104
|
+
}
|
|
105
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
106
|
+
0 && (module.exports = {
|
|
107
|
+
baseAnalyze
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=baseAnalyze.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/Anthropic/helpers/baseAnalyze.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';\n\nimport type { Content, MessagesResponse } from './interfaces';\nimport { getBaseUrl, splitByComma } from './utils';\nimport { apiRequest } from '../transport';\n\nexport async function baseAnalyze(\n\tthis: IExecuteFunctions,\n\ti: number,\n\turlsPropertyName: string,\n\ttype: 'image' | 'document',\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\tconst baseUrl = await getBaseUrl.call(this);\n\tconst fileUrlPrefix = `${baseUrl}/v1/files/`;\n\n\tlet content: Content[];\n\tif (inputType === 'url') {\n\t\tconst urls = this.getNodeParameter(urlsPropertyName, i, '') as string;\n\t\tcontent = splitByComma(urls).map((url) => {\n\t\t\tif (url.startsWith(fileUrlPrefix)) {\n\t\t\t\treturn {\n\t\t\t\t\ttype,\n\t\t\t\t\tsource: {\n\t\t\t\t\t\ttype: 'file',\n\t\t\t\t\t\tfile_id: url.replace(fileUrlPrefix, ''),\n\t\t\t\t\t},\n\t\t\t\t} as Content;\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\ttype,\n\t\t\t\t\tsource: {\n\t\t\t\t\t\ttype: 'url',\n\t\t\t\t\t\turl,\n\t\t\t\t\t},\n\t\t\t\t} as Content;\n\t\t\t}\n\t\t});\n\t} else {\n\t\tconst binaryPropertyNames = this.getNodeParameter('binaryPropertyName', i, 'data');\n\t\tconst promises = splitByComma(binaryPropertyNames).map(async (binaryPropertyName) => {\n\t\t\tconst binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);\n\t\t\tconst buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);\n\t\t\tconst fileBase64 = buffer.toString('base64');\n\t\t\treturn {\n\t\t\t\ttype,\n\t\t\t\tsource: {\n\t\t\t\t\ttype: 'base64',\n\t\t\t\t\tmedia_type: binaryData.mimeType,\n\t\t\t\t\tdata: fileBase64,\n\t\t\t\t},\n\t\t\t} as Content;\n\t\t});\n\n\t\tcontent = await Promise.all(promises);\n\t}\n\n\tcontent.push({\n\t\ttype: 'text',\n\t\ttext,\n\t});\n\n\tconst body = {\n\t\tmodel,\n\t\tmax_tokens: options.maxTokens ?? 1024,\n\t\tmessages: [\n\t\t\t{\n\t\t\t\trole: 'user',\n\t\t\t\tcontent,\n\t\t\t},\n\t\t],\n\t};\n\n\tconst response = (await apiRequest.call(this, 'POST', '/v1/messages', {\n\t\tbody,\n\t})) as MessagesResponse;\n\n\tif (simplify) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tjson: { content: response.content },\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;AAGA,mBAAyC;AACzC,uBAA2B;AAE3B,eAAsB,YAErB,GACA,kBACA,MACgC;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;AACtD,QAAM,UAAU,MAAM,wBAAW,KAAK,IAAI;AAC1C,QAAM,gBAAgB,GAAG,OAAO;AAEhC,MAAI;AACJ,MAAI,cAAc,OAAO;AACxB,UAAM,OAAO,KAAK,iBAAiB,kBAAkB,GAAG,EAAE;AAC1D,kBAAU,2BAAa,IAAI,EAAE,IAAI,CAAC,QAAQ;AACzC,UAAI,IAAI,WAAW,aAAa,GAAG;AAClC,eAAO;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,YACP,MAAM;AAAA,YACN,SAAS,IAAI,QAAQ,eAAe,EAAE;AAAA,UACvC;AAAA,QACD;AAAA,MACD,OAAO;AACN,eAAO;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,YACP,MAAM;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD,CAAC;AAAA,EACF,OAAO;AACN,UAAM,sBAAsB,KAAK,iBAAiB,sBAAsB,GAAG,MAAM;AACjF,UAAM,eAAW,2BAAa,mBAAmB,EAAE,IAAI,OAAO,uBAAuB;AACpF,YAAM,aAAa,KAAK,QAAQ,iBAAiB,GAAG,kBAAkB;AACtE,YAAM,SAAS,MAAM,KAAK,QAAQ,oBAAoB,GAAG,kBAAkB;AAC3E,YAAM,aAAa,OAAO,SAAS,QAAQ;AAC3C,aAAO;AAAA,QACN;AAAA,QACA,QAAQ;AAAA,UACP,MAAM;AAAA,UACN,YAAY,WAAW;AAAA,UACvB,MAAM;AAAA,QACP;AAAA,MACD;AAAA,IACD,CAAC;AAED,cAAU,MAAM,QAAQ,IAAI,QAAQ;AAAA,EACrC;AAEA,UAAQ,KAAK;AAAA,IACZ,MAAM;AAAA,IACN;AAAA,EACD,CAAC;AAED,QAAM,OAAO;AAAA,IACZ;AAAA,IACA,YAAY,QAAQ,aAAa;AAAA,IACjC,UAAU;AAAA,MACT;AAAA,QACC,MAAM;AAAA,QACN;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,QAAM,WAAY,MAAM,4BAAW,KAAK,MAAM,QAAQ,gBAAgB;AAAA,IACrE;AAAA,EACD,CAAC;AAED,MAAI,UAAU;AACb,WAAO;AAAA,MACN;AAAA,QACC,MAAM,EAAE,SAAS,SAAS,QAAQ;AAAA,QAClC,YAAY,EAAE,MAAM,EAAE;AAAA,MACvB;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AAAA,IACN;AAAA,MACC,MAAM,EAAE,GAAG,SAAS;AAAA,MACpB,YAAY,EAAE,MAAM,EAAE;AAAA,IACvB;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1,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/Anthropic/helpers/interfaces.ts"],"sourcesContent":["import type { IDataObject } from 'n8n-workflow';\nimport type { JsonSchema7Type } from 'zod-to-json-schema';\n\nexport type FileSource =\n\t| {\n\t\t\ttype: 'base64';\n\t\t\tmedia_type: string;\n\t\t\tdata: string;\n\t }\n\t| {\n\t\t\ttype: 'url';\n\t\t\turl: string;\n\t }\n\t| {\n\t\t\ttype: 'file';\n\t\t\tfile_id: string;\n\t };\n\nexport type Content =\n\t| {\n\t\t\ttype: 'text';\n\t\t\ttext: string;\n\t }\n\t| {\n\t\t\ttype: 'image';\n\t\t\tsource: FileSource;\n\t }\n\t| {\n\t\t\ttype: 'document';\n\t\t\tsource: FileSource;\n\t }\n\t| {\n\t\t\ttype: 'tool_use';\n\t\t\tid: string;\n\t\t\tname: string;\n\t\t\tinput: IDataObject;\n\t }\n\t| {\n\t\t\ttype: 'tool_result';\n\t\t\ttool_use_id: string;\n\t\t\tcontent: string;\n\t }\n\t| {\n\t\t\ttype: 'container_upload';\n\t\t\tfile_id: string;\n\t };\n\nexport interface Message {\n\trole: 'user' | 'assistant';\n\tcontent: string | Content[];\n}\n\nexport interface File {\n\tcreated_at: string;\n\tdownloadable: boolean;\n\tfilename: string;\n\tid: string;\n\tmime_type: string;\n\tsize_bytes: number;\n\ttype: 'file';\n}\n\nexport type Tool =\n\t| {\n\t\t\ttype: 'custom';\n\t\t\tname: string;\n\t\t\tinput_schema: JsonSchema7Type;\n\t\t\tdescription: string;\n\t }\n\t| {\n\t\t\ttype: 'web_search_20250305';\n\t\t\tname: 'web_search';\n\t\t\tmax_uses?: number;\n\t\t\tallowed_domains?: string[];\n\t\t\tblocked_domains?: string[];\n\t }\n\t| {\n\t\t\ttype: 'code_execution_20250522';\n\t\t\tname: 'code_execution';\n\t };\n\nexport interface MessagesResponse {\n\tcontent: Content[];\n\tstop_reason: string | null;\n}\n\nexport interface PromptResponse {\n\tmessages: Message[];\n\tsystem: string;\n}\n\nexport interface TemplatizeResponse extends PromptResponse {\n\tvariable_values: IDataObject;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","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 utils_exports = {};
|
|
30
|
+
__export(utils_exports, {
|
|
31
|
+
downloadFile: () => downloadFile,
|
|
32
|
+
getBaseUrl: () => getBaseUrl,
|
|
33
|
+
getMimeType: () => getMimeType,
|
|
34
|
+
splitByComma: () => splitByComma,
|
|
35
|
+
uploadFile: () => uploadFile
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(utils_exports);
|
|
38
|
+
var import_form_data = __toESM(require("form-data"));
|
|
39
|
+
var import_transport = require("../transport");
|
|
40
|
+
function getMimeType(contentType) {
|
|
41
|
+
return contentType?.split(";")?.[0];
|
|
42
|
+
}
|
|
43
|
+
async function downloadFile(url, qs) {
|
|
44
|
+
const downloadResponse = await this.helpers.httpRequest({
|
|
45
|
+
method: "GET",
|
|
46
|
+
url,
|
|
47
|
+
qs,
|
|
48
|
+
returnFullResponse: true,
|
|
49
|
+
encoding: "arraybuffer"
|
|
50
|
+
});
|
|
51
|
+
const mimeType = getMimeType(downloadResponse.headers?.["content-type"]) ?? "application/octet-stream";
|
|
52
|
+
const fileContent = Buffer.from(downloadResponse.body);
|
|
53
|
+
return {
|
|
54
|
+
fileContent,
|
|
55
|
+
mimeType
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
async function uploadFile(fileContent, mimeType, fileName) {
|
|
59
|
+
const form = new import_form_data.default();
|
|
60
|
+
form.append("file", fileContent, {
|
|
61
|
+
filename: fileName ?? "file",
|
|
62
|
+
contentType: mimeType
|
|
63
|
+
});
|
|
64
|
+
return await import_transport.apiRequest.call(this, "POST", "/v1/files", {
|
|
65
|
+
headers: form.getHeaders(),
|
|
66
|
+
body: form
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function splitByComma(str) {
|
|
70
|
+
return str.split(",").map((s) => s.trim()).filter((s) => s);
|
|
71
|
+
}
|
|
72
|
+
async function getBaseUrl() {
|
|
73
|
+
const credentials = await this.getCredentials("anthropicApi");
|
|
74
|
+
return credentials.url ?? "https://api.anthropic.com";
|
|
75
|
+
}
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
78
|
+
downloadFile,
|
|
79
|
+
getBaseUrl,
|
|
80
|
+
getMimeType,
|
|
81
|
+
splitByComma,
|
|
82
|
+
uploadFile
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/Anthropic/helpers/utils.ts"],"sourcesContent":["import FormData from 'form-data';\nimport type { IDataObject, IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-workflow';\n\nimport { apiRequest } from '../transport';\nimport type { File } from './interfaces';\n\nexport function getMimeType(contentType?: string) {\n\treturn contentType?.split(';')?.[0];\n}\n\nexport async function downloadFile(this: IExecuteFunctions, url: string, qs?: IDataObject) {\n\tconst downloadResponse = (await this.helpers.httpRequest({\n\t\tmethod: 'GET',\n\t\turl,\n\t\tqs,\n\t\treturnFullResponse: true,\n\t\tencoding: 'arraybuffer',\n\t})) as { body: ArrayBuffer; headers: IDataObject };\n\n\tconst mimeType =\n\t\tgetMimeType(downloadResponse.headers?.['content-type'] as string) ?? 'application/octet-stream';\n\tconst fileContent = Buffer.from(downloadResponse.body);\n\treturn {\n\t\tfileContent,\n\t\tmimeType,\n\t};\n}\n\nexport async function uploadFile(\n\tthis: IExecuteFunctions,\n\tfileContent: Buffer,\n\tmimeType: string,\n\tfileName?: string,\n) {\n\tconst form = new FormData();\n\tform.append('file', fileContent, {\n\t\tfilename: fileName ?? 'file',\n\t\tcontentType: mimeType,\n\t});\n\treturn (await apiRequest.call(this, 'POST', '/v1/files', {\n\t\theaders: form.getHeaders(),\n\t\tbody: form,\n\t})) as File;\n}\n\nexport function splitByComma(str: string) {\n\treturn str\n\t\t.split(',')\n\t\t.map((s) => s.trim())\n\t\t.filter((s) => s);\n}\n\nexport async function getBaseUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {\n\tconst credentials = await this.getCredentials('anthropicApi');\n\treturn (credentials.url ?? 'https://api.anthropic.com') as string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAqB;AAGrB,uBAA2B;AAGpB,SAAS,YAAY,aAAsB;AACjD,SAAO,aAAa,MAAM,GAAG,IAAI,CAAC;AACnC;AAEA,eAAsB,aAAsC,KAAa,IAAkB;AAC1F,QAAM,mBAAoB,MAAM,KAAK,QAAQ,YAAY;AAAA,IACxD,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB,UAAU;AAAA,EACX,CAAC;AAED,QAAM,WACL,YAAY,iBAAiB,UAAU,cAAc,CAAW,KAAK;AACtE,QAAM,cAAc,OAAO,KAAK,iBAAiB,IAAI;AACrD,SAAO;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAEA,eAAsB,WAErB,aACA,UACA,UACC;AACD,QAAM,OAAO,IAAI,iBAAAA,QAAS;AAC1B,OAAK,OAAO,QAAQ,aAAa;AAAA,IAChC,UAAU,YAAY;AAAA,IACtB,aAAa;AAAA,EACd,CAAC;AACD,SAAQ,MAAM,4BAAW,KAAK,MAAM,QAAQ,aAAa;AAAA,IACxD,SAAS,KAAK,WAAW;AAAA,IACzB,MAAM;AAAA,EACP,CAAC;AACF;AAEO,SAAS,aAAa,KAAa;AACzC,SAAO,IACL,MAAM,GAAG,EACT,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,CAAC,MAAM,CAAC;AAClB;AAEA,eAAsB,aAA4D;AACjF,QAAM,cAAc,MAAM,KAAK,eAAe,cAAc;AAC5D,SAAQ,YAAY,OAAO;AAC5B;","names":["FormData"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 methods_exports = {};
|
|
30
|
+
__export(methods_exports, {
|
|
31
|
+
listSearch: () => listSearch
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(methods_exports);
|
|
34
|
+
var listSearch = __toESM(require("./listSearch"));
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
listSearch
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/Anthropic/methods/index.ts"],"sourcesContent":["export * as listSearch from './listSearch';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA4B;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 listSearch_exports = {};
|
|
20
|
+
__export(listSearch_exports, {
|
|
21
|
+
modelSearch: () => modelSearch
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(listSearch_exports);
|
|
24
|
+
var import_transport = require("../transport");
|
|
25
|
+
async function modelSearch(filter) {
|
|
26
|
+
const response = await import_transport.apiRequest.call(this, "GET", "/v1/models");
|
|
27
|
+
let models = response.data;
|
|
28
|
+
if (filter) {
|
|
29
|
+
models = models.filter((model) => model.id.toLowerCase().includes(filter.toLowerCase()));
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
results: models.map((model) => ({
|
|
33
|
+
name: model.id,
|
|
34
|
+
value: model.id
|
|
35
|
+
}))
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
modelSearch
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=listSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/Anthropic/methods/listSearch.ts"],"sourcesContent":["import type { ILoadOptionsFunctions, INodeListSearchResult } from 'n8n-workflow';\n\nimport { apiRequest } from '../transport';\n\nexport async function modelSearch(\n\tthis: ILoadOptionsFunctions,\n\tfilter?: string,\n): Promise<INodeListSearchResult> {\n\tconst response = (await apiRequest.call(this, 'GET', '/v1/models')) as {\n\t\tdata: Array<{ id: string }>;\n\t};\n\n\tlet models = response.data;\n\tif (filter) {\n\t\tmodels = models.filter((model) => model.id.toLowerCase().includes(filter.toLowerCase()));\n\t}\n\n\treturn {\n\t\tresults: models.map((model) => ({\n\t\t\tname: model.id,\n\t\t\tvalue: model.id,\n\t\t})),\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,uBAA2B;AAE3B,eAAsB,YAErB,QACiC;AACjC,QAAM,WAAY,MAAM,4BAAW,KAAK,MAAM,OAAO,YAAY;AAIjE,MAAI,SAAS,SAAS;AACtB,MAAI,QAAQ;AACX,aAAS,OAAO,OAAO,CAAC,UAAU,MAAM,GAAG,YAAY,EAAE,SAAS,OAAO,YAAY,CAAC,CAAC;AAAA,EACxF;AAEA,SAAO;AAAA,IACN,SAAS,OAAO,IAAI,CAAC,WAAW;AAAA,MAC/B,MAAM,MAAM;AAAA,MACZ,OAAO,MAAM;AAAA,IACd,EAAE;AAAA,EACH;AACD;","names":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
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 transport_exports = {};
|
|
20
|
+
__export(transport_exports, {
|
|
21
|
+
apiRequest: () => apiRequest
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(transport_exports);
|
|
24
|
+
async function apiRequest(method, endpoint, parameters) {
|
|
25
|
+
const { body, qs, option, headers } = parameters ?? {};
|
|
26
|
+
const credentials = await this.getCredentials("anthropicApi");
|
|
27
|
+
const baseUrl = credentials.url ?? "https://api.anthropic.com";
|
|
28
|
+
const url = `${baseUrl}${endpoint}`;
|
|
29
|
+
const betas = ["files-api-2025-04-14"];
|
|
30
|
+
if (parameters?.enableAnthropicBetas?.promptTools) {
|
|
31
|
+
betas.push("prompt-tools-2025-04-02");
|
|
32
|
+
}
|
|
33
|
+
if (parameters?.enableAnthropicBetas?.codeExecution) {
|
|
34
|
+
betas.push("code-execution-2025-05-22");
|
|
35
|
+
}
|
|
36
|
+
const options = {
|
|
37
|
+
headers: {
|
|
38
|
+
"anthropic-version": "2023-06-01",
|
|
39
|
+
"anthropic-beta": betas.join(","),
|
|
40
|
+
...headers
|
|
41
|
+
},
|
|
42
|
+
method,
|
|
43
|
+
body,
|
|
44
|
+
qs,
|
|
45
|
+
url,
|
|
46
|
+
json: true
|
|
47
|
+
};
|
|
48
|
+
if (option && Object.keys(option).length !== 0) {
|
|
49
|
+
Object.assign(options, option);
|
|
50
|
+
}
|
|
51
|
+
return await this.helpers.httpRequestWithAuthentication.call(this, "anthropicApi", options);
|
|
52
|
+
}
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
apiRequest
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/Anthropic/transport/index.ts"],"sourcesContent":["import type FormData from 'form-data';\nimport type {\n\tIDataObject,\n\tIExecuteFunctions,\n\tIHttpRequestMethods,\n\tILoadOptionsFunctions,\n} from 'n8n-workflow';\n\ntype RequestParameters = {\n\theaders?: IDataObject;\n\tbody?: IDataObject | string | FormData;\n\tqs?: IDataObject;\n\toption?: IDataObject;\n\tenableAnthropicBetas?: {\n\t\tpromptTools?: boolean;\n\t\tcodeExecution?: boolean;\n\t};\n};\n\nexport async function apiRequest(\n\tthis: IExecuteFunctions | ILoadOptionsFunctions,\n\tmethod: IHttpRequestMethods,\n\tendpoint: string,\n\tparameters?: RequestParameters,\n) {\n\tconst { body, qs, option, headers } = parameters ?? {};\n\n\tconst credentials = await this.getCredentials('anthropicApi');\n\tconst baseUrl = credentials.url ?? 'https://api.anthropic.com';\n\tconst url = `${baseUrl}${endpoint}`;\n\n\tconst betas = ['files-api-2025-04-14'];\n\tif (parameters?.enableAnthropicBetas?.promptTools) {\n\t\tbetas.push('prompt-tools-2025-04-02');\n\t}\n\n\tif (parameters?.enableAnthropicBetas?.codeExecution) {\n\t\tbetas.push('code-execution-2025-05-22');\n\t}\n\n\tconst options = {\n\t\theaders: {\n\t\t\t'anthropic-version': '2023-06-01',\n\t\t\t'anthropic-beta': betas.join(','),\n\t\t\t...headers,\n\t\t},\n\t\tmethod,\n\t\tbody,\n\t\tqs,\n\t\turl,\n\t\tjson: true,\n\t};\n\n\tif (option && Object.keys(option).length !== 0) {\n\t\tObject.assign(options, option);\n\t}\n\n\treturn await this.helpers.httpRequestWithAuthentication.call(this, 'anthropicApi', options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBA,eAAsB,WAErB,QACA,UACA,YACC;AACD,QAAM,EAAE,MAAM,IAAI,QAAQ,QAAQ,IAAI,cAAc,CAAC;AAErD,QAAM,cAAc,MAAM,KAAK,eAAe,cAAc;AAC5D,QAAM,UAAU,YAAY,OAAO;AACnC,QAAM,MAAM,GAAG,OAAO,GAAG,QAAQ;AAEjC,QAAM,QAAQ,CAAC,sBAAsB;AACrC,MAAI,YAAY,sBAAsB,aAAa;AAClD,UAAM,KAAK,yBAAyB;AAAA,EACrC;AAEA,MAAI,YAAY,sBAAsB,eAAe;AACpD,UAAM,KAAK,2BAA2B;AAAA,EACvC;AAEA,QAAM,UAAU;AAAA,IACf,SAAS;AAAA,MACR,qBAAqB;AAAA,MACrB,kBAAkB,MAAM,KAAK,GAAG;AAAA,MAChC,GAAG;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,EACP;AAEA,MAAI,UAAU,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AAC/C,WAAO,OAAO,SAAS,MAAM;AAAA,EAC9B;AAEA,SAAO,MAAM,KAAK,QAAQ,8BAA8B,KAAK,MAAM,gBAAgB,OAAO;AAC3F;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[
|
|
2
|
-
{"name":"anthropicApi","displayName":"Anthropic","documentationUrl":"anthropic","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Base URL","name":"url","type":"string","default":"https://api.anthropic.com","description":"Override the default base URL for the API"}],"authenticate":{"type":"generic","properties":{"headers":{"x-api-key":"={{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{$credentials?.url}}","url":"/v1/messages","method":"POST","headers":{"anthropic-version":"2023-06-01"},"body":{"model":"claude-3-haiku-20240307","messages":[{"role":"user","content":"Hey"}],"max_tokens":1}}},"supportedNodes":["lmChatAnthropic"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/
|
|
2
|
+
{"name":"anthropicApi","displayName":"Anthropic","documentationUrl":"anthropic","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Base URL","name":"url","type":"string","default":"https://api.anthropic.com","description":"Override the default base URL for the API"}],"authenticate":{"type":"generic","properties":{"headers":{"x-api-key":"={{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{$credentials?.url}}","url":"/v1/messages","method":"POST","headers":{"anthropic-version":"2023-06-01"},"body":{"model":"claude-3-haiku-20240307","messages":[{"role":"user","content":"Hey"}],"max_tokens":1}}},"supportedNodes":["anthropic","lmChatAnthropic"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vendors/Anthropic/anthropic.svg"},
|
|
3
3
|
{"name":"azureOpenAiApi","displayName":"Azure Open AI","documentationUrl":"azureopenai","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Resource Name","name":"resourceName","type":"string","required":true,"default":""},{"displayName":"API Version","name":"apiVersion","type":"string","required":true,"default":"2025-03-01-preview"},{"displayName":"Endpoint","name":"endpoint","type":"string","placeholder":"https://westeurope.api.cognitive.microsoft.com"}],"authenticate":{"type":"generic","properties":{"headers":{"api-key":"={{$credentials.apiKey}}"}}},"supportedNodes":["embeddingsAzureOpenAi","lmChatAzureOpenAi"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsAzureOpenAi/azure.svg"},
|
|
4
4
|
{"name":"azureEntraCognitiveServicesOAuth2Api","displayName":"Azure Entra ID (Azure Active Directory) API","extends":["oAuth2Api"],"documentationUrl":"azureEntraCognitiveServicesOAuth2Api","properties":[{"displayName":"Grant Type","name":"grantType","type":"hidden","default":"authorizationCode"},{"displayName":"Resource Name","name":"resourceName","type":"string","required":true,"default":""},{"displayName":"API Version","name":"apiVersion","type":"string","required":true,"default":"2025-03-01-preview"},{"displayName":"Endpoint","name":"endpoint","type":"string","placeholder":"https://westeurope.api.cognitive.microsoft.com"},{"displayName":"Tenant ID","name":"tenantId","type":"string","default":"common","description":"Enter your Azure Tenant ID (Directory ID) or keep \"common\" for multi-tenant apps. Using a specific Tenant ID is generally recommended and required for certain authentication flows.","placeholder":"e.g., xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx or common"},{"displayName":"Authorization URL","name":"authUrl","type":"hidden","default":"=https://login.microsoftonline.com/{{$self[\"tenantId\"]}}/oauth2/authorize"},{"displayName":"Access Token URL","name":"accessTokenUrl","type":"hidden","default":"=https://login.microsoftonline.com/{{$self[\"tenantId\"]}}/oauth2/token"},{"displayName":"Additional Body Properties","name":"additionalBodyProperties","type":"hidden","default":"{\"grant_type\": \"client_credentials\", \"resource\": \"https://cognitiveservices.azure.com/\"}"},{"displayName":"Authentication","name":"authentication","type":"hidden","default":"body"},{"displayName":"Custom Scopes","name":"customScopes","type":"boolean","default":false,"description":"Define custom scopes. You might need this if the default scopes are not sufficient or if you want to minimize permissions. Ensure you include \"openid\" and \"offline_access\"."},{"displayName":"Auth URI Query Parameters","name":"authQueryParameters","type":"hidden","default":"","description":"For some services additional query parameters have to be set which can be defined here","placeholder":""},{"displayName":"Enabled Scopes","name":"enabledScopes","type":"string","displayOptions":{"show":{"customScopes":[true]}},"default":"openid offline_access","placeholder":"openid offline_access","description":"Space-separated list of scopes to request."},{"displayName":"Scope","name":"scope","type":"hidden","default":"={{ $self.customScopes ? $self.enabledScopes : \"openid offline_access\"}}"}],"supportedNodes":["lmChatAzureOpenAi"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/llms/LmChatAzureOpenAi/azure.svg"},
|
|
5
5
|
{"name":"cohereApi","displayName":"CohereApi","documentationUrl":"cohere","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Base URL","name":"url","type":"hidden","default":"https://api.cohere.ai"}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{ $credentials.url }}","url":"/v1/models?page_size=1"}},"supportedNodes":["embeddingsCohere","lmChatCohere","lmCohere","rerankerCohere"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsCohere/cohere.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsCohere/cohere.dark.svg"}},
|