@n8n/n8n-nodes-langchain 1.115.1 → 1.116.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/credentials/AnthropicApi.credentials.js +39 -8
- package/dist/credentials/AnthropicApi.credentials.js.map +1 -1
- package/dist/credentials/LemonadeApi.credentials.js +70 -0
- package/dist/credentials/LemonadeApi.credentials.js.map +1 -0
- package/dist/known/credentials.json +9 -0
- package/dist/known/nodes.json +12 -0
- package/dist/nodes/agents/Agent/Agent.node.js +1 -2
- package/dist/nodes/agents/Agent/Agent.node.js.map +1 -1
- package/dist/nodes/agents/Agent/V1/AgentV1.node.js +2 -0
- package/dist/nodes/agents/Agent/V1/AgentV1.node.js.map +1 -1
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/description.js +13 -1
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/description.js.map +1 -1
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/execute.js +49 -30
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/execute.js.map +1 -1
- package/dist/nodes/chains/ChainLLM/methods/chainExecutor.js +3 -0
- package/dist/nodes/chains/ChainLLM/methods/chainExecutor.js.map +1 -1
- package/dist/nodes/embeddings/EmbeddingsLemonade/EmbeddingsLemonade.node.js +87 -0
- package/dist/nodes/embeddings/EmbeddingsLemonade/EmbeddingsLemonade.node.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsLemonade/lemonade.svg +53 -0
- package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +17 -0
- package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js.map +1 -1
- package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js +12 -8
- package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js.map +1 -1
- package/dist/nodes/llms/LMChatLemonade/LmChatLemonade.node.js +106 -0
- package/dist/nodes/llms/LMChatLemonade/LmChatLemonade.node.js.map +1 -0
- package/dist/nodes/llms/LMChatLemonade/lemonade.svg +53 -0
- package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js +6 -5
- package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js.map +1 -1
- package/dist/nodes/llms/LMLemonade/LmLemonade.node.js +107 -0
- package/dist/nodes/llms/LMLemonade/LmLemonade.node.js.map +1 -0
- package/dist/nodes/llms/LMLemonade/description.js +147 -0
- package/dist/nodes/llms/LMLemonade/description.js.map +1 -0
- package/dist/nodes/llms/LMLemonade/lemonade.svg +53 -0
- package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js +3 -0
- package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js.map +1 -1
- package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js +14 -1
- package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js.map +1 -1
- package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js +107 -47
- package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js.map +1 -1
- package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js +2 -1
- package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js.map +1 -1
- package/dist/nodes/vector_store/VectorStoreQdrant/VectorStoreQdrant.node.js +43 -4
- package/dist/nodes/vector_store/VectorStoreQdrant/VectorStoreQdrant.node.js.map +1 -1
- package/dist/nodes/vendors/Anthropic/transport/index.js +9 -5
- package/dist/nodes/vendors/Anthropic/transport/index.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/OpenAi.node.js +50 -11
- package/dist/nodes/vendors/OpenAi/OpenAi.node.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/helpers/binary-data.js +3 -3
- package/dist/nodes/vendors/OpenAi/helpers/binary-data.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/helpers/description.js +75 -0
- package/dist/nodes/vendors/OpenAi/helpers/description.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/interfaces.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/helpers/modelFiltering.js +34 -0
- package/dist/nodes/vendors/OpenAi/helpers/modelFiltering.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/polling.js +52 -0
- package/dist/nodes/vendors/OpenAi/helpers/polling.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/utils.js +27 -0
- package/dist/nodes/vendors/OpenAi/helpers/utils.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/methods/listSearch.js +10 -6
- package/dist/nodes/vendors/OpenAi/methods/listSearch.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/v1/OpenAiV1.node.js +110 -0
- package/dist/nodes/vendors/OpenAi/v1/OpenAiV1.node.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/create.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/create.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/deleteAssistant.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/deleteAssistant.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/list.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/list.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/message.operation.js +5 -5
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/message.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/update.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/update.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/generate.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/audio/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/audio/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/transcribe.operation.js +2 -2
- package/dist/nodes/vendors/OpenAi/v1/actions/audio/transcribe.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/translate.operation.js +2 -2
- package/dist/nodes/vendors/OpenAi/v1/actions/audio/translate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/descriptions.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/deleteFile.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/file/deleteFile.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/file/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/list.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/file/list.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/upload.operation.js +2 -2
- package/dist/nodes/vendors/OpenAi/v1/actions/file/upload.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/analyze.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/image/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/generate.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/image/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/image/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/node.type.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/router.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/router.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/classify.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/text/classify.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/text/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/message.operation.js +4 -4
- package/dist/nodes/vendors/OpenAi/v1/actions/text/message.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/OpenAiV2.node.js +116 -0
- package/dist/nodes/vendors/OpenAi/v2/OpenAiV2.node.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/generate.operation.js +197 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/index.js +96 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/transcribe.operation.js +121 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/transcribe.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/translate.operation.js +111 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/translate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/create.operation.js +120 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/create.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/get.operation.js +60 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/get.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/index.js +94 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/remove.operation.js +60 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/remove.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/update.operation.js +75 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/update.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/descriptions.js +279 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/descriptions.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/deleteFile.operation.js +84 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/deleteFile.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/index.js +84 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/list.operation.js +92 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/list.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/upload.operation.js +130 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/upload.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/analyze.operation.js +211 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/edit.operation.js +464 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/edit.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/generate.operation.js +319 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/index.js +84 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/node.type.js +17 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/node.type.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/router.js +111 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/router.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/classify.operation.js +102 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/classify.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/helpers/responses.js +277 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/helpers/responses.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/index.js +75 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/response.operation.js +774 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/response.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/video/generate.operation.js +199 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/video/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/video/index.js +64 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/video/index.js.map +1 -0
- package/dist/types/credentials.json +2 -1
- package/dist/types/nodes.json +10 -6
- package/dist/utils/helpers.js +22 -2
- package/dist/utils/helpers.js.map +1 -1
- package/package.json +14 -10
- package/dist/nodes/vendors/OpenAi/actions/assistant/create.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/deleteAssistant.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/list.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/message.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/update.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/audio/generate.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/audio/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/audio/transcribe.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/audio/translate.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/descriptions.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/file/deleteFile.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/file/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/file/list.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/file/upload.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/image/analyze.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/image/generate.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/image/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/node.type.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/router.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/text/classify.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/text/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/text/message.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/versionDescription.js +0 -160
- package/dist/nodes/vendors/OpenAi/actions/versionDescription.js.map +0 -1
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/index.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/index.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/descriptions.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/index.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/index.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/node.type.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/index.js +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
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 upload_operation_exports = {};
|
|
30
|
+
__export(upload_operation_exports, {
|
|
31
|
+
description: () => description,
|
|
32
|
+
execute: () => execute
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(upload_operation_exports);
|
|
35
|
+
var import_form_data = __toESM(require("form-data"));
|
|
36
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
37
|
+
var import_binary_data = require("../../../helpers/binary-data");
|
|
38
|
+
var import_transport = require("../../../transport");
|
|
39
|
+
const properties = [
|
|
40
|
+
{
|
|
41
|
+
displayName: "Input Data Field Name",
|
|
42
|
+
name: "binaryPropertyName",
|
|
43
|
+
type: "string",
|
|
44
|
+
default: "data",
|
|
45
|
+
hint: "The name of the input field containing the binary file data to be processed",
|
|
46
|
+
placeholder: "e.g. data",
|
|
47
|
+
description: "Name of the binary property which contains the file. The size of individual files can be a maximum of 512 MB or 2 million tokens for Assistants."
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
displayName: "Options",
|
|
51
|
+
name: "options",
|
|
52
|
+
placeholder: "Add Option",
|
|
53
|
+
type: "collection",
|
|
54
|
+
default: {},
|
|
55
|
+
options: [
|
|
56
|
+
{
|
|
57
|
+
displayName: "Purpose",
|
|
58
|
+
name: "purpose",
|
|
59
|
+
type: "options",
|
|
60
|
+
default: "user_data",
|
|
61
|
+
description: "The intended purpose of the uploaded file, the 'Fine-tuning' only supports .jsonl files",
|
|
62
|
+
options: [
|
|
63
|
+
{
|
|
64
|
+
name: "Assistants",
|
|
65
|
+
value: "assistants"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "Fine-Tune",
|
|
69
|
+
value: "fine-tune"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "Vision",
|
|
73
|
+
value: "vision"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "User Data",
|
|
77
|
+
value: "user_data"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
const displayOptions = {
|
|
85
|
+
show: {
|
|
86
|
+
operation: ["upload"],
|
|
87
|
+
resource: ["file"]
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
|
|
91
|
+
async function execute(i) {
|
|
92
|
+
const binaryPropertyName = this.getNodeParameter("binaryPropertyName", i);
|
|
93
|
+
const options = this.getNodeParameter("options", i, {});
|
|
94
|
+
const formData = new import_form_data.default();
|
|
95
|
+
formData.append("purpose", options.purpose || "user_data");
|
|
96
|
+
const { filename, contentType, fileContent } = await (0, import_binary_data.getBinaryDataFile)(
|
|
97
|
+
this,
|
|
98
|
+
i,
|
|
99
|
+
binaryPropertyName
|
|
100
|
+
);
|
|
101
|
+
formData.append("file", fileContent, {
|
|
102
|
+
filename,
|
|
103
|
+
contentType
|
|
104
|
+
});
|
|
105
|
+
try {
|
|
106
|
+
const response = await import_transport.apiRequest.call(this, "POST", "/files", {
|
|
107
|
+
option: { formData },
|
|
108
|
+
headers: formData.getHeaders()
|
|
109
|
+
});
|
|
110
|
+
return [
|
|
111
|
+
{
|
|
112
|
+
json: response,
|
|
113
|
+
pairedItem: { item: i }
|
|
114
|
+
}
|
|
115
|
+
];
|
|
116
|
+
} catch (error) {
|
|
117
|
+
if (error.message.includes("Bad request") && error.description?.includes("Expected file to have JSONL format")) {
|
|
118
|
+
throw new import_n8n_workflow.NodeOperationError(this.getNode(), "The file content is not in JSONL format", {
|
|
119
|
+
description: "Fine-tuning accepts only files in JSONL format, where every line is a valid JSON dictionary"
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
126
|
+
0 && (module.exports = {
|
|
127
|
+
description,
|
|
128
|
+
execute
|
|
129
|
+
});
|
|
130
|
+
//# sourceMappingURL=upload.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../nodes/vendors/OpenAi/v2/actions/file/upload.operation.ts"],"sourcesContent":["import FormData from 'form-data';\nimport type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';\nimport { updateDisplayOptions, NodeOperationError } from 'n8n-workflow';\n\nimport { getBinaryDataFile } from '../../../helpers/binary-data';\nimport { apiRequest } from '../../../transport';\n\nconst properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Input Data Field Name',\n\t\tname: 'binaryPropertyName',\n\t\ttype: 'string',\n\t\tdefault: 'data',\n\t\thint: 'The name of the input field containing the binary file data to be processed',\n\t\tplaceholder: 'e.g. data',\n\t\tdescription:\n\t\t\t'Name of the binary property which contains the file. The size of individual files can be a maximum of 512 MB or 2 million tokens for Assistants.',\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: 'Purpose',\n\t\t\t\tname: 'purpose',\n\t\t\t\ttype: 'options',\n\t\t\t\tdefault: 'user_data',\n\t\t\t\tdescription:\n\t\t\t\t\t\"The intended purpose of the uploaded file, the 'Fine-tuning' only supports .jsonl files\",\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Assistants',\n\t\t\t\t\t\tvalue: 'assistants',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Fine-Tune',\n\t\t\t\t\t\tvalue: 'fine-tune',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Vision',\n\t\t\t\t\t\tvalue: 'vision',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'User Data',\n\t\t\t\t\t\tvalue: 'user_data',\n\t\t\t\t\t},\n\t\t\t\t],\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 binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);\n\tconst options = this.getNodeParameter('options', i, {});\n\n\tconst formData = new FormData();\n\n\tformData.append('purpose', options.purpose || 'user_data');\n\n\tconst { filename, contentType, fileContent } = await getBinaryDataFile(\n\t\tthis,\n\t\ti,\n\t\tbinaryPropertyName,\n\t);\n\tformData.append('file', fileContent, {\n\t\tfilename,\n\t\tcontentType,\n\t});\n\n\ttry {\n\t\tconst response = await apiRequest.call(this, 'POST', '/files', {\n\t\t\toption: { formData },\n\t\t\theaders: formData.getHeaders(),\n\t\t});\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tjson: response,\n\t\t\t\tpairedItem: { item: i },\n\t\t\t},\n\t\t];\n\t} catch (error) {\n\t\tif (\n\t\t\terror.message.includes('Bad request') &&\n\t\t\terror.description?.includes('Expected file to have JSONL format')\n\t\t) {\n\t\t\tthrow new NodeOperationError(this.getNode(), 'The file content is not in JSONL format', {\n\t\t\t\tdescription:\n\t\t\t\t\t'Fine-tuning accepts only files in JSONL format, where every line is a valid JSON dictionary',\n\t\t\t});\n\t\t}\n\t\tthrow error;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAqB;AAErB,0BAAyD;AAEzD,yBAAkC;AAClC,uBAA2B;AAE3B,MAAM,aAAgC;AAAA,EACrC;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aACC;AAAA,EACF;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,IACV,SAAS;AAAA,MACR;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,aACC;AAAA,QACD,SAAS;AAAA,UACR;AAAA,YACC,MAAM;AAAA,YACN,OAAO;AAAA,UACR;AAAA,UACA;AAAA,YACC,MAAM;AAAA,YACN,OAAO;AAAA,UACR;AAAA,UACA;AAAA,YACC,MAAM;AAAA,YACN,OAAO;AAAA,UACR;AAAA,UACA;AAAA,YACC,MAAM;AAAA,YACN,OAAO;AAAA,UACR;AAAA,QACD;AAAA,MACD;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,qBAAqB,KAAK,iBAAiB,sBAAsB,CAAC;AACxE,QAAM,UAAU,KAAK,iBAAiB,WAAW,GAAG,CAAC,CAAC;AAEtD,QAAM,WAAW,IAAI,iBAAAA,QAAS;AAE9B,WAAS,OAAO,WAAW,QAAQ,WAAW,WAAW;AAEzD,QAAM,EAAE,UAAU,aAAa,YAAY,IAAI,UAAM;AAAA,IACpD;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,WAAS,OAAO,QAAQ,aAAa;AAAA,IACpC;AAAA,IACA;AAAA,EACD,CAAC;AAED,MAAI;AACH,UAAM,WAAW,MAAM,4BAAW,KAAK,MAAM,QAAQ,UAAU;AAAA,MAC9D,QAAQ,EAAE,SAAS;AAAA,MACnB,SAAS,SAAS,WAAW;AAAA,IAC9B,CAAC;AAED,WAAO;AAAA,MACN;AAAA,QACC,MAAM;AAAA,QACN,YAAY,EAAE,MAAM,EAAE;AAAA,MACvB;AAAA,IACD;AAAA,EACD,SAAS,OAAO;AACf,QACC,MAAM,QAAQ,SAAS,aAAa,KACpC,MAAM,aAAa,SAAS,oCAAoC,GAC/D;AACD,YAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,2CAA2C;AAAA,QACvF,aACC;AAAA,MACF,CAAC;AAAA,IACF;AACA,UAAM;AAAA,EACP;AACD;","names":["FormData"]}
|
|
@@ -0,0 +1,211 @@
|
|
|
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_transport = require("../../../transport");
|
|
27
|
+
var import_descriptions = require("../descriptions");
|
|
28
|
+
var import_binary_data = require("../../../helpers/binary-data");
|
|
29
|
+
const properties = [
|
|
30
|
+
{
|
|
31
|
+
...(0, import_descriptions.modelRLC)("imageModelSearch")
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
displayName: "Text Input",
|
|
35
|
+
name: "text",
|
|
36
|
+
type: "string",
|
|
37
|
+
placeholder: "e.g. What's in this image?",
|
|
38
|
+
default: "What's in this image?",
|
|
39
|
+
typeOptions: {
|
|
40
|
+
rows: 2
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
displayName: "Input Type",
|
|
45
|
+
name: "inputType",
|
|
46
|
+
type: "options",
|
|
47
|
+
default: "url",
|
|
48
|
+
options: [
|
|
49
|
+
{
|
|
50
|
+
name: "Image URL(s)",
|
|
51
|
+
value: "url"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "Binary File(s)",
|
|
55
|
+
value: "base64"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
displayName: "URL(s)",
|
|
61
|
+
name: "imageUrls",
|
|
62
|
+
type: "string",
|
|
63
|
+
placeholder: "e.g. https://example.com/image.jpeg",
|
|
64
|
+
description: "URL(s) of the image(s) to analyze, multiple URLs can be added separated by comma",
|
|
65
|
+
default: "",
|
|
66
|
+
displayOptions: {
|
|
67
|
+
show: {
|
|
68
|
+
inputType: ["url"]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
displayName: "Input Data Field Name",
|
|
74
|
+
name: "binaryPropertyName",
|
|
75
|
+
type: "string",
|
|
76
|
+
default: "data",
|
|
77
|
+
placeholder: "e.g. data",
|
|
78
|
+
hint: "The name of the input field containing the binary file data to be processed",
|
|
79
|
+
description: "Name of the binary property which contains the image(s)",
|
|
80
|
+
displayOptions: {
|
|
81
|
+
show: {
|
|
82
|
+
inputType: ["base64"]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
displayName: "Simplify Output",
|
|
88
|
+
name: "simplify",
|
|
89
|
+
type: "boolean",
|
|
90
|
+
default: true,
|
|
91
|
+
description: "Whether to simplify the response or not"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
displayName: "Options",
|
|
95
|
+
name: "options",
|
|
96
|
+
placeholder: "Add Option",
|
|
97
|
+
type: "collection",
|
|
98
|
+
default: {},
|
|
99
|
+
options: [
|
|
100
|
+
{
|
|
101
|
+
displayName: "Detail",
|
|
102
|
+
name: "detail",
|
|
103
|
+
type: "options",
|
|
104
|
+
default: "auto",
|
|
105
|
+
options: [
|
|
106
|
+
{
|
|
107
|
+
name: "Auto",
|
|
108
|
+
value: "auto",
|
|
109
|
+
description: "Model will look at the image input size and decide if it should use the low or high setting"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "Low",
|
|
113
|
+
value: "low",
|
|
114
|
+
description: "Return faster responses and consume fewer tokens"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "High",
|
|
118
|
+
value: "high",
|
|
119
|
+
description: "Return more detailed responses, consumes more tokens"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
displayName: "Length of Description (Max Tokens)",
|
|
125
|
+
description: "Fewer tokens will result in shorter, less detailed image description",
|
|
126
|
+
name: "maxTokens",
|
|
127
|
+
type: "number",
|
|
128
|
+
default: 300,
|
|
129
|
+
typeOptions: {
|
|
130
|
+
minValue: 1
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
];
|
|
136
|
+
const displayOptions = {
|
|
137
|
+
show: {
|
|
138
|
+
operation: ["analyze"],
|
|
139
|
+
resource: ["image"]
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
|
|
143
|
+
async function execute(i) {
|
|
144
|
+
const model = this.getNodeParameter("modelId", i, "gpt-4o", { extractValue: true });
|
|
145
|
+
const text = this.getNodeParameter("text", i, "");
|
|
146
|
+
const inputType = this.getNodeParameter("inputType", i);
|
|
147
|
+
const options = this.getNodeParameter("options", i, {});
|
|
148
|
+
const content = [
|
|
149
|
+
{
|
|
150
|
+
type: "input_text",
|
|
151
|
+
text
|
|
152
|
+
}
|
|
153
|
+
];
|
|
154
|
+
const detail = options.detail || "auto";
|
|
155
|
+
if (inputType === "url") {
|
|
156
|
+
const imageUrls = this.getNodeParameter("imageUrls", i).split(",").map((url) => url.trim());
|
|
157
|
+
for (const url of imageUrls) {
|
|
158
|
+
content.push({
|
|
159
|
+
type: "input_image",
|
|
160
|
+
detail,
|
|
161
|
+
image_url: url
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
const binaryPropertyName = this.getNodeParameter("binaryPropertyName", i).split(",").map((propertyName) => propertyName.trim());
|
|
166
|
+
for (const propertyName of binaryPropertyName) {
|
|
167
|
+
const { fileContent, contentType } = await (0, import_binary_data.getBinaryDataFile)(this, i, propertyName);
|
|
168
|
+
const buffer = await this.helpers.binaryToBuffer(fileContent);
|
|
169
|
+
const fileBase64 = buffer.toString("base64");
|
|
170
|
+
content.push({
|
|
171
|
+
type: "input_image",
|
|
172
|
+
detail,
|
|
173
|
+
image_url: `data:${contentType};base64,${fileBase64}`
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const body = {
|
|
178
|
+
model,
|
|
179
|
+
input: [
|
|
180
|
+
{
|
|
181
|
+
role: "user",
|
|
182
|
+
content
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
max_output_tokens: options.maxTokens || 300
|
|
186
|
+
};
|
|
187
|
+
const response = await import_transport.apiRequest.call(this, "POST", "/responses", {
|
|
188
|
+
body
|
|
189
|
+
});
|
|
190
|
+
const simplify = this.getNodeParameter("simplify", i);
|
|
191
|
+
if (simplify) {
|
|
192
|
+
return [
|
|
193
|
+
{
|
|
194
|
+
json: response.output,
|
|
195
|
+
pairedItem: { item: i }
|
|
196
|
+
}
|
|
197
|
+
];
|
|
198
|
+
}
|
|
199
|
+
return [
|
|
200
|
+
{
|
|
201
|
+
json: response,
|
|
202
|
+
pairedItem: { item: i }
|
|
203
|
+
}
|
|
204
|
+
];
|
|
205
|
+
}
|
|
206
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
207
|
+
0 && (module.exports = {
|
|
208
|
+
description,
|
|
209
|
+
execute
|
|
210
|
+
});
|
|
211
|
+
//# sourceMappingURL=analyze.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../nodes/vendors/OpenAi/v2/actions/image/analyze.operation.ts"],"sourcesContent":["import type {\n\tIDataObject,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeProperties,\n} from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport type { ResponseInputImage } from 'openai/resources/responses/responses';\nimport type { ChatContent, ChatResponse, ChatResponseRequest } from '../../../helpers/interfaces';\nimport { apiRequest } from '../../../transport';\nimport { modelRLC } from '../descriptions';\nimport { getBinaryDataFile } from '../../../helpers/binary-data';\n\nconst properties: INodeProperties[] = [\n\t{\n\t\t...modelRLC('imageModelSearch'),\n\t},\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: 'base64',\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.jpeg',\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',\n\t\tname: 'binaryPropertyName',\n\t\ttype: 'string',\n\t\tdefault: 'data',\n\t\tplaceholder: 'e.g. data',\n\t\thint: 'The name of the input field containing the binary file data to be processed',\n\t\tdescription: 'Name of the binary property which contains the image(s)',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tinputType: ['base64'],\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: 'Detail',\n\t\t\t\tname: 'detail',\n\t\t\t\ttype: 'options',\n\t\t\t\tdefault: 'auto',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Auto',\n\t\t\t\t\t\tvalue: 'auto',\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Model will look at the image input size and decide if it should use the low or high setting',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Low',\n\t\t\t\t\t\tvalue: 'low',\n\t\t\t\t\t\tdescription: 'Return faster responses and consume fewer tokens',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'High',\n\t\t\t\t\t\tvalue: 'high',\n\t\t\t\t\t\tdescription: 'Return more detailed responses, consumes more tokens',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\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: 300,\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['analyze'],\n\t\tresource: ['image'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst model = this.getNodeParameter('modelId', i, 'gpt-4o', { extractValue: true }) as string;\n\n\tconst text = this.getNodeParameter('text', i, '') as string;\n\tconst inputType = this.getNodeParameter('inputType', i) as string;\n\tconst options = this.getNodeParameter('options', i, {});\n\n\tconst content: ChatContent = [\n\t\t{\n\t\t\ttype: 'input_text',\n\t\t\ttext,\n\t\t},\n\t];\n\n\tconst detail = (options.detail as ResponseInputImage['detail']) || ('auto' as const);\n\n\tif (inputType === 'url') {\n\t\tconst imageUrls = (this.getNodeParameter('imageUrls', i) as string)\n\t\t\t.split(',')\n\t\t\t.map((url) => url.trim());\n\n\t\tfor (const url of imageUrls) {\n\t\t\tcontent.push({\n\t\t\t\ttype: 'input_image',\n\t\t\t\tdetail,\n\t\t\t\timage_url: url,\n\t\t\t});\n\t\t}\n\t} else {\n\t\tconst binaryPropertyName = this.getNodeParameter('binaryPropertyName', i)\n\t\t\t.split(',')\n\t\t\t.map((propertyName) => propertyName.trim());\n\n\t\tfor (const propertyName of binaryPropertyName) {\n\t\t\tconst { fileContent, contentType } = await getBinaryDataFile(this, i, propertyName);\n\t\t\tconst buffer = await this.helpers.binaryToBuffer(fileContent);\n\t\t\tconst fileBase64 = buffer.toString('base64');\n\n\t\t\tcontent.push({\n\t\t\t\ttype: 'input_image',\n\t\t\t\tdetail,\n\t\t\t\timage_url: `data:${contentType};base64,${fileBase64}`,\n\t\t\t});\n\t\t}\n\t}\n\n\tconst body: ChatResponseRequest = {\n\t\tmodel,\n\t\tinput: [\n\t\t\t{\n\t\t\t\trole: 'user',\n\t\t\t\tcontent,\n\t\t\t},\n\t\t],\n\t\tmax_output_tokens: (options.maxTokens as number) || 300,\n\t};\n\n\tconst response = (await apiRequest.call(this, 'POST', '/responses', {\n\t\tbody,\n\t})) as ChatResponse;\n\n\tconst simplify = this.getNodeParameter('simplify', i) as boolean;\n\n\tif (simplify) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tjson: response.output as unknown as IDataObject,\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 as unknown as IDataObject,\n\t\t\tpairedItem: { item: i },\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,0BAAqC;AAIrC,uBAA2B;AAC3B,0BAAyB;AACzB,yBAAkC;AAElC,MAAM,aAAgC;AAAA,EACrC;A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