@n8n/n8n-nodes-langchain 1.115.0 → 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 +17 -13
  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,106 @@
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 LmChatLemonade_node_exports = {};
20
+ __export(LmChatLemonade_node_exports, {
21
+ LmChatLemonade: () => LmChatLemonade
22
+ });
23
+ module.exports = __toCommonJS(LmChatLemonade_node_exports);
24
+ var import_openai = require("@langchain/openai");
25
+ var import_n8n_workflow = require("n8n-workflow");
26
+ var import_sharedFields = require("../../../utils/sharedFields");
27
+ var import_description = require("../LMLemonade/description");
28
+ var import_n8nLlmFailedAttemptHandler = require("../n8nLlmFailedAttemptHandler");
29
+ var import_N8nLlmTracing = require("../N8nLlmTracing");
30
+ class LmChatLemonade {
31
+ constructor() {
32
+ this.description = {
33
+ displayName: "Lemonade Chat Model",
34
+ name: "lmChatLemonade",
35
+ icon: "file:lemonade.svg",
36
+ group: ["transform"],
37
+ version: 1,
38
+ description: "Language Model Lemonade Chat",
39
+ defaults: {
40
+ name: "Lemonade Chat Model"
41
+ },
42
+ codex: {
43
+ categories: ["AI"],
44
+ subcategories: {
45
+ AI: ["Language Models", "Root Nodes"],
46
+ "Language Models": ["Chat Models (Recommended)"]
47
+ },
48
+ resources: {
49
+ primaryDocumentation: [
50
+ {
51
+ url: "https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatlemonade/"
52
+ }
53
+ ]
54
+ }
55
+ },
56
+ inputs: [],
57
+ outputs: [import_n8n_workflow.NodeConnectionTypes.AiLanguageModel],
58
+ outputNames: ["Model"],
59
+ ...import_description.lemonadeDescription,
60
+ properties: [
61
+ (0, import_sharedFields.getConnectionHintNoticeField)([import_n8n_workflow.NodeConnectionTypes.AiChain, import_n8n_workflow.NodeConnectionTypes.AiAgent]),
62
+ import_description.lemonadeModel,
63
+ import_description.lemonadeOptions
64
+ ]
65
+ };
66
+ }
67
+ async supplyData(itemIndex) {
68
+ const credentials = await this.getCredentials("lemonadeApi");
69
+ const modelName = this.getNodeParameter("model", itemIndex);
70
+ const options = this.getNodeParameter("options", itemIndex, {});
71
+ const processedOptions = {
72
+ ...options,
73
+ maxTokens: options.maxTokens && options.maxTokens > 0 ? options.maxTokens : void 0,
74
+ stop: void 0
75
+ // Will be set below if options.stop exists
76
+ };
77
+ if (options.stop) {
78
+ const stopSequences = options.stop.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
79
+ processedOptions.stop = stopSequences.length > 0 ? stopSequences : void 0;
80
+ }
81
+ const configuration = {
82
+ baseURL: credentials.baseUrl
83
+ };
84
+ if (credentials.apiKey) {
85
+ configuration.defaultHeaders = {
86
+ Authorization: `Bearer ${credentials.apiKey}`
87
+ };
88
+ }
89
+ const model = new import_openai.ChatOpenAI({
90
+ apiKey: credentials.apiKey || "lemonade-placeholder-key",
91
+ model: modelName,
92
+ ...processedOptions,
93
+ configuration,
94
+ callbacks: [new import_N8nLlmTracing.N8nLlmTracing(this)],
95
+ onFailedAttempt: (0, import_n8nLlmFailedAttemptHandler.makeN8nLlmFailedAttemptHandler)(this)
96
+ });
97
+ return {
98
+ response: model
99
+ };
100
+ }
101
+ }
102
+ // Annotate the CommonJS export names for ESM import in node:
103
+ 0 && (module.exports = {
104
+ LmChatLemonade
105
+ });
106
+ //# sourceMappingURL=LmChatLemonade.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../nodes/llms/LMChatLemonade/LmChatLemonade.node.ts"],"sourcesContent":["import { ChatOpenAI } from '@langchain/openai';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport type { LemonadeApiCredentialsType } from '../../../credentials/LemonadeApi.credentials';\n\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nimport { lemonadeModel, lemonadeOptions, lemonadeDescription } from '../LMLemonade/description';\nimport { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';\nimport { N8nLlmTracing } from '../N8nLlmTracing';\n\nexport class LmChatLemonade implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Lemonade Chat Model',\n\n\t\tname: 'lmChatLemonade',\n\t\ticon: 'file:lemonade.svg',\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tdescription: 'Language Model Lemonade Chat',\n\t\tdefaults: {\n\t\t\tname: 'Lemonade Chat Model',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Language Models', 'Root Nodes'],\n\t\t\t\t'Language Models': ['Chat Models (Recommended)'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatlemonade/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\n\t\tinputs: [],\n\n\t\toutputs: [NodeConnectionTypes.AiLanguageModel],\n\t\toutputNames: ['Model'],\n\t\t...lemonadeDescription,\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),\n\t\t\tlemonadeModel,\n\t\t\tlemonadeOptions,\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst credentials = (await this.getCredentials('lemonadeApi')) as LemonadeApiCredentialsType;\n\n\t\tconst modelName = this.getNodeParameter('model', itemIndex) as string;\n\t\tconst options = this.getNodeParameter('options', itemIndex, {}) as {\n\t\t\ttemperature?: number;\n\t\t\ttopP?: number;\n\t\t\tfrequencyPenalty?: number;\n\t\t\tpresencePenalty?: number;\n\t\t\tmaxTokens?: number;\n\t\t\tstop?: string;\n\t\t};\n\n\t\t// Process stop sequences and maxTokens\n\t\tconst processedOptions: {\n\t\t\ttemperature?: number;\n\t\t\ttopP?: number;\n\t\t\tfrequencyPenalty?: number;\n\t\t\tpresencePenalty?: number;\n\t\t\tmaxTokens?: number;\n\t\t\tstop?: string[] | undefined;\n\t\t} = {\n\t\t\t...options,\n\t\t\tmaxTokens: options.maxTokens && options.maxTokens > 0 ? options.maxTokens : undefined,\n\t\t\tstop: undefined, // Will be set below if options.stop exists\n\t\t};\n\n\t\tif (options.stop) {\n\t\t\tconst stopSequences = options.stop\n\t\t\t\t.split(',')\n\t\t\t\t.map((s) => s.trim())\n\t\t\t\t.filter((s) => s.length > 0);\n\t\t\tprocessedOptions.stop = stopSequences.length > 0 ? stopSequences : undefined;\n\t\t}\n\n\t\t// Build configuration object like official OpenAI node\n\t\tconst configuration: any = {\n\t\t\tbaseURL: credentials.baseUrl,\n\t\t};\n\n\t\t// Add custom headers if API key is provided\n\t\tif (credentials.apiKey) {\n\t\t\tconfiguration.defaultHeaders = {\n\t\t\t\tAuthorization: `Bearer ${credentials.apiKey}`,\n\t\t\t};\n\t\t}\n\n\t\tconst model = new ChatOpenAI({\n\t\t\tapiKey: credentials.apiKey || 'lemonade-placeholder-key',\n\t\t\tmodel: modelName,\n\t\t\t...processedOptions,\n\t\t\tconfiguration,\n\t\t\tcallbacks: [new N8nLlmTracing(this)],\n\t\t\tonFailedAttempt: makeN8nLlmFailedAttemptHandler(this),\n\t\t});\n\n\t\treturn {\n\t\t\tresponse: model,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA2B;AAC3B,0BAMO;AAIP,0BAA6C;AAE7C,yBAAoE;AACpE,wCAA+C;AAC/C,2BAA8B;AAEvB,MAAM,eAAoC;AAAA,EAA1C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MAEb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,mBAAmB,YAAY;AAAA,UACpC,mBAAmB,CAAC,2BAA2B;AAAA,QAChD;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MAEA,QAAQ,CAAC;AAAA,MAET,SAAS,CAAC,wCAAoB,eAAe;AAAA,MAC7C,aAAa,CAAC,OAAO;AAAA,MACrB,GAAG;AAAA,MACH,YAAY;AAAA,YACX,kDAA6B,CAAC,wCAAoB,SAAS,wCAAoB,OAAO,CAAC;AAAA,QACvF;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA;AAAA,EAEA,MAAM,WAAuC,WAAwC;AACpF,UAAM,cAAe,MAAM,KAAK,eAAe,aAAa;AAE5D,UAAM,YAAY,KAAK,iBAAiB,SAAS,SAAS;AAC1D,UAAM,UAAU,KAAK,iBAAiB,WAAW,WAAW,CAAC,CAAC;AAU9D,UAAM,mBAOF;AAAA,MACH,GAAG;AAAA,MACH,WAAW,QAAQ,aAAa,QAAQ,YAAY,IAAI,QAAQ,YAAY;AAAA,MAC5E,MAAM;AAAA;AAAA,IACP;AAEA,QAAI,QAAQ,MAAM;AACjB,YAAM,gBAAgB,QAAQ,KAC5B,MAAM,GAAG,EACT,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC;AAC5B,uBAAiB,OAAO,cAAc,SAAS,IAAI,gBAAgB;AAAA,IACpE;AAGA,UAAM,gBAAqB;AAAA,MAC1B,SAAS,YAAY;AAAA,IACtB;AAGA,QAAI,YAAY,QAAQ;AACvB,oBAAc,iBAAiB;AAAA,QAC9B,eAAe,UAAU,YAAY,MAAM;AAAA,MAC5C;AAAA,IACD;AAEA,UAAM,QAAQ,IAAI,yBAAW;AAAA,MAC5B,QAAQ,YAAY,UAAU;AAAA,MAC9B,OAAO;AAAA,MACP,GAAG;AAAA,MACH;AAAA,MACA,WAAW,CAAC,IAAI,mCAAc,IAAI,CAAC;AAAA,MACnC,qBAAiB,kEAA+B,IAAI;AAAA,IACrD,CAAC;AAED,WAAO;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AACD;","names":[]}
@@ -0,0 +1,53 @@
1
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M7.03604 2.49169L2 5.00962C2.82591 7.34634 5.52523 8.53484 8.04325 7.52763L14.0865 5.00967C13.2606 2.66287 9.85018 1.17686 7.03604 2.49169Z" fill="url(#paint0_linear_18_30102)"/>
3
+ <g filter="url(#filter0_f_18_30102)">
4
+ <path d="M2.64575 5.26035L7.22767 2.96947C8.5803 2.39118 10.05 2.55851 11.2129 2.97773C12.2111 3.33758 12.9907 3.9608 13.418 4.75328L7.85198 7.0724C5.7348 7.91746 3.52324 7.0363 2.64575 5.26035Z" fill="url(#paint1_linear_18_30102)"/>
5
+ </g>
6
+ <g filter="url(#filter1_f_18_30102)">
7
+ <path d="M5.00464 4.17246L7.43032 2.76879C8.78294 2.1905 10.2527 2.35783 11.4155 2.77705C12.4137 3.13689 13.1933 3.76012 13.6206 4.5526C10.4511 2.99575 9.9351 2.43024 5.00464 4.17246Z" fill="url(#paint2_linear_18_30102)"/>
8
+ </g>
9
+ <path d="M14.9236 4.5997C9.51985 6.50701 6.6904 12.4499 8.59216 17.8694L9.84454 21.4282C11.2477 25.4172 14.8309 28.0107 18.7736 28.3363C19.5157 28.3945 20.2115 28.7201 20.7681 29.2202C21.5682 29.9413 22.7162 30.2087 23.7947 29.8249C24.8731 29.4412 25.6037 28.5108 25.7776 27.4525C25.8936 26.7082 26.2299 26.0336 26.7749 25.5103C29.6391 22.7656 30.8103 18.4974 29.4072 14.5084L28.1548 10.9496C26.2531 5.51849 20.3274 2.68077 14.9236 4.5997Z" fill="url(#paint3_radial_18_30102)"/>
10
+ <path d="M14.9236 4.5997C9.51985 6.50701 6.6904 12.4499 8.59216 17.8694L9.84454 21.4282C11.2477 25.4172 14.8309 28.0107 18.7736 28.3363C19.5157 28.3945 20.2115 28.7201 20.7681 29.2202C21.5682 29.9413 22.7162 30.2087 23.7947 29.8249C24.8731 29.4412 25.6037 28.5108 25.7776 27.4525C25.8936 26.7082 26.2299 26.0336 26.7749 25.5103C29.6391 22.7656 30.8103 18.4974 29.4072 14.5084L28.1548 10.9496C26.2531 5.51849 20.3274 2.68077 14.9236 4.5997Z" fill="url(#paint4_radial_18_30102)"/>
11
+ <path d="M14.9236 4.5997C9.51985 6.50701 6.6904 12.4499 8.59216 17.8694L9.84454 21.4282C11.2477 25.4172 14.8309 28.0107 18.7736 28.3363C19.5157 28.3945 20.2115 28.7201 20.7681 29.2202C21.5682 29.9413 22.7162 30.2087 23.7947 29.8249C24.8731 29.4412 25.6037 28.5108 25.7776 27.4525C25.8936 26.7082 26.2299 26.0336 26.7749 25.5103C29.6391 22.7656 30.8103 18.4974 29.4072 14.5084L28.1548 10.9496C26.2531 5.51849 20.3274 2.68077 14.9236 4.5997Z" fill="url(#paint5_radial_18_30102)"/>
12
+ <defs>
13
+ <filter id="filter0_f_18_30102" x="1.89035" y="1.84127" width="12.283" height="6.31025" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
14
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
15
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
16
+ <feGaussianBlur stdDeviation="0.377703" result="effect1_foregroundBlur_18_30102"/>
17
+ </filter>
18
+ <filter id="filter1_f_18_30102" x="4.24923" y="1.64059" width="10.1268" height="3.66743" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
19
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
20
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
21
+ <feGaussianBlur stdDeviation="0.377703" result="effect1_foregroundBlur_18_30102"/>
22
+ </filter>
23
+ <linearGradient id="paint0_linear_18_30102" x1="2" y1="5.00899" x2="14.0865" y2="5.00899" gradientUnits="userSpaceOnUse">
24
+ <stop stop-color="#80A338"/>
25
+ <stop offset="1" stop-color="#B3D745"/>
26
+ </linearGradient>
27
+ <linearGradient id="paint1_linear_18_30102" x1="1.99902" y1="5.02002" x2="14.0855" y2="5.02002" gradientUnits="userSpaceOnUse">
28
+ <stop stop-color="#95BD27"/>
29
+ <stop offset="1" stop-color="#BAE038"/>
30
+ </linearGradient>
31
+ <linearGradient id="paint2_linear_18_30102" x1="13.6206" y1="4.2397" x2="6.38307" y2="3.29833" gradientUnits="userSpaceOnUse">
32
+ <stop stop-color="#D1F56E" stop-opacity="0"/>
33
+ <stop offset="0.286062" stop-color="#D1F56E"/>
34
+ <stop offset="1" stop-color="#D1F56E" stop-opacity="0"/>
35
+ </linearGradient>
36
+ <radialGradient id="paint3_radial_18_30102" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(21.2025 10.5724) rotate(115.148) scale(17.6305 14.9181)">
37
+ <stop stop-color="#FFFB98"/>
38
+ <stop offset="0.505208" stop-color="#FFD84C"/>
39
+ <stop offset="1" stop-color="#E6B534"/>
40
+ </radialGradient>
41
+ <radialGradient id="paint4_radial_18_30102" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(14.6238 4.96834) rotate(69.3343) scale(26.7531 22.6372)">
42
+ <stop offset="0.521583" stop-color="#FFDE67" stop-opacity="0"/>
43
+ <stop offset="0.736095" stop-color="#FFA457" stop-opacity="0.2"/>
44
+ <stop offset="0.886173" stop-color="#D5676D" stop-opacity="0.75"/>
45
+ <stop offset="0.917885" stop-color="#E88257"/>
46
+ <stop offset="1" stop-color="#F49754"/>
47
+ </radialGradient>
48
+ <radialGradient id="paint5_radial_18_30102" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(-10.5942 -28.473) rotate(56.1215) scale(51.3589 43.4576)">
49
+ <stop offset="0.707976" stop-color="#D5B638"/>
50
+ <stop offset="0.873737" stop-color="#D5B638" stop-opacity="0"/>
51
+ </radialGradient>
52
+ </defs>
53
+ </svg>
@@ -32,6 +32,7 @@ __export(loadModels_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(loadModels_exports);
34
34
  var import_openai = __toESM(require("openai"));
35
+ var import_modelFiltering = require("../../../vendors/OpenAi/helpers/modelFiltering");
35
36
  var import_httpProxyAgent = require("../../../../utils/httpProxyAgent");
36
37
  async function searchModels(filter) {
37
38
  const credentials = await this.getCredentials("openAiApi");
@@ -44,12 +45,12 @@ async function searchModels(filter) {
44
45
  }
45
46
  });
46
47
  const { data: models = [] } = await openai.models.list();
48
+ const url = baseURL && new URL(baseURL);
49
+ const isCustomAPI = !!(url && url.hostname !== "api.openai.com");
47
50
  const filteredModels = models.filter((model) => {
48
- const url = baseURL && new URL(baseURL);
49
- const isCustomAPI = url && url.hostname !== "api.openai.com";
50
- const isInvalidModel = !isCustomAPI && (model.id.startsWith("babbage") || model.id.startsWith("davinci") || model.id.startsWith("computer-use") || model.id.startsWith("dall-e") || model.id.startsWith("text-embedding") || model.id.startsWith("tts") || model.id.startsWith("whisper") || model.id.startsWith("omni-moderation") || model.id.startsWith("gpt-") && model.id.includes("instruct"));
51
- if (!filter) return !isInvalidModel;
52
- return !isInvalidModel && model.id.toLowerCase().includes(filter.toLowerCase());
51
+ const includeModel = (0, import_modelFiltering.shouldIncludeModel)(model.id, isCustomAPI);
52
+ if (!filter) return includeModel;
53
+ return includeModel && model.id.toLowerCase().includes(filter.toLowerCase());
53
54
  });
54
55
  filteredModels.sort((a, b) => a.id.localeCompare(b.id));
55
56
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../nodes/llms/LMChatOpenAi/methods/loadModels.ts"],"sourcesContent":["import type { ILoadOptionsFunctions, INodeListSearchResult } from 'n8n-workflow';\nimport OpenAI from 'openai';\n\nimport { getProxyAgent } from '@utils/httpProxyAgent';\n\nexport async function searchModels(\n\tthis: ILoadOptionsFunctions,\n\tfilter?: string,\n): Promise<INodeListSearchResult> {\n\tconst credentials = await this.getCredentials('openAiApi');\n\tconst baseURL =\n\t\t(this.getNodeParameter('options.baseURL', '') as string) ||\n\t\t(credentials.url as string) ||\n\t\t'https://api.openai.com/v1';\n\n\tconst openai = new OpenAI({\n\t\tbaseURL,\n\t\tapiKey: credentials.apiKey as string,\n\t\tfetchOptions: {\n\t\t\tdispatcher: getProxyAgent(baseURL),\n\t\t},\n\t});\n\tconst { data: models = [] } = await openai.models.list();\n\n\tconst filteredModels = models.filter((model: { id: string }) => {\n\t\tconst url = baseURL && new URL(baseURL);\n\t\tconst isCustomAPI = url && url.hostname !== 'api.openai.com';\n\t\t// Filter out TTS, embedding, image generation, and other models\n\t\tconst isInvalidModel =\n\t\t\t!isCustomAPI &&\n\t\t\t(model.id.startsWith('babbage') ||\n\t\t\t\tmodel.id.startsWith('davinci') ||\n\t\t\t\tmodel.id.startsWith('computer-use') ||\n\t\t\t\tmodel.id.startsWith('dall-e') ||\n\t\t\t\tmodel.id.startsWith('text-embedding') ||\n\t\t\t\tmodel.id.startsWith('tts') ||\n\t\t\t\tmodel.id.startsWith('whisper') ||\n\t\t\t\tmodel.id.startsWith('omni-moderation') ||\n\t\t\t\t(model.id.startsWith('gpt-') && model.id.includes('instruct')));\n\n\t\tif (!filter) return !isInvalidModel;\n\n\t\treturn !isInvalidModel && model.id.toLowerCase().includes(filter.toLowerCase());\n\t});\n\n\tfilteredModels.sort((a, b) => a.id.localeCompare(b.id));\n\n\treturn {\n\t\tresults: filteredModels.map((model: { id: string }) => ({\n\t\t\tname: model.id,\n\t\t\tvalue: model.id,\n\t\t})),\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAmB;AAEnB,4BAA8B;AAE9B,eAAsB,aAErB,QACiC;AACjC,QAAM,cAAc,MAAM,KAAK,eAAe,WAAW;AACzD,QAAM,UACJ,KAAK,iBAAiB,mBAAmB,EAAE,KAC3C,YAAY,OACb;AAED,QAAM,SAAS,IAAI,cAAAA,QAAO;AAAA,IACzB;AAAA,IACA,QAAQ,YAAY;AAAA,IACpB,cAAc;AAAA,MACb,gBAAY,qCAAc,OAAO;AAAA,IAClC;AAAA,EACD,CAAC;AACD,QAAM,EAAE,MAAM,SAAS,CAAC,EAAE,IAAI,MAAM,OAAO,OAAO,KAAK;AAEvD,QAAM,iBAAiB,OAAO,OAAO,CAAC,UAA0B;AAC/D,UAAM,MAAM,WAAW,IAAI,IAAI,OAAO;AACtC,UAAM,cAAc,OAAO,IAAI,aAAa;AAE5C,UAAM,iBACL,CAAC,gBACA,MAAM,GAAG,WAAW,SAAS,KAC7B,MAAM,GAAG,WAAW,SAAS,KAC7B,MAAM,GAAG,WAAW,cAAc,KAClC,MAAM,GAAG,WAAW,QAAQ,KAC5B,MAAM,GAAG,WAAW,gBAAgB,KACpC,MAAM,GAAG,WAAW,KAAK,KACzB,MAAM,GAAG,WAAW,SAAS,KAC7B,MAAM,GAAG,WAAW,iBAAiB,KACpC,MAAM,GAAG,WAAW,MAAM,KAAK,MAAM,GAAG,SAAS,UAAU;AAE9D,QAAI,CAAC,OAAQ,QAAO,CAAC;AAErB,WAAO,CAAC,kBAAkB,MAAM,GAAG,YAAY,EAAE,SAAS,OAAO,YAAY,CAAC;AAAA,EAC/E,CAAC;AAED,iBAAe,KAAK,CAAC,GAAG,MAAM,EAAE,GAAG,cAAc,EAAE,EAAE,CAAC;AAEtD,SAAO;AAAA,IACN,SAAS,eAAe,IAAI,CAAC,WAA2B;AAAA,MACvD,MAAM,MAAM;AAAA,MACZ,OAAO,MAAM;AAAA,IACd,EAAE;AAAA,EACH;AACD;","names":["OpenAI"]}
1
+ {"version":3,"sources":["../../../../../nodes/llms/LMChatOpenAi/methods/loadModels.ts"],"sourcesContent":["import type { ILoadOptionsFunctions, INodeListSearchResult } from 'n8n-workflow';\nimport OpenAI from 'openai';\n\nimport { shouldIncludeModel } from '../../../vendors/OpenAi/helpers/modelFiltering';\nimport { getProxyAgent } from '@utils/httpProxyAgent';\n\nexport async function searchModels(\n\tthis: ILoadOptionsFunctions,\n\tfilter?: string,\n): Promise<INodeListSearchResult> {\n\tconst credentials = await this.getCredentials('openAiApi');\n\tconst baseURL =\n\t\t(this.getNodeParameter('options.baseURL', '') as string) ||\n\t\t(credentials.url as string) ||\n\t\t'https://api.openai.com/v1';\n\n\tconst openai = new OpenAI({\n\t\tbaseURL,\n\t\tapiKey: credentials.apiKey as string,\n\t\tfetchOptions: {\n\t\t\tdispatcher: getProxyAgent(baseURL),\n\t\t},\n\t});\n\tconst { data: models = [] } = await openai.models.list();\n\n\tconst url = baseURL && new URL(baseURL);\n\tconst isCustomAPI = !!(url && url.hostname !== 'api.openai.com');\n\n\tconst filteredModels = models.filter((model: { id: string }) => {\n\t\tconst includeModel = shouldIncludeModel(model.id, isCustomAPI);\n\n\t\tif (!filter) return includeModel;\n\n\t\treturn includeModel && model.id.toLowerCase().includes(filter.toLowerCase());\n\t});\n\n\tfilteredModels.sort((a, b) => a.id.localeCompare(b.id));\n\n\treturn {\n\t\tresults: filteredModels.map((model: { id: string }) => ({\n\t\t\tname: model.id,\n\t\t\tvalue: model.id,\n\t\t})),\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAmB;AAEnB,4BAAmC;AACnC,4BAA8B;AAE9B,eAAsB,aAErB,QACiC;AACjC,QAAM,cAAc,MAAM,KAAK,eAAe,WAAW;AACzD,QAAM,UACJ,KAAK,iBAAiB,mBAAmB,EAAE,KAC3C,YAAY,OACb;AAED,QAAM,SAAS,IAAI,cAAAA,QAAO;AAAA,IACzB;AAAA,IACA,QAAQ,YAAY;AAAA,IACpB,cAAc;AAAA,MACb,gBAAY,qCAAc,OAAO;AAAA,IAClC;AAAA,EACD,CAAC;AACD,QAAM,EAAE,MAAM,SAAS,CAAC,EAAE,IAAI,MAAM,OAAO,OAAO,KAAK;AAEvD,QAAM,MAAM,WAAW,IAAI,IAAI,OAAO;AACtC,QAAM,cAAc,CAAC,EAAE,OAAO,IAAI,aAAa;AAE/C,QAAM,iBAAiB,OAAO,OAAO,CAAC,UAA0B;AAC/D,UAAM,mBAAe,0CAAmB,MAAM,IAAI,WAAW;AAE7D,QAAI,CAAC,OAAQ,QAAO;AAEpB,WAAO,gBAAgB,MAAM,GAAG,YAAY,EAAE,SAAS,OAAO,YAAY,CAAC;AAAA,EAC5E,CAAC;AAED,iBAAe,KAAK,CAAC,GAAG,MAAM,EAAE,GAAG,cAAc,EAAE,EAAE,CAAC;AAEtD,SAAO;AAAA,IACN,SAAS,eAAe,IAAI,CAAC,WAA2B;AAAA,MACvD,MAAM,MAAM;AAAA,MACZ,OAAO,MAAM;AAAA,IACd,EAAE;AAAA,EACH;AACD;","names":["OpenAI"]}
@@ -0,0 +1,107 @@
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 LmLemonade_node_exports = {};
20
+ __export(LmLemonade_node_exports, {
21
+ LmLemonade: () => LmLemonade
22
+ });
23
+ module.exports = __toCommonJS(LmLemonade_node_exports);
24
+ var import_openai = require("@langchain/openai");
25
+ var import_n8n_workflow = require("n8n-workflow");
26
+ var import_sharedFields = require("../../../utils/sharedFields");
27
+ var import_description = require("./description");
28
+ var import_n8nLlmFailedAttemptHandler = require("../n8nLlmFailedAttemptHandler");
29
+ var import_N8nLlmTracing = require("../N8nLlmTracing");
30
+ class LmLemonade {
31
+ constructor() {
32
+ this.description = {
33
+ displayName: "Lemonade Model",
34
+ name: "lmLemonade",
35
+ icon: "file:lemonade.svg",
36
+ group: ["transform"],
37
+ version: 1,
38
+ description: "Language Model Lemonade",
39
+ defaults: {
40
+ name: "Lemonade Model"
41
+ },
42
+ codex: {
43
+ categories: ["AI"],
44
+ subcategories: {
45
+ AI: ["Language Models", "Root Nodes"],
46
+ "Language Models": ["Text Completion Models"]
47
+ },
48
+ resources: {
49
+ primaryDocumentation: [
50
+ {
51
+ url: "https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmlemonade/"
52
+ }
53
+ ]
54
+ }
55
+ },
56
+ inputs: [],
57
+ outputs: [import_n8n_workflow.NodeConnectionTypes.AiLanguageModel],
58
+ outputNames: ["Model"],
59
+ ...import_description.lemonadeDescription,
60
+ properties: [
61
+ (0, import_sharedFields.getConnectionHintNoticeField)([import_n8n_workflow.NodeConnectionTypes.AiChain, import_n8n_workflow.NodeConnectionTypes.AiAgent]),
62
+ import_description.lemonadeModel,
63
+ import_description.lemonadeOptions
64
+ ]
65
+ };
66
+ }
67
+ async supplyData(itemIndex) {
68
+ const credentials = await this.getCredentials("lemonadeApi");
69
+ const modelName = this.getNodeParameter("model", itemIndex);
70
+ const options = this.getNodeParameter("options", itemIndex, {});
71
+ let stop;
72
+ if (options.stop) {
73
+ const stopSequences = options.stop.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
74
+ stop = stopSequences.length > 0 ? stopSequences : void 0;
75
+ }
76
+ const apiKey = credentials.apiKey || "lemonade-placeholder-key";
77
+ const configuration = {
78
+ baseURL: credentials.baseUrl
79
+ };
80
+ if (credentials.apiKey) {
81
+ configuration.defaultHeaders = {
82
+ Authorization: `Bearer ${credentials.apiKey}`
83
+ };
84
+ }
85
+ const model = new import_openai.OpenAI({
86
+ apiKey,
87
+ model: modelName,
88
+ temperature: options.temperature,
89
+ topP: options.topP,
90
+ frequencyPenalty: options.frequencyPenalty,
91
+ presencePenalty: options.presencePenalty,
92
+ maxTokens: options.maxTokens && options.maxTokens > 0 ? options.maxTokens : void 0,
93
+ stop,
94
+ configuration,
95
+ callbacks: [new import_N8nLlmTracing.N8nLlmTracing(this)],
96
+ onFailedAttempt: (0, import_n8nLlmFailedAttemptHandler.makeN8nLlmFailedAttemptHandler)(this)
97
+ });
98
+ return {
99
+ response: model
100
+ };
101
+ }
102
+ }
103
+ // Annotate the CommonJS export names for ESM import in node:
104
+ 0 && (module.exports = {
105
+ LmLemonade
106
+ });
107
+ //# sourceMappingURL=LmLemonade.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../nodes/llms/LMLemonade/LmLemonade.node.ts"],"sourcesContent":["import { OpenAI } from '@langchain/openai';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport type { LemonadeApiCredentialsType } from '../../../credentials/LemonadeApi.credentials';\n\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nimport { lemonadeDescription, lemonadeModel, lemonadeOptions } from './description';\nimport { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';\nimport { N8nLlmTracing } from '../N8nLlmTracing';\n\nexport class LmLemonade implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Lemonade Model',\n\n\t\tname: 'lmLemonade',\n\t\ticon: 'file:lemonade.svg',\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tdescription: 'Language Model Lemonade',\n\t\tdefaults: {\n\t\t\tname: 'Lemonade Model',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Language Models', 'Root Nodes'],\n\t\t\t\t'Language Models': ['Text Completion Models'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmlemonade/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\n\t\tinputs: [],\n\n\t\toutputs: [NodeConnectionTypes.AiLanguageModel],\n\t\toutputNames: ['Model'],\n\t\t...lemonadeDescription,\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),\n\t\t\tlemonadeModel,\n\t\t\tlemonadeOptions,\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst credentials = (await this.getCredentials('lemonadeApi')) as LemonadeApiCredentialsType;\n\n\t\tconst modelName = this.getNodeParameter('model', itemIndex) as string;\n\t\tconst options = this.getNodeParameter('options', itemIndex, {}) as {\n\t\t\ttemperature?: number;\n\t\t\ttopP?: number;\n\t\t\tfrequencyPenalty?: number;\n\t\t\tpresencePenalty?: number;\n\t\t\tmaxTokens?: number;\n\t\t\tstop?: string;\n\t\t};\n\n\t\t// Process stop sequences\n\t\tlet stop: string[] | undefined;\n\t\tif (options.stop) {\n\t\t\tconst stopSequences = options.stop\n\t\t\t\t.split(',')\n\t\t\t\t.map((s) => s.trim())\n\t\t\t\t.filter((s) => s.length > 0);\n\t\t\tstop = stopSequences.length > 0 ? stopSequences : undefined;\n\t\t}\n\n\t\t// Ensure we have an API key for OpenAI client validation\n\t\tconst apiKey = credentials.apiKey || 'lemonade-placeholder-key';\n\n\t\t// Build configuration object separately like official OpenAI node\n\t\tconst configuration: any = {\n\t\t\tbaseURL: credentials.baseUrl,\n\t\t};\n\n\t\t// Add custom headers if API key is provided\n\t\tif (credentials.apiKey) {\n\t\t\tconfiguration.defaultHeaders = {\n\t\t\t\tAuthorization: `Bearer ${credentials.apiKey}`,\n\t\t\t};\n\t\t}\n\n\t\tconst model = new OpenAI({\n\t\t\tapiKey,\n\t\t\tmodel: modelName,\n\t\t\ttemperature: options.temperature,\n\t\t\ttopP: options.topP,\n\t\t\tfrequencyPenalty: options.frequencyPenalty,\n\t\t\tpresencePenalty: options.presencePenalty,\n\t\t\tmaxTokens: options.maxTokens && options.maxTokens > 0 ? options.maxTokens : undefined,\n\t\t\tstop,\n\t\t\tconfiguration,\n\t\t\tcallbacks: [new N8nLlmTracing(this)],\n\t\t\tonFailedAttempt: makeN8nLlmFailedAttemptHandler(this),\n\t\t});\n\n\t\treturn {\n\t\t\tresponse: model,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AACvB,0BAMO;AAIP,0BAA6C;AAE7C,yBAAoE;AACpE,wCAA+C;AAC/C,2BAA8B;AAEvB,MAAM,WAAgC;AAAA,EAAtC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MAEb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,mBAAmB,YAAY;AAAA,UACpC,mBAAmB,CAAC,wBAAwB;AAAA,QAC7C;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MAEA,QAAQ,CAAC;AAAA,MAET,SAAS,CAAC,wCAAoB,eAAe;AAAA,MAC7C,aAAa,CAAC,OAAO;AAAA,MACrB,GAAG;AAAA,MACH,YAAY;AAAA,YACX,kDAA6B,CAAC,wCAAoB,SAAS,wCAAoB,OAAO,CAAC;AAAA,QACvF;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA;AAAA,EAEA,MAAM,WAAuC,WAAwC;AACpF,UAAM,cAAe,MAAM,KAAK,eAAe,aAAa;AAE5D,UAAM,YAAY,KAAK,iBAAiB,SAAS,SAAS;AAC1D,UAAM,UAAU,KAAK,iBAAiB,WAAW,WAAW,CAAC,CAAC;AAU9D,QAAI;AACJ,QAAI,QAAQ,MAAM;AACjB,YAAM,gBAAgB,QAAQ,KAC5B,MAAM,GAAG,EACT,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC;AAC5B,aAAO,cAAc,SAAS,IAAI,gBAAgB;AAAA,IACnD;AAGA,UAAM,SAAS,YAAY,UAAU;AAGrC,UAAM,gBAAqB;AAAA,MAC1B,SAAS,YAAY;AAAA,IACtB;AAGA,QAAI,YAAY,QAAQ;AACvB,oBAAc,iBAAiB;AAAA,QAC9B,eAAe,UAAU,YAAY,MAAM;AAAA,MAC5C;AAAA,IACD;AAEA,UAAM,QAAQ,IAAI,qBAAO;AAAA,MACxB;AAAA,MACA,OAAO;AAAA,MACP,aAAa,QAAQ;AAAA,MACrB,MAAM,QAAQ;AAAA,MACd,kBAAkB,QAAQ;AAAA,MAC1B,iBAAiB,QAAQ;AAAA,MACzB,WAAW,QAAQ,aAAa,QAAQ,YAAY,IAAI,QAAQ,YAAY;AAAA,MAC5E;AAAA,MACA;AAAA,MACA,WAAW,CAAC,IAAI,mCAAc,IAAI,CAAC;AAAA,MACnC,qBAAiB,kEAA+B,IAAI;AAAA,IACrD,CAAC;AAED,WAAO;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AACD;","names":[]}
@@ -0,0 +1,147 @@
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 description_exports = {};
20
+ __export(description_exports, {
21
+ lemonadeDescription: () => lemonadeDescription,
22
+ lemonadeModel: () => lemonadeModel,
23
+ lemonadeOptions: () => lemonadeOptions
24
+ });
25
+ module.exports = __toCommonJS(description_exports);
26
+ const lemonadeDescription = {
27
+ credentials: [
28
+ {
29
+ name: "lemonadeApi",
30
+ required: true
31
+ }
32
+ ],
33
+ requestDefaults: {
34
+ ignoreHttpStatusErrors: true,
35
+ baseURL: '={{ $credentials.baseUrl.replace(new RegExp("/$"), "") }}'
36
+ }
37
+ };
38
+ const lemonadeModel = {
39
+ displayName: "Model",
40
+ name: "model",
41
+ type: "options",
42
+ default: "",
43
+ description: "The model which will generate the completion. Models are loaded and managed through the Lemonade server.",
44
+ typeOptions: {
45
+ loadOptions: {
46
+ routing: {
47
+ request: {
48
+ method: "GET",
49
+ url: "/models"
50
+ },
51
+ output: {
52
+ postReceive: [
53
+ {
54
+ type: "rootProperty",
55
+ properties: {
56
+ property: "data"
57
+ }
58
+ },
59
+ {
60
+ type: "setKeyValue",
61
+ properties: {
62
+ name: "={{$responseItem.id}}",
63
+ value: "={{$responseItem.id}}"
64
+ }
65
+ },
66
+ {
67
+ type: "sort",
68
+ properties: {
69
+ key: "name"
70
+ }
71
+ }
72
+ ]
73
+ }
74
+ }
75
+ }
76
+ },
77
+ routing: {
78
+ send: {
79
+ type: "body",
80
+ property: "model"
81
+ }
82
+ },
83
+ required: true
84
+ };
85
+ const lemonadeOptions = {
86
+ displayName: "Options",
87
+ name: "options",
88
+ placeholder: "Add Option",
89
+ description: "Additional options to add",
90
+ type: "collection",
91
+ default: {},
92
+ options: [
93
+ {
94
+ displayName: "Sampling Temperature",
95
+ name: "temperature",
96
+ default: 0.7,
97
+ typeOptions: { maxValue: 2, minValue: 0, numberPrecision: 1 },
98
+ description: "Controls the randomness of the generated text. Lower values make the output more focused and deterministic, while higher values make it more diverse and random.",
99
+ type: "number"
100
+ },
101
+ {
102
+ displayName: "Top P",
103
+ name: "topP",
104
+ default: 1,
105
+ typeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },
106
+ description: "Chooses from the smallest possible set of tokens whose cumulative probability exceeds the probability top_p. Helps generate more human-like text by reducing repetitions.",
107
+ type: "number"
108
+ },
109
+ {
110
+ displayName: "Frequency Penalty",
111
+ name: "frequencyPenalty",
112
+ type: "number",
113
+ default: 0,
114
+ typeOptions: { minValue: -2, maxValue: 2, numberPrecision: 1 },
115
+ description: "Adjusts the penalty for tokens that have already appeared in the generated text. Positive values discourage repetition, negative values encourage it."
116
+ },
117
+ {
118
+ displayName: "Presence Penalty",
119
+ name: "presencePenalty",
120
+ type: "number",
121
+ default: 0,
122
+ typeOptions: { minValue: -2, maxValue: 2, numberPrecision: 1 },
123
+ description: "Adjusts the penalty for tokens based on their presence in the generated text so far. Positive values penalize tokens that have already appeared, encouraging diversity."
124
+ },
125
+ {
126
+ displayName: "Max Tokens to Generate",
127
+ name: "maxTokens",
128
+ type: "number",
129
+ default: -1,
130
+ description: "The maximum number of tokens to generate. Set to -1 for no limit. Be cautious when setting this to a large value, as it can lead to very long outputs."
131
+ },
132
+ {
133
+ displayName: "Stop Sequences",
134
+ name: "stop",
135
+ type: "string",
136
+ default: "",
137
+ description: "Comma-separated list of sequences where the model will stop generating text"
138
+ }
139
+ ]
140
+ };
141
+ // Annotate the CommonJS export names for ESM import in node:
142
+ 0 && (module.exports = {
143
+ lemonadeDescription,
144
+ lemonadeModel,
145
+ lemonadeOptions
146
+ });
147
+ //# sourceMappingURL=description.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../nodes/llms/LMLemonade/description.ts"],"sourcesContent":["import type { INodeProperties, INodeTypeDescription } from 'n8n-workflow';\n\nexport const lemonadeDescription: Partial<INodeTypeDescription> = {\n\tcredentials: [\n\t\t{\n\t\t\tname: 'lemonadeApi',\n\t\t\trequired: true,\n\t\t},\n\t],\n\trequestDefaults: {\n\t\tignoreHttpStatusErrors: true,\n\t\tbaseURL: '={{ $credentials.baseUrl.replace(new RegExp(\"/$\"), \"\") }}',\n\t},\n};\n\nexport const lemonadeModel: INodeProperties = {\n\tdisplayName: 'Model',\n\tname: 'model',\n\ttype: 'options',\n\tdefault: '',\n\tdescription:\n\t\t'The model which will generate the completion. Models are loaded and managed through the Lemonade server.',\n\ttypeOptions: {\n\t\tloadOptions: {\n\t\t\trouting: {\n\t\t\t\trequest: {\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\turl: '/models',\n\t\t\t\t},\n\t\t\t\toutput: {\n\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'rootProperty',\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tproperty: 'data',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'setKeyValue',\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tname: '={{$responseItem.id}}',\n\t\t\t\t\t\t\t\tvalue: '={{$responseItem.id}}',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'sort',\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tkey: 'name',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\trouting: {\n\t\tsend: {\n\t\t\ttype: 'body',\n\t\t\tproperty: 'model',\n\t\t},\n\t},\n\trequired: true,\n};\n\nexport const lemonadeOptions: INodeProperties = {\n\tdisplayName: 'Options',\n\tname: 'options',\n\tplaceholder: 'Add Option',\n\tdescription: 'Additional options to add',\n\ttype: 'collection',\n\tdefault: {},\n\toptions: [\n\t\t{\n\t\t\tdisplayName: 'Sampling Temperature',\n\t\t\tname: 'temperature',\n\t\t\tdefault: 0.7,\n\t\t\ttypeOptions: { maxValue: 2, minValue: 0, numberPrecision: 1 },\n\t\t\tdescription:\n\t\t\t\t'Controls the randomness of the generated text. Lower values make the output more focused and deterministic, while higher values make it more diverse and random.',\n\t\t\ttype: 'number',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Top P',\n\t\t\tname: 'topP',\n\t\t\tdefault: 1,\n\t\t\ttypeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },\n\t\t\tdescription:\n\t\t\t\t'Chooses from the smallest possible set of tokens whose cumulative probability exceeds the probability top_p. Helps generate more human-like text by reducing repetitions.',\n\t\t\ttype: 'number',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Frequency Penalty',\n\t\t\tname: 'frequencyPenalty',\n\t\t\ttype: 'number',\n\t\t\tdefault: 0.0,\n\t\t\ttypeOptions: { minValue: -2, maxValue: 2, numberPrecision: 1 },\n\t\t\tdescription:\n\t\t\t\t'Adjusts the penalty for tokens that have already appeared in the generated text. Positive values discourage repetition, negative values encourage it.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Presence Penalty',\n\t\t\tname: 'presencePenalty',\n\t\t\ttype: 'number',\n\t\t\tdefault: 0.0,\n\t\t\ttypeOptions: { minValue: -2, maxValue: 2, numberPrecision: 1 },\n\t\t\tdescription:\n\t\t\t\t'Adjusts the penalty for tokens based on their presence in the generated text so far. Positive values penalize tokens that have already appeared, encouraging diversity.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Max Tokens to Generate',\n\t\t\tname: 'maxTokens',\n\t\t\ttype: 'number',\n\t\t\tdefault: -1,\n\t\t\tdescription:\n\t\t\t\t'The maximum number of tokens to generate. Set to -1 for no limit. Be cautious when setting this to a large value, as it can lead to very long outputs.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Stop Sequences',\n\t\t\tname: 'stop',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tdescription: 'Comma-separated list of sequences where the model will stop generating text',\n\t\t},\n\t],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,sBAAqD;AAAA,EACjE,aAAa;AAAA,IACZ;AAAA,MACC,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AAAA,EACA,iBAAiB;AAAA,IAChB,wBAAwB;AAAA,IACxB,SAAS;AAAA,EACV;AACD;AAEO,MAAM,gBAAiC;AAAA,EAC7C,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aACC;AAAA,EACD,aAAa;AAAA,IACZ,aAAa;AAAA,MACZ,SAAS;AAAA,QACR,SAAS;AAAA,UACR,QAAQ;AAAA,UACR,KAAK;AAAA,QACN;AAAA,QACA,QAAQ;AAAA,UACP,aAAa;AAAA,YACZ;AAAA,cACC,MAAM;AAAA,cACN,YAAY;AAAA,gBACX,UAAU;AAAA,cACX;AAAA,YACD;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,YAAY;AAAA,gBACX,MAAM;AAAA,gBACN,OAAO;AAAA,cACR;AAAA,YACD;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,YAAY;AAAA,gBACX,KAAK;AAAA,cACN;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,SAAS;AAAA,IACR,MAAM;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AAAA,EACA,UAAU;AACX;AAEO,MAAM,kBAAmC;AAAA,EAC/C,aAAa;AAAA,EACb,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,MAAM;AAAA,EACN,SAAS,CAAC;AAAA,EACV,SAAS;AAAA,IACR;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa,EAAE,UAAU,GAAG,UAAU,GAAG,iBAAiB,EAAE;AAAA,MAC5D,aACC;AAAA,MACD,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa,EAAE,UAAU,GAAG,UAAU,GAAG,iBAAiB,EAAE;AAAA,MAC5D,aACC;AAAA,MACD,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa,EAAE,UAAU,IAAI,UAAU,GAAG,iBAAiB,EAAE;AAAA,MAC7D,aACC;AAAA,IACF;AAAA,IACA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa,EAAE,UAAU,IAAI,UAAU,GAAG,iBAAiB,EAAE;AAAA,MAC7D,aACC;AAAA,IACF;AAAA,IACA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aACC;AAAA,IACF;AAAA,IACA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,IACd;AAAA,EACD;AACD;","names":[]}
@@ -0,0 +1,53 @@
1
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M7.03604 2.49169L2 5.00962C2.82591 7.34634 5.52523 8.53484 8.04325 7.52763L14.0865 5.00967C13.2606 2.66287 9.85018 1.17686 7.03604 2.49169Z" fill="url(#paint0_linear_18_30102)"/>
3
+ <g filter="url(#filter0_f_18_30102)">
4
+ <path d="M2.64575 5.26035L7.22767 2.96947C8.5803 2.39118 10.05 2.55851 11.2129 2.97773C12.2111 3.33758 12.9907 3.9608 13.418 4.75328L7.85198 7.0724C5.7348 7.91746 3.52324 7.0363 2.64575 5.26035Z" fill="url(#paint1_linear_18_30102)"/>
5
+ </g>
6
+ <g filter="url(#filter1_f_18_30102)">
7
+ <path d="M5.00464 4.17246L7.43032 2.76879C8.78294 2.1905 10.2527 2.35783 11.4155 2.77705C12.4137 3.13689 13.1933 3.76012 13.6206 4.5526C10.4511 2.99575 9.9351 2.43024 5.00464 4.17246Z" fill="url(#paint2_linear_18_30102)"/>
8
+ </g>
9
+ <path d="M14.9236 4.5997C9.51985 6.50701 6.6904 12.4499 8.59216 17.8694L9.84454 21.4282C11.2477 25.4172 14.8309 28.0107 18.7736 28.3363C19.5157 28.3945 20.2115 28.7201 20.7681 29.2202C21.5682 29.9413 22.7162 30.2087 23.7947 29.8249C24.8731 29.4412 25.6037 28.5108 25.7776 27.4525C25.8936 26.7082 26.2299 26.0336 26.7749 25.5103C29.6391 22.7656 30.8103 18.4974 29.4072 14.5084L28.1548 10.9496C26.2531 5.51849 20.3274 2.68077 14.9236 4.5997Z" fill="url(#paint3_radial_18_30102)"/>
10
+ <path d="M14.9236 4.5997C9.51985 6.50701 6.6904 12.4499 8.59216 17.8694L9.84454 21.4282C11.2477 25.4172 14.8309 28.0107 18.7736 28.3363C19.5157 28.3945 20.2115 28.7201 20.7681 29.2202C21.5682 29.9413 22.7162 30.2087 23.7947 29.8249C24.8731 29.4412 25.6037 28.5108 25.7776 27.4525C25.8936 26.7082 26.2299 26.0336 26.7749 25.5103C29.6391 22.7656 30.8103 18.4974 29.4072 14.5084L28.1548 10.9496C26.2531 5.51849 20.3274 2.68077 14.9236 4.5997Z" fill="url(#paint4_radial_18_30102)"/>
11
+ <path d="M14.9236 4.5997C9.51985 6.50701 6.6904 12.4499 8.59216 17.8694L9.84454 21.4282C11.2477 25.4172 14.8309 28.0107 18.7736 28.3363C19.5157 28.3945 20.2115 28.7201 20.7681 29.2202C21.5682 29.9413 22.7162 30.2087 23.7947 29.8249C24.8731 29.4412 25.6037 28.5108 25.7776 27.4525C25.8936 26.7082 26.2299 26.0336 26.7749 25.5103C29.6391 22.7656 30.8103 18.4974 29.4072 14.5084L28.1548 10.9496C26.2531 5.51849 20.3274 2.68077 14.9236 4.5997Z" fill="url(#paint5_radial_18_30102)"/>
12
+ <defs>
13
+ <filter id="filter0_f_18_30102" x="1.89035" y="1.84127" width="12.283" height="6.31025" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
14
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
15
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
16
+ <feGaussianBlur stdDeviation="0.377703" result="effect1_foregroundBlur_18_30102"/>
17
+ </filter>
18
+ <filter id="filter1_f_18_30102" x="4.24923" y="1.64059" width="10.1268" height="3.66743" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
19
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
20
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
21
+ <feGaussianBlur stdDeviation="0.377703" result="effect1_foregroundBlur_18_30102"/>
22
+ </filter>
23
+ <linearGradient id="paint0_linear_18_30102" x1="2" y1="5.00899" x2="14.0865" y2="5.00899" gradientUnits="userSpaceOnUse">
24
+ <stop stop-color="#80A338"/>
25
+ <stop offset="1" stop-color="#B3D745"/>
26
+ </linearGradient>
27
+ <linearGradient id="paint1_linear_18_30102" x1="1.99902" y1="5.02002" x2="14.0855" y2="5.02002" gradientUnits="userSpaceOnUse">
28
+ <stop stop-color="#95BD27"/>
29
+ <stop offset="1" stop-color="#BAE038"/>
30
+ </linearGradient>
31
+ <linearGradient id="paint2_linear_18_30102" x1="13.6206" y1="4.2397" x2="6.38307" y2="3.29833" gradientUnits="userSpaceOnUse">
32
+ <stop stop-color="#D1F56E" stop-opacity="0"/>
33
+ <stop offset="0.286062" stop-color="#D1F56E"/>
34
+ <stop offset="1" stop-color="#D1F56E" stop-opacity="0"/>
35
+ </linearGradient>
36
+ <radialGradient id="paint3_radial_18_30102" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(21.2025 10.5724) rotate(115.148) scale(17.6305 14.9181)">
37
+ <stop stop-color="#FFFB98"/>
38
+ <stop offset="0.505208" stop-color="#FFD84C"/>
39
+ <stop offset="1" stop-color="#E6B534"/>
40
+ </radialGradient>
41
+ <radialGradient id="paint4_radial_18_30102" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(14.6238 4.96834) rotate(69.3343) scale(26.7531 22.6372)">
42
+ <stop offset="0.521583" stop-color="#FFDE67" stop-opacity="0"/>
43
+ <stop offset="0.736095" stop-color="#FFA457" stop-opacity="0.2"/>
44
+ <stop offset="0.886173" stop-color="#D5676D" stop-opacity="0.75"/>
45
+ <stop offset="0.917885" stop-color="#E88257"/>
46
+ <stop offset="1" stop-color="#F49754"/>
47
+ </radialGradient>
48
+ <radialGradient id="paint5_radial_18_30102" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(-10.5942 -28.473) rotate(56.1215) scale(51.3589 43.4576)">
49
+ <stop offset="0.707976" stop-color="#D5B638"/>
50
+ <stop offset="0.873737" stop-color="#D5B638" stop-opacity="0"/>
51
+ </radialGradient>
52
+ </defs>
53
+ </svg>
@@ -106,6 +106,9 @@ class LmChatAzureOpenAi {
106
106
  }
107
107
  this.logger.info(`Instantiating AzureChatOpenAI model with deployment: ${modelName}`);
108
108
  const model = new import_openai.AzureChatOpenAI({
109
+ // Model name is required so logs are correct
110
+ // Also ensures internal logic (like mapping "maxTokens" to "maxCompletionTokens") is correct
111
+ model: modelName,
109
112
  azureOpenAIApiDeploymentName: modelName,
110
113
  ...modelConfig,
111
114
  ...options,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.ts"],"sourcesContent":["import { AzureChatOpenAI } from '@langchain/openai';\nimport {\n\tNodeOperationError,\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport { getProxyAgent } from '@utils/httpProxyAgent';\n\nimport { setupApiKeyAuthentication } from './credentials/api-key';\nimport { setupOAuth2Authentication } from './credentials/oauth2';\nimport { properties } from './properties';\nimport { AuthenticationType } from './types';\nimport type {\n\tAzureOpenAIApiKeyModelConfig,\n\tAzureOpenAIOAuth2ModelConfig,\n\tAzureOpenAIOptions,\n} from './types';\nimport { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';\nimport { N8nLlmTracing } from '../N8nLlmTracing';\n\nexport class LmChatAzureOpenAi implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Azure OpenAI Chat Model',\n\n\t\tname: 'lmChatAzureOpenAi',\n\t\ticon: 'file:azure.svg',\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tdescription: 'For advanced usage with an AI chain',\n\t\tdefaults: {\n\t\t\tname: 'Azure OpenAI Chat Model',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Language Models', 'Root Nodes'],\n\t\t\t\t'Language Models': ['Chat Models (Recommended)'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatazureopenai/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\n\t\tinputs: [],\n\n\t\toutputs: [NodeConnectionTypes.AiLanguageModel],\n\t\toutputNames: ['Model'],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'azureOpenAiApi',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: [AuthenticationType.ApiKey],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'azureEntraCognitiveServicesOAuth2Api',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: [AuthenticationType.EntraOAuth2],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tproperties,\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\ttry {\n\t\t\tconst authenticationMethod = this.getNodeParameter(\n\t\t\t\t'authentication',\n\t\t\t\titemIndex,\n\t\t\t) as AuthenticationType;\n\t\t\tconst modelName = this.getNodeParameter('model', itemIndex) as string;\n\t\t\tconst options = this.getNodeParameter('options', itemIndex, {}) as AzureOpenAIOptions;\n\n\t\t\t// Set up Authentication based on selection and get configuration\n\t\t\tlet modelConfig: AzureOpenAIApiKeyModelConfig | AzureOpenAIOAuth2ModelConfig;\n\t\t\tswitch (authenticationMethod) {\n\t\t\t\tcase AuthenticationType.ApiKey:\n\t\t\t\t\tmodelConfig = await setupApiKeyAuthentication.call(this, 'azureOpenAiApi');\n\t\t\t\t\tbreak;\n\t\t\t\tcase AuthenticationType.EntraOAuth2:\n\t\t\t\t\tmodelConfig = await setupOAuth2Authentication.call(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\t'azureEntraCognitiveServicesOAuth2Api',\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Invalid authentication method');\n\t\t\t}\n\n\t\t\tthis.logger.info(`Instantiating AzureChatOpenAI model with deployment: ${modelName}`);\n\n\t\t\t// Create and return the model\n\t\t\tconst model = new AzureChatOpenAI({\n\t\t\t\tazureOpenAIApiDeploymentName: modelName,\n\t\t\t\t...modelConfig,\n\t\t\t\t...options,\n\t\t\t\ttimeout: options.timeout ?? 60000,\n\t\t\t\tmaxRetries: options.maxRetries ?? 2,\n\t\t\t\tcallbacks: [new N8nLlmTracing(this)],\n\t\t\t\tconfiguration: {\n\t\t\t\t\tfetchOptions: {\n\t\t\t\t\t\tdispatcher: getProxyAgent(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tmodelKwargs: options.responseFormat\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tresponse_format: { type: options.responseFormat },\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\t\tonFailedAttempt: makeN8nLlmFailedAttemptHandler(this),\n\t\t\t});\n\n\t\t\tthis.logger.info(`Azure OpenAI client initialized for deployment: ${modelName}`);\n\n\t\t\treturn {\n\t\t\t\tresponse: model,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tthis.logger.error(`Error in LmChatAzureOpenAi.supplyData: ${error.message}`, error);\n\n\t\t\t// Re-throw NodeOperationError directly, wrap others\n\t\t\tif (error instanceof NodeOperationError) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t`Failed to initialize Azure OpenAI client: ${error.message}`,\n\t\t\t\terror,\n\t\t\t);\n\t\t}\n\t}\n}\n"],"mappings":"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","names":[]}
1
+ {"version":3,"sources":["../../../../nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.ts"],"sourcesContent":["import { AzureChatOpenAI } from '@langchain/openai';\nimport {\n\tNodeOperationError,\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport { getProxyAgent } from '@utils/httpProxyAgent';\n\nimport { setupApiKeyAuthentication } from './credentials/api-key';\nimport { setupOAuth2Authentication } from './credentials/oauth2';\nimport { properties } from './properties';\nimport { AuthenticationType } from './types';\nimport type {\n\tAzureOpenAIApiKeyModelConfig,\n\tAzureOpenAIOAuth2ModelConfig,\n\tAzureOpenAIOptions,\n} from './types';\nimport { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';\nimport { N8nLlmTracing } from '../N8nLlmTracing';\n\nexport class LmChatAzureOpenAi implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Azure OpenAI Chat Model',\n\n\t\tname: 'lmChatAzureOpenAi',\n\t\ticon: 'file:azure.svg',\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tdescription: 'For advanced usage with an AI chain',\n\t\tdefaults: {\n\t\t\tname: 'Azure OpenAI Chat Model',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Language Models', 'Root Nodes'],\n\t\t\t\t'Language Models': ['Chat Models (Recommended)'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatazureopenai/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\n\t\tinputs: [],\n\n\t\toutputs: [NodeConnectionTypes.AiLanguageModel],\n\t\toutputNames: ['Model'],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'azureOpenAiApi',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: [AuthenticationType.ApiKey],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'azureEntraCognitiveServicesOAuth2Api',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: [AuthenticationType.EntraOAuth2],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tproperties,\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\ttry {\n\t\t\tconst authenticationMethod = this.getNodeParameter(\n\t\t\t\t'authentication',\n\t\t\t\titemIndex,\n\t\t\t) as AuthenticationType;\n\t\t\tconst modelName = this.getNodeParameter('model', itemIndex) as string;\n\t\t\tconst options = this.getNodeParameter('options', itemIndex, {}) as AzureOpenAIOptions;\n\n\t\t\t// Set up Authentication based on selection and get configuration\n\t\t\tlet modelConfig: AzureOpenAIApiKeyModelConfig | AzureOpenAIOAuth2ModelConfig;\n\t\t\tswitch (authenticationMethod) {\n\t\t\t\tcase AuthenticationType.ApiKey:\n\t\t\t\t\tmodelConfig = await setupApiKeyAuthentication.call(this, 'azureOpenAiApi');\n\t\t\t\t\tbreak;\n\t\t\t\tcase AuthenticationType.EntraOAuth2:\n\t\t\t\t\tmodelConfig = await setupOAuth2Authentication.call(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\t'azureEntraCognitiveServicesOAuth2Api',\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Invalid authentication method');\n\t\t\t}\n\n\t\t\tthis.logger.info(`Instantiating AzureChatOpenAI model with deployment: ${modelName}`);\n\n\t\t\t// Create and return the model\n\t\t\tconst model = new AzureChatOpenAI({\n\t\t\t\t// Model name is required so logs are correct\n\t\t\t\t// Also ensures internal logic (like mapping \"maxTokens\" to \"maxCompletionTokens\") is correct\n\t\t\t\tmodel: modelName,\n\t\t\t\tazureOpenAIApiDeploymentName: modelName,\n\t\t\t\t...modelConfig,\n\t\t\t\t...options,\n\t\t\t\ttimeout: options.timeout ?? 60000,\n\t\t\t\tmaxRetries: options.maxRetries ?? 2,\n\t\t\t\tcallbacks: [new N8nLlmTracing(this)],\n\t\t\t\tconfiguration: {\n\t\t\t\t\tfetchOptions: {\n\t\t\t\t\t\tdispatcher: getProxyAgent(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tmodelKwargs: options.responseFormat\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tresponse_format: { type: options.responseFormat },\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\t\tonFailedAttempt: makeN8nLlmFailedAttemptHandler(this),\n\t\t\t});\n\n\t\t\tthis.logger.info(`Azure OpenAI client initialized for deployment: ${modelName}`);\n\n\t\t\treturn {\n\t\t\t\tresponse: model,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tthis.logger.error(`Error in LmChatAzureOpenAi.supplyData: ${error.message}`, error);\n\n\t\t\t// Re-throw NodeOperationError directly, wrap others\n\t\t\tif (error instanceof NodeOperationError) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t`Failed to initialize Azure OpenAI client: ${error.message}`,\n\t\t\t\terror,\n\t\t\t);\n\t\t}\n\t}\n}\n"],"mappings":"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","names":[]}