@n8n/n8n-nodes-langchain 1.115.1 → 1.116.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/dist/credentials/AnthropicApi.credentials.js +39 -8
  2. package/dist/credentials/AnthropicApi.credentials.js.map +1 -1
  3. package/dist/credentials/LemonadeApi.credentials.js +70 -0
  4. package/dist/credentials/LemonadeApi.credentials.js.map +1 -0
  5. package/dist/known/credentials.json +9 -0
  6. package/dist/known/nodes.json +12 -0
  7. package/dist/nodes/agents/Agent/Agent.node.js +1 -2
  8. package/dist/nodes/agents/Agent/Agent.node.js.map +1 -1
  9. package/dist/nodes/agents/Agent/V1/AgentV1.node.js +2 -0
  10. package/dist/nodes/agents/Agent/V1/AgentV1.node.js.map +1 -1
  11. package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/description.js +13 -1
  12. package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/description.js.map +1 -1
  13. package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/execute.js +49 -30
  14. package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/execute.js.map +1 -1
  15. package/dist/nodes/chains/ChainLLM/methods/chainExecutor.js +3 -0
  16. package/dist/nodes/chains/ChainLLM/methods/chainExecutor.js.map +1 -1
  17. package/dist/nodes/embeddings/EmbeddingsLemonade/EmbeddingsLemonade.node.js +87 -0
  18. package/dist/nodes/embeddings/EmbeddingsLemonade/EmbeddingsLemonade.node.js.map +1 -0
  19. package/dist/nodes/embeddings/EmbeddingsLemonade/lemonade.svg +53 -0
  20. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +17 -0
  21. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js.map +1 -1
  22. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js +12 -8
  23. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js.map +1 -1
  24. package/dist/nodes/llms/LMChatLemonade/LmChatLemonade.node.js +106 -0
  25. package/dist/nodes/llms/LMChatLemonade/LmChatLemonade.node.js.map +1 -0
  26. package/dist/nodes/llms/LMChatLemonade/lemonade.svg +53 -0
  27. package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js +6 -5
  28. package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js.map +1 -1
  29. package/dist/nodes/llms/LMLemonade/LmLemonade.node.js +107 -0
  30. package/dist/nodes/llms/LMLemonade/LmLemonade.node.js.map +1 -0
  31. package/dist/nodes/llms/LMLemonade/description.js +147 -0
  32. package/dist/nodes/llms/LMLemonade/description.js.map +1 -0
  33. package/dist/nodes/llms/LMLemonade/lemonade.svg +53 -0
  34. package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js +3 -0
  35. package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js.map +1 -1
  36. package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js +14 -1
  37. package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js.map +1 -1
  38. package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js +107 -47
  39. package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js.map +1 -1
  40. package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js +2 -1
  41. package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js.map +1 -1
  42. package/dist/nodes/vector_store/VectorStoreQdrant/VectorStoreQdrant.node.js +43 -4
  43. package/dist/nodes/vector_store/VectorStoreQdrant/VectorStoreQdrant.node.js.map +1 -1
  44. package/dist/nodes/vendors/Anthropic/transport/index.js +9 -5
  45. package/dist/nodes/vendors/Anthropic/transport/index.js.map +1 -1
  46. package/dist/nodes/vendors/OpenAi/OpenAi.node.js +50 -11
  47. package/dist/nodes/vendors/OpenAi/OpenAi.node.js.map +1 -1
  48. package/dist/nodes/vendors/OpenAi/helpers/binary-data.js +3 -3
  49. package/dist/nodes/vendors/OpenAi/helpers/binary-data.js.map +1 -1
  50. package/dist/nodes/vendors/OpenAi/helpers/description.js +75 -0
  51. package/dist/nodes/vendors/OpenAi/helpers/description.js.map +1 -0
  52. package/dist/nodes/vendors/OpenAi/helpers/interfaces.js.map +1 -1
  53. package/dist/nodes/vendors/OpenAi/helpers/modelFiltering.js +34 -0
  54. package/dist/nodes/vendors/OpenAi/helpers/modelFiltering.js.map +1 -0
  55. package/dist/nodes/vendors/OpenAi/helpers/polling.js +52 -0
  56. package/dist/nodes/vendors/OpenAi/helpers/polling.js.map +1 -0
  57. package/dist/nodes/vendors/OpenAi/helpers/utils.js +27 -0
  58. package/dist/nodes/vendors/OpenAi/helpers/utils.js.map +1 -1
  59. package/dist/nodes/vendors/OpenAi/methods/listSearch.js +10 -6
  60. package/dist/nodes/vendors/OpenAi/methods/listSearch.js.map +1 -1
  61. package/dist/nodes/vendors/OpenAi/v1/OpenAiV1.node.js +110 -0
  62. package/dist/nodes/vendors/OpenAi/v1/OpenAiV1.node.js.map +1 -0
  63. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/create.operation.js +1 -1
  64. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/create.operation.js.map +1 -0
  65. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/deleteAssistant.operation.js +1 -1
  66. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/deleteAssistant.operation.js.map +1 -0
  67. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/index.js.map +1 -0
  68. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/list.operation.js +1 -1
  69. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/list.operation.js.map +1 -0
  70. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/message.operation.js +5 -5
  71. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/message.operation.js.map +1 -0
  72. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/update.operation.js +1 -1
  73. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/update.operation.js.map +1 -0
  74. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/generate.operation.js +1 -1
  75. package/dist/nodes/vendors/OpenAi/v1/actions/audio/generate.operation.js.map +1 -0
  76. package/dist/nodes/vendors/OpenAi/v1/actions/audio/index.js.map +1 -0
  77. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/transcribe.operation.js +2 -2
  78. package/dist/nodes/vendors/OpenAi/v1/actions/audio/transcribe.operation.js.map +1 -0
  79. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/translate.operation.js +2 -2
  80. package/dist/nodes/vendors/OpenAi/v1/actions/audio/translate.operation.js.map +1 -0
  81. package/dist/nodes/vendors/OpenAi/v1/actions/descriptions.js.map +1 -0
  82. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/deleteFile.operation.js +1 -1
  83. package/dist/nodes/vendors/OpenAi/v1/actions/file/deleteFile.operation.js.map +1 -0
  84. package/dist/nodes/vendors/OpenAi/v1/actions/file/index.js.map +1 -0
  85. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/list.operation.js +1 -1
  86. package/dist/nodes/vendors/OpenAi/v1/actions/file/list.operation.js.map +1 -0
  87. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/upload.operation.js +2 -2
  88. package/dist/nodes/vendors/OpenAi/v1/actions/file/upload.operation.js.map +1 -0
  89. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/analyze.operation.js +1 -1
  90. package/dist/nodes/vendors/OpenAi/v1/actions/image/analyze.operation.js.map +1 -0
  91. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/generate.operation.js +1 -1
  92. package/dist/nodes/vendors/OpenAi/v1/actions/image/generate.operation.js.map +1 -0
  93. package/dist/nodes/vendors/OpenAi/v1/actions/image/index.js.map +1 -0
  94. package/dist/nodes/vendors/OpenAi/v1/actions/node.type.js.map +1 -0
  95. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/router.js +1 -1
  96. package/dist/nodes/vendors/OpenAi/v1/actions/router.js.map +1 -0
  97. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/classify.operation.js +1 -1
  98. package/dist/nodes/vendors/OpenAi/v1/actions/text/classify.operation.js.map +1 -0
  99. package/dist/nodes/vendors/OpenAi/v1/actions/text/index.js.map +1 -0
  100. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/message.operation.js +4 -4
  101. package/dist/nodes/vendors/OpenAi/v1/actions/text/message.operation.js.map +1 -0
  102. package/dist/nodes/vendors/OpenAi/v2/OpenAiV2.node.js +116 -0
  103. package/dist/nodes/vendors/OpenAi/v2/OpenAiV2.node.js.map +1 -0
  104. package/dist/nodes/vendors/OpenAi/v2/actions/audio/generate.operation.js +197 -0
  105. package/dist/nodes/vendors/OpenAi/v2/actions/audio/generate.operation.js.map +1 -0
  106. package/dist/nodes/vendors/OpenAi/v2/actions/audio/index.js +96 -0
  107. package/dist/nodes/vendors/OpenAi/v2/actions/audio/index.js.map +1 -0
  108. package/dist/nodes/vendors/OpenAi/v2/actions/audio/transcribe.operation.js +121 -0
  109. package/dist/nodes/vendors/OpenAi/v2/actions/audio/transcribe.operation.js.map +1 -0
  110. package/dist/nodes/vendors/OpenAi/v2/actions/audio/translate.operation.js +111 -0
  111. package/dist/nodes/vendors/OpenAi/v2/actions/audio/translate.operation.js.map +1 -0
  112. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/create.operation.js +120 -0
  113. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/create.operation.js.map +1 -0
  114. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/get.operation.js +60 -0
  115. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/get.operation.js.map +1 -0
  116. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/index.js +94 -0
  117. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/index.js.map +1 -0
  118. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/remove.operation.js +60 -0
  119. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/remove.operation.js.map +1 -0
  120. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/update.operation.js +75 -0
  121. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/update.operation.js.map +1 -0
  122. package/dist/nodes/vendors/OpenAi/v2/actions/descriptions.js +279 -0
  123. package/dist/nodes/vendors/OpenAi/v2/actions/descriptions.js.map +1 -0
  124. package/dist/nodes/vendors/OpenAi/v2/actions/file/deleteFile.operation.js +84 -0
  125. package/dist/nodes/vendors/OpenAi/v2/actions/file/deleteFile.operation.js.map +1 -0
  126. package/dist/nodes/vendors/OpenAi/v2/actions/file/index.js +84 -0
  127. package/dist/nodes/vendors/OpenAi/v2/actions/file/index.js.map +1 -0
  128. package/dist/nodes/vendors/OpenAi/v2/actions/file/list.operation.js +92 -0
  129. package/dist/nodes/vendors/OpenAi/v2/actions/file/list.operation.js.map +1 -0
  130. package/dist/nodes/vendors/OpenAi/v2/actions/file/upload.operation.js +130 -0
  131. package/dist/nodes/vendors/OpenAi/v2/actions/file/upload.operation.js.map +1 -0
  132. package/dist/nodes/vendors/OpenAi/v2/actions/image/analyze.operation.js +211 -0
  133. package/dist/nodes/vendors/OpenAi/v2/actions/image/analyze.operation.js.map +1 -0
  134. package/dist/nodes/vendors/OpenAi/v2/actions/image/edit.operation.js +464 -0
  135. package/dist/nodes/vendors/OpenAi/v2/actions/image/edit.operation.js.map +1 -0
  136. package/dist/nodes/vendors/OpenAi/v2/actions/image/generate.operation.js +319 -0
  137. package/dist/nodes/vendors/OpenAi/v2/actions/image/generate.operation.js.map +1 -0
  138. package/dist/nodes/vendors/OpenAi/v2/actions/image/index.js +84 -0
  139. package/dist/nodes/vendors/OpenAi/v2/actions/image/index.js.map +1 -0
  140. package/dist/nodes/vendors/OpenAi/v2/actions/node.type.js +17 -0
  141. package/dist/nodes/vendors/OpenAi/v2/actions/node.type.js.map +1 -0
  142. package/dist/nodes/vendors/OpenAi/v2/actions/router.js +111 -0
  143. package/dist/nodes/vendors/OpenAi/v2/actions/router.js.map +1 -0
  144. package/dist/nodes/vendors/OpenAi/v2/actions/text/classify.operation.js +102 -0
  145. package/dist/nodes/vendors/OpenAi/v2/actions/text/classify.operation.js.map +1 -0
  146. package/dist/nodes/vendors/OpenAi/v2/actions/text/helpers/responses.js +277 -0
  147. package/dist/nodes/vendors/OpenAi/v2/actions/text/helpers/responses.js.map +1 -0
  148. package/dist/nodes/vendors/OpenAi/v2/actions/text/index.js +86 -0
  149. package/dist/nodes/vendors/OpenAi/v2/actions/text/index.js.map +1 -0
  150. package/dist/nodes/vendors/OpenAi/v2/actions/text/message.operation.js +345 -0
  151. package/dist/nodes/vendors/OpenAi/v2/actions/text/message.operation.js.map +1 -0
  152. package/dist/nodes/vendors/OpenAi/v2/actions/text/response.operation.js +777 -0
  153. package/dist/nodes/vendors/OpenAi/v2/actions/text/response.operation.js.map +1 -0
  154. package/dist/nodes/vendors/OpenAi/v2/actions/video/generate.operation.js +199 -0
  155. package/dist/nodes/vendors/OpenAi/v2/actions/video/generate.operation.js.map +1 -0
  156. package/dist/nodes/vendors/OpenAi/v2/actions/video/index.js +64 -0
  157. package/dist/nodes/vendors/OpenAi/v2/actions/video/index.js.map +1 -0
  158. package/dist/types/credentials.json +2 -1
  159. package/dist/types/nodes.json +10 -6
  160. package/dist/utils/helpers.js +22 -2
  161. package/dist/utils/helpers.js.map +1 -1
  162. package/package.json +16 -12
  163. package/dist/nodes/vendors/OpenAi/actions/assistant/create.operation.js.map +0 -1
  164. package/dist/nodes/vendors/OpenAi/actions/assistant/deleteAssistant.operation.js.map +0 -1
  165. package/dist/nodes/vendors/OpenAi/actions/assistant/index.js.map +0 -1
  166. package/dist/nodes/vendors/OpenAi/actions/assistant/list.operation.js.map +0 -1
  167. package/dist/nodes/vendors/OpenAi/actions/assistant/message.operation.js.map +0 -1
  168. package/dist/nodes/vendors/OpenAi/actions/assistant/update.operation.js.map +0 -1
  169. package/dist/nodes/vendors/OpenAi/actions/audio/generate.operation.js.map +0 -1
  170. package/dist/nodes/vendors/OpenAi/actions/audio/index.js.map +0 -1
  171. package/dist/nodes/vendors/OpenAi/actions/audio/transcribe.operation.js.map +0 -1
  172. package/dist/nodes/vendors/OpenAi/actions/audio/translate.operation.js.map +0 -1
  173. package/dist/nodes/vendors/OpenAi/actions/descriptions.js.map +0 -1
  174. package/dist/nodes/vendors/OpenAi/actions/file/deleteFile.operation.js.map +0 -1
  175. package/dist/nodes/vendors/OpenAi/actions/file/index.js.map +0 -1
  176. package/dist/nodes/vendors/OpenAi/actions/file/list.operation.js.map +0 -1
  177. package/dist/nodes/vendors/OpenAi/actions/file/upload.operation.js.map +0 -1
  178. package/dist/nodes/vendors/OpenAi/actions/image/analyze.operation.js.map +0 -1
  179. package/dist/nodes/vendors/OpenAi/actions/image/generate.operation.js.map +0 -1
  180. package/dist/nodes/vendors/OpenAi/actions/image/index.js.map +0 -1
  181. package/dist/nodes/vendors/OpenAi/actions/node.type.js.map +0 -1
  182. package/dist/nodes/vendors/OpenAi/actions/router.js.map +0 -1
  183. package/dist/nodes/vendors/OpenAi/actions/text/classify.operation.js.map +0 -1
  184. package/dist/nodes/vendors/OpenAi/actions/text/index.js.map +0 -1
  185. package/dist/nodes/vendors/OpenAi/actions/text/message.operation.js.map +0 -1
  186. package/dist/nodes/vendors/OpenAi/actions/versionDescription.js +0 -160
  187. package/dist/nodes/vendors/OpenAi/actions/versionDescription.js.map +0 -1
  188. /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/index.js +0 -0
  189. /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/index.js +0 -0
  190. /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/descriptions.js +0 -0
  191. /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/index.js +0 -0
  192. /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/index.js +0 -0
  193. /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/node.type.js +0 -0
  194. /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/index.js +0 -0
@@ -0,0 +1,116 @@
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 OpenAiV2_node_exports = {};
30
+ __export(OpenAiV2_node_exports, {
31
+ OpenAiV2: () => OpenAiV2
32
+ });
33
+ module.exports = __toCommonJS(OpenAiV2_node_exports);
34
+ var import_n8n_workflow = require("n8n-workflow");
35
+ var import_description = require("../helpers/description");
36
+ var import_methods = require("../methods");
37
+ var import_router = require("./actions/router");
38
+ var audio = __toESM(require("./actions/audio"));
39
+ var conversation = __toESM(require("./actions/conversation"));
40
+ var file = __toESM(require("./actions/file"));
41
+ var image = __toESM(require("./actions/image"));
42
+ var text = __toESM(require("./actions/text"));
43
+ var video = __toESM(require("./actions/video"));
44
+ class OpenAiV2 {
45
+ constructor(baseDescription) {
46
+ this.methods = {
47
+ listSearch: import_methods.listSearch,
48
+ loadOptions: import_methods.loadOptions
49
+ };
50
+ this.description = {
51
+ ...baseDescription,
52
+ version: [2],
53
+ defaults: {
54
+ name: "OpenAI"
55
+ },
56
+ inputs: `={{(${import_description.configureNodeInputs})($parameter.resource, $parameter.operation, $parameter.hideTools, $parameter.memory ?? undefined)}}`,
57
+ outputs: [import_n8n_workflow.NodeConnectionTypes.Main],
58
+ credentials: [
59
+ {
60
+ name: "openAiApi",
61
+ required: true
62
+ }
63
+ ],
64
+ properties: [
65
+ {
66
+ displayName: "Resource",
67
+ name: "resource",
68
+ type: "options",
69
+ noDataExpression: true,
70
+ // eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
71
+ options: [
72
+ {
73
+ name: "Text",
74
+ value: "text"
75
+ },
76
+ {
77
+ name: "Image",
78
+ value: "image"
79
+ },
80
+ {
81
+ name: "Audio",
82
+ value: "audio"
83
+ },
84
+ {
85
+ name: "File",
86
+ value: "file"
87
+ },
88
+ {
89
+ name: "Conversation",
90
+ value: "conversation"
91
+ },
92
+ {
93
+ name: "Video",
94
+ value: "video"
95
+ }
96
+ ],
97
+ default: "text"
98
+ },
99
+ ...audio.description,
100
+ ...file.description,
101
+ ...image.description,
102
+ ...text.description,
103
+ ...conversation.description,
104
+ ...video.description
105
+ ]
106
+ };
107
+ }
108
+ async execute() {
109
+ return await import_router.router.call(this);
110
+ }
111
+ }
112
+ // Annotate the CommonJS export names for ESM import in node:
113
+ 0 && (module.exports = {
114
+ OpenAiV2
115
+ });
116
+ //# sourceMappingURL=OpenAiV2.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../nodes/vendors/OpenAi/v2/OpenAiV2.node.ts"],"sourcesContent":["import {\n\tNodeConnectionTypes,\n\ttype IExecuteFunctions,\n\ttype INodeType,\n\ttype INodeTypeBaseDescription,\n\ttype INodeTypeDescription,\n} from 'n8n-workflow';\n\nimport { configureNodeInputs } from '../helpers/description';\nimport { listSearch, loadOptions } from '../methods';\nimport { router } from './actions/router';\n\nimport * as audio from './actions/audio';\nimport * as conversation from './actions/conversation';\nimport * as file from './actions/file';\nimport * as image from './actions/image';\nimport * as text from './actions/text';\nimport * as video from './actions/video';\n\nexport class OpenAiV2 implements INodeType {\n\tdescription: INodeTypeDescription;\n\n\tconstructor(baseDescription: INodeTypeBaseDescription) {\n\t\tthis.description = {\n\t\t\t...baseDescription,\n\t\t\tversion: [2],\n\t\t\tdefaults: {\n\t\t\t\tname: 'OpenAI',\n\t\t\t},\n\t\t\tinputs: `={{(${configureNodeInputs})($parameter.resource, $parameter.operation, $parameter.hideTools, $parameter.memory ?? undefined)}}`,\n\t\t\toutputs: [NodeConnectionTypes.Main],\n\t\t\tcredentials: [\n\t\t\t\t{\n\t\t\t\t\tname: 'openAiApi',\n\t\t\t\t\trequired: true,\n\t\t\t\t},\n\t\t\t],\n\t\t\tproperties: [\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Resource',\n\t\t\t\t\tname: 'resource',\n\t\t\t\t\ttype: 'options',\n\t\t\t\t\tnoDataExpression: true,\n\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'Text',\n\t\t\t\t\t\t\tvalue: 'text',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'Image',\n\t\t\t\t\t\t\tvalue: 'image',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'Audio',\n\t\t\t\t\t\t\tvalue: 'audio',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'File',\n\t\t\t\t\t\t\tvalue: 'file',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'Conversation',\n\t\t\t\t\t\t\tvalue: 'conversation',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'Video',\n\t\t\t\t\t\t\tvalue: 'video',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdefault: 'text',\n\t\t\t\t},\n\t\t\t\t...audio.description,\n\t\t\t\t...file.description,\n\t\t\t\t...image.description,\n\t\t\t\t...text.description,\n\t\t\t\t...conversation.description,\n\t\t\t\t...video.description,\n\t\t\t],\n\t\t};\n\t}\n\n\tmethods = {\n\t\tlistSearch,\n\t\tloadOptions,\n\t};\n\n\tasync execute(this: IExecuteFunctions) {\n\t\treturn await router.call(this);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAMO;AAEP,yBAAoC;AACpC,qBAAwC;AACxC,oBAAuB;AAEvB,YAAuB;AACvB,mBAA8B;AAC9B,WAAsB;AACtB,YAAuB;AACvB,WAAsB;AACtB,YAAuB;AAEhB,MAAM,SAA8B;AAAA,EAG1C,YAAY,iBAA2C;AA4DvD,mBAAU;AAAA,MACT;AAAA,MACA;AAAA,IACD;AA9DC,SAAK,cAAc;AAAA,MAClB,GAAG;AAAA,MACH,SAAS,CAAC,CAAC;AAAA,MACX,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,QAAQ,OAAO,sCAAmB;AAAA,MAClC,SAAS,CAAC,wCAAoB,IAAI;AAAA,MAClC,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,UACN,UAAU;AAAA,QACX;AAAA,MACD;AAAA,MACA,YAAY;AAAA,QACX;AAAA,UACC,aAAa;AAAA,UACb,MAAM;AAAA,UACN,MAAM;AAAA,UACN,kBAAkB;AAAA;AAAA,UAElB,SAAS;AAAA,YACR;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,UACD;AAAA,UACA,SAAS;AAAA,QACV;AAAA,QACA,GAAG,MAAM;AAAA,QACT,GAAG,KAAK;AAAA,QACR,GAAG,MAAM;AAAA,QACT,GAAG,KAAK;AAAA,QACR,GAAG,aAAa;AAAA,QAChB,GAAG,MAAM;AAAA,MACV;AAAA,IACD;AAAA,EACD;AAAA,EAOA,MAAM,UAAiC;AACtC,WAAO,MAAM,qBAAO,KAAK,IAAI;AAAA,EAC9B;AACD;","names":[]}
@@ -0,0 +1,197 @@
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: "Model",
30
+ name: "model",
31
+ type: "options",
32
+ default: "tts-1",
33
+ options: [
34
+ {
35
+ name: "TTS-1",
36
+ value: "tts-1"
37
+ },
38
+ {
39
+ name: "TTS-1-HD",
40
+ value: "tts-1-hd"
41
+ }
42
+ ]
43
+ },
44
+ {
45
+ displayName: "Text Input",
46
+ name: "input",
47
+ type: "string",
48
+ placeholder: "e.g. The quick brown fox jumped over the lazy dog",
49
+ description: "The text to generate audio for. The maximum length is 4096 characters.",
50
+ default: "",
51
+ typeOptions: {
52
+ rows: 2
53
+ }
54
+ },
55
+ {
56
+ displayName: "Voice",
57
+ name: "voice",
58
+ type: "options",
59
+ default: "alloy",
60
+ description: "The voice to use when generating the audio",
61
+ options: [
62
+ {
63
+ name: "Alloy",
64
+ value: "alloy"
65
+ },
66
+ {
67
+ name: "Echo",
68
+ value: "echo"
69
+ },
70
+ {
71
+ name: "Fable",
72
+ value: "fable"
73
+ },
74
+ {
75
+ name: "Nova",
76
+ value: "nova"
77
+ },
78
+ {
79
+ name: "Onyx",
80
+ value: "onyx"
81
+ },
82
+ {
83
+ name: "Shimmer",
84
+ value: "shimmer"
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ displayName: "Options",
90
+ name: "options",
91
+ placeholder: "Add Option",
92
+ type: "collection",
93
+ default: {},
94
+ options: [
95
+ {
96
+ displayName: "Response Format",
97
+ name: "response_format",
98
+ type: "options",
99
+ default: "mp3",
100
+ options: [
101
+ {
102
+ name: "MP3",
103
+ value: "mp3"
104
+ },
105
+ {
106
+ name: "OPUS",
107
+ value: "opus"
108
+ },
109
+ {
110
+ name: "AAC",
111
+ value: "aac"
112
+ },
113
+ {
114
+ name: "FLAC",
115
+ value: "flac"
116
+ }
117
+ ]
118
+ },
119
+ {
120
+ displayName: "Audio Speed",
121
+ name: "speed",
122
+ type: "number",
123
+ default: 1,
124
+ typeOptions: {
125
+ minValue: 0.25,
126
+ maxValue: 4,
127
+ numberPrecision: 1
128
+ }
129
+ },
130
+ {
131
+ displayName: "Put Output in Field",
132
+ name: "binaryPropertyOutput",
133
+ type: "string",
134
+ default: "data",
135
+ hint: "The name of the output field to put the binary file data in"
136
+ }
137
+ ]
138
+ }
139
+ ];
140
+ const displayOptions = {
141
+ show: {
142
+ operation: ["generate"],
143
+ resource: ["audio"]
144
+ }
145
+ };
146
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
147
+ async function execute(i) {
148
+ const model = this.getNodeParameter("model", i);
149
+ const input = this.getNodeParameter("input", i);
150
+ const voice = this.getNodeParameter("voice", i);
151
+ let response_format = "mp3";
152
+ let speed = 1;
153
+ const options = this.getNodeParameter("options", i, {});
154
+ if (options.response_format) {
155
+ response_format = options.response_format;
156
+ }
157
+ if (options.speed) {
158
+ speed = options.speed;
159
+ }
160
+ const body = {
161
+ model,
162
+ input,
163
+ voice,
164
+ response_format,
165
+ speed
166
+ };
167
+ const option = {
168
+ useStream: true,
169
+ returnFullResponse: true,
170
+ encoding: "arraybuffer",
171
+ json: false
172
+ };
173
+ const response = await import_transport.apiRequest.call(this, "POST", "/audio/speech", { body, option });
174
+ const binaryData = await this.helpers.prepareBinaryData(
175
+ response,
176
+ `audio.${response_format}`,
177
+ `audio/${response_format}`
178
+ );
179
+ const binaryPropertyOutput = options.binaryPropertyOutput || "data";
180
+ const newItem = {
181
+ json: {
182
+ ...binaryData,
183
+ data: void 0
184
+ },
185
+ pairedItem: { item: i },
186
+ binary: {
187
+ [binaryPropertyOutput]: binaryData
188
+ }
189
+ };
190
+ return [newItem];
191
+ }
192
+ // Annotate the CommonJS export names for ESM import in node:
193
+ 0 && (module.exports = {
194
+ description,
195
+ execute
196
+ });
197
+ //# sourceMappingURL=generate.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../nodes/vendors/OpenAi/v2/actions/audio/generate.operation.ts"],"sourcesContent":["import type {\n\tINodeProperties,\n\tIExecuteFunctions,\n\tIDataObject,\n\tINodeExecutionData,\n} from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport { apiRequest } from '../../../transport';\n\nconst properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Model',\n\t\tname: 'model',\n\t\ttype: 'options',\n\t\tdefault: 'tts-1',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'TTS-1',\n\t\t\t\tvalue: 'tts-1',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'TTS-1-HD',\n\t\t\t\tvalue: 'tts-1-hd',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'Text Input',\n\t\tname: 'input',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. The quick brown fox jumped over the lazy dog',\n\t\tdescription: 'The text to generate audio for. The maximum length is 4096 characters.',\n\t\tdefault: '',\n\t\ttypeOptions: {\n\t\t\trows: 2,\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Voice',\n\t\tname: 'voice',\n\t\ttype: 'options',\n\t\tdefault: 'alloy',\n\t\tdescription: 'The voice to use when generating the audio',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Alloy',\n\t\t\t\tvalue: 'alloy',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Echo',\n\t\t\t\tvalue: 'echo',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Fable',\n\t\t\t\tvalue: 'fable',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Nova',\n\t\t\t\tvalue: 'nova',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Onyx',\n\t\t\t\tvalue: 'onyx',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Shimmer',\n\t\t\t\tvalue: 'shimmer',\n\t\t\t},\n\t\t],\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: 'Response Format',\n\t\t\t\tname: 'response_format',\n\t\t\t\ttype: 'options',\n\t\t\t\tdefault: 'mp3',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'MP3',\n\t\t\t\t\t\tvalue: 'mp3',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'OPUS',\n\t\t\t\t\t\tvalue: 'opus',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'AAC',\n\t\t\t\t\t\tvalue: 'aac',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'FLAC',\n\t\t\t\t\t\tvalue: 'flac',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Audio Speed',\n\t\t\t\tname: 'speed',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 1,\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 0.25,\n\t\t\t\t\tmaxValue: 4,\n\t\t\t\t\tnumberPrecision: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Put Output in Field',\n\t\t\t\tname: 'binaryPropertyOutput',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: 'data',\n\t\t\t\thint: 'The name of the output field to put the binary file data in',\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['generate'],\n\t\tresource: ['audio'],\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('model', i) as string;\n\tconst input = this.getNodeParameter('input', i) as string;\n\tconst voice = this.getNodeParameter('voice', i) as string;\n\tlet response_format = 'mp3';\n\tlet speed = 1;\n\n\tconst options = this.getNodeParameter('options', i, {});\n\n\tif (options.response_format) {\n\t\tresponse_format = options.response_format as string;\n\t}\n\n\tif (options.speed) {\n\t\tspeed = options.speed as number;\n\t}\n\n\tconst body: IDataObject = {\n\t\tmodel,\n\t\tinput,\n\t\tvoice,\n\t\tresponse_format,\n\t\tspeed,\n\t};\n\n\tconst option = {\n\t\tuseStream: true,\n\t\treturnFullResponse: true,\n\t\tencoding: 'arraybuffer',\n\t\tjson: false,\n\t};\n\n\tconst response = await apiRequest.call(this, 'POST', '/audio/speech', { body, option });\n\n\tconst binaryData = await this.helpers.prepareBinaryData(\n\t\tresponse,\n\t\t`audio.${response_format}`,\n\t\t`audio/${response_format}`,\n\t);\n\n\tconst binaryPropertyOutput = (options.binaryPropertyOutput as string) || 'data';\n\n\tconst newItem: INodeExecutionData = {\n\t\tjson: {\n\t\t\t...binaryData,\n\t\t\tdata: undefined,\n\t\t},\n\t\tpairedItem: { item: i },\n\t\tbinary: {\n\t\t\t[binaryPropertyOutput]: binaryData,\n\t\t},\n\t};\n\n\treturn [newItem];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,0BAAqC;AAErC,uBAA2B;AAE3B,MAAM,aAAgC;AAAA,EACrC;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,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,M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Descriptor;
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 audio_exports = {};
30
+ __export(audio_exports, {
31
+ description: () => description,
32
+ generate: () => generate,
33
+ transcribe: () => transcribe,
34
+ translate: () => translate
35
+ });
36
+ module.exports = __toCommonJS(audio_exports);
37
+ var generate = __toESM(require("./generate.operation"));
38
+ var transcribe = __toESM(require("./transcribe.operation"));
39
+ var translate = __toESM(require("./translate.operation"));
40
+ const description = [
41
+ {
42
+ displayName: "Operation",
43
+ name: "operation",
44
+ type: "options",
45
+ noDataExpression: true,
46
+ options: [
47
+ {
48
+ name: "Generate Audio",
49
+ value: "generate",
50
+ action: "Generate audio",
51
+ description: "Creates audio from a text prompt"
52
+ },
53
+ {
54
+ name: "Transcribe a Recording",
55
+ value: "transcribe",
56
+ action: "Transcribe a recording",
57
+ description: "Transcribes audio into the text"
58
+ },
59
+ {
60
+ name: "Translate a Recording",
61
+ value: "translate",
62
+ action: "Translate a recording",
63
+ description: "Translate audio into the text in the english language"
64
+ }
65
+ ],
66
+ default: "generate",
67
+ displayOptions: {
68
+ show: {
69
+ resource: ["audio"]
70
+ }
71
+ }
72
+ },
73
+ {
74
+ displayName: "OpenAI API limits the size of the audio file to 25 MB",
75
+ name: "fileSizeLimitNotice",
76
+ type: "notice",
77
+ default: " ",
78
+ displayOptions: {
79
+ show: {
80
+ resource: ["audio"],
81
+ operation: ["translate", "transcribe"]
82
+ }
83
+ }
84
+ },
85
+ ...generate.description,
86
+ ...transcribe.description,
87
+ ...translate.description
88
+ ];
89
+ // Annotate the CommonJS export names for ESM import in node:
90
+ 0 && (module.exports = {
91
+ description,
92
+ generate,
93
+ transcribe,
94
+ translate
95
+ });
96
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../nodes/vendors/OpenAi/v2/actions/audio/index.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as generate from './generate.operation';\nimport * as transcribe from './transcribe.operation';\nimport * as translate from './translate.operation';\n\nexport { generate, transcribe, translate };\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: 'Generate Audio',\n\t\t\t\tvalue: 'generate',\n\t\t\t\taction: 'Generate audio',\n\t\t\t\tdescription: 'Creates audio from a text prompt',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Transcribe a Recording',\n\t\t\t\tvalue: 'transcribe',\n\t\t\t\taction: 'Transcribe a recording',\n\t\t\t\tdescription: 'Transcribes audio into the text',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Translate a Recording',\n\t\t\t\tvalue: 'translate',\n\t\t\t\taction: 'Translate a recording',\n\t\t\t\tdescription: 'Translate audio into the text in the english language',\n\t\t\t},\n\t\t],\n\t\tdefault: 'generate',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['audio'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'OpenAI API limits the size of the audio file to 25 MB',\n\t\tname: 'fileSizeLimitNotice',\n\t\ttype: 'notice',\n\t\tdefault: ' ',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['audio'],\n\t\t\t\toperation: ['translate', 'transcribe'],\n\t\t\t},\n\t\t},\n\t},\n\t...generate.description,\n\t...transcribe.description,\n\t...translate.description,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,eAA0B;AAC1B,iBAA4B;AAC5B,gBAA2B;AAIpB,MAAM,cAAiC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,aAAa;AAAA,MACd;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,aAAa;AAAA,MACd;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,aAAa;AAAA,MACd;AAAA,IACD;AAAA,IACA,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,OAAO;AAAA,MACnB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,OAAO;AAAA,QAClB,WAAW,CAAC,aAAa,YAAY;AAAA,MACtC;AAAA,IACD;AAAA,EACD;AAAA,EACA,GAAG,SAAS;AAAA,EACZ,GAAG,WAAW;AAAA,EACd,GAAG,UAAU;AACd;","names":[]}
@@ -0,0 +1,121 @@
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 transcribe_operation_exports = {};
30
+ __export(transcribe_operation_exports, {
31
+ description: () => description,
32
+ execute: () => execute
33
+ });
34
+ module.exports = __toCommonJS(transcribe_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
+ placeholder: "e.g. data",
46
+ hint: "The name of the input field containing the binary file data to be processed",
47
+ description: "Name of the binary property which contains the audio file in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm"
48
+ },
49
+ {
50
+ displayName: "Options",
51
+ name: "options",
52
+ placeholder: "Add Option",
53
+ type: "collection",
54
+ default: {},
55
+ options: [
56
+ {
57
+ displayName: "Language of the Audio File",
58
+ name: "language",
59
+ type: "string",
60
+ description: 'The language of the input audio. Supplying the input language in <a href="https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes" target="_blank">ISO-639-1</a> format will improve accuracy and latency.',
61
+ default: ""
62
+ },
63
+ {
64
+ displayName: "Output Randomness (Temperature)",
65
+ name: "temperature",
66
+ type: "number",
67
+ default: 0,
68
+ typeOptions: {
69
+ minValue: 0,
70
+ maxValue: 1,
71
+ numberPrecision: 1
72
+ }
73
+ }
74
+ ]
75
+ }
76
+ ];
77
+ const displayOptions = {
78
+ show: {
79
+ operation: ["transcribe"],
80
+ resource: ["audio"]
81
+ }
82
+ };
83
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
84
+ async function execute(i) {
85
+ const model = "whisper-1";
86
+ const binaryPropertyName = this.getNodeParameter("binaryPropertyName", i);
87
+ const options = this.getNodeParameter("options", i, {});
88
+ const formData = new import_form_data.default();
89
+ formData.append("model", model);
90
+ if (options.language) {
91
+ formData.append("language", options.language);
92
+ }
93
+ if (options.temperature) {
94
+ formData.append("temperature", options.temperature.toString());
95
+ }
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
+ const response = await import_transport.apiRequest.call(this, "POST", "/audio/transcriptions", {
106
+ option: { formData },
107
+ headers: formData.getHeaders()
108
+ });
109
+ return [
110
+ {
111
+ json: response,
112
+ pairedItem: { item: i }
113
+ }
114
+ ];
115
+ }
116
+ // Annotate the CommonJS export names for ESM import in node:
117
+ 0 && (module.exports = {
118
+ description,
119
+ execute
120
+ });
121
+ //# sourceMappingURL=transcribe.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../nodes/vendors/OpenAi/v2/actions/audio/transcribe.operation.ts"],"sourcesContent":["import FormData from 'form-data';\nimport type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';\nimport { updateDisplayOptions } 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\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 property which contains the audio file in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm',\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: 'Language of the Audio File',\n\t\t\t\tname: 'language',\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription:\n\t\t\t\t\t'The language of the input audio. Supplying the input language in <a href=\"https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes\" target=\"_blank\">ISO-639-1</a> format will improve accuracy and latency.',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Output Randomness (Temperature)',\n\t\t\t\tname: 'temperature',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 0,\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 0,\n\t\t\t\t\tmaxValue: 1,\n\t\t\t\t\tnumberPrecision: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['transcribe'],\n\t\tresource: ['audio'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst model = 'whisper-1';\n\tconst binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);\n\tconst options = this.getNodeParameter('options', i, {});\n\n\tconst formData = new FormData();\n\n\tformData.append('model', model);\n\n\tif (options.language) {\n\t\tformData.append('language', options.language);\n\t}\n\n\tif (options.temperature) {\n\t\tformData.append('temperature', options.temperature.toString());\n\t}\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\tconst response = await apiRequest.call(this, 'POST', '/audio/transcriptions', {\n\t\toption: { formData },\n\t\theaders: formData.getHeaders(),\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;AAAA,uBAAqB;AAErB,0BAAqC;AAErC,yBAAkC;AAClC,uBAA2B;AAE3B,MAAM,aAAgC;AAAA,EACrC;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM;AAAA,IACN,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,aACC;AAAA,Q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