@kyuda/n8n-nodes-databricks 1.2.2 → 1.3.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.

Potentially problematic release.


This version of @kyuda/n8n-nodes-databricks might be problematic. Click here for more details.

Files changed (227) hide show
  1. package/dist/package.json +6 -30
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +6 -30
  4. package/dist/nodes/agents/DatabricksAiAgent/CallbackHandler.d.ts +0 -66
  5. package/dist/nodes/agents/DatabricksAiAgent/CallbackHandler.js +0 -531
  6. package/dist/nodes/agents/DatabricksAiAgent/CallbackHandler.js.map +0 -1
  7. package/dist/nodes/agents/DatabricksAiAgent/DatabricksAiAgent.node.d.ts +0 -5
  8. package/dist/nodes/agents/DatabricksAiAgent/DatabricksAiAgent.node.js +0 -133
  9. package/dist/nodes/agents/DatabricksAiAgent/DatabricksAiAgent.node.js.map +0 -1
  10. package/dist/nodes/agents/DatabricksAiAgent/DatabricksAiAgentDark.icon.svg +0 -9
  11. package/dist/nodes/agents/DatabricksAiAgent/DatabricksAiAgentLight.icon.svg +0 -9
  12. package/dist/nodes/agents/DatabricksAiAgent/description.d.ts +0 -4
  13. package/dist/nodes/agents/DatabricksAiAgent/description.js +0 -28
  14. package/dist/nodes/agents/DatabricksAiAgent/description.js.map +0 -1
  15. package/dist/nodes/agents/DatabricksAiAgent/execute.d.ts +0 -2
  16. package/dist/nodes/agents/DatabricksAiAgent/execute.js +0 -418
  17. package/dist/nodes/agents/DatabricksAiAgent/execute.js.map +0 -1
  18. package/dist/nodes/agents/DatabricksAiAgent/src/constants.d.ts +0 -82
  19. package/dist/nodes/agents/DatabricksAiAgent/src/constants.js +0 -105
  20. package/dist/nodes/agents/DatabricksAiAgent/src/constants.js.map +0 -1
  21. package/dist/nodes/agents/DatabricksAiAgent/src/types/types.d.ts +0 -6
  22. package/dist/nodes/agents/DatabricksAiAgent/src/types/types.js +0 -3
  23. package/dist/nodes/agents/DatabricksAiAgent/src/types/types.js.map +0 -1
  24. package/dist/nodes/agents/DatabricksAiAgent/src/utils/N8nOutputParser.d.ts +0 -5
  25. package/dist/nodes/agents/DatabricksAiAgent/src/utils/N8nOutputParser.js +0 -13
  26. package/dist/nodes/agents/DatabricksAiAgent/src/utils/N8nOutputParser.js.map +0 -1
  27. package/dist/nodes/agents/DatabricksAiAgent/src/utils/N8nTool.d.ts +0 -10
  28. package/dist/nodes/agents/DatabricksAiAgent/src/utils/N8nTool.js +0 -88
  29. package/dist/nodes/agents/DatabricksAiAgent/src/utils/N8nTool.js.map +0 -1
  30. package/dist/nodes/agents/DatabricksAiAgent/src/utils/common.d.ts +0 -28
  31. package/dist/nodes/agents/DatabricksAiAgent/src/utils/common.js +0 -207
  32. package/dist/nodes/agents/DatabricksAiAgent/src/utils/common.js.map +0 -1
  33. package/dist/nodes/agents/DatabricksAiAgent/src/utils/descriptions.d.ts +0 -17
  34. package/dist/nodes/agents/DatabricksAiAgent/src/utils/descriptions.js +0 -135
  35. package/dist/nodes/agents/DatabricksAiAgent/src/utils/descriptions.js.map +0 -1
  36. package/dist/nodes/agents/DatabricksAiAgent/src/utils/helpers.d.ts +0 -24
  37. package/dist/nodes/agents/DatabricksAiAgent/src/utils/helpers.js +0 -221
  38. package/dist/nodes/agents/DatabricksAiAgent/src/utils/helpers.js.map +0 -1
  39. package/dist/nodes/agents/DatabricksAiAgent/src/utils/options.d.ts +0 -2
  40. package/dist/nodes/agents/DatabricksAiAgent/src/utils/options.js +0 -38
  41. package/dist/nodes/agents/DatabricksAiAgent/src/utils/options.js.map +0 -1
  42. package/dist/nodes/agents/DatabricksAiAgent/src/utils/output_parsers/N8nStructuredOutputParser.d.ts +0 -12
  43. package/dist/nodes/agents/DatabricksAiAgent/src/utils/output_parsers/N8nStructuredOutputParser.js +0 -106
  44. package/dist/nodes/agents/DatabricksAiAgent/src/utils/output_parsers/N8nStructuredOutputParser.js.map +0 -1
  45. package/dist/nodes/agents/DatabricksAiAgent/src/utils/prompt.d.ts +0 -1
  46. package/dist/nodes/agents/DatabricksAiAgent/src/utils/prompt.js +0 -5
  47. package/dist/nodes/agents/DatabricksAiAgent/src/utils/prompt.js.map +0 -1
  48. package/dist/nodes/agents/DatabricksAiAgent/src/utils/retry.d.ts +0 -16
  49. package/dist/nodes/agents/DatabricksAiAgent/src/utils/retry.js +0 -132
  50. package/dist/nodes/agents/DatabricksAiAgent/src/utils/retry.js.map +0 -1
  51. package/dist/nodes/agents/DatabricksAiAgent/src/utils/security.d.ts +0 -18
  52. package/dist/nodes/agents/DatabricksAiAgent/src/utils/security.js +0 -150
  53. package/dist/nodes/agents/DatabricksAiAgent/src/utils/security.js.map +0 -1
  54. package/dist/nodes/agents/DatabricksAiAgent/src/utils/sharedFields.d.ts +0 -7
  55. package/dist/nodes/agents/DatabricksAiAgent/src/utils/sharedFields.js +0 -150
  56. package/dist/nodes/agents/DatabricksAiAgent/src/utils/sharedFields.js.map +0 -1
  57. package/dist/nodes/agents/DatabricksAiAgent/utils.d.ts +0 -2
  58. package/dist/nodes/agents/DatabricksAiAgent/utils.js +0 -52
  59. package/dist/nodes/agents/DatabricksAiAgent/utils.js.map +0 -1
  60. package/dist/nodes/embeddings/EmbeddingsDatabricks/EmbeddingsDatabricks.node.d.ts +0 -5
  61. package/dist/nodes/embeddings/EmbeddingsDatabricks/EmbeddingsDatabricks.node.js +0 -155
  62. package/dist/nodes/embeddings/EmbeddingsDatabricks/EmbeddingsDatabricks.node.js.map +0 -1
  63. package/dist/nodes/embeddings/EmbeddingsDatabricks/databricks.dark.svg +0 -19
  64. package/dist/nodes/embeddings/EmbeddingsDatabricks/databricks.svg +0 -19
  65. package/dist/nodes/llms/LmChatDatabricks/LmChatDatabricks.node.d.ts +0 -10
  66. package/dist/nodes/llms/LmChatDatabricks/LmChatDatabricks.node.js +0 -265
  67. package/dist/nodes/llms/LmChatDatabricks/LmChatDatabricks.node.js.map +0 -1
  68. package/dist/nodes/llms/LmChatDatabricks/databricks.dark.svg +0 -19
  69. package/dist/nodes/llms/LmChatDatabricks/databricks.svg +0 -19
  70. package/dist/nodes/llms/N8nLlmTracing.d.ts +0 -44
  71. package/dist/nodes/llms/N8nLlmTracing.js +0 -140
  72. package/dist/nodes/llms/N8nLlmTracing.js.map +0 -1
  73. package/dist/nodes/llms/n8nDefaultFailedAttemptHandler.d.ts +0 -1
  74. package/dist/nodes/llms/n8nDefaultFailedAttemptHandler.js +0 -31
  75. package/dist/nodes/llms/n8nDefaultFailedAttemptHandler.js.map +0 -1
  76. package/dist/nodes/llms/n8nDefaultFailedAttemptHandler.test.d.ts +0 -1
  77. package/dist/nodes/llms/n8nDefaultFailedAttemptHandler.test.js +0 -53
  78. package/dist/nodes/llms/n8nDefaultFailedAttemptHandler.test.js.map +0 -1
  79. package/dist/nodes/llms/n8nLlmFailedAttemptHandler.d.ts +0 -3
  80. package/dist/nodes/llms/n8nLlmFailedAttemptHandler.js +0 -28
  81. package/dist/nodes/llms/n8nLlmFailedAttemptHandler.js.map +0 -1
  82. package/dist/nodes/llms/n8nLlmFailedAttemptHandler.test.d.ts +0 -1
  83. package/dist/nodes/llms/n8nLlmFailedAttemptHandler.test.js +0 -50
  84. package/dist/nodes/llms/n8nLlmFailedAttemptHandler.test.js.map +0 -1
  85. package/dist/nodes/vector_store/VectorStoreDatabricks/VectorStoreDatabricks.node.d.ts +0 -15
  86. package/dist/nodes/vector_store/VectorStoreDatabricks/VectorStoreDatabricks.node.js +0 -98
  87. package/dist/nodes/vector_store/VectorStoreDatabricks/VectorStoreDatabricks.node.js.map +0 -1
  88. package/dist/nodes/vector_store/VectorStoreDatabricks/databricks.dark.svg +0 -19
  89. package/dist/nodes/vector_store/VectorStoreDatabricks/databricks.svg +0 -19
  90. package/dist/nodes/vector_store/shared/MemoryManager/MemoryCalculator.d.ts +0 -7
  91. package/dist/nodes/vector_store/shared/MemoryManager/MemoryCalculator.js +0 -50
  92. package/dist/nodes/vector_store/shared/MemoryManager/MemoryCalculator.js.map +0 -1
  93. package/dist/nodes/vector_store/shared/MemoryManager/MemoryVectorStoreManager.d.ts +0 -32
  94. package/dist/nodes/vector_store/shared/MemoryManager/MemoryVectorStoreManager.js +0 -175
  95. package/dist/nodes/vector_store/shared/MemoryManager/MemoryVectorStoreManager.js.map +0 -1
  96. package/dist/nodes/vector_store/shared/MemoryManager/StoreCleanupService.d.ts +0 -16
  97. package/dist/nodes/vector_store/shared/MemoryManager/StoreCleanupService.js +0 -95
  98. package/dist/nodes/vector_store/shared/MemoryManager/StoreCleanupService.js.map +0 -1
  99. package/dist/nodes/vector_store/shared/MemoryManager/config.d.ts +0 -4
  100. package/dist/nodes/vector_store/shared/MemoryManager/config.js +0 -38
  101. package/dist/nodes/vector_store/shared/MemoryManager/config.js.map +0 -1
  102. package/dist/nodes/vector_store/shared/MemoryManager/test/MemoryCalculator.test.d.ts +0 -1
  103. package/dist/nodes/vector_store/shared/MemoryManager/test/MemoryCalculator.test.js +0 -158
  104. package/dist/nodes/vector_store/shared/MemoryManager/test/MemoryCalculator.test.js.map +0 -1
  105. package/dist/nodes/vector_store/shared/MemoryManager/test/MemoryVectorStoreManager.test.d.ts +0 -1
  106. package/dist/nodes/vector_store/shared/MemoryManager/test/MemoryVectorStoreManager.test.js +0 -204
  107. package/dist/nodes/vector_store/shared/MemoryManager/test/MemoryVectorStoreManager.test.js.map +0 -1
  108. package/dist/nodes/vector_store/shared/MemoryManager/test/StoreCleanupService.test.d.ts +0 -1
  109. package/dist/nodes/vector_store/shared/MemoryManager/test/StoreCleanupService.test.js +0 -138
  110. package/dist/nodes/vector_store/shared/MemoryManager/test/StoreCleanupService.test.js.map +0 -1
  111. package/dist/nodes/vector_store/shared/MemoryManager/test/config.test.d.ts +0 -1
  112. package/dist/nodes/vector_store/shared/MemoryManager/test/config.test.js +0 -57
  113. package/dist/nodes/vector_store/shared/MemoryManager/test/config.test.js.map +0 -1
  114. package/dist/nodes/vector_store/shared/MemoryManager/types.d.ts +0 -39
  115. package/dist/nodes/vector_store/shared/MemoryManager/types.js +0 -3
  116. package/dist/nodes/vector_store/shared/MemoryManager/types.js.map +0 -1
  117. package/dist/nodes/vector_store/shared/createVectorStoreNode/__tests__/utils.test.d.ts +0 -1
  118. package/dist/nodes/vector_store/shared/createVectorStoreNode/__tests__/utils.test.js +0 -156
  119. package/dist/nodes/vector_store/shared/createVectorStoreNode/__tests__/utils.test.js.map +0 -1
  120. package/dist/nodes/vector_store/shared/createVectorStoreNode/constants.d.ts +0 -4
  121. package/dist/nodes/vector_store/shared/createVectorStoreNode/constants.js +0 -45
  122. package/dist/nodes/vector_store/shared/createVectorStoreNode/constants.js.map +0 -1
  123. package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.d.ts +0 -15
  124. package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.js +0 -227
  125. package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.js.map +0 -1
  126. package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.test.d.ts +0 -1
  127. package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.test.js +0 -131
  128. package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.test.js.map +0 -1
  129. package/dist/nodes/vector_store/shared/createVectorStoreNode/methods/listSearch.d.ts +0 -7
  130. package/dist/nodes/vector_store/shared/createVectorStoreNode/methods/listSearch.js +0 -32
  131. package/dist/nodes/vector_store/shared/createVectorStoreNode/methods/listSearch.js.map +0 -1
  132. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/insertOperation.test.d.ts +0 -1
  133. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/insertOperation.test.js +0 -190
  134. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/insertOperation.test.js.map +0 -1
  135. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/loadOperation.test.d.ts +0 -1
  136. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/loadOperation.test.js +0 -101
  137. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/loadOperation.test.js.map +0 -1
  138. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/operationHandlers.test.d.ts +0 -1
  139. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/operationHandlers.test.js +0 -93
  140. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/operationHandlers.test.js.map +0 -1
  141. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveAsToolOperation.test.d.ts +0 -1
  142. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveAsToolOperation.test.js +0 -109
  143. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveAsToolOperation.test.js.map +0 -1
  144. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveOperation.test.d.ts +0 -1
  145. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveOperation.test.js +0 -60
  146. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveOperation.test.js.map +0 -1
  147. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/updateOperation.test.d.ts +0 -1
  148. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/updateOperation.test.js +0 -108
  149. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/updateOperation.test.js.map +0 -1
  150. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/index.d.ts +0 -5
  151. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/index.js +0 -22
  152. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/index.js.map +0 -1
  153. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/insertOperation.d.ts +0 -5
  154. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/insertOperation.js +0 -36
  155. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/insertOperation.js.map +0 -1
  156. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/loadOperation.d.ts +0 -5
  157. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/loadOperation.js +0 -34
  158. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/loadOperation.js.map +0 -1
  159. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.d.ts +0 -5
  160. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js +0 -43
  161. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js.map +0 -1
  162. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.d.ts +0 -5
  163. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.js +0 -17
  164. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.js.map +0 -1
  165. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.d.ts +0 -5
  166. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.js +0 -40
  167. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.js.map +0 -1
  168. package/dist/nodes/vector_store/shared/createVectorStoreNode/test-helpers.d.ts +0 -0
  169. package/dist/nodes/vector_store/shared/createVectorStoreNode/test-helpers.js +0 -2
  170. package/dist/nodes/vector_store/shared/createVectorStoreNode/test-helpers.js.map +0 -1
  171. package/dist/nodes/vector_store/shared/createVectorStoreNode/types.d.ts +0 -31
  172. package/dist/nodes/vector_store/shared/createVectorStoreNode/types.js +0 -3
  173. package/dist/nodes/vector_store/shared/createVectorStoreNode/types.js.map +0 -1
  174. package/dist/nodes/vector_store/shared/createVectorStoreNode/utils.d.ts +0 -6
  175. package/dist/nodes/vector_store/shared/createVectorStoreNode/utils.js +0 -22
  176. package/dist/nodes/vector_store/shared/createVectorStoreNode/utils.js.map +0 -1
  177. package/dist/nodes/vector_store/shared/descriptions.d.ts +0 -4
  178. package/dist/nodes/vector_store/shared/descriptions.js +0 -70
  179. package/dist/nodes/vector_store/shared/descriptions.js.map +0 -1
  180. package/dist/nodes/vector_store/shared/processDocuments.d.ts +0 -25
  181. package/dist/nodes/vector_store/shared/processDocuments.js +0 -42
  182. package/dist/nodes/vector_store/shared/processDocuments.js.map +0 -1
  183. package/dist/utils/DatabricksVectorStoreLangChain.d.ts +0 -26
  184. package/dist/utils/DatabricksVectorStoreLangChain.js +0 -116
  185. package/dist/utils/DatabricksVectorStoreLangChain.js.map +0 -1
  186. package/dist/utils/N8nBinaryLoader.d.ts +0 -18
  187. package/dist/utils/N8nBinaryLoader.js +0 -159
  188. package/dist/utils/N8nBinaryLoader.js.map +0 -1
  189. package/dist/utils/N8nJsonLoader.d.ts +0 -11
  190. package/dist/utils/N8nJsonLoader.js +0 -67
  191. package/dist/utils/N8nJsonLoader.js.map +0 -1
  192. package/dist/utils/N8nTool.d.ts +0 -10
  193. package/dist/utils/N8nTool.js +0 -88
  194. package/dist/utils/N8nTool.js.map +0 -1
  195. package/dist/utils/descriptions.d.ts +0 -13
  196. package/dist/utils/descriptions.js +0 -112
  197. package/dist/utils/descriptions.js.map +0 -1
  198. package/dist/utils/helpers.d.ts +0 -23
  199. package/dist/utils/helpers.js +0 -172
  200. package/dist/utils/helpers.js.map +0 -1
  201. package/dist/utils/logWrapper.d.ts +0 -27
  202. package/dist/utils/logWrapper.js +0 -297
  203. package/dist/utils/logWrapper.js.map +0 -1
  204. package/dist/utils/output_parsers/N8nItemListOutputParser.d.ts +0 -13
  205. package/dist/utils/output_parsers/N8nItemListOutputParser.js +0 -43
  206. package/dist/utils/output_parsers/N8nItemListOutputParser.js.map +0 -1
  207. package/dist/utils/output_parsers/N8nOutputFixingParser.d.ts +0 -18
  208. package/dist/utils/output_parsers/N8nOutputFixingParser.js +0 -68
  209. package/dist/utils/output_parsers/N8nOutputFixingParser.js.map +0 -1
  210. package/dist/utils/output_parsers/N8nOutputParser.d.ts +0 -7
  211. package/dist/utils/output_parsers/N8nOutputParser.js +0 -19
  212. package/dist/utils/output_parsers/N8nOutputParser.js.map +0 -1
  213. package/dist/utils/output_parsers/N8nStructuredOutputParser.d.ts +0 -12
  214. package/dist/utils/output_parsers/N8nStructuredOutputParser.js +0 -84
  215. package/dist/utils/output_parsers/N8nStructuredOutputParser.js.map +0 -1
  216. package/dist/utils/output_parsers/prompt.d.ts +0 -3
  217. package/dist/utils/output_parsers/prompt.js +0 -22
  218. package/dist/utils/output_parsers/prompt.js.map +0 -1
  219. package/dist/utils/schemaParsing.d.ts +0 -6
  220. package/dist/utils/schemaParsing.js +0 -23
  221. package/dist/utils/schemaParsing.js.map +0 -1
  222. package/dist/utils/sharedFields.d.ts +0 -6
  223. package/dist/utils/sharedFields.js +0 -122
  224. package/dist/utils/sharedFields.js.map +0 -1
  225. package/dist/utils/tracing.d.ts +0 -7
  226. package/dist/utils/tracing.js +0 -20
  227. package/dist/utils/tracing.js.map +0 -1
@@ -1,297 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.callMethodAsync = callMethodAsync;
4
- exports.callMethodSync = callMethodSync;
5
- exports.logWrapper = logWrapper;
6
- const embeddings_1 = require("@langchain/core/embeddings");
7
- const retrievers_1 = require("@langchain/core/retrievers");
8
- const vectorstores_1 = require("@langchain/core/vectorstores");
9
- const textsplitters_1 = require("@langchain/textsplitters");
10
- const n8n_workflow_1 = require("n8n-workflow");
11
- const helpers_1 = require("./helpers");
12
- const N8nBinaryLoader_1 = require("./N8nBinaryLoader");
13
- const N8nJsonLoader_1 = require("./N8nJsonLoader");
14
- async function callMethodAsync(parameters) {
15
- try {
16
- return await parameters.method.call(this, ...parameters.arguments);
17
- }
18
- catch (e) {
19
- const connectedNode = parameters.executeFunctions.getNode();
20
- const error = new n8n_workflow_1.NodeOperationError(connectedNode, e, {
21
- functionality: 'configuration-node',
22
- });
23
- const metadata = (0, n8n_workflow_1.parseErrorMetadata)(error);
24
- parameters.executeFunctions.addOutputData(parameters.connectionType, parameters.currentNodeRunIndex, error, metadata);
25
- if (error.message) {
26
- if (!error.description) {
27
- error.description = error.message;
28
- }
29
- throw error;
30
- }
31
- throw new n8n_workflow_1.NodeOperationError(connectedNode, `Error on node "${connectedNode.name}" which is connected via input "${parameters.connectionType}"`, { functionality: 'configuration-node' });
32
- }
33
- }
34
- function callMethodSync(parameters) {
35
- try {
36
- return parameters.method.call(this, ...parameters.arguments);
37
- }
38
- catch (e) {
39
- const connectedNode = parameters.executeFunctions.getNode();
40
- const error = new n8n_workflow_1.NodeOperationError(connectedNode, e);
41
- parameters.executeFunctions.addOutputData(parameters.connectionType, parameters.currentNodeRunIndex, error);
42
- throw new n8n_workflow_1.NodeOperationError(connectedNode, `Error on node "${connectedNode.name}" which is connected via input "${parameters.connectionType}"`, { functionality: 'configuration-node' });
43
- }
44
- }
45
- function logWrapper(originalInstance, executeFunctions) {
46
- return new Proxy(originalInstance, {
47
- get: (target, prop) => {
48
- let connectionType;
49
- if ((0, helpers_1.isBaseChatMemory)(originalInstance)) {
50
- if (prop === 'loadMemoryVariables' && 'loadMemoryVariables' in target) {
51
- return async (values) => {
52
- var _a;
53
- connectionType = n8n_workflow_1.NodeConnectionTypes.AiMemory;
54
- const { index } = executeFunctions.addInputData(connectionType, [
55
- [{ json: { action: 'loadMemoryVariables', values } }],
56
- ]);
57
- const response = (await callMethodAsync.call(target, {
58
- executeFunctions,
59
- connectionType,
60
- currentNodeRunIndex: index,
61
- method: target[prop],
62
- arguments: [values],
63
- }));
64
- const chatHistory = (_a = response === null || response === void 0 ? void 0 : response.chat_history) !== null && _a !== void 0 ? _a : response;
65
- executeFunctions.addOutputData(connectionType, index, [
66
- [{ json: { action: 'loadMemoryVariables', chatHistory } }],
67
- ]);
68
- return response;
69
- };
70
- }
71
- else if (prop === 'saveContext' && 'saveContext' in target) {
72
- return async (input, output) => {
73
- connectionType = n8n_workflow_1.NodeConnectionTypes.AiMemory;
74
- const { index } = executeFunctions.addInputData(connectionType, [
75
- [{ json: { action: 'saveContext', input, output } }],
76
- ]);
77
- const response = (await callMethodAsync.call(target, {
78
- executeFunctions,
79
- connectionType,
80
- currentNodeRunIndex: index,
81
- method: target[prop],
82
- arguments: [input, output],
83
- }));
84
- const chatHistory = await target.chatHistory.getMessages();
85
- executeFunctions.addOutputData(connectionType, index, [
86
- [{ json: { action: 'saveContext', chatHistory } }],
87
- ]);
88
- return response;
89
- };
90
- }
91
- }
92
- if ((0, helpers_1.isBaseChatMessageHistory)(originalInstance)) {
93
- if (prop === 'getMessages' && 'getMessages' in target) {
94
- return async () => {
95
- connectionType = n8n_workflow_1.NodeConnectionTypes.AiMemory;
96
- const { index } = executeFunctions.addInputData(connectionType, [
97
- [{ json: { action: 'getMessages' } }],
98
- ]);
99
- const response = (await callMethodAsync.call(target, {
100
- executeFunctions,
101
- connectionType,
102
- currentNodeRunIndex: index,
103
- method: target[prop],
104
- arguments: [],
105
- }));
106
- const payload = { action: 'getMessages', response };
107
- executeFunctions.addOutputData(connectionType, index, [[{ json: payload }]]);
108
- (0, helpers_1.logAiEvent)(executeFunctions, 'ai-messages-retrieved-from-memory', { response });
109
- return response;
110
- };
111
- }
112
- else if (prop === 'addMessage' && 'addMessage' in target) {
113
- return async (message) => {
114
- connectionType = n8n_workflow_1.NodeConnectionTypes.AiMemory;
115
- const payload = { action: 'addMessage', message };
116
- const { index } = executeFunctions.addInputData(connectionType, [[{ json: payload }]]);
117
- await callMethodAsync.call(target, {
118
- executeFunctions,
119
- connectionType,
120
- currentNodeRunIndex: index,
121
- method: target[prop],
122
- arguments: [message],
123
- });
124
- (0, helpers_1.logAiEvent)(executeFunctions, 'ai-message-added-to-memory', { message });
125
- executeFunctions.addOutputData(connectionType, index, [[{ json: payload }]]);
126
- };
127
- }
128
- }
129
- if (originalInstance instanceof retrievers_1.BaseRetriever) {
130
- if (prop === 'getRelevantDocuments' && 'getRelevantDocuments' in target) {
131
- return async (query, config) => {
132
- var _a, _b, _c, _d;
133
- connectionType = n8n_workflow_1.NodeConnectionTypes.AiRetriever;
134
- const { index } = executeFunctions.addInputData(connectionType, [
135
- [{ json: { query, config } }],
136
- ]);
137
- const response = (await callMethodAsync.call(target, {
138
- executeFunctions,
139
- connectionType,
140
- currentNodeRunIndex: index,
141
- method: target[prop],
142
- arguments: [query, config],
143
- }));
144
- const executionId = (_b = (_a = response[0]) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.executionId;
145
- const workflowId = (_d = (_c = response[0]) === null || _c === void 0 ? void 0 : _c.metadata) === null || _d === void 0 ? void 0 : _d.workflowId;
146
- const metadata = {};
147
- if (executionId && workflowId) {
148
- metadata.subExecution = {
149
- executionId,
150
- workflowId,
151
- };
152
- }
153
- (0, helpers_1.logAiEvent)(executeFunctions, 'ai-documents-retrieved', { query });
154
- executeFunctions.addOutputData(connectionType, index, [[{ json: { response } }]], metadata);
155
- return response;
156
- };
157
- }
158
- }
159
- if (originalInstance instanceof embeddings_1.Embeddings) {
160
- if (prop === 'embedDocuments' && 'embedDocuments' in target) {
161
- return async (documents) => {
162
- connectionType = n8n_workflow_1.NodeConnectionTypes.AiEmbedding;
163
- const { index } = executeFunctions.addInputData(connectionType, [
164
- [{ json: { documents } }],
165
- ]);
166
- const response = (await callMethodAsync.call(target, {
167
- executeFunctions,
168
- connectionType,
169
- currentNodeRunIndex: index,
170
- method: target[prop],
171
- arguments: [documents],
172
- }));
173
- (0, helpers_1.logAiEvent)(executeFunctions, 'ai-document-embedded');
174
- executeFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);
175
- return response;
176
- };
177
- }
178
- if (prop === 'embedQuery' && 'embedQuery' in target) {
179
- return async (query) => {
180
- connectionType = n8n_workflow_1.NodeConnectionTypes.AiEmbedding;
181
- const { index } = executeFunctions.addInputData(connectionType, [
182
- [{ json: { query } }],
183
- ]);
184
- const response = (await callMethodAsync.call(target, {
185
- executeFunctions,
186
- connectionType,
187
- currentNodeRunIndex: index,
188
- method: target[prop],
189
- arguments: [query],
190
- }));
191
- (0, helpers_1.logAiEvent)(executeFunctions, 'ai-query-embedded');
192
- executeFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);
193
- return response;
194
- };
195
- }
196
- }
197
- if (originalInstance instanceof N8nJsonLoader_1.N8nJsonLoader ||
198
- originalInstance instanceof N8nBinaryLoader_1.N8nBinaryLoader) {
199
- if (prop === 'processAll' && 'processAll' in target) {
200
- return async (items) => {
201
- connectionType = n8n_workflow_1.NodeConnectionTypes.AiDocument;
202
- const { index } = executeFunctions.addInputData(connectionType, [items]);
203
- const response = (await callMethodAsync.call(target, {
204
- executeFunctions,
205
- connectionType,
206
- currentNodeRunIndex: index,
207
- method: target[prop],
208
- arguments: [items],
209
- }));
210
- executeFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);
211
- return response;
212
- };
213
- }
214
- if (prop === 'processItem' && 'processItem' in target) {
215
- return async (item, itemIndex) => {
216
- connectionType = n8n_workflow_1.NodeConnectionTypes.AiDocument;
217
- const { index } = executeFunctions.addInputData(connectionType, [[item]]);
218
- const response = (await callMethodAsync.call(target, {
219
- executeFunctions,
220
- connectionType,
221
- currentNodeRunIndex: index,
222
- method: target[prop],
223
- arguments: [item, itemIndex],
224
- }));
225
- (0, helpers_1.logAiEvent)(executeFunctions, 'ai-document-processed');
226
- executeFunctions.addOutputData(connectionType, index, [
227
- [{ json: { response }, pairedItem: { item: itemIndex } }],
228
- ]);
229
- return response;
230
- };
231
- }
232
- }
233
- if (originalInstance instanceof textsplitters_1.TextSplitter) {
234
- if (prop === 'splitText' && 'splitText' in target) {
235
- return async (text) => {
236
- connectionType = n8n_workflow_1.NodeConnectionTypes.AiTextSplitter;
237
- const { index } = executeFunctions.addInputData(connectionType, [
238
- [{ json: { textSplitter: text } }],
239
- ]);
240
- const response = (await callMethodAsync.call(target, {
241
- executeFunctions,
242
- connectionType,
243
- currentNodeRunIndex: index,
244
- method: target[prop],
245
- arguments: [text],
246
- }));
247
- (0, helpers_1.logAiEvent)(executeFunctions, 'ai-text-split');
248
- executeFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);
249
- return response;
250
- };
251
- }
252
- }
253
- if ((0, helpers_1.isToolsInstance)(originalInstance)) {
254
- if (prop === '_call' && '_call' in target) {
255
- return async (query) => {
256
- connectionType = n8n_workflow_1.NodeConnectionTypes.AiTool;
257
- const { index } = executeFunctions.addInputData(connectionType, [
258
- [{ json: { query } }],
259
- ]);
260
- const response = (await callMethodAsync.call(target, {
261
- executeFunctions,
262
- connectionType,
263
- currentNodeRunIndex: index,
264
- method: target[prop],
265
- arguments: [query],
266
- }));
267
- (0, helpers_1.logAiEvent)(executeFunctions, 'ai-tool-called', { query, response });
268
- executeFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);
269
- return response;
270
- };
271
- }
272
- }
273
- if (originalInstance instanceof vectorstores_1.VectorStore) {
274
- if (prop === 'similaritySearch' && 'similaritySearch' in target) {
275
- return async (query, k, filter, _callbacks) => {
276
- connectionType = n8n_workflow_1.NodeConnectionTypes.AiVectorStore;
277
- const { index } = executeFunctions.addInputData(connectionType, [
278
- [{ json: { query, k, filter } }],
279
- ]);
280
- const response = (await callMethodAsync.call(target, {
281
- executeFunctions,
282
- connectionType,
283
- currentNodeRunIndex: index,
284
- method: target[prop],
285
- arguments: [query, k, filter, _callbacks],
286
- }));
287
- (0, helpers_1.logAiEvent)(executeFunctions, 'ai-vector-store-searched', { query });
288
- executeFunctions.addOutputData(connectionType, index, [[{ json: { response } }]]);
289
- return response;
290
- };
291
- }
292
- }
293
- return target[prop];
294
- },
295
- });
296
- }
297
- //# sourceMappingURL=logWrapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logWrapper.js","sourceRoot":"","sources":["../../utils/logWrapper.ts"],"names":[],"mappings":";;AAyBA,0CAwCC;AAED,wCA2BC;AAED,gCA2UC;AAvaD,2DAAwD;AAGxD,2DAA2D;AAE3D,+DAA2D;AAC3D,4DAAwD;AASxD,+CAA2F;AAE3F,uCA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C;wBAEH,MAAM,QAAQ,GAAG,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE;4BACpD,gBAAgB;4BAChB,cAAc;4BACd,mBAAmB,EAAE,KAAK;4BAC1B,MAAM,EAAE,MAAM,CAAC,IAAI,CAAQ;4BAC3B,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC;yBACzC,CAAC,CAAyC,CAAC;wBAE5C,IAAA,oBAAU,EAAC,gBAAgB,EAAE,0BAA0B,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;wBACpE,gBAAgB,CAAC,aAAa,CAAC,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;wBAElF,OAAO,QAAQ,CAAC;oBACjB,CAAC,CAAC;gBACH,CAAC;YACF,CAAC;YAGD,OAAQ,MAAc,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;KACD,CAAC,CAAC;AACJ,CAAC"}
@@ -1,13 +0,0 @@
1
- import { BaseOutputParser } from '@langchain/core/output_parsers';
2
- export declare class N8nItemListOutputParser extends BaseOutputParser<string[]> {
3
- lc_namespace: string[];
4
- private numberOfItems;
5
- private separator;
6
- constructor(options: {
7
- numberOfItems?: number;
8
- separator?: string;
9
- });
10
- parse(text: string): Promise<string[]>;
11
- getFormatInstructions(): string;
12
- getSchema(): void;
13
- }
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.N8nItemListOutputParser = void 0;
4
- const output_parsers_1 = require("@langchain/core/output_parsers");
5
- class N8nItemListOutputParser extends output_parsers_1.BaseOutputParser {
6
- constructor(options) {
7
- super();
8
- this.lc_namespace = ['n8n-nodes-langchain', 'output_parsers', 'list_items'];
9
- const { numberOfItems = 3, separator = '\n' } = options;
10
- if (numberOfItems && numberOfItems > 0) {
11
- this.numberOfItems = numberOfItems;
12
- }
13
- this.separator = separator;
14
- if (this.separator === '\\n') {
15
- this.separator = '\n';
16
- }
17
- }
18
- async parse(text) {
19
- const response = text
20
- .split(this.separator)
21
- .map((item) => item.trim())
22
- .filter((item) => item);
23
- if (this.numberOfItems && response.length < this.numberOfItems) {
24
- throw new output_parsers_1.OutputParserException(`Wrong number of items returned. Expected ${this.numberOfItems} items but got ${response.length} items instead.`);
25
- }
26
- return response.slice(0, this.numberOfItems);
27
- }
28
- getFormatInstructions() {
29
- var _a;
30
- const instructions = `Your response should be a list of ${this.numberOfItems ? this.numberOfItems + ' ' : ''}items separated by`;
31
- const numberOfExamples = (_a = this.numberOfItems) !== null && _a !== void 0 ? _a : 3;
32
- const examples = [];
33
- for (let i = 1; i <= numberOfExamples; i++) {
34
- examples.push(`item${i}`);
35
- }
36
- return `${instructions} "${this.separator}" (for example: "${examples.join(this.separator)}")`;
37
- }
38
- getSchema() {
39
- return;
40
- }
41
- }
42
- exports.N8nItemListOutputParser = N8nItemListOutputParser;
43
- //# sourceMappingURL=N8nItemListOutputParser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"N8nItemListOutputParser.js","sourceRoot":"","sources":["../../../utils/output_parsers/N8nItemListOutputParser.ts"],"names":[],"mappings":";;;AAAA,mEAAyF;AAEzF,MAAa,uBAAwB,SAAQ,iCAA0B;IAOtE,YAAY,OAAuD;QAClE,KAAK,EAAE,CAAC;QAPT,iBAAY,GAAG,CAAC,qBAAqB,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAStE,MAAM,EAAE,aAAa,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;QAExD,IAAI,aAAa,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;YACxC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACpC,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE,CAAC;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C"}
@@ -1,18 +0,0 @@
1
- import type { Callbacks } from '@langchain/core/callbacks/manager';
2
- import type { BaseLanguageModel } from '@langchain/core/language_models/base';
3
- import { BaseOutputParser } from '@langchain/core/output_parsers';
4
- import type { PromptTemplate } from '@langchain/core/prompts';
5
- import type { ISupplyDataFunctions } from 'n8n-workflow';
6
- import type { N8nStructuredOutputParser } from './N8nStructuredOutputParser';
7
- export declare class N8nOutputFixingParser extends BaseOutputParser {
8
- private context;
9
- private model;
10
- private outputParser;
11
- private fixPromptTemplate;
12
- lc_namespace: string[];
13
- constructor(context: ISupplyDataFunctions, model: BaseLanguageModel, outputParser: N8nStructuredOutputParser, fixPromptTemplate: PromptTemplate);
14
- getRetryChain(): import("@langchain/core/runnables").Runnable<any, any, import("@langchain/core/runnables").RunnableConfig<Record<string, any>>>;
15
- parse(completion: string, callbacks?: Callbacks): Promise<object>;
16
- getFormatInstructions(): any;
17
- getSchema(): any;
18
- }
@@ -1,68 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.N8nOutputFixingParser = void 0;
4
- const output_parsers_1 = require("@langchain/core/output_parsers");
5
- const n8n_workflow_1 = require("n8n-workflow");
6
- const helpers_1 = require("../helpers");
7
- class N8nOutputFixingParser extends output_parsers_1.BaseOutputParser {
8
- constructor(context, model, outputParser, fixPromptTemplate) {
9
- super();
10
- this.context = context;
11
- this.model = model;
12
- this.outputParser = outputParser;
13
- this.fixPromptTemplate = fixPromptTemplate;
14
- this.lc_namespace = ['langchain', 'output_parsers', 'fix'];
15
- }
16
- getRetryChain() {
17
- return this.fixPromptTemplate.pipe(this.model);
18
- }
19
- async parse(completion, callbacks) {
20
- const { index } = this.context.addInputData(n8n_workflow_1.NodeConnectionTypes.AiOutputParser, [
21
- [{ json: { action: 'parse', text: completion } }],
22
- ]);
23
- try {
24
- const response = await this.outputParser.parse(completion, callbacks, (e) => {
25
- if (e instanceof output_parsers_1.OutputParserException) {
26
- return e;
27
- }
28
- return new output_parsers_1.OutputParserException(e.message, completion);
29
- });
30
- (0, helpers_1.logAiEvent)(this.context, 'ai-output-parsed', { text: completion, response });
31
- this.context.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiOutputParser, index, [
32
- [{ json: { action: 'parse', response } }],
33
- ]);
34
- return response;
35
- }
36
- catch (error) {
37
- if (!(error instanceof output_parsers_1.OutputParserException)) {
38
- throw error;
39
- }
40
- try {
41
- const result = (await this.getRetryChain().invoke({
42
- completion,
43
- error: error.message,
44
- instructions: this.getFormatInstructions(),
45
- }));
46
- const resultText = result.content.toString();
47
- const parsed = await this.outputParser.parse(resultText, callbacks);
48
- this.context.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiOutputParser, index, [
49
- [{ json: { action: 'parse', response: parsed } }],
50
- ]);
51
- return parsed;
52
- }
53
- catch (autoParseError) {
54
- this.context.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiOutputParser, index, autoParseError);
55
- throw autoParseError;
56
- }
57
- }
58
- }
59
- getFormatInstructions() {
60
- var _a;
61
- return (_a = this.outputParser.getSchema().description) !== null && _a !== void 0 ? _a : '';
62
- }
63
- getSchema() {
64
- return this.outputParser.getSchema();
65
- }
66
- }
67
- exports.N8nOutputFixingParser = N8nOutputFixingParser;
68
- //# sourceMappingURL=N8nOutputFixingParser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"N8nOutputFixingParser.js","sourceRoot":"","sources":["../../../utils/output_parsers/N8nOutputFixingParser.ts"],"names":[],"mappings":";;;AAGA,mEAAyF;AAGzF,+CAAmD;AAGnD,wCAAwC;AAExC,MAAa,qBAAsB,SAAQ,iCAAgB;IAG1D,YACS,OAA6B,EAC7B,KAAwB,EACxB,YAAuC,EACvC,iBAAiC;QAEzC,KAAK,EAAE,CAAC;QALA,YAAO,GAAP,OAAO,CAAsB;QAC7B,UAAK,GAAL,KAAK,CAAmB;QACxB,iBAAY,GAAZ,YAAY,CAA2B;QACvC,sBAAiB,GAAjB,iBAAiB,CAAgB;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,CAAC;YACD,IAAI,CAAC;gBAEJ,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC;oBACjD,UAAU;oBACV,KAAK,EAAE,KAAK,CAAC,OAAO;oBACpB,YAAY,EAAE,IAAI,CAAC,qBAAqB,EAAE;iBAC1C,CAAC,CAAc,CAAC;gBAEjB,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;gBAC7C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBAGpE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,kCAAmB,CAAC,cAAc,EAAE,KAAK,EAAE;oBACrE,CAAC,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC;iBACjD,CAAC,CAAC;gBAEH,OAAO,MAAM,CAAC;YACf,CAAC;YAAC,OAAO,cAAc,EAAE,CAAC;gBAEzB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,kCAAmB,CAAC,cAAc,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;gBACtF,MAAM,cAAc,CAAC;YACtB,CAAC;QACF,CAAC;IACF,CAAC;IAMD,qBAAqB;;QACpB,OAAO,MAAA,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC,WAAW,mCAAI,EAAE,CAAC;IACxD,CAAC;IAED,SAAS;QACR,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC;IACtC,CAAC;CACD;AAnFD,sDAmFC"}
@@ -1,7 +0,0 @@
1
- import type { IExecuteFunctions } from 'n8n-workflow';
2
- import { N8nItemListOutputParser } from './N8nItemListOutputParser';
3
- import { N8nOutputFixingParser } from './N8nOutputFixingParser';
4
- import { N8nStructuredOutputParser } from './N8nStructuredOutputParser';
5
- export type N8nOutputParser = N8nOutputFixingParser | N8nStructuredOutputParser | N8nItemListOutputParser;
6
- export { N8nOutputFixingParser, N8nItemListOutputParser, N8nStructuredOutputParser };
7
- export declare function getOptionalOutputParser(ctx: IExecuteFunctions): Promise<N8nOutputParser | undefined>;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.N8nStructuredOutputParser = exports.N8nItemListOutputParser = exports.N8nOutputFixingParser = void 0;
4
- exports.getOptionalOutputParser = getOptionalOutputParser;
5
- const n8n_workflow_1 = require("n8n-workflow");
6
- const N8nItemListOutputParser_1 = require("./N8nItemListOutputParser");
7
- Object.defineProperty(exports, "N8nItemListOutputParser", { enumerable: true, get: function () { return N8nItemListOutputParser_1.N8nItemListOutputParser; } });
8
- const N8nOutputFixingParser_1 = require("./N8nOutputFixingParser");
9
- Object.defineProperty(exports, "N8nOutputFixingParser", { enumerable: true, get: function () { return N8nOutputFixingParser_1.N8nOutputFixingParser; } });
10
- const N8nStructuredOutputParser_1 = require("./N8nStructuredOutputParser");
11
- Object.defineProperty(exports, "N8nStructuredOutputParser", { enumerable: true, get: function () { return N8nStructuredOutputParser_1.N8nStructuredOutputParser; } });
12
- async function getOptionalOutputParser(ctx) {
13
- let outputParser;
14
- if (ctx.getNodeParameter('hasOutputParser', 0, true) === true) {
15
- outputParser = (await ctx.getInputConnectionData(n8n_workflow_1.NodeConnectionTypes.AiOutputParser, 0));
16
- }
17
- return outputParser;
18
- }
19
- //# sourceMappingURL=N8nOutputParser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"N8nOutputParser.js","sourceRoot":"","sources":["../../../utils/output_parsers/N8nOutputParser.ts"],"names":[],"mappings":";;;AAcA,0DAaC;AA1BD,+CAAmD;AAEnD,uEAAoE;AASpC,wGATvB,iDAAuB,OASuB;AARvD,mEAAgE;AAQvD,sGARA,6CAAqB,OAQA;AAP9B,2EAAwE;AAOf,0GAPhD,qDAAyB,OAOgD;AAE3E,KAAK,UAAU,uBAAuB,CAC5C,GAAsB;IAEtB,IAAI,YAAyC,CAAC;IAE9C,IAAI,GAAG,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QAC/D,YAAY,GAAG,CAAC,MAAM,GAAG,CAAC,sBAAsB,CAC/C,kCAAmB,CAAC,cAAc,EAClC,CAAC,CACD,CAAoB,CAAC;IACvB,CAAC;IAED,OAAO,YAAY,CAAC;AACrB,CAAC"}
@@ -1,12 +0,0 @@
1
- import type { Callbacks } from '@langchain/core/callbacks/manager';
2
- import { StructuredOutputParser } from '@langchain/classic/output_parsers';
3
- import type { ISupplyDataFunctions } from 'n8n-workflow';
4
- import { z } from 'zod';
5
- export declare class N8nStructuredOutputParser extends StructuredOutputParser<any> {
6
- private context;
7
- constructor(context: ISupplyDataFunctions, zodSchema: z.ZodSchema<object>);
8
- lc_namespace: string[];
9
- parse(text: string, _callbacks?: Callbacks, errorMapper?: (error: Error) => Error): Promise<object>;
10
- static fromZodJsonSchema(zodSchema: z.ZodSchema<object>, nodeVersion: number, context: ISupplyDataFunctions): Promise<N8nStructuredOutputParser>;
11
- getSchema(): any;
12
- }
@@ -1,84 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.N8nStructuredOutputParser = void 0;
7
- const output_parsers_1 = require("@langchain/classic/output_parsers");
8
- const get_1 = __importDefault(require("lodash/get"));
9
- const n8n_workflow_1 = require("n8n-workflow");
10
- const zod_1 = require("zod");
11
- const helpers_1 = require("../helpers");
12
- const STRUCTURED_OUTPUT_KEY = '__structured__output';
13
- const STRUCTURED_OUTPUT_OBJECT_KEY = '__structured__output__object';
14
- const STRUCTURED_OUTPUT_ARRAY_KEY = '__structured__output__array';
15
- class N8nStructuredOutputParser extends output_parsers_1.StructuredOutputParser {
16
- constructor(context, zodSchema) {
17
- super(zodSchema);
18
- this.context = context;
19
- this.lc_namespace = ['langchain', 'output_parsers', 'structured'];
20
- }
21
- async parse(text, _callbacks, errorMapper) {
22
- var _a, _b, _c, _d;
23
- const { index } = this.context.addInputData(n8n_workflow_1.NodeConnectionTypes.AiOutputParser, [
24
- [{ json: { action: 'parse', text } }],
25
- ]);
26
- try {
27
- const jsonString = text.includes('```') ? text.split(/```(?:json)?/)[1] : text;
28
- const json = JSON.parse(jsonString.trim());
29
- const parsed = await this.getSchema().parseAsync(json);
30
- let result = ((_c = (_b = (_a = (0, get_1.default)(parsed, [STRUCTURED_OUTPUT_KEY, STRUCTURED_OUTPUT_OBJECT_KEY])) !== null && _a !== void 0 ? _a : (0, get_1.default)(parsed, [STRUCTURED_OUTPUT_KEY, STRUCTURED_OUTPUT_ARRAY_KEY])) !== null && _b !== void 0 ? _b : (0, get_1.default)(parsed, STRUCTURED_OUTPUT_KEY)) !== null && _c !== void 0 ? _c : parsed);
31
- result = (0, helpers_1.unwrapNestedOutput)(result);
32
- (0, helpers_1.logAiEvent)(this.context, 'ai-output-parsed', { text, response: result });
33
- this.context.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiOutputParser, index, [
34
- [{ json: { action: 'parse', response: result } }],
35
- ]);
36
- return result;
37
- }
38
- catch (e) {
39
- const nodeError = new n8n_workflow_1.NodeOperationError(this.context.getNode(), "Model output doesn't fit required format", {
40
- description: "To continue the execution when this happens, change the 'On Error' parameter in the root node's settings",
41
- });
42
- (0, helpers_1.logAiEvent)(this.context, 'ai-output-parsed', {
43
- text,
44
- response: (_d = e.message) !== null && _d !== void 0 ? _d : e,
45
- });
46
- this.context.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiOutputParser, index, nodeError);
47
- if (errorMapper) {
48
- throw errorMapper(e);
49
- }
50
- throw nodeError;
51
- }
52
- }
53
- static async fromZodJsonSchema(zodSchema, nodeVersion, context) {
54
- let returnSchema;
55
- if (nodeVersion === 1) {
56
- returnSchema = zod_1.z.object({
57
- [STRUCTURED_OUTPUT_KEY]: zod_1.z
58
- .object({
59
- [STRUCTURED_OUTPUT_OBJECT_KEY]: zodSchema.optional(),
60
- [STRUCTURED_OUTPUT_ARRAY_KEY]: zod_1.z.array(zodSchema).optional(),
61
- })
62
- .describe(`Wrapper around the output data. It can only contain ${STRUCTURED_OUTPUT_OBJECT_KEY} or ${STRUCTURED_OUTPUT_ARRAY_KEY} but never both.`)
63
- .refine((data) => {
64
- return (Boolean(data[STRUCTURED_OUTPUT_OBJECT_KEY]) !==
65
- Boolean(data[STRUCTURED_OUTPUT_ARRAY_KEY]));
66
- }, {
67
- message: 'One and only one of __structured__output__object and __structured__output__array should be present.',
68
- path: [STRUCTURED_OUTPUT_KEY],
69
- }),
70
- });
71
- }
72
- else {
73
- returnSchema = zod_1.z.object({
74
- output: zodSchema.optional(),
75
- });
76
- }
77
- return new N8nStructuredOutputParser(context, returnSchema);
78
- }
79
- getSchema() {
80
- return this.schema;
81
- }
82
- }
83
- exports.N8nStructuredOutputParser = N8nStructuredOutputParser;
84
- //# sourceMappingURL=N8nStructuredOutputParser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"N8nStructuredOutputParser.js","sourceRoot":"","sources":["../../../utils/output_parsers/N8nStructuredOutputParser.ts"],"names":[],"mappings":";;;;;;AACA,sEAA2E;AAC3E,qDAA6B;AAE7B,+CAAuE;AACvE,6BAAwB;AAExB,wCAA4D;AAE5D,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AACrD,MAAM,4BAA4B,GAAG,8BAA8B,CAAC;AACpE,MAAM,2BAA2B,GAAG,6BAA6B,CAAC;AAElE,MAAa,yBAA0B,SAAQ,uCAA2B;IACzE,YACS,OAA6B,EACrC,SAA8B;QAE9B,KAAK,CAAC,SAAS,CAAC,CAAC;QAHT,YAAO,GAAP,OAAO,CAAsB;QAMtC,iBAAY,GAAG,CAAC,WAAW,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;IAF7D,CAAC;IAID,KAA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,CAAC,2BAA2B,CAAC,CAAC,CAC1C,CAAC;gBACH,CAAC,EACD;oBACC,OAAO,EACN,qGAAqG;oBACtG,IAAI,EAAE,CAAC,qBAAqB,CAAC;iBAC7B,CACD;aACF,CAAC,CAAC;QACJ,CAAC;aAAM,CAAC;YACP,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC;gBACvB,MAAM,EAAE,SAAS,CAAC,QAAQ,EAAE;aAC5B,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,yBAAyB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC7D,CAAC;IAED,SAAS;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;CACD;AAzGD,8DAyGC"}
@@ -1,3 +0,0 @@
1
- import { PromptTemplate } from '@langchain/core/prompts';
2
- export declare const NAIVE_FIX_TEMPLATE = "Instructions:\n--------------\n{instructions}\n--------------\nCompletion:\n--------------\n{completion}\n--------------\n\nAbove, the Completion did not satisfy the constraints given in the Instructions.\nError:\n--------------\n{error}\n--------------\n\nPlease try again. Please only respond with an answer that satisfies the constraints laid out in the Instructions:";
3
- export declare const NAIVE_FIX_PROMPT: PromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"Instructions:\n--------------\n{instructions}\n--------------\nCompletion:\n--------------\n{completion}\n--------------\n\nAbove, the Completion did not satisfy the constraints given in the Instructions.\nError:\n--------------\n{error}\n--------------\n\nPlease try again. Please only respond with an answer that satisfies the constraints laid out in the Instructions:">, any>;