@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,319 @@
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: "dall-e-3",
33
+ description: "The model to use for image generation",
34
+ options: [
35
+ {
36
+ name: "DALL\xB7E 2",
37
+ value: "dall-e-2"
38
+ },
39
+ {
40
+ name: "DALL\xB7E 3",
41
+ value: "dall-e-3"
42
+ },
43
+ {
44
+ name: "GPT Image 1",
45
+ value: "gpt-image-1"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ displayName: "Prompt",
51
+ name: "prompt",
52
+ type: "string",
53
+ placeholder: "e.g. A cute cat eating a dinosaur",
54
+ description: "A text description of the desired image(s). The maximum length is 1000 characters for dall-e-2 and 4000 characters for dall-e-3.",
55
+ default: "",
56
+ typeOptions: {
57
+ rows: 2
58
+ }
59
+ },
60
+ {
61
+ displayName: "Options",
62
+ name: "options",
63
+ placeholder: "Add Option",
64
+ type: "collection",
65
+ default: {},
66
+ options: [
67
+ {
68
+ displayName: "Number of Images",
69
+ name: "n",
70
+ default: 1,
71
+ description: "Number of images to generate",
72
+ type: "number",
73
+ typeOptions: {
74
+ minValue: 1,
75
+ maxValue: 10
76
+ },
77
+ displayOptions: {
78
+ show: {
79
+ "/model": ["dall-e-2"]
80
+ }
81
+ }
82
+ },
83
+ {
84
+ displayName: "Quality",
85
+ name: "dalleQuality",
86
+ type: "options",
87
+ description: "The quality of the image that will be generated, HD creates images with finer details and greater consistency across the image",
88
+ options: [
89
+ {
90
+ name: "HD",
91
+ value: "hd"
92
+ },
93
+ {
94
+ name: "Standard",
95
+ value: "standard"
96
+ }
97
+ ],
98
+ displayOptions: {
99
+ show: {
100
+ "/model": ["dall-e-3"]
101
+ }
102
+ },
103
+ default: "standard"
104
+ },
105
+ {
106
+ displayName: "Quality",
107
+ name: "quality",
108
+ type: "options",
109
+ description: "The quality of the image that will be generated, High creates images with finer details and greater consistency across the image",
110
+ options: [
111
+ {
112
+ name: "High",
113
+ value: "high"
114
+ },
115
+ {
116
+ name: "Medium",
117
+ value: "medium"
118
+ },
119
+ {
120
+ name: "Low",
121
+ value: "low"
122
+ }
123
+ ],
124
+ displayOptions: {
125
+ show: {
126
+ "/model": ["gpt-image-1"]
127
+ }
128
+ },
129
+ default: "medium"
130
+ },
131
+ {
132
+ displayName: "Resolution",
133
+ name: "size",
134
+ type: "options",
135
+ options: [
136
+ {
137
+ name: "256x256",
138
+ value: "256x256"
139
+ },
140
+ {
141
+ name: "512x512",
142
+ value: "512x512"
143
+ },
144
+ {
145
+ name: "1024x1024",
146
+ value: "1024x1024"
147
+ }
148
+ ],
149
+ displayOptions: {
150
+ show: {
151
+ "/model": ["dall-e-2"]
152
+ }
153
+ },
154
+ default: "1024x1024"
155
+ },
156
+ {
157
+ displayName: "Resolution",
158
+ name: "size",
159
+ type: "options",
160
+ options: [
161
+ {
162
+ name: "1024x1024",
163
+ value: "1024x1024"
164
+ },
165
+ {
166
+ name: "1792x1024",
167
+ value: "1792x1024"
168
+ },
169
+ {
170
+ name: "1024x1792",
171
+ value: "1024x1792"
172
+ }
173
+ ],
174
+ displayOptions: {
175
+ show: {
176
+ "/model": ["dall-e-3"]
177
+ }
178
+ },
179
+ default: "1024x1024"
180
+ },
181
+ {
182
+ displayName: "Resolution",
183
+ name: "size",
184
+ type: "options",
185
+ options: [
186
+ {
187
+ name: "1024x1024",
188
+ value: "1024x1024"
189
+ },
190
+ {
191
+ name: "1024x1536",
192
+ value: "1024x1536"
193
+ },
194
+ {
195
+ name: "1536x1024",
196
+ value: "1536x1024"
197
+ }
198
+ ],
199
+ displayOptions: {
200
+ show: {
201
+ "/model": ["gpt-image-1"]
202
+ }
203
+ },
204
+ default: "1024x1024"
205
+ },
206
+ {
207
+ displayName: "Style",
208
+ name: "style",
209
+ type: "options",
210
+ options: [
211
+ {
212
+ name: "Natural",
213
+ value: "natural",
214
+ description: "Produce more natural looking images"
215
+ },
216
+ {
217
+ name: "Vivid",
218
+ value: "vivid",
219
+ description: "Lean towards generating hyper-real and dramatic images"
220
+ }
221
+ ],
222
+ displayOptions: {
223
+ show: {
224
+ "/model": ["dall-e-3"]
225
+ }
226
+ },
227
+ default: "vivid"
228
+ },
229
+ {
230
+ displayName: "Respond with Image URL(s)",
231
+ name: "returnImageUrls",
232
+ type: "boolean",
233
+ default: false,
234
+ description: "Whether to return image URL(s) instead of binary file(s)",
235
+ displayOptions: {
236
+ hide: {
237
+ "/model": ["gpt-image-1"]
238
+ }
239
+ }
240
+ },
241
+ {
242
+ displayName: "Put Output in Field",
243
+ name: "binaryPropertyOutput",
244
+ type: "string",
245
+ default: "data",
246
+ hint: "The name of the output field to put the binary file data in",
247
+ displayOptions: {
248
+ show: {
249
+ returnImageUrls: [false]
250
+ }
251
+ }
252
+ }
253
+ ]
254
+ }
255
+ ];
256
+ const displayOptions = {
257
+ show: {
258
+ operation: ["generate"],
259
+ resource: ["image"]
260
+ }
261
+ };
262
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
263
+ async function execute(i) {
264
+ const model = this.getNodeParameter("model", i);
265
+ const prompt = this.getNodeParameter("prompt", i);
266
+ const options = this.getNodeParameter("options", i, {});
267
+ let response_format = "b64_json";
268
+ let binaryPropertyOutput = "data";
269
+ if (options.returnImageUrls) {
270
+ response_format = "url";
271
+ }
272
+ if (options.binaryPropertyOutput) {
273
+ binaryPropertyOutput = options.binaryPropertyOutput;
274
+ delete options.binaryPropertyOutput;
275
+ }
276
+ if (options.dalleQuality) {
277
+ options.quality = options.dalleQuality;
278
+ delete options.dalleQuality;
279
+ }
280
+ delete options.returnImageUrls;
281
+ const body = {
282
+ prompt,
283
+ model,
284
+ response_format: model !== "gpt-image-1" ? response_format : void 0,
285
+ // gpt-image-1 does not support response_format
286
+ ...options
287
+ };
288
+ const { data } = await import_transport.apiRequest.call(this, "POST", "/images/generations", { body });
289
+ if (response_format === "url") {
290
+ return (data || []).map((entry) => ({
291
+ json: entry,
292
+ pairedItem: { item: i }
293
+ }));
294
+ } else {
295
+ const returnData = [];
296
+ for (const entry of data) {
297
+ const binaryData = await this.helpers.prepareBinaryData(
298
+ Buffer.from(entry.b64_json, "base64"),
299
+ "data"
300
+ );
301
+ returnData.push({
302
+ json: Object.assign({}, binaryData, {
303
+ data: void 0
304
+ }),
305
+ binary: {
306
+ [binaryPropertyOutput]: binaryData
307
+ },
308
+ pairedItem: { item: i }
309
+ });
310
+ }
311
+ return returnData;
312
+ }
313
+ }
314
+ // Annotate the CommonJS export names for ESM import in node:
315
+ 0 && (module.exports = {
316
+ description,
317
+ execute
318
+ });
319
+ //# sourceMappingURL=generate.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../nodes/vendors/OpenAi/v2/actions/image/generate.operation.ts"],"sourcesContent":["import type {\n\tINodeProperties,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tIDataObject,\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: 'dall-e-3',\n\t\tdescription: 'The model to use for image generation',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'DALL·E 2',\n\t\t\t\tvalue: 'dall-e-2',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'DALL·E 3',\n\t\t\t\tvalue: 'dall-e-3',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'GPT Image 1',\n\t\t\t\tvalue: 'gpt-image-1',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'Prompt',\n\t\tname: 'prompt',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. A cute cat eating a dinosaur',\n\t\tdescription:\n\t\t\t'A text description of the desired image(s). The maximum length is 1000 characters for dall-e-2 and 4000 characters for dall-e-3.',\n\t\tdefault: '',\n\t\ttypeOptions: {\n\t\t\trows: 2,\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: 'Number of Images',\n\t\t\t\tname: 'n',\n\t\t\t\tdefault: 1,\n\t\t\t\tdescription: 'Number of images to generate',\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t\tmaxValue: 10,\n\t\t\t\t},\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'/model': ['dall-e-2'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Quality',\n\t\t\t\tname: 'dalleQuality',\n\t\t\t\ttype: 'options',\n\t\t\t\tdescription:\n\t\t\t\t\t'The quality of the image that will be generated, HD creates images with finer details and greater consistency across the image',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'HD',\n\t\t\t\t\t\tvalue: 'hd',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Standard',\n\t\t\t\t\t\tvalue: 'standard',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'/model': ['dall-e-3'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: 'standard',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Quality',\n\t\t\t\tname: 'quality',\n\t\t\t\ttype: 'options',\n\t\t\t\tdescription:\n\t\t\t\t\t'The quality of the image that will be generated, High creates images with finer details and greater consistency across the image',\n\t\t\t\toptions: [\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},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Medium',\n\t\t\t\t\t\tvalue: 'medium',\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},\n\t\t\t\t],\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'/model': ['gpt-image-1'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: 'medium',\n\t\t\t},\n\n\t\t\t{\n\t\t\t\tdisplayName: 'Resolution',\n\t\t\t\tname: 'size',\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: '256x256',\n\t\t\t\t\t\tvalue: '256x256',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: '512x512',\n\t\t\t\t\t\tvalue: '512x512',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: '1024x1024',\n\t\t\t\t\t\tvalue: '1024x1024',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'/model': ['dall-e-2'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '1024x1024',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Resolution',\n\t\t\t\tname: 'size',\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: '1024x1024',\n\t\t\t\t\t\tvalue: '1024x1024',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: '1792x1024',\n\t\t\t\t\t\tvalue: '1792x1024',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: '1024x1792',\n\t\t\t\t\t\tvalue: '1024x1792',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'/model': ['dall-e-3'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '1024x1024',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Resolution',\n\t\t\t\tname: 'size',\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: '1024x1024',\n\t\t\t\t\t\tvalue: '1024x1024',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: '1024x1536',\n\t\t\t\t\t\tvalue: '1024x1536',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: '1536x1024',\n\t\t\t\t\t\tvalue: '1536x1024',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'/model': ['gpt-image-1'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '1024x1024',\n\t\t\t},\n\n\t\t\t{\n\t\t\t\tdisplayName: 'Style',\n\t\t\t\tname: 'style',\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Natural',\n\t\t\t\t\t\tvalue: 'natural',\n\t\t\t\t\t\tdescription: 'Produce more natural looking images',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Vivid',\n\t\t\t\t\t\tvalue: 'vivid',\n\t\t\t\t\t\tdescription: 'Lean towards generating hyper-real and dramatic images',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'/model': ['dall-e-3'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: 'vivid',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Respond with Image URL(s)',\n\t\t\t\tname: 'returnImageUrls',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: 'Whether to return image URL(s) instead of binary file(s)',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\thide: {\n\t\t\t\t\t\t'/model': ['gpt-image-1'],\n\t\t\t\t\t},\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\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\treturnImageUrls: [false],\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: ['generate'],\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('model', i) as string;\n\tconst prompt = this.getNodeParameter('prompt', i) as string;\n\tconst options = this.getNodeParameter('options', i, {});\n\tlet response_format = 'b64_json';\n\tlet binaryPropertyOutput = 'data';\n\n\tif (options.returnImageUrls) {\n\t\tresponse_format = 'url';\n\t}\n\n\tif (options.binaryPropertyOutput) {\n\t\tbinaryPropertyOutput = options.binaryPropertyOutput as string;\n\t\tdelete options.binaryPropertyOutput;\n\t}\n\n\tif (options.dalleQuality) {\n\t\toptions.quality = options.dalleQuality;\n\t\tdelete options.dalleQuality;\n\t}\n\n\tdelete options.returnImageUrls;\n\tconst body: IDataObject = {\n\t\tprompt,\n\t\tmodel,\n\t\tresponse_format: model !== 'gpt-image-1' ? response_format : undefined, // gpt-image-1 does not support response_format\n\t\t...options,\n\t};\n\n\tconst { data } = await apiRequest.call(this, 'POST', '/images/generations', { body });\n\tif (response_format === 'url') {\n\t\treturn ((data as IDataObject[]) || []).map((entry) => ({\n\t\t\tjson: entry,\n\t\t\tpairedItem: { item: i },\n\t\t}));\n\t} else {\n\t\tconst returnData: INodeExecutionData[] = [];\n\n\t\tfor (const entry of data) {\n\t\t\tconst binaryData = await this.helpers.prepareBinaryData(\n\t\t\t\tBuffer.from(entry.b64_json as string, 'base64'),\n\t\t\t\t'data',\n\t\t\t);\n\t\t\treturnData.push({\n\t\t\t\tjson: Object.assign({}, binaryData, {\n\t\t\t\t\tdata: undefined,\n\t\t\t\t}),\n\t\t\t\tbinary: {\n\t\t\t\t\t[binaryPropertyOutput]: binaryData,\n\t\t\t\t},\n\t\t\t\tpairedItem: { item: i },\n\t\t\t});\n\t\t}\n\n\t\treturn returnData;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,0BAAqC;AAErC,uBAA2B;AAE3B,MAAM,aAAgC;AAAA,EAC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Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var image_exports = {};
30
+ __export(image_exports, {
31
+ analyze: () => analyze,
32
+ description: () => description,
33
+ edit: () => edit,
34
+ generate: () => generate
35
+ });
36
+ module.exports = __toCommonJS(image_exports);
37
+ var analyze = __toESM(require("./analyze.operation"));
38
+ var generate = __toESM(require("./generate.operation"));
39
+ var edit = __toESM(require("./edit.operation"));
40
+ const description = [
41
+ {
42
+ displayName: "Operation",
43
+ name: "operation",
44
+ type: "options",
45
+ noDataExpression: true,
46
+ options: [
47
+ {
48
+ name: "Analyze Image",
49
+ value: "analyze",
50
+ action: "Analyze image",
51
+ description: "Take in images and answer questions about them"
52
+ },
53
+ {
54
+ name: "Generate an Image",
55
+ value: "generate",
56
+ action: "Generate an image",
57
+ description: "Creates an image from a text prompt"
58
+ },
59
+ {
60
+ name: "Edit Image",
61
+ value: "edit",
62
+ action: "Edit image",
63
+ description: "Edit an image"
64
+ }
65
+ ],
66
+ default: "generate",
67
+ displayOptions: {
68
+ show: {
69
+ resource: ["image"]
70
+ }
71
+ }
72
+ },
73
+ ...generate.description,
74
+ ...analyze.description,
75
+ ...edit.description
76
+ ];
77
+ // Annotate the CommonJS export names for ESM import in node:
78
+ 0 && (module.exports = {
79
+ analyze,
80
+ description,
81
+ edit,
82
+ generate
83
+ });
84
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../nodes/vendors/OpenAi/v2/actions/image/index.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as analyze from './analyze.operation';\nimport * as generate from './generate.operation';\nimport * as edit from './edit.operation';\n\nexport { generate, analyze, edit };\n\nexport const description: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Operation',\n\t\tname: 'operation',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Analyze Image',\n\t\t\t\tvalue: 'analyze',\n\t\t\t\taction: 'Analyze image',\n\t\t\t\tdescription: 'Take in images and answer questions about them',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Generate an Image',\n\t\t\t\tvalue: 'generate',\n\t\t\t\taction: 'Generate an image',\n\t\t\t\tdescription: 'Creates an image from a text prompt',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Edit Image',\n\t\t\t\tvalue: 'edit',\n\t\t\t\taction: 'Edit image',\n\t\t\t\tdescription: 'Edit an image',\n\t\t\t},\n\t\t],\n\t\tdefault: 'generate',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['image'],\n\t\t\t},\n\t\t},\n\t},\n\t...generate.description,\n\t...analyze.description,\n\t...edit.description,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,cAAyB;AACzB,eAA0B;AAC1B,WAAsB;AAIf,MAAM,cAAiC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,aAAa;AAAA,MACd;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,aAAa;AAAA,MACd;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,aAAa;AAAA,MACd;AAAA,IACD;AAAA,IACA,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,OAAO;AAAA,MACnB;AAAA,IACD;AAAA,EACD;AAAA,EACA,GAAG,SAAS;AAAA,EACZ,GAAG,QAAQ;AAAA,EACX,GAAG,KAAK;AACT;","names":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var node_type_exports = {};
16
+ module.exports = __toCommonJS(node_type_exports);
17
+ //# sourceMappingURL=node.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/OpenAi/v2/actions/node.type.ts"],"sourcesContent":["import type { AllEntities } from 'n8n-workflow';\n\ntype NodeMap = {\n\taudio: 'generate' | 'transcribe' | 'translate';\n\tfile: 'upload' | 'deleteFile' | 'list';\n\timage: 'generate' | 'analyze' | 'edit';\n\ttext: 'message' | 'classify' | 'response';\n\tconversation: 'create' | 'get' | 'update' | 'remove';\n\tvideo: 'generate';\n};\n\nexport type OpenAiType = AllEntities<NodeMap>;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,111 @@
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 router_exports = {};
30
+ __export(router_exports, {
31
+ router: () => router
32
+ });
33
+ module.exports = __toCommonJS(router_exports);
34
+ var import_n8n_workflow = require("n8n-workflow");
35
+ var import_error_handling = require("../../helpers/error-handling");
36
+ var audio = __toESM(require("./audio"));
37
+ var conversation = __toESM(require("./conversation"));
38
+ var file = __toESM(require("./file"));
39
+ var image = __toESM(require("./image"));
40
+ var text = __toESM(require("./text"));
41
+ var video = __toESM(require("./video"));
42
+ async function router() {
43
+ const returnData = [];
44
+ const items = this.getInputData();
45
+ const resource = this.getNodeParameter("resource", 0);
46
+ const operation = this.getNodeParameter("operation", 0);
47
+ const openAiTypeData = {
48
+ resource,
49
+ operation
50
+ };
51
+ let execute;
52
+ switch (openAiTypeData.resource) {
53
+ case "audio":
54
+ execute = audio[openAiTypeData.operation].execute;
55
+ break;
56
+ case "file":
57
+ execute = file[openAiTypeData.operation].execute;
58
+ break;
59
+ case "image":
60
+ execute = image[openAiTypeData.operation].execute;
61
+ break;
62
+ case "text":
63
+ execute = text[openAiTypeData.operation].execute;
64
+ break;
65
+ case "conversation":
66
+ execute = conversation[openAiTypeData.operation].execute;
67
+ break;
68
+ case "video":
69
+ execute = video[openAiTypeData.operation].execute;
70
+ break;
71
+ default:
72
+ throw new import_n8n_workflow.NodeOperationError(
73
+ this.getNode(),
74
+ `The operation "${operation}" is not supported!`
75
+ );
76
+ }
77
+ for (let i = 0; i < items.length; i++) {
78
+ try {
79
+ const responseData = await execute.call(this, i);
80
+ returnData.push(...responseData);
81
+ } catch (error) {
82
+ if (this.continueOnFail()) {
83
+ returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
84
+ continue;
85
+ }
86
+ if (error instanceof import_n8n_workflow.NodeApiError) {
87
+ const errorCode = error.cause?.error?.error?.code;
88
+ if (errorCode) {
89
+ const customErrorMessage = (0, import_error_handling.getCustomErrorMessage)(errorCode);
90
+ if (customErrorMessage) {
91
+ error.message = customErrorMessage;
92
+ }
93
+ }
94
+ error.context = {
95
+ itemIndex: i
96
+ };
97
+ throw error;
98
+ }
99
+ throw new import_n8n_workflow.NodeOperationError(this.getNode(), error, {
100
+ itemIndex: i,
101
+ description: error.description
102
+ });
103
+ }
104
+ }
105
+ return [returnData];
106
+ }
107
+ // Annotate the CommonJS export names for ESM import in node:
108
+ 0 && (module.exports = {
109
+ router
110
+ });
111
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/OpenAi/v2/actions/router.ts"],"sourcesContent":["import {\n\tNodeApiError,\n\tNodeOperationError,\n\ttype IExecuteFunctions,\n\ttype INodeExecutionData,\n} from 'n8n-workflow';\n\nimport { getCustomErrorMessage } from '../../helpers/error-handling';\nimport type { OpenAiType } from './node.type';\nimport * as audio from './audio';\nimport * as conversation from './conversation';\nimport * as file from './file';\nimport * as image from './image';\nimport * as text from './text';\nimport * as video from './video';\n\nexport async function router(this: IExecuteFunctions) {\n\tconst returnData: INodeExecutionData[] = [];\n\n\tconst items = this.getInputData();\n\tconst resource = this.getNodeParameter<OpenAiType>('resource', 0);\n\tconst operation = this.getNodeParameter('operation', 0);\n\n\tconst openAiTypeData = {\n\t\tresource,\n\t\toperation,\n\t} as OpenAiType;\n\n\tlet execute;\n\tswitch (openAiTypeData.resource) {\n\t\tcase 'audio':\n\t\t\texecute = audio[openAiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'file':\n\t\t\texecute = file[openAiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'image':\n\t\t\texecute = image[openAiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'text':\n\t\t\texecute = text[openAiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'conversation':\n\t\t\texecute = conversation[openAiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'video':\n\t\t\texecute = video[openAiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t`The operation \"${operation}\" is not supported!`,\n\t\t\t);\n\t}\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\ttry {\n\t\t\tconst responseData = await execute.call(this, i);\n\n\t\t\treturnData.push(...responseData);\n\t\t} catch (error) {\n\t\t\tif (this.continueOnFail()) {\n\t\t\t\treturnData.push({ json: { error: error.message }, pairedItem: { item: i } });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (error instanceof NodeApiError) {\n\t\t\t\t// If the error is a rate limit error, we want to handle it differently\n\t\t\t\tconst errorCode: string | undefined = (error.cause as any)?.error?.error?.code;\n\t\t\t\tif (errorCode) {\n\t\t\t\t\tconst customErrorMessage = getCustomErrorMessage(errorCode);\n\t\t\t\t\tif (customErrorMessage) {\n\t\t\t\t\t\terror.message = customErrorMessage;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\terror.context = {\n\t\t\t\t\titemIndex: i,\n\t\t\t\t};\n\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tthrow new NodeOperationError(this.getNode(), error, {\n\t\t\t\titemIndex: i,\n\t\t\t\tdescription: error.description,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn [returnData];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAKO;AAEP,4BAAsC;AAEtC,YAAuB;AACvB,mBAA8B;AAC9B,WAAsB;AACtB,YAAuB;AACvB,WAAsB;AACtB,YAAuB;AAEvB,eAAsB,SAAgC;AACrD,QAAM,aAAmC,CAAC;AAE1C,QAAM,QAAQ,KAAK,aAAa;AAChC,QAAM,WAAW,KAAK,iBAA6B,YAAY,CAAC;AAChE,QAAM,YAAY,KAAK,iBAAiB,aAAa,CAAC;AAEtD,QAAM,iBAAiB;AAAA,IACtB;AAAA,IACA;AAAA,EACD;AAEA,MAAI;AACJ,UAAQ,eAAe,UAAU;AAAA,IAChC,KAAK;AACJ,gBAAU,MAAM,eAAe,SAAS,EAAE;AAC1C;AAAA,IACD,KAAK;AACJ,g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ropNames = 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 classify_operation_exports = {};
20
+ __export(classify_operation_exports, {
21
+ description: () => description,
22
+ execute: () => execute
23
+ });
24
+ module.exports = __toCommonJS(classify_operation_exports);
25
+ var import_n8n_workflow = require("n8n-workflow");
26
+ var import_transport = require("../../../transport");
27
+ const properties = [
28
+ {
29
+ displayName: "Text Input",
30
+ name: "input",
31
+ type: "string",
32
+ placeholder: "e.g. Sample text goes here",
33
+ description: "The input text to classify if it is violates the moderation policy",
34
+ default: "",
35
+ typeOptions: {
36
+ rows: 2
37
+ }
38
+ },
39
+ {
40
+ displayName: "Simplify Output",
41
+ name: "simplify",
42
+ type: "boolean",
43
+ default: false,
44
+ description: "Whether to return a simplified version of the response instead of the raw data"
45
+ },
46
+ {
47
+ displayName: "Options",
48
+ name: "options",
49
+ placeholder: "Add Option",
50
+ type: "collection",
51
+ default: {},
52
+ options: [
53
+ {
54
+ displayName: "Use Stable Model",
55
+ name: "useStableModel",
56
+ type: "boolean",
57
+ default: false,
58
+ description: "Whether to use the stable version of the model instead of the latest version, accuracy may be slightly lower"
59
+ }
60
+ ]
61
+ }
62
+ ];
63
+ const displayOptions = {
64
+ show: {
65
+ operation: ["classify"],
66
+ resource: ["text"]
67
+ }
68
+ };
69
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
70
+ async function execute(i) {
71
+ const input = this.getNodeParameter("input", i);
72
+ const options = this.getNodeParameter("options", i);
73
+ const model = options.useStableModel ? "text-moderation-stable" : "text-moderation-latest";
74
+ const body = {
75
+ input,
76
+ model
77
+ };
78
+ const { results } = await import_transport.apiRequest.call(this, "POST", "/moderations", { body });
79
+ if (!results) return [];
80
+ const simplify = this.getNodeParameter("simplify", i);
81
+ if (simplify && results) {
82
+ return [
83
+ {
84
+ json: { flagged: results[0].flagged },
85
+ pairedItem: { item: i }
86
+ }
87
+ ];
88
+ } else {
89
+ return [
90
+ {
91
+ json: results[0],
92
+ pairedItem: { item: i }
93
+ }
94
+ ];
95
+ }
96
+ }
97
+ // Annotate the CommonJS export names for ESM import in node:
98
+ 0 && (module.exports = {
99
+ description,
100
+ execute
101
+ });
102
+ //# sourceMappingURL=classify.operation.js.map