@n8n/n8n-nodes-langchain 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/LICENSE.md +85 -0
  2. package/README.md +13 -0
  3. package/dist/credentials/AnthropicApi.credentials.d.ts +9 -0
  4. package/dist/credentials/AnthropicApi.credentials.js +45 -0
  5. package/dist/credentials/AnthropicApi.credentials.js.map +1 -0
  6. package/dist/credentials/CohereApi.credentials.d.ts +9 -0
  7. package/dist/credentials/CohereApi.credentials.js +40 -0
  8. package/dist/credentials/CohereApi.credentials.js.map +1 -0
  9. package/dist/credentials/GooglePalmApi.credentials.d.ts +9 -0
  10. package/dist/credentials/GooglePalmApi.credentials.js +42 -0
  11. package/dist/credentials/GooglePalmApi.credentials.js.map +1 -0
  12. package/dist/credentials/HuggingFaceApi.credentials.d.ts +9 -0
  13. package/dist/credentials/HuggingFaceApi.credentials.js +36 -0
  14. package/dist/credentials/HuggingFaceApi.credentials.js.map +1 -0
  15. package/dist/credentials/MotorheadApi.credentials.d.ts +9 -0
  16. package/dist/credentials/MotorheadApi.credentials.js +49 -0
  17. package/dist/credentials/MotorheadApi.credentials.js.map +1 -0
  18. package/dist/credentials/OllamaApi.credentials.d.ts +8 -0
  19. package/dist/credentials/OllamaApi.credentials.js +35 -0
  20. package/dist/credentials/OllamaApi.credentials.js.map +1 -0
  21. package/dist/credentials/PineconeApi.credentials.d.ts +8 -0
  22. package/dist/credentials/PineconeApi.credentials.js +37 -0
  23. package/dist/credentials/PineconeApi.credentials.js.map +1 -0
  24. package/dist/credentials/SerpApi.credentials.d.ts +9 -0
  25. package/dist/credentials/SerpApi.credentials.js +36 -0
  26. package/dist/credentials/SerpApi.credentials.js.map +1 -0
  27. package/dist/credentials/WolframAlphaApi.credentials.d.ts +9 -0
  28. package/dist/credentials/WolframAlphaApi.credentials.js +40 -0
  29. package/dist/credentials/WolframAlphaApi.credentials.js.map +1 -0
  30. package/dist/credentials/XataApi.credentials.d.ts +9 -0
  31. package/dist/credentials/XataApi.credentials.js +50 -0
  32. package/dist/credentials/XataApi.credentials.js.map +1 -0
  33. package/dist/credentials/ZepApi.credentials.d.ts +9 -0
  34. package/dist/credentials/ZepApi.credentials.js +43 -0
  35. package/dist/credentials/ZepApi.credentials.js.map +1 -0
  36. package/dist/nodes/agents/Agent/Agent.node.d.ts +5 -0
  37. package/dist/nodes/agents/Agent/Agent.node.js +188 -0
  38. package/dist/nodes/agents/Agent/Agent.node.js.map +1 -0
  39. package/dist/nodes/agents/Agent/agents/ConversationalAgent/description.d.ts +2 -0
  40. package/dist/nodes/agents/Agent/agents/ConversationalAgent/description.js +41 -0
  41. package/dist/nodes/agents/Agent/agents/ConversationalAgent/description.js.map +1 -0
  42. package/dist/nodes/agents/Agent/agents/ConversationalAgent/execute.d.ts +2 -0
  43. package/dist/nodes/agents/Agent/agents/ConversationalAgent/execute.js +58 -0
  44. package/dist/nodes/agents/Agent/agents/ConversationalAgent/execute.js.map +1 -0
  45. package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/description.d.ts +2 -0
  46. package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/description.js +17 -0
  47. package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/description.js.map +1 -0
  48. package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/execute.d.ts +2 -0
  49. package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/execute.js +53 -0
  50. package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/execute.js.map +1 -0
  51. package/dist/nodes/agents/Agent/agents/ReActAgent/description.d.ts +2 -0
  52. package/dist/nodes/agents/Agent/agents/ReActAgent/description.js +17 -0
  53. package/dist/nodes/agents/Agent/agents/ReActAgent/description.js.map +1 -0
  54. package/dist/nodes/agents/Agent/agents/ReActAgent/execute.d.ts +2 -0
  55. package/dist/nodes/agents/Agent/agents/ReActAgent/execute.js +46 -0
  56. package/dist/nodes/agents/Agent/agents/ReActAgent/execute.js.map +1 -0
  57. package/dist/nodes/agents/Agent/agents/SqlAgent/description.d.ts +2 -0
  58. package/dist/nodes/agents/Agent/agents/SqlAgent/description.js +113 -0
  59. package/dist/nodes/agents/Agent/agents/SqlAgent/description.js.map +1 -0
  60. package/dist/nodes/agents/Agent/agents/SqlAgent/execute.d.ts +2 -0
  61. package/dist/nodes/agents/Agent/agents/SqlAgent/execute.js +64 -0
  62. package/dist/nodes/agents/Agent/agents/SqlAgent/execute.js.map +1 -0
  63. package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/mysql.d.ts +3 -0
  64. package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/mysql.js +21 -0
  65. package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/mysql.js.map +1 -0
  66. package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/postgres.d.ts +3 -0
  67. package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/postgres.js +21 -0
  68. package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/postgres.js.map +1 -0
  69. package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/sqlite.d.ts +3 -0
  70. package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/sqlite.js +53 -0
  71. package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/sqlite.js.map +1 -0
  72. package/dist/nodes/agents/Agent/agents/SqlAgent/other/prompts.d.ts +2 -0
  73. package/dist/nodes/agents/Agent/agents/SqlAgent/other/prompts.js +21 -0
  74. package/dist/nodes/agents/Agent/agents/SqlAgent/other/prompts.js.map +1 -0
  75. package/dist/nodes/chains/ChainLLM/ChainLlm.node.d.ts +5 -0
  76. package/dist/nodes/chains/ChainLLM/ChainLlm.node.js +152 -0
  77. package/dist/nodes/chains/ChainLLM/ChainLlm.node.js.map +1 -0
  78. package/dist/nodes/chains/ChainRetrievalQA/ChainRetrievalQa.node.d.ts +5 -0
  79. package/dist/nodes/chains/ChainRetrievalQA/ChainRetrievalQa.node.js +100 -0
  80. package/dist/nodes/chains/ChainRetrievalQA/ChainRetrievalQa.node.js.map +1 -0
  81. package/dist/nodes/chains/ChainSummarization/ChainSummarization.node.d.ts +5 -0
  82. package/dist/nodes/chains/ChainSummarization/ChainSummarization.node.js +140 -0
  83. package/dist/nodes/chains/ChainSummarization/ChainSummarization.node.js.map +1 -0
  84. package/dist/nodes/code/Code.node.d.ts +7 -0
  85. package/dist/nodes/code/Code.node.js +296 -0
  86. package/dist/nodes/code/Code.node.js.map +1 -0
  87. package/dist/nodes/document_loaders/DocumentBinaryInputLoader/DocumentBinaryInputLoader.node.d.ts +5 -0
  88. package/dist/nodes/document_loaders/DocumentBinaryInputLoader/DocumentBinaryInputLoader.node.js +148 -0
  89. package/dist/nodes/document_loaders/DocumentBinaryInputLoader/DocumentBinaryInputLoader.node.js.map +1 -0
  90. package/dist/nodes/document_loaders/DocumentBinaryInputLoader/binary.svg +3 -0
  91. package/dist/nodes/document_loaders/DocumentGithubLoader/DocumentGithubLoader.node.d.ts +5 -0
  92. package/dist/nodes/document_loaders/DocumentGithubLoader/DocumentGithubLoader.node.js +105 -0
  93. package/dist/nodes/document_loaders/DocumentGithubLoader/DocumentGithubLoader.node.js.map +1 -0
  94. package/dist/nodes/document_loaders/DocumentGithubLoader/github.svg +1 -0
  95. package/dist/nodes/document_loaders/DocumentJSONInputLoader/DocumentJsonInputLoader.node.d.ts +5 -0
  96. package/dist/nodes/document_loaders/DocumentJSONInputLoader/DocumentJsonInputLoader.node.js +61 -0
  97. package/dist/nodes/document_loaders/DocumentJSONInputLoader/DocumentJsonInputLoader.node.js.map +1 -0
  98. package/dist/nodes/document_loaders/DocumentJSONInputLoader/json.svg +48 -0
  99. package/dist/nodes/embeddings/EmbeddingsCohere/EmbeddingsCohere.node.d.ts +5 -0
  100. package/dist/nodes/embeddings/EmbeddingsCohere/EmbeddingsCohere.node.js +89 -0
  101. package/dist/nodes/embeddings/EmbeddingsCohere/EmbeddingsCohere.node.js.map +1 -0
  102. package/dist/nodes/embeddings/EmbeddingsCohere/cohere.svg +93 -0
  103. package/dist/nodes/embeddings/EmbeddingsGooglePalm/EmbeddingsGooglePalm.node.d.ts +5 -0
  104. package/dist/nodes/embeddings/EmbeddingsGooglePalm/EmbeddingsGooglePalm.node.js +121 -0
  105. package/dist/nodes/embeddings/EmbeddingsGooglePalm/EmbeddingsGooglePalm.node.js.map +1 -0
  106. package/dist/nodes/embeddings/EmbeddingsGooglePalm/google.svg +1 -0
  107. package/dist/nodes/embeddings/EmbeddingsHuggingFaceInference/EmbeddingsHuggingFaceInference.node.d.ts +5 -0
  108. package/dist/nodes/embeddings/EmbeddingsHuggingFaceInference/EmbeddingsHuggingFaceInference.node.js +71 -0
  109. package/dist/nodes/embeddings/EmbeddingsHuggingFaceInference/EmbeddingsHuggingFaceInference.node.js.map +1 -0
  110. package/dist/nodes/embeddings/EmbeddingsHuggingFaceInference/huggingface.svg +8 -0
  111. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.d.ts +5 -0
  112. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +94 -0
  113. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js.map +1 -0
  114. package/dist/nodes/embeddings/EmbeddingsOpenAI/openAi.svg +7 -0
  115. package/dist/nodes/embeddings/EmbeddingsTensorFlow/EmbeddingsTensorFlow.node.d.ts +6 -0
  116. package/dist/nodes/embeddings/EmbeddingsTensorFlow/EmbeddingsTensorFlow.node.js +54 -0
  117. package/dist/nodes/embeddings/EmbeddingsTensorFlow/EmbeddingsTensorFlow.node.js.map +1 -0
  118. package/dist/nodes/embeddings/EmbeddingsTensorFlow/tensorflow.svg +49 -0
  119. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.d.ts +5 -0
  120. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js +118 -0
  121. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js.map +1 -0
  122. package/dist/nodes/llms/LMChatAnthropic/anthropic.png +0 -0
  123. package/dist/nodes/llms/LMChatAnthropic/anthropic.svg +1 -0
  124. package/dist/nodes/llms/LMChatOllama/LmChatOllama.node.d.ts +5 -0
  125. package/dist/nodes/llms/LMChatOllama/LmChatOllama.node.js +119 -0
  126. package/dist/nodes/llms/LMChatOllama/LmChatOllama.node.js.map +1 -0
  127. package/dist/nodes/llms/LMChatOllama/ollama.svg +43 -0
  128. package/dist/nodes/llms/LMChatOpenAi/LmChatOpenAi.node.d.ts +5 -0
  129. package/dist/nodes/llms/LMChatOpenAi/LmChatOpenAi.node.js +175 -0
  130. package/dist/nodes/llms/LMChatOpenAi/LmChatOpenAi.node.js.map +1 -0
  131. package/dist/nodes/llms/LMChatOpenAi/openAi.svg +7 -0
  132. package/dist/nodes/llms/LMCohere/LmCohere.node.d.ts +5 -0
  133. package/dist/nodes/llms/LMCohere/LmCohere.node.js +93 -0
  134. package/dist/nodes/llms/LMCohere/LmCohere.node.js.map +1 -0
  135. package/dist/nodes/llms/LMCohere/cohere.svg +93 -0
  136. package/dist/nodes/llms/LMOllama/LmOllama.node.d.ts +5 -0
  137. package/dist/nodes/llms/LMOllama/LmOllama.node.js +119 -0
  138. package/dist/nodes/llms/LMOllama/LmOllama.node.js.map +1 -0
  139. package/dist/nodes/llms/LMOllama/ollama.svg +43 -0
  140. package/dist/nodes/llms/LMOpenAi/LmOpenAi.node.d.ts +5 -0
  141. package/dist/nodes/llms/LMOpenAi/LmOpenAi.node.js +175 -0
  142. package/dist/nodes/llms/LMOpenAi/LmOpenAi.node.js.map +1 -0
  143. package/dist/nodes/llms/LMOpenAi/openAi.svg +7 -0
  144. package/dist/nodes/llms/LMOpenHuggingFaceInference/LmOpenHuggingFaceInference.node.d.ts +5 -0
  145. package/dist/nodes/llms/LMOpenHuggingFaceInference/LmOpenHuggingFaceInference.node.js +126 -0
  146. package/dist/nodes/llms/LMOpenHuggingFaceInference/LmOpenHuggingFaceInference.node.js.map +1 -0
  147. package/dist/nodes/llms/LMOpenHuggingFaceInference/huggingface.svg +8 -0
  148. package/dist/nodes/llms/LmChatGooglePalm/LmChatGooglePalm.node.d.ts +5 -0
  149. package/dist/nodes/llms/LmChatGooglePalm/LmChatGooglePalm.node.js +150 -0
  150. package/dist/nodes/llms/LmChatGooglePalm/LmChatGooglePalm.node.js.map +1 -0
  151. package/dist/nodes/llms/LmChatGooglePalm/google.svg +1 -0
  152. package/dist/nodes/llms/LmGooglePalm/LmGooglePalm.node.d.ts +5 -0
  153. package/dist/nodes/llms/LmGooglePalm/LmGooglePalm.node.js +157 -0
  154. package/dist/nodes/llms/LmGooglePalm/LmGooglePalm.node.js.map +1 -0
  155. package/dist/nodes/llms/LmGooglePalm/google.svg +1 -0
  156. package/dist/nodes/memory/MemoryBufferWindow/MemoryBufferWindow.node.d.ts +5 -0
  157. package/dist/nodes/memory/MemoryBufferWindow/MemoryBufferWindow.node.js +108 -0
  158. package/dist/nodes/memory/MemoryBufferWindow/MemoryBufferWindow.node.js.map +1 -0
  159. package/dist/nodes/memory/MemoryChatRetriever/MemoryChatRetriever.node.d.ts +5 -0
  160. package/dist/nodes/memory/MemoryChatRetriever/MemoryChatRetriever.node.js +85 -0
  161. package/dist/nodes/memory/MemoryChatRetriever/MemoryChatRetriever.node.js.map +1 -0
  162. package/dist/nodes/memory/MemoryMotorhead/MemoryMotorhead.node.d.ts +5 -0
  163. package/dist/nodes/memory/MemoryMotorhead/MemoryMotorhead.node.js +70 -0
  164. package/dist/nodes/memory/MemoryMotorhead/MemoryMotorhead.node.js.map +1 -0
  165. package/dist/nodes/memory/MemoryRedisChat/MemoryRedisChat.node.d.ts +5 -0
  166. package/dist/nodes/memory/MemoryRedisChat/MemoryRedisChat.node.js +103 -0
  167. package/dist/nodes/memory/MemoryRedisChat/MemoryRedisChat.node.js.map +1 -0
  168. package/dist/nodes/memory/MemoryRedisChat/redis.svg +1 -0
  169. package/dist/nodes/memory/MemoryXata/MemoryXata.node.d.ts +5 -0
  170. package/dist/nodes/memory/MemoryXata/MemoryXata.node.js +84 -0
  171. package/dist/nodes/memory/MemoryXata/MemoryXata.node.js.map +1 -0
  172. package/dist/nodes/memory/MemoryXata/xata.svg +1 -0
  173. package/dist/nodes/memory/MemoryZep/MemoryZep.node.d.ts +5 -0
  174. package/dist/nodes/memory/MemoryZep/MemoryZep.node.js +70 -0
  175. package/dist/nodes/memory/MemoryZep/MemoryZep.node.js.map +1 -0
  176. package/dist/nodes/memory/MemoryZep/zep.png +0 -0
  177. package/dist/nodes/output_parser/OutputParserAutofixing/OutputParserAutofixing.node.d.ts +5 -0
  178. package/dist/nodes/output_parser/OutputParserAutofixing/OutputParserAutofixing.node.js +60 -0
  179. package/dist/nodes/output_parser/OutputParserAutofixing/OutputParserAutofixing.node.js.map +1 -0
  180. package/dist/nodes/output_parser/OutputParserItemList/ItemListOutputParser.d.ts +12 -0
  181. package/dist/nodes/output_parser/OutputParserItemList/ItemListOutputParser.js +40 -0
  182. package/dist/nodes/output_parser/OutputParserItemList/ItemListOutputParser.js.map +1 -0
  183. package/dist/nodes/output_parser/OutputParserItemList/OutputParserItemList.node.d.ts +5 -0
  184. package/dist/nodes/output_parser/OutputParserItemList/OutputParserItemList.node.js +71 -0
  185. package/dist/nodes/output_parser/OutputParserItemList/OutputParserItemList.node.js.map +1 -0
  186. package/dist/nodes/output_parser/OutputParserStructured/OutputParserStructured.node.d.ts +5 -0
  187. package/dist/nodes/output_parser/OutputParserStructured/OutputParserStructured.node.js +97 -0
  188. package/dist/nodes/output_parser/OutputParserStructured/OutputParserStructured.node.js.map +1 -0
  189. package/dist/nodes/retrievers/RetrieverContextualCompression/RetrieverContextualCompression.node.d.ts +5 -0
  190. package/dist/nodes/retrievers/RetrieverContextualCompression/RetrieverContextualCompression.node.js +71 -0
  191. package/dist/nodes/retrievers/RetrieverContextualCompression/RetrieverContextualCompression.node.js.map +1 -0
  192. package/dist/nodes/retrievers/RetrieverVectorStore/RetrieverVectorStore.node.d.ts +5 -0
  193. package/dist/nodes/retrievers/RetrieverVectorStore/RetrieverVectorStore.node.js +62 -0
  194. package/dist/nodes/retrievers/RetrieverVectorStore/RetrieverVectorStore.node.js.map +1 -0
  195. package/dist/nodes/text_splitters/TextSplitterCharacterTextSplitter/TextSplitterCharacterTextSplitter.node.d.ts +5 -0
  196. package/dist/nodes/text_splitters/TextSplitterCharacterTextSplitter/TextSplitterCharacterTextSplitter.node.js +75 -0
  197. package/dist/nodes/text_splitters/TextSplitterCharacterTextSplitter/TextSplitterCharacterTextSplitter.node.js.map +1 -0
  198. package/dist/nodes/text_splitters/TextSplitterRecursiveCharacterTextSplitter/TextSplitterRecursiveCharacterTextSplitter.node.d.ts +5 -0
  199. package/dist/nodes/text_splitters/TextSplitterRecursiveCharacterTextSplitter/TextSplitterRecursiveCharacterTextSplitter.node.js +67 -0
  200. package/dist/nodes/text_splitters/TextSplitterRecursiveCharacterTextSplitter/TextSplitterRecursiveCharacterTextSplitter.node.js.map +1 -0
  201. package/dist/nodes/text_splitters/TextSplitterTokenSplitter/TextSplitterTokenSplitter.node.d.ts +5 -0
  202. package/dist/nodes/text_splitters/TextSplitterTokenSplitter/TextSplitterTokenSplitter.node.js +69 -0
  203. package/dist/nodes/text_splitters/TextSplitterTokenSplitter/TextSplitterTokenSplitter.node.js.map +1 -0
  204. package/dist/nodes/tools/ToolCalculator/ToolCalculator.node.d.ts +5 -0
  205. package/dist/nodes/tools/ToolCalculator/ToolCalculator.node.js +44 -0
  206. package/dist/nodes/tools/ToolCalculator/ToolCalculator.node.js.map +1 -0
  207. package/dist/nodes/tools/ToolCode/ToolCode.node.d.ts +5 -0
  208. package/dist/nodes/tools/ToolCode/ToolCode.node.js +179 -0
  209. package/dist/nodes/tools/ToolCode/ToolCode.node.js.map +1 -0
  210. package/dist/nodes/tools/ToolSerpApi/ToolSerpApi.node.d.ts +5 -0
  211. package/dist/nodes/tools/ToolSerpApi/ToolSerpApi.node.js +112 -0
  212. package/dist/nodes/tools/ToolSerpApi/ToolSerpApi.node.js.map +1 -0
  213. package/dist/nodes/tools/ToolSerpApi/serpApi.svg +13 -0
  214. package/dist/nodes/tools/ToolWikipedia/ToolWikipedia.node.d.ts +5 -0
  215. package/dist/nodes/tools/ToolWikipedia/ToolWikipedia.node.js +44 -0
  216. package/dist/nodes/tools/ToolWikipedia/ToolWikipedia.node.js.map +1 -0
  217. package/dist/nodes/tools/ToolWikipedia/wikipedia.svg +41 -0
  218. package/dist/nodes/tools/ToolWolframAlpha/ToolWolframAlpha.node.d.ts +5 -0
  219. package/dist/nodes/tools/ToolWolframAlpha/ToolWolframAlpha.node.js +51 -0
  220. package/dist/nodes/tools/ToolWolframAlpha/ToolWolframAlpha.node.js.map +1 -0
  221. package/dist/nodes/tools/ToolWolframAlpha/wolfram-alpha.svg +23 -0
  222. package/dist/nodes/tools/ToolWorkflow/ToolWorkflow.node.d.ts +5 -0
  223. package/dist/nodes/tools/ToolWorkflow/ToolWorkflow.node.js +355 -0
  224. package/dist/nodes/tools/ToolWorkflow/ToolWorkflow.node.js.map +1 -0
  225. package/dist/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.d.ts +5 -0
  226. package/dist/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.js +63 -0
  227. package/dist/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.js.map +1 -0
  228. package/dist/nodes/vector_store/VectorStoreInMemory/VectorStoreInMemory.node.d.ts +5 -0
  229. package/dist/nodes/vector_store/VectorStoreInMemory/VectorStoreInMemory.node.js +66 -0
  230. package/dist/nodes/vector_store/VectorStoreInMemory/VectorStoreInMemory.node.js.map +1 -0
  231. package/dist/nodes/vector_store/VectorStorePineconeInsert/VectorStorePineconeInsert.node.d.ts +5 -0
  232. package/dist/nodes/vector_store/VectorStorePineconeInsert/VectorStorePineconeInsert.node.js +122 -0
  233. package/dist/nodes/vector_store/VectorStorePineconeInsert/VectorStorePineconeInsert.node.js.map +1 -0
  234. package/dist/nodes/vector_store/VectorStorePineconeInsert/pinecone.svg +1 -0
  235. package/dist/nodes/vector_store/VectorStorePineconeLoad/VectorStorePineconeLoad.node.d.ts +5 -0
  236. package/dist/nodes/vector_store/VectorStorePineconeLoad/VectorStorePineconeLoad.node.js +87 -0
  237. package/dist/nodes/vector_store/VectorStorePineconeLoad/VectorStorePineconeLoad.node.js.map +1 -0
  238. package/dist/nodes/vector_store/VectorStorePineconeLoad/pinecone.svg +1 -0
  239. package/dist/nodes/vector_store/VectorStoreSupabaseInsert/VectorStoreSupabaseInsert.node.d.ts +5 -0
  240. package/dist/nodes/vector_store/VectorStoreSupabaseInsert/VectorStoreSupabaseInsert.node.js +115 -0
  241. package/dist/nodes/vector_store/VectorStoreSupabaseInsert/VectorStoreSupabaseInsert.node.js.map +1 -0
  242. package/dist/nodes/vector_store/VectorStoreSupabaseInsert/supabase.svg +15 -0
  243. package/dist/nodes/vector_store/VectorStoreSupabaseLoad/VectorStoreSupabaseLoad.node.d.ts +5 -0
  244. package/dist/nodes/vector_store/VectorStoreSupabaseLoad/VectorStoreSupabaseLoad.node.js +107 -0
  245. package/dist/nodes/vector_store/VectorStoreSupabaseLoad/VectorStoreSupabaseLoad.node.js.map +1 -0
  246. package/dist/nodes/vector_store/VectorStoreSupabaseLoad/supabase.svg +15 -0
  247. package/dist/nodes/vector_store/VectorStoreZepInsert/VectorStoreZepInsert.node.d.ts +5 -0
  248. package/dist/nodes/vector_store/VectorStoreZepInsert/VectorStoreZepInsert.node.js +124 -0
  249. package/dist/nodes/vector_store/VectorStoreZepInsert/VectorStoreZepInsert.node.js.map +1 -0
  250. package/dist/nodes/vector_store/VectorStoreZepInsert/zep.png +0 -0
  251. package/dist/nodes/vector_store/VectorStoreZepLoad/VectorStoreZepLoad.node.d.ts +5 -0
  252. package/dist/nodes/vector_store/VectorStoreZepLoad/VectorStoreZepLoad.node.js +93 -0
  253. package/dist/nodes/vector_store/VectorStoreZepLoad/VectorStoreZepLoad.node.js.map +1 -0
  254. package/dist/nodes/vector_store/VectorStoreZepLoad/zep.png +0 -0
  255. package/dist/tsconfig.tsbuildinfo +1 -0
  256. package/dist/utils/EpubLoader.d.ts +16 -0
  257. package/dist/utils/EpubLoader.js +53 -0
  258. package/dist/utils/EpubLoader.js.map +1 -0
  259. package/dist/utils/N8nBinaryLoader.d.ts +7 -0
  260. package/dist/utils/N8nBinaryLoader.js +92 -0
  261. package/dist/utils/N8nBinaryLoader.js.map +1 -0
  262. package/dist/utils/N8nJsonLoader.d.ts +7 -0
  263. package/dist/utils/N8nJsonLoader.js +30 -0
  264. package/dist/utils/N8nJsonLoader.js.map +1 -0
  265. package/dist/utils/logWrapper.d.ts +31 -0
  266. package/dist/utils/logWrapper.js +321 -0
  267. package/dist/utils/logWrapper.js.map +1 -0
  268. package/index.js +0 -0
  269. package/package.json +135 -0
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sqlAgentAgentProperties = void 0;
4
+ const prompts_1 = require("./other/prompts");
5
+ exports.sqlAgentAgentProperties = [
6
+ {
7
+ displayName: 'Data Source',
8
+ name: 'dataSource',
9
+ type: 'options',
10
+ displayOptions: {
11
+ show: {
12
+ agent: ['sqlAgent'],
13
+ },
14
+ },
15
+ default: 'sqlite',
16
+ description: 'SQL database to connect to',
17
+ options: [
18
+ {
19
+ name: 'MySQL',
20
+ value: 'mysql',
21
+ description: 'Connect to a MySQL database',
22
+ },
23
+ {
24
+ name: 'Postgres',
25
+ value: 'postgres',
26
+ description: 'Connect to a Postgres database',
27
+ },
28
+ {
29
+ name: 'SQLite',
30
+ value: 'sqlite',
31
+ description: 'Use SQLite by connecting a database file as binary input',
32
+ },
33
+ ],
34
+ },
35
+ {
36
+ displayName: 'Prompt',
37
+ name: 'input',
38
+ type: 'string',
39
+ displayOptions: {
40
+ show: {
41
+ agent: ['sqlAgent'],
42
+ },
43
+ },
44
+ default: '',
45
+ required: true,
46
+ typeOptions: {
47
+ rows: 5,
48
+ },
49
+ },
50
+ {
51
+ displayName: 'Options',
52
+ name: 'options',
53
+ type: 'collection',
54
+ displayOptions: {
55
+ show: {
56
+ agent: ['sqlAgent'],
57
+ },
58
+ },
59
+ default: {},
60
+ placeholder: 'Add Option',
61
+ options: [
62
+ {
63
+ displayName: 'Ignored Tables',
64
+ name: 'ignoredTables',
65
+ type: 'string',
66
+ default: '',
67
+ description: 'Comma-separated list of tables to ignore from the database. If empty, no tables are ignored.',
68
+ },
69
+ {
70
+ displayName: 'Include Sample Rows',
71
+ name: 'includedSampleRows',
72
+ type: 'number',
73
+ description: 'Number of sample rows to include in the prompt to the agent. It helps the agent to understand the schema of the database but it also increases the amount of tokens used.',
74
+ default: 3,
75
+ },
76
+ {
77
+ displayName: 'Included Tables',
78
+ name: 'includedTables',
79
+ type: 'string',
80
+ default: '',
81
+ description: 'Comma-separated list of tables to include in the database. If empty, all tables are included.',
82
+ },
83
+ {
84
+ displayName: 'Prefix Prompt',
85
+ name: 'prefixPrompt',
86
+ type: 'string',
87
+ default: prompts_1.SQL_PREFIX,
88
+ description: 'Prefix prompt to use for the agent',
89
+ typeOptions: {
90
+ rows: 10,
91
+ },
92
+ },
93
+ {
94
+ displayName: 'Suffix Prompt',
95
+ name: 'suffixPrompt',
96
+ type: 'string',
97
+ default: prompts_1.SQL_SUFFIX,
98
+ description: 'Suffix prompt to use for the agent',
99
+ typeOptions: {
100
+ rows: 4,
101
+ },
102
+ },
103
+ {
104
+ displayName: 'Top K',
105
+ name: 'topK',
106
+ type: 'number',
107
+ default: 10,
108
+ description: 'Number of top results agent should return',
109
+ },
110
+ ],
111
+ },
112
+ ];
113
+ //# sourceMappingURL=description.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"description.js","sourceRoot":"","sources":["../../../../../../nodes/agents/Agent/agents/SqlAgent/description.ts"],"names":[],"mappings":";;;AACA,6CAAyD;AAE5C,QAAA,uBAAuB,GAAsB;IACzD;QACC,WAAW,EAAE,aAAa;QAC1B,IAAI,E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,EAAE,iBAAiB;gBAC9B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EACV,+FAA+F;aAChG;YACD;gBACC,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,oBAAU;gBACnB,WAAW,EAAE,oCAAoC;gBACjD,WAAW,EAAE;oBACZ,IAAI,EAAE,EAAE;iBACR;aACD;YACD;gBACC,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,oBAAU;gBACnB,WAAW,EAAE,oCAAoC;gBACjD,WAAW,EAAE;oBACZ,IAAI,EAAE,CAAC;iBACP;aACD;YACD;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,2CAA2C;aACxD;SACD;KACD;CACD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { type IExecuteFunctions, type INodeExecutionData } from 'n8n-workflow';
2
+ export declare function sqlAgentAgentExecute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sqlAgentAgentExecute = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const sql_db_1 = require("langchain/sql_db");
6
+ const sql_1 = require("langchain/agents/toolkits/sql");
7
+ const sqlite_1 = require("./other/handlers/sqlite");
8
+ const postgres_1 = require("./other/handlers/postgres");
9
+ const prompts_1 = require("./other/prompts");
10
+ const mysql_1 = require("./other/handlers/mysql");
11
+ const parseTablesString = (tablesString) => tablesString
12
+ .split(',')
13
+ .map((table) => table.trim())
14
+ .filter((table) => table.length > 0);
15
+ async function sqlAgentAgentExecute() {
16
+ var _a, _b, _c, _d, _e;
17
+ this.logger.verbose('Executing SQL Agent');
18
+ const model = (await this.getInputConnectionData("ai_languageModel", 0));
19
+ const items = this.getInputData();
20
+ const returnData = [];
21
+ for (let i = 0; i < items.length; i++) {
22
+ const item = items[i];
23
+ const input = this.getNodeParameter('input', i);
24
+ const options = this.getNodeParameter('options', i, {});
25
+ const selectedDataSource = this.getNodeParameter('dataSource', i, 'sqlite');
26
+ const includedSampleRows = options.includedSampleRows;
27
+ const includedTablesArray = parseTablesString((_a = options.includedTables) !== null && _a !== void 0 ? _a : '');
28
+ const ignoredTablesArray = parseTablesString((_b = options.ignoredTables) !== null && _b !== void 0 ? _b : '');
29
+ let dataSource = null;
30
+ if (selectedDataSource === 'sqlite') {
31
+ if (!item.binary) {
32
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No binary data found, please connect a binary to the input if you want to use SQLite as data source');
33
+ }
34
+ dataSource = sqlite_1.getSqliteDataSource.call(this, item.binary);
35
+ }
36
+ if (selectedDataSource === 'postgres') {
37
+ dataSource = await postgres_1.getPostgresDataSource.call(this);
38
+ }
39
+ if (selectedDataSource === 'mysql') {
40
+ dataSource = await mysql_1.getMysqlDataSource.call(this);
41
+ }
42
+ if (!dataSource) {
43
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No data source found, please configure data source');
44
+ }
45
+ const agentOptions = {
46
+ topK: (_c = options.topK) !== null && _c !== void 0 ? _c : 10,
47
+ prefix: (_d = options.prefixPrompt) !== null && _d !== void 0 ? _d : prompts_1.SQL_PREFIX,
48
+ suffix: (_e = options.suffixPrompt) !== null && _e !== void 0 ? _e : prompts_1.SQL_SUFFIX,
49
+ };
50
+ const dbInstance = await sql_db_1.SqlDatabase.fromDataSourceParams({
51
+ appDataSource: dataSource,
52
+ includesTables: includedTablesArray.length > 0 ? includedTablesArray : undefined,
53
+ ignoreTables: ignoredTablesArray.length > 0 ? ignoredTablesArray : undefined,
54
+ sampleRowsInTableInfo: includedSampleRows !== null && includedSampleRows !== void 0 ? includedSampleRows : 3,
55
+ });
56
+ const toolkit = new sql_1.SqlToolkit(dbInstance, model);
57
+ const agentExecutor = (0, sql_1.createSqlAgent)(model, toolkit, agentOptions);
58
+ const response = await agentExecutor.call({ input });
59
+ returnData.push({ json: response });
60
+ }
61
+ return this.prepareOutputData(returnData);
62
+ }
63
+ exports.sqlAgentAgentExecute = sqlAgentAgentExecute;
64
+ //# sourceMappingURL=execute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../../../nodes/agents/Agent/agents/SqlAgent/execute.ts"],"names":[],"mappings":";;;AAAA,+CAKsB;AAEtB,6CAA+C;AAE/C,uDAA2E;AAG3E,oDAA8D;AAC9D,wDAAkE;AAClE,6CAAyD;AACzD,kDAA4D;AAE5D,MAAM,iBAAiB,GAAG,CAAC,YAAoB,EAAE,EAAE,CAClD,YAAY;KACV,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;KAC5B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAEhC,KAAK,UAAU,oBAAoB;;IAGzC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAE3C,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,CAAC,sBAAsB,qBAE/C,CAAC,CACD,CAAsB,CAAC;IACxB,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAElC,MAAM,UAAU,GAAyB,EAAE,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO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YACtD,MAAM,EAAE,MAAC,OAAO,CAAC,YAAuB,mCAAI,oBAAU;SACtD,CAAC;QAEF,MAAM,UAAU,GAAG,MAAM,oBAAW,CAAC,oBAAoB,CAAC;YACzD,aAAa,EAAE,UAAU;YACzB,cAAc,EAAE,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS;YAChF,YAAY,EAAE,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS;YAC5E,qBAAqB,EAAE,kBAAkB,aAAlB,kBAAkB,cAAlB,kBAAkB,GAAI,CAAC;SAC9C,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,IAAI,gBAAU,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAClD,MAAM,aAAa,GAAG,IAAA,oBAAc,EAAC,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;QAEnE,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAErD,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;KACpC;IAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC;AA1ED,oDA0EC"}
@@ -0,0 +1,3 @@
1
+ import { type IExecuteFunctions } from 'n8n-workflow';
2
+ import { DataSource } from 'typeorm';
3
+ export declare function getMysqlDataSource(this: IExecuteFunctions): Promise<DataSource>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMysqlDataSource = void 0;
4
+ const typeorm_1 = require("typeorm");
5
+ async function getMysqlDataSource() {
6
+ const credentials = await this.getCredentials('mySql');
7
+ const dataSource = new typeorm_1.DataSource({
8
+ type: 'mysql',
9
+ host: credentials.host,
10
+ port: credentials.port,
11
+ username: credentials.user,
12
+ password: credentials.password,
13
+ database: credentials.database,
14
+ ssl: {
15
+ rejectUnauthorized: credentials.ssl,
16
+ },
17
+ });
18
+ return dataSource;
19
+ }
20
+ exports.getMysqlDataSource = getMysqlDataSource;
21
+ //# sourceMappingURL=mysql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mysql.js","sourceRoot":"","sources":["../../../../../../../../nodes/agents/Agent/agents/SqlAgent/other/handlers/mysql.ts"],"names":[],"mappings":";;;AACA,qCAAqC;AAE9B,KAAK,UAAU,kBAAkB;IACvC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAEvD,MAAM,UAAU,GAAG,IAAI,oBAAU,CAAC;QACjC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,WAAW,CAAC,IAAc;QAChC,IAAI,EAAE,WAAW,CAAC,IAAc;QAChC,QAAQ,EAAE,WAAW,CAAC,IAAc;QACpC,QAAQ,EAAE,WAAW,CAAC,QAAkB;QACxC,QAAQ,EAAE,WAAW,CAAC,QAAkB;QACxC,GAAG,EAAE;YACJ,kBAAkB,EAAE,WAAW,CAAC,GAAc;SAC9C;KACD,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACnB,CAAC;AAhBD,gDAgBC"}
@@ -0,0 +1,3 @@
1
+ import { type IExecuteFunctions } from 'n8n-workflow';
2
+ import { DataSource } from 'typeorm';
3
+ export declare function getPostgresDataSource(this: IExecuteFunctions): Promise<DataSource>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPostgresDataSource = void 0;
4
+ const typeorm_1 = require("typeorm");
5
+ async function getPostgresDataSource() {
6
+ const credentials = await this.getCredentials('postgres');
7
+ const dataSource = new typeorm_1.DataSource({
8
+ type: 'postgres',
9
+ host: credentials.host,
10
+ port: credentials.port,
11
+ username: credentials.user,
12
+ password: credentials.password,
13
+ database: credentials.database,
14
+ ssl: {
15
+ rejectUnauthorized: !credentials.allowUnauthorizedCerts,
16
+ },
17
+ });
18
+ return dataSource;
19
+ }
20
+ exports.getPostgresDataSource = getPostgresDataSource;
21
+ //# sourceMappingURL=postgres.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgres.js","sourceRoot":"","sources":["../../../../../../../../nodes/agents/Agent/agents/SqlAgent/other/handlers/postgres.ts"],"names":[],"mappings":";;;AACA,qCAAqC;AAE9B,KAAK,UAAU,qBAAqB;IAC1C,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAE1D,MAAM,UAAU,GAAG,IAAI,oBAAU,CAAC;QACjC,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,WAAW,CAAC,IAAc;QAChC,IAAI,EAAE,WAAW,CAAC,IAAc;QAChC,QAAQ,EAAE,WAAW,CAAC,IAAc;QACpC,QAAQ,EAAE,WAAW,CAAC,QAAkB;QACxC,QAAQ,EAAE,WAAW,CAAC,QAAkB;QACxC,GAAG,EAAE;YACJ,kBAAkB,EAAE,CAAE,WAAW,CAAC,sBAAkC;SACpE;KACD,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACnB,CAAC;AAhBD,sDAgBC"}
@@ -0,0 +1,3 @@
1
+ import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ import { DataSource } from 'typeorm';
3
+ export declare function getSqliteDataSource(this: IExecuteFunctions, binary: INodeExecutionData['binary']): DataSource;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.getSqliteDataSource = void 0;
27
+ const fs = __importStar(require("fs"));
28
+ const n8n_workflow_1 = require("n8n-workflow");
29
+ const temp = __importStar(require("temp"));
30
+ const sqlite3 = __importStar(require("sqlite3"));
31
+ const typeorm_1 = require("typeorm");
32
+ function getSqliteDataSource(binary) {
33
+ const binaryData = binary === null || binary === void 0 ? void 0 : binary.data;
34
+ if (!binaryData) {
35
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No binary data received.');
36
+ }
37
+ const bufferString = Buffer.from(binaryData.data, n8n_workflow_1.BINARY_ENCODING);
38
+ temp.track();
39
+ const tempDbPath = temp.path({ suffix: '.sqlite' });
40
+ fs.writeFileSync(tempDbPath, bufferString);
41
+ const tempDb = new sqlite3.Database(tempDbPath, (error) => {
42
+ if (error) {
43
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Could not connect to database');
44
+ }
45
+ });
46
+ tempDb.close();
47
+ return new typeorm_1.DataSource({
48
+ type: 'sqlite',
49
+ database: tempDbPath,
50
+ });
51
+ }
52
+ exports.getSqliteDataSource = getSqliteDataSource;
53
+ //# sourceMappingURL=sqlite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlite.js","sourceRoot":"","sources":["../../../../../../../../nodes/agents/Agent/agents/SqlAgent/other/handlers/sqlite.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,+CAAmE;AACnE,2CAA6B;AAC7B,iDAAmC;AACnC,qCAAqC;AAErC,SAAgB,mBAAmB,CAElC,MAAoC;IAEpC,MAAM,UAAU,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC;IAEhC,IAAI,CAAC,UAAU,EAAE;QAChB,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,0BAA0B,CAAC,CAAC;KACzE;IAED,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,8BAAe,CAAC,CAAC;IAGnE,IAAI,CAAC,KAAK,EAAE,CAAC;IAEb,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACpD,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAG3C,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAmB,EAAE,EAAE;QACvE,IAAI,KAAK,EAAE;YACV,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,+BAA+B,CAAC,CAAC;SAC9E;IACF,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,OAAO,IAAI,oBAAU,CAAC;QACrB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,UAAU;KACpB,CAAC,CAAC;AACJ,CAAC;AA9BD,kDA8BC"}
@@ -0,0 +1,2 @@
1
+ export declare const SQL_PREFIX = "You are an agent designed to interact with an SQL database.\nGiven an input question, create a syntactically correct {dialect} query to run, then look at the results of the query and return the answer.\nUnless the user specifies a specific number of examples they wish to obtain, always limit your query to at most {top_k} results using the LIMIT clause.\nYou can order the results by a relevant column to return the most interesting examples in the database.\nNever query for all the columns from a specific table, only ask for a the few relevant columns given the question.\nYou have access to tools for interacting with the database.\nOnly use the below tools. Only use the information returned by the below tools to construct your final answer.\nYou MUST double check your query before executing it. If you get an error while executing a query, rewrite the query and try again.\n\nDO NOT make any DML statements (INSERT, UPDATE, DELETE, DROP etc.) to the database.\n\nIf the question does not seem related to the database, just return \"I don't know\" as the answer.";
2
+ export declare const SQL_SUFFIX = "Begin!\n\nQuestion: {input}\nThought: I should look at the tables in the database to see what I can query.\n{agent_scratchpad}";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQL_SUFFIX = exports.SQL_PREFIX = void 0;
4
+ exports.SQL_PREFIX = `You are an agent designed to interact with an SQL database.
5
+ Given an input question, create a syntactically correct {dialect} query to run, then look at the results of the query and return the answer.
6
+ Unless the user specifies a specific number of examples they wish to obtain, always limit your query to at most {top_k} results using the LIMIT clause.
7
+ You can order the results by a relevant column to return the most interesting examples in the database.
8
+ Never query for all the columns from a specific table, only ask for a the few relevant columns given the question.
9
+ You have access to tools for interacting with the database.
10
+ Only use the below tools. Only use the information returned by the below tools to construct your final answer.
11
+ You MUST double check your query before executing it. If you get an error while executing a query, rewrite the query and try again.
12
+
13
+ DO NOT make any DML statements (INSERT, UPDATE, DELETE, DROP etc.) to the database.
14
+
15
+ If the question does not seem related to the database, just return "I don't know" as the answer.`;
16
+ exports.SQL_SUFFIX = `Begin!
17
+
18
+ Question: {input}
19
+ Thought: I should look at the tables in the database to see what I can query.
20
+ {agent_scratchpad}`;
21
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../../../../nodes/agents/Agent/agents/SqlAgent/other/prompts.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;;;;;;;;;;;iGAWuE,CAAC;AAErF,QAAA,UAAU,GAAG;;;;mBAIP,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type IExecuteFunctions, type INodeExecutionData, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class ChainLlm implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChainLlm = void 0;
4
+ const prompts_1 = require("langchain/prompts");
5
+ const output_parsers_1 = require("langchain/output_parsers");
6
+ async function getChain(context, query) {
7
+ const llm = (await context.getInputConnectionData("ai_languageModel", 0));
8
+ const outputParsers = (await context.getInputConnectionData("ai_outputParser", 0));
9
+ let prompt;
10
+ let outputParser;
11
+ if (outputParsers.length) {
12
+ if (outputParsers.length === 1) {
13
+ outputParser = outputParsers[0];
14
+ }
15
+ else {
16
+ outputParser = new output_parsers_1.CombiningOutputParser(...outputParsers);
17
+ }
18
+ const formatInstructions = outputParser.getFormatInstructions();
19
+ prompt = new prompts_1.PromptTemplate({
20
+ template: query + '\n{formatInstructions}',
21
+ inputVariables: [],
22
+ partialVariables: { formatInstructions },
23
+ });
24
+ }
25
+ else {
26
+ prompt = prompts_1.PromptTemplate.fromTemplate(query);
27
+ }
28
+ let chain = prompt.pipe(llm);
29
+ if (outputParser) {
30
+ chain = chain.pipe(outputParser);
31
+ }
32
+ const response = (await chain.invoke({ query }));
33
+ return Array.isArray(response) ? response : [response];
34
+ }
35
+ class ChainLlm {
36
+ constructor() {
37
+ this.description = {
38
+ displayName: 'Basic LLM Chain',
39
+ name: 'chainLlm',
40
+ icon: 'fa:link',
41
+ group: ['transform'],
42
+ version: 1,
43
+ description: 'A simple chain to prompt a large language mode',
44
+ defaults: {
45
+ name: 'Basic LLM Chain',
46
+ color: '#909298',
47
+ },
48
+ codex: {
49
+ alias: ['LangChain'],
50
+ categories: ['AI'],
51
+ subcategories: {
52
+ AI: ['Chains'],
53
+ },
54
+ resources: {
55
+ primaryDocumentation: [
56
+ {
57
+ url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainllm/',
58
+ },
59
+ ],
60
+ },
61
+ },
62
+ inputs: [
63
+ "main",
64
+ {
65
+ displayName: 'Model',
66
+ maxConnections: 1,
67
+ type: "ai_languageModel",
68
+ required: true,
69
+ },
70
+ {
71
+ displayName: 'Output Parser',
72
+ type: "ai_outputParser",
73
+ required: false,
74
+ },
75
+ ],
76
+ outputs: ["main"],
77
+ credentials: [],
78
+ properties: [
79
+ {
80
+ displayName: 'Mode',
81
+ name: 'mode',
82
+ type: 'options',
83
+ noDataExpression: true,
84
+ options: [
85
+ {
86
+ name: 'Run Once for All Items',
87
+ value: 'runOnceForAllItems',
88
+ description: 'Run this chain only once, no matter how many input items there are',
89
+ },
90
+ {
91
+ name: 'Run Once for Each Item',
92
+ value: 'runOnceForEachItem',
93
+ description: 'Run this chain as many times as there are input items',
94
+ },
95
+ ],
96
+ default: 'runOnceForAllItems',
97
+ },
98
+ {
99
+ displayName: 'Prompt',
100
+ name: 'prompt',
101
+ type: 'string',
102
+ default: '={{ $json.input }}',
103
+ },
104
+ ],
105
+ };
106
+ }
107
+ async execute() {
108
+ this.logger.verbose('Executing LLM Chain');
109
+ const items = this.getInputData();
110
+ const runMode = this.getNodeParameter('mode', 0);
111
+ const returnData = [];
112
+ let itemCount = items.length;
113
+ if (runMode === 'runOnceForAllItems') {
114
+ itemCount = 1;
115
+ }
116
+ for (let i = 0; i < itemCount; i++) {
117
+ const prompt = this.getNodeParameter('prompt', i);
118
+ const responses = await getChain(this, prompt);
119
+ responses.forEach((response) => {
120
+ let data;
121
+ if (typeof response === 'string') {
122
+ data = {
123
+ response: {
124
+ text: response.trim(),
125
+ },
126
+ };
127
+ }
128
+ else if (Array.isArray(response)) {
129
+ data = {
130
+ data: response,
131
+ };
132
+ }
133
+ else if (response instanceof Object) {
134
+ data = response;
135
+ }
136
+ else {
137
+ data = {
138
+ response: {
139
+ text: response,
140
+ },
141
+ };
142
+ }
143
+ returnData.push({
144
+ json: data,
145
+ });
146
+ });
147
+ }
148
+ return [returnData];
149
+ }
150
+ }
151
+ exports.ChainLlm = ChainLlm;
152
+ //# sourceMappingURL=ChainLlm.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChainLlm.node.js","sourceRoot":"","sources":["../../../../nodes/chains/ChainLLM/ChainLlm.node.ts"],"names":[],"mappings":";;;AAUA,+CAAmD;AAEnD,6DAAiE;AAEjE,KAAK,UAAU,QAAQ,CAAC,OAA0B,EAAE,KAAa;IAChE,MAAM,GAAG,GAAG,CAAC,MAAM,OAAO,CAAC,sBAAsB,qBAEhD,CAAC,CACD,CAAsB,CAAC;IACxB,MAAM,aAAa,GAAG,CAAC,MAAM,OAAO,CAAC,sBAAsB,oBAE1D,CAAC,CACD,CAAuB,CAAC;IAEzB,IAAI,MAAsB,CAAC;IAE3B,IAAI,YAA0C,CAAC;IAC/C,IAAI,aAAa,CAAC,MAAM,EAAE;QACzB,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,YAAY,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;SAChC;aAAM;YACN,YAAY,GAAG,IAAI,sCAAqB,CAAC,GAAG,aAAa,CAAC,CAAC;SAC3D;QACD,MAAM,kBAAkB,GAAG,YAAY,CAAC,qBAAqB,EAAE,CAAC;QAEhE,MAAM,GAAG,IAAI,wBAAc,CAAC;YAC3B,QAAQ,EAAE,KAAK,GAAG,wBAAwB;YAC1C,cAAc,EAAE,EAAE;YAClB,gBAAgB,EAAE,EAAE,kBAAkB,EAAE;SACxC,CAAC,CAAC;KACH;SAAM;QACN,MAAM,GAAG,wBAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;KAC5C;IAED,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE7B,IAAI,YAAY,EAAE;QACjB,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KACjC;IAED,MAAM,QAAQ,GAAG,C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;wBACN,IAAI,EAAE,QAAQ;qBACd,CAAC;iBACF;qBAAM,IAAI,QAAQ,YAAY,MAAM,EAAE;oBACtC,IAAI,GAAG,QAAuB,CAAC;iBAC/B;qBAAM;oBACN,IAAI,GAAG;wBACN,QAAQ,EAAE;4BACT,IAAI,EAAE,QAAQ;yBACd;qBACD,CAAC;iBACF;gBAED,UAAU,CAAC,IAAI,CAAC;oBACf,IAAI,EAAE,IAAI;iBACV,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;SACH;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAtHD,4BAsHC"}
@@ -0,0 +1,5 @@
1
+ import { type IExecuteFunctions, type INodeExecutionData, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class ChainRetrievalQa implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChainRetrievalQa = void 0;
4
+ const chains_1 = require("langchain/chains");
5
+ class ChainRetrievalQa {
6
+ constructor() {
7
+ this.description = {
8
+ displayName: 'Q&A Chain from Retrieved Documents',
9
+ name: 'chainRetrievalQa',
10
+ icon: 'fa:link',
11
+ group: ['transform'],
12
+ version: 1,
13
+ description: 'Retrieves answers to queries based on retrieved documents',
14
+ defaults: {
15
+ name: 'Retrieval QA Chain',
16
+ color: '#909298',
17
+ },
18
+ codex: {
19
+ alias: ['LangChain'],
20
+ categories: ['AI'],
21
+ subcategories: {
22
+ AI: ['Chains'],
23
+ },
24
+ resources: {
25
+ primaryDocumentation: [
26
+ {
27
+ url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainretrievalqa/',
28
+ },
29
+ ],
30
+ },
31
+ },
32
+ inputs: [
33
+ "main",
34
+ {
35
+ displayName: 'Model',
36
+ maxConnections: 1,
37
+ type: "ai_languageModel",
38
+ required: true,
39
+ },
40
+ {
41
+ displayName: 'Retriever',
42
+ maxConnections: 1,
43
+ type: "ai_retriever",
44
+ required: true,
45
+ },
46
+ ],
47
+ outputs: ["main"],
48
+ credentials: [],
49
+ properties: [
50
+ {
51
+ displayName: 'Mode',
52
+ name: 'mode',
53
+ type: 'options',
54
+ noDataExpression: true,
55
+ options: [
56
+ {
57
+ name: 'Run Once for All Items',
58
+ value: 'runOnceForAllItems',
59
+ description: 'Run this chain only once, no matter how many input items there are',
60
+ },
61
+ {
62
+ name: 'Run Once for Each Item',
63
+ value: 'runOnceForEachItem',
64
+ description: 'Run this chain as many times as there are input items',
65
+ },
66
+ ],
67
+ default: 'runOnceForAllItems',
68
+ },
69
+ {
70
+ displayName: 'Query',
71
+ name: 'query',
72
+ type: 'string',
73
+ default: '',
74
+ },
75
+ ],
76
+ };
77
+ }
78
+ async execute() {
79
+ this.logger.verbose('Executing Retrieval QA Chain');
80
+ const model = (await this.getInputConnectionData("ai_languageModel", 0));
81
+ const retriever = (await this.getInputConnectionData("ai_retriever", 0));
82
+ const items = this.getInputData();
83
+ const chain = chains_1.RetrievalQAChain.fromLLM(model, retriever);
84
+ const returnData = [];
85
+ const runMode = this.getNodeParameter('mode', 0);
86
+ if (runMode === 'runOnceForAllItems') {
87
+ const query = this.getNodeParameter('query', 0);
88
+ const response = await chain.call({ query });
89
+ return this.prepareOutputData([{ json: { response } }]);
90
+ }
91
+ for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
92
+ const query = this.getNodeParameter('query', itemIndex);
93
+ const response = await chain.call({ query });
94
+ returnData.push({ json: { response } });
95
+ }
96
+ return this.prepareOutputData(returnData);
97
+ }
98
+ }
99
+ exports.ChainRetrievalQa = ChainRetrievalQa;
100
+ //# sourceMappingURL=ChainRetrievalQa.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChainRetrievalQa.node.js","sourceRoot":"","sources":["../../../../nodes/chains/ChainRetrievalQA/ChainRetr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C,EAAE,KAAK,EAAE,CAAC,CAAC;YAC7C,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;SACxC;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;CACD;AA3GD,4CA2GC"}
@@ -0,0 +1,5 @@
1
+ import { type IExecuteFunctions, type INodeExecutionData, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class ChainSummarization implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }