@n8n/n8n-nodes-langchain 1.83.1 → 1.85.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/dist/build.tsbuildinfo +1 -1
  2. package/dist/credentials/XAiApi.credentials.d.ts +9 -0
  3. package/dist/credentials/XAiApi.credentials.js +42 -0
  4. package/dist/credentials/XAiApi.credentials.js.map +1 -0
  5. package/dist/known/credentials.json +7 -0
  6. package/dist/known/nodes.json +8 -0
  7. package/dist/nodes/agents/Agent/Agent.node.js +32 -30
  8. package/dist/nodes/agents/Agent/Agent.node.js.map +1 -1
  9. package/dist/nodes/agents/Agent/agents/ConversationalAgent/execute.js +11 -21
  10. package/dist/nodes/agents/Agent/agents/ConversationalAgent/execute.js.map +1 -1
  11. package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/execute.js +5 -9
  12. package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/execute.js.map +1 -1
  13. package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/execute.js +4 -8
  14. package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/execute.js.map +1 -1
  15. package/dist/nodes/agents/Agent/agents/ReActAgent/execute.js +4 -8
  16. package/dist/nodes/agents/Agent/agents/ReActAgent/execute.js.map +1 -1
  17. package/dist/nodes/agents/Agent/agents/SqlAgent/execute.js +2 -2
  18. package/dist/nodes/agents/Agent/agents/SqlAgent/execute.js.map +1 -1
  19. package/dist/nodes/agents/Agent/agents/ToolsAgent/execute.js +7 -8
  20. package/dist/nodes/agents/Agent/agents/ToolsAgent/execute.js.map +1 -1
  21. package/dist/nodes/agents/OpenAiAssistant/OpenAiAssistant.node.js +3 -3
  22. package/dist/nodes/agents/OpenAiAssistant/OpenAiAssistant.node.js.map +1 -1
  23. package/dist/nodes/chains/ChainLLM/ChainLlm.node.js +17 -389
  24. package/dist/nodes/chains/ChainLLM/ChainLlm.node.js.map +1 -1
  25. package/dist/nodes/chains/ChainLLM/methods/chainExecutor.d.ts +2 -0
  26. package/dist/nodes/chains/ChainLLM/methods/chainExecutor.js +50 -0
  27. package/dist/nodes/chains/ChainLLM/methods/chainExecutor.js.map +1 -0
  28. package/dist/nodes/chains/ChainLLM/methods/config.d.ts +3 -0
  29. package/dist/nodes/chains/ChainLLM/methods/config.js +254 -0
  30. package/dist/nodes/chains/ChainLLM/methods/config.js.map +1 -0
  31. package/dist/nodes/chains/ChainLLM/methods/imageUtils.d.ts +12 -0
  32. package/dist/nodes/chains/ChainLLM/methods/imageUtils.js +66 -0
  33. package/dist/nodes/chains/ChainLLM/methods/imageUtils.js.map +1 -0
  34. package/dist/nodes/chains/ChainLLM/methods/index.d.ts +4 -0
  35. package/dist/nodes/chains/ChainLLM/methods/index.js +11 -0
  36. package/dist/nodes/chains/ChainLLM/methods/index.js.map +1 -0
  37. package/dist/nodes/chains/ChainLLM/methods/promptUtils.d.ts +3 -0
  38. package/dist/nodes/chains/ChainLLM/methods/promptUtils.js +69 -0
  39. package/dist/nodes/chains/ChainLLM/methods/promptUtils.js.map +1 -0
  40. package/dist/nodes/chains/ChainLLM/methods/responseFormatter.d.ts +2 -0
  41. package/dist/nodes/chains/ChainLLM/methods/responseFormatter.js +26 -0
  42. package/dist/nodes/chains/ChainLLM/methods/responseFormatter.js.map +1 -0
  43. package/dist/nodes/chains/ChainLLM/methods/types.d.ts +28 -0
  44. package/dist/nodes/chains/ChainLLM/methods/types.js +3 -0
  45. package/dist/nodes/chains/ChainLLM/methods/types.js.map +1 -0
  46. package/dist/nodes/chains/ChainRetrievalQA/ChainRetrievalQa.node.js +74 -39
  47. package/dist/nodes/chains/ChainRetrievalQA/ChainRetrievalQa.node.js.map +1 -1
  48. package/dist/nodes/chains/ChainSummarization/V1/ChainSummarizationV1.node.js +7 -6
  49. package/dist/nodes/chains/ChainSummarization/V1/ChainSummarizationV1.node.js.map +1 -1
  50. package/dist/nodes/chains/ChainSummarization/V2/ChainSummarizationV2.node.js +9 -8
  51. package/dist/nodes/chains/ChainSummarization/V2/ChainSummarizationV2.node.js.map +1 -1
  52. package/dist/nodes/chains/InformationExtractor/InformationExtractor.node.js +4 -4
  53. package/dist/nodes/chains/InformationExtractor/InformationExtractor.node.js.map +1 -1
  54. package/dist/nodes/chains/SentimentAnalysis/SentimentAnalysis.node.js +4 -4
  55. package/dist/nodes/chains/SentimentAnalysis/SentimentAnalysis.node.js.map +1 -1
  56. package/dist/nodes/chains/TextClassifier/TextClassifier.node.js +5 -5
  57. package/dist/nodes/chains/TextClassifier/TextClassifier.node.js.map +1 -1
  58. package/dist/nodes/code/Code.node.js +11 -11
  59. package/dist/nodes/code/Code.node.js.map +1 -1
  60. package/dist/nodes/document_loaders/DocumentBinaryInputLoader/DocumentBinaryInputLoader.node.js +5 -4
  61. package/dist/nodes/document_loaders/DocumentBinaryInputLoader/DocumentBinaryInputLoader.node.js.map +1 -1
  62. package/dist/nodes/document_loaders/DocumentDefaultDataLoader/DocumentDefaultDataLoader.node.js +4 -3
  63. package/dist/nodes/document_loaders/DocumentDefaultDataLoader/DocumentDefaultDataLoader.node.js.map +1 -1
  64. package/dist/nodes/document_loaders/DocumentGithubLoader/DocumentGithubLoader.node.js +7 -6
  65. package/dist/nodes/document_loaders/DocumentGithubLoader/DocumentGithubLoader.node.js.map +1 -1
  66. package/dist/nodes/document_loaders/DocumentJSONInputLoader/DocumentJsonInputLoader.node.js +5 -4
  67. package/dist/nodes/document_loaders/DocumentJSONInputLoader/DocumentJsonInputLoader.node.js.map +1 -1
  68. package/dist/nodes/embeddings/EmbeddingsAwsBedrock/EmbeddingsAwsBedrock.node.js +3 -2
  69. package/dist/nodes/embeddings/EmbeddingsAwsBedrock/EmbeddingsAwsBedrock.node.js.map +1 -1
  70. package/dist/nodes/embeddings/EmbeddingsAzureOpenAi/EmbeddingsAzureOpenAi.node.js +3 -2
  71. package/dist/nodes/embeddings/EmbeddingsAzureOpenAi/EmbeddingsAzureOpenAi.node.js.map +1 -1
  72. package/dist/nodes/embeddings/EmbeddingsCohere/EmbeddingsCohere.node.js +3 -2
  73. package/dist/nodes/embeddings/EmbeddingsCohere/EmbeddingsCohere.node.js.map +1 -1
  74. package/dist/nodes/embeddings/EmbeddingsGoogleGemini/EmbeddingsGoogleGemini.node.js +3 -2
  75. package/dist/nodes/embeddings/EmbeddingsGoogleGemini/EmbeddingsGoogleGemini.node.js.map +1 -1
  76. package/dist/nodes/embeddings/EmbeddingsHuggingFaceInference/EmbeddingsHuggingFaceInference.node.js +3 -2
  77. package/dist/nodes/embeddings/EmbeddingsHuggingFaceInference/EmbeddingsHuggingFaceInference.node.js.map +1 -1
  78. package/dist/nodes/embeddings/EmbeddingsMistralCloud/EmbeddingsMistralCloud.node.js +3 -2
  79. package/dist/nodes/embeddings/EmbeddingsMistralCloud/EmbeddingsMistralCloud.node.js.map +1 -1
  80. package/dist/nodes/embeddings/EmbeddingsOllama/EmbeddingsOllama.node.js +3 -2
  81. package/dist/nodes/embeddings/EmbeddingsOllama/EmbeddingsOllama.node.js.map +1 -1
  82. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +3 -2
  83. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js.map +1 -1
  84. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js +3 -2
  85. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js.map +1 -1
  86. package/dist/nodes/llms/LMChatOllama/LmChatOllama.node.js +3 -2
  87. package/dist/nodes/llms/LMChatOllama/LmChatOllama.node.js.map +1 -1
  88. package/dist/nodes/llms/LMChatOpenAi/LmChatOpenAi.node.js +5 -4
  89. package/dist/nodes/llms/LMChatOpenAi/LmChatOpenAi.node.js.map +1 -1
  90. package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js +3 -1
  91. package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js.map +1 -1
  92. package/dist/nodes/llms/LMCohere/LmCohere.node.js +3 -2
  93. package/dist/nodes/llms/LMCohere/LmCohere.node.js.map +1 -1
  94. package/dist/nodes/llms/LMOllama/LmOllama.node.js +3 -2
  95. package/dist/nodes/llms/LMOllama/LmOllama.node.js.map +1 -1
  96. package/dist/nodes/llms/LMOpenAi/LmOpenAi.node.js +2 -1
  97. package/dist/nodes/llms/LMOpenAi/LmOpenAi.node.js.map +1 -1
  98. package/dist/nodes/llms/LMOpenHuggingFaceInference/LmOpenHuggingFaceInference.node.js +3 -2
  99. package/dist/nodes/llms/LMOpenHuggingFaceInference/LmOpenHuggingFaceInference.node.js.map +1 -1
  100. package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js +3 -2
  101. package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js.map +1 -1
  102. package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js +4 -3
  103. package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js.map +1 -1
  104. package/dist/nodes/llms/LmChatDeepSeek/LmChatDeepSeek.node.js +3 -2
  105. package/dist/nodes/llms/LmChatDeepSeek/LmChatDeepSeek.node.js.map +1 -1
  106. package/dist/nodes/llms/LmChatGoogleGemini/LmChatGoogleGemini.node.js +3 -2
  107. package/dist/nodes/llms/LmChatGoogleGemini/LmChatGoogleGemini.node.js.map +1 -1
  108. package/dist/nodes/llms/LmChatGoogleVertex/LmChatGoogleVertex.node.js +2 -2
  109. package/dist/nodes/llms/LmChatGoogleVertex/LmChatGoogleVertex.node.js.map +1 -1
  110. package/dist/nodes/llms/LmChatGroq/LmChatGroq.node.js +3 -2
  111. package/dist/nodes/llms/LmChatGroq/LmChatGroq.node.js.map +1 -1
  112. package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js +3 -2
  113. package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js.map +1 -1
  114. package/dist/nodes/llms/LmChatOpenRouter/LmChatOpenRouter.node.js +3 -2
  115. package/dist/nodes/llms/LmChatOpenRouter/LmChatOpenRouter.node.js.map +1 -1
  116. package/dist/nodes/llms/LmChatXAiGrok/LmChatXAiGrok.node.d.ts +5 -0
  117. package/dist/nodes/llms/LmChatXAiGrok/LmChatXAiGrok.node.js +223 -0
  118. package/dist/nodes/llms/LmChatXAiGrok/LmChatXAiGrok.node.js.map +1 -0
  119. package/dist/nodes/llms/LmChatXAiGrok/logo.dark.svg +1 -0
  120. package/dist/nodes/llms/LmChatXAiGrok/logo.svg +1 -0
  121. package/dist/nodes/llms/N8nLlmTracing.d.ts +2 -2
  122. package/dist/nodes/llms/N8nLlmTracing.js +1 -1
  123. package/dist/nodes/llms/N8nLlmTracing.js.map +1 -1
  124. package/dist/nodes/memory/MemoryBufferWindow/MemoryBufferWindow.node.js +3 -2
  125. package/dist/nodes/memory/MemoryBufferWindow/MemoryBufferWindow.node.js.map +1 -1
  126. package/dist/nodes/memory/MemoryChatRetriever/MemoryChatRetriever.node.js +5 -4
  127. package/dist/nodes/memory/MemoryChatRetriever/MemoryChatRetriever.node.js.map +1 -1
  128. package/dist/nodes/memory/MemoryManager/MemoryManager.node.js +5 -4
  129. package/dist/nodes/memory/MemoryManager/MemoryManager.node.js.map +1 -1
  130. package/dist/nodes/memory/MemoryMotorhead/MemoryMotorhead.node.js +3 -2
  131. package/dist/nodes/memory/MemoryMotorhead/MemoryMotorhead.node.js.map +1 -1
  132. package/dist/nodes/memory/MemoryPostgresChat/MemoryPostgresChat.node.js +3 -2
  133. package/dist/nodes/memory/MemoryPostgresChat/MemoryPostgresChat.node.js.map +1 -1
  134. package/dist/nodes/memory/MemoryRedisChat/MemoryRedisChat.node.js +6 -3
  135. package/dist/nodes/memory/MemoryRedisChat/MemoryRedisChat.node.js.map +1 -1
  136. package/dist/nodes/memory/MemoryXata/MemoryXata.node.js +2 -2
  137. package/dist/nodes/memory/MemoryXata/MemoryXata.node.js.map +1 -1
  138. package/dist/nodes/memory/MemoryZep/MemoryZep.node.js +2 -2
  139. package/dist/nodes/memory/MemoryZep/MemoryZep.node.js.map +1 -1
  140. package/dist/nodes/output_parser/OutputParserAutofixing/OutputParserAutofixing.node.js +6 -6
  141. package/dist/nodes/output_parser/OutputParserAutofixing/OutputParserAutofixing.node.js.map +1 -1
  142. package/dist/nodes/output_parser/OutputParserItemList/OutputParserItemList.node.js +3 -2
  143. package/dist/nodes/output_parser/OutputParserItemList/OutputParserItemList.node.js.map +1 -1
  144. package/dist/nodes/output_parser/OutputParserStructured/OutputParserStructured.node.js +2 -2
  145. package/dist/nodes/output_parser/OutputParserStructured/OutputParserStructured.node.js.map +1 -1
  146. package/dist/nodes/retrievers/RetrieverContextualCompression/RetrieverContextualCompression.node.js +6 -5
  147. package/dist/nodes/retrievers/RetrieverContextualCompression/RetrieverContextualCompression.node.js.map +1 -1
  148. package/dist/nodes/retrievers/RetrieverMultiQuery/RetrieverMultiQuery.node.js +6 -5
  149. package/dist/nodes/retrievers/RetrieverMultiQuery/RetrieverMultiQuery.node.js.map +1 -1
  150. package/dist/nodes/retrievers/RetrieverVectorStore/RetrieverVectorStore.node.js +4 -3
  151. package/dist/nodes/retrievers/RetrieverVectorStore/RetrieverVectorStore.node.js.map +1 -1
  152. package/dist/nodes/retrievers/RetrieverWorkflow/RetrieverWorkflow.node.js +1 -1
  153. package/dist/nodes/retrievers/RetrieverWorkflow/RetrieverWorkflow.node.js.map +1 -1
  154. package/dist/nodes/text_splitters/TextSplitterCharacterTextSplitter/TextSplitterCharacterTextSplitter.node.js +3 -2
  155. package/dist/nodes/text_splitters/TextSplitterCharacterTextSplitter/TextSplitterCharacterTextSplitter.node.js.map +1 -1
  156. package/dist/nodes/text_splitters/TextSplitterRecursiveCharacterTextSplitter/TextSplitterRecursiveCharacterTextSplitter.node.js +3 -2
  157. package/dist/nodes/text_splitters/TextSplitterRecursiveCharacterTextSplitter/TextSplitterRecursiveCharacterTextSplitter.node.js.map +1 -1
  158. package/dist/nodes/text_splitters/TextSplitterTokenSplitter/TextSplitterTokenSplitter.node.js +3 -2
  159. package/dist/nodes/text_splitters/TextSplitterTokenSplitter/TextSplitterTokenSplitter.node.js.map +1 -1
  160. package/dist/nodes/tools/ToolCalculator/ToolCalculator.node.js +3 -2
  161. package/dist/nodes/tools/ToolCalculator/ToolCalculator.node.js.map +1 -1
  162. package/dist/nodes/tools/ToolCode/ToolCode.node.js +5 -5
  163. package/dist/nodes/tools/ToolCode/ToolCode.node.js.map +1 -1
  164. package/dist/nodes/tools/ToolHttpRequest/ToolHttpRequest.node.js +2 -2
  165. package/dist/nodes/tools/ToolHttpRequest/ToolHttpRequest.node.js.map +1 -1
  166. package/dist/nodes/tools/ToolHttpRequest/utils.js +3 -3
  167. package/dist/nodes/tools/ToolHttpRequest/utils.js.map +1 -1
  168. package/dist/nodes/tools/ToolSerpApi/ToolSerpApi.node.js +3 -2
  169. package/dist/nodes/tools/ToolSerpApi/ToolSerpApi.node.js.map +1 -1
  170. package/dist/nodes/tools/ToolVectorStore/ToolVectorStore.node.js +7 -6
  171. package/dist/nodes/tools/ToolVectorStore/ToolVectorStore.node.js.map +1 -1
  172. package/dist/nodes/tools/ToolWikipedia/ToolWikipedia.node.js +3 -2
  173. package/dist/nodes/tools/ToolWikipedia/ToolWikipedia.node.js.map +1 -1
  174. package/dist/nodes/tools/ToolWolframAlpha/ToolWolframAlpha.node.js +3 -2
  175. package/dist/nodes/tools/ToolWolframAlpha/ToolWolframAlpha.node.js.map +1 -1
  176. package/dist/nodes/tools/ToolWorkflow/v1/ToolWorkflowV1.node.js +3 -3
  177. package/dist/nodes/tools/ToolWorkflow/v1/ToolWorkflowV1.node.js.map +1 -1
  178. package/dist/nodes/tools/ToolWorkflow/v1/versionDescription.js +3 -2
  179. package/dist/nodes/tools/ToolWorkflow/v1/versionDescription.js.map +1 -1
  180. package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js +2 -2
  181. package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js.map +1 -1
  182. package/dist/nodes/tools/ToolWorkflow/v2/versionDescription.js +3 -2
  183. package/dist/nodes/tools/ToolWorkflow/v2/versionDescription.js.map +1 -1
  184. package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js +3 -3
  185. package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js.map +1 -1
  186. package/dist/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.js +2 -1
  187. package/dist/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.js.map +1 -1
  188. package/dist/nodes/vector_store/VectorStoreInMemory/VectorStoreInMemory.node.js +5 -5
  189. package/dist/nodes/vector_store/VectorStoreInMemory/VectorStoreInMemory.node.js.map +1 -1
  190. package/dist/nodes/vector_store/VectorStoreInMemoryInsert/VectorStoreInMemoryInsert.node.js +9 -8
  191. package/dist/nodes/vector_store/VectorStoreInMemoryInsert/VectorStoreInMemoryInsert.node.js.map +1 -1
  192. package/dist/nodes/vector_store/VectorStoreInMemoryLoad/VectorStoreInMemoryLoad.node.js +6 -5
  193. package/dist/nodes/vector_store/VectorStoreInMemoryLoad/VectorStoreInMemoryLoad.node.js.map +1 -1
  194. package/dist/nodes/vector_store/VectorStoreMongoDBAtlas/VectorStoreMongoDBAtlas.node.d.ts +16 -0
  195. package/dist/nodes/vector_store/VectorStoreMongoDBAtlas/VectorStoreMongoDBAtlas.node.js +244 -0
  196. package/dist/nodes/vector_store/VectorStoreMongoDBAtlas/VectorStoreMongoDBAtlas.node.js.map +1 -0
  197. package/dist/nodes/vector_store/VectorStoreMongoDBAtlas/mongodb.dark.svg +3 -0
  198. package/dist/nodes/vector_store/VectorStoreMongoDBAtlas/mongodb.svg +3 -0
  199. package/dist/nodes/vector_store/VectorStorePGVector/VectorStorePGVector.node.js +1 -1
  200. package/dist/nodes/vector_store/VectorStorePGVector/VectorStorePGVector.node.js.map +1 -1
  201. package/dist/nodes/vector_store/VectorStorePinecone/VectorStorePinecone.node.js +2 -2
  202. package/dist/nodes/vector_store/VectorStorePinecone/VectorStorePinecone.node.js.map +1 -1
  203. package/dist/nodes/vector_store/VectorStorePineconeInsert/VectorStorePineconeInsert.node.d.ts +1 -1
  204. package/dist/nodes/vector_store/VectorStorePineconeInsert/VectorStorePineconeInsert.node.js +8 -7
  205. package/dist/nodes/vector_store/VectorStorePineconeInsert/VectorStorePineconeInsert.node.js.map +1 -1
  206. package/dist/nodes/vector_store/VectorStorePineconeLoad/VectorStorePineconeLoad.node.d.ts +1 -1
  207. package/dist/nodes/vector_store/VectorStorePineconeLoad/VectorStorePineconeLoad.node.js +5 -4
  208. package/dist/nodes/vector_store/VectorStorePineconeLoad/VectorStorePineconeLoad.node.js.map +1 -1
  209. package/dist/nodes/vector_store/VectorStoreQdrant/VectorStoreQdrant.node.js +2 -2
  210. package/dist/nodes/vector_store/VectorStoreQdrant/VectorStoreQdrant.node.js.map +1 -1
  211. package/dist/nodes/vector_store/VectorStoreSupabase/VectorStoreSupabase.node.js +2 -2
  212. package/dist/nodes/vector_store/VectorStoreSupabase/VectorStoreSupabase.node.js.map +1 -1
  213. package/dist/nodes/vector_store/VectorStoreSupabaseInsert/VectorStoreSupabaseInsert.node.d.ts +1 -1
  214. package/dist/nodes/vector_store/VectorStoreSupabaseInsert/VectorStoreSupabaseInsert.node.js +8 -7
  215. package/dist/nodes/vector_store/VectorStoreSupabaseInsert/VectorStoreSupabaseInsert.node.js.map +1 -1
  216. package/dist/nodes/vector_store/VectorStoreSupabaseLoad/VectorStoreSupabaseLoad.node.d.ts +1 -1
  217. package/dist/nodes/vector_store/VectorStoreSupabaseLoad/VectorStoreSupabaseLoad.node.js +5 -4
  218. package/dist/nodes/vector_store/VectorStoreSupabaseLoad/VectorStoreSupabaseLoad.node.js.map +1 -1
  219. package/dist/nodes/vector_store/VectorStoreZep/VectorStoreZep.node.js +1 -1
  220. package/dist/nodes/vector_store/VectorStoreZep/VectorStoreZep.node.js.map +1 -1
  221. package/dist/nodes/vector_store/VectorStoreZepInsert/VectorStoreZepInsert.node.js +7 -6
  222. package/dist/nodes/vector_store/VectorStoreZepInsert/VectorStoreZepInsert.node.js.map +1 -1
  223. package/dist/nodes/vector_store/VectorStoreZepLoad/VectorStoreZepLoad.node.js +4 -3
  224. package/dist/nodes/vector_store/VectorStoreZepLoad/VectorStoreZepLoad.node.js.map +1 -1
  225. package/dist/nodes/vector_store/shared/MemoryManager/MemoryCalculator.d.ts +7 -0
  226. package/dist/nodes/vector_store/shared/MemoryManager/MemoryCalculator.js +50 -0
  227. package/dist/nodes/vector_store/shared/MemoryManager/MemoryCalculator.js.map +1 -0
  228. package/dist/nodes/vector_store/shared/MemoryManager/MemoryVectorStoreManager.d.ts +32 -0
  229. package/dist/nodes/vector_store/shared/MemoryManager/MemoryVectorStoreManager.js +173 -0
  230. package/dist/nodes/vector_store/shared/MemoryManager/MemoryVectorStoreManager.js.map +1 -0
  231. package/dist/nodes/vector_store/shared/MemoryManager/StoreCleanupService.d.ts +16 -0
  232. package/dist/nodes/vector_store/shared/MemoryManager/StoreCleanupService.js +95 -0
  233. package/dist/nodes/vector_store/shared/MemoryManager/StoreCleanupService.js.map +1 -0
  234. package/dist/nodes/vector_store/shared/MemoryManager/config.d.ts +4 -0
  235. package/dist/nodes/vector_store/shared/MemoryManager/config.js +38 -0
  236. package/dist/nodes/vector_store/shared/MemoryManager/config.js.map +1 -0
  237. package/dist/nodes/vector_store/shared/MemoryManager/types.d.ts +39 -0
  238. package/dist/nodes/vector_store/shared/MemoryManager/types.js +3 -0
  239. package/dist/nodes/vector_store/shared/MemoryManager/types.js.map +1 -0
  240. package/dist/nodes/vector_store/shared/createVectorStoreNode/constants.d.ts +4 -0
  241. package/dist/nodes/vector_store/shared/createVectorStoreNode/constants.js +45 -0
  242. package/dist/nodes/vector_store/shared/createVectorStoreNode/constants.js.map +1 -0
  243. package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.d.ts +15 -0
  244. package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.js +226 -0
  245. package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.js.map +1 -0
  246. package/dist/nodes/vector_store/shared/createVectorStoreNode/methods/listSearch.js.map +1 -0
  247. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/index.d.ts +5 -0
  248. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/index.js +22 -0
  249. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/index.js.map +1 -0
  250. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/insertOperation.d.ts +5 -0
  251. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/insertOperation.js +35 -0
  252. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/insertOperation.js.map +1 -0
  253. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/loadOperation.d.ts +5 -0
  254. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/loadOperation.js +33 -0
  255. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/loadOperation.js.map +1 -0
  256. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.d.ts +5 -0
  257. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js +42 -0
  258. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js.map +1 -0
  259. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.d.ts +5 -0
  260. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.js +16 -0
  261. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.js.map +1 -0
  262. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.d.ts +5 -0
  263. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.js +39 -0
  264. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.js.map +1 -0
  265. package/dist/nodes/vector_store/shared/{createVectorStoreNode.d.ts → createVectorStoreNode/types.d.ts} +3 -16
  266. package/dist/nodes/vector_store/shared/createVectorStoreNode/types.js +3 -0
  267. package/dist/nodes/vector_store/shared/createVectorStoreNode/types.js.map +1 -0
  268. package/dist/nodes/vector_store/shared/createVectorStoreNode/utils.d.ts +6 -0
  269. package/dist/nodes/vector_store/shared/createVectorStoreNode/utils.js +20 -0
  270. package/dist/nodes/vector_store/shared/createVectorStoreNode/utils.js.map +1 -0
  271. package/dist/nodes/vendors/OpenAi/actions/assistant/message.operation.js +1 -1
  272. package/dist/nodes/vendors/OpenAi/actions/assistant/message.operation.js.map +1 -1
  273. package/dist/nodes/vendors/OpenAi/actions/versionDescription.js +9 -8
  274. package/dist/nodes/vendors/OpenAi/actions/versionDescription.js.map +1 -1
  275. package/dist/nodes/vendors/OpenAi/methods/listSearch.js +2 -1
  276. package/dist/nodes/vendors/OpenAi/methods/listSearch.js.map +1 -1
  277. package/dist/types/credentials.json +1 -0
  278. package/dist/types/nodes.json +17 -15
  279. package/dist/utils/N8nTool.js +2 -2
  280. package/dist/utils/N8nTool.js.map +1 -1
  281. package/dist/utils/helpers.d.ts +1 -0
  282. package/dist/utils/helpers.js +13 -1
  283. package/dist/utils/helpers.js.map +1 -1
  284. package/dist/utils/logWrapper.d.ts +1 -2
  285. package/dist/utils/logWrapper.js +12 -12
  286. package/dist/utils/logWrapper.js.map +1 -1
  287. package/dist/utils/output_parsers/N8nOutputFixingParser.js +11 -5
  288. package/dist/utils/output_parsers/N8nOutputFixingParser.js.map +1 -1
  289. package/dist/utils/output_parsers/N8nOutputParser.d.ts +1 -1
  290. package/dist/utils/output_parsers/N8nOutputParser.js +6 -5
  291. package/dist/utils/output_parsers/N8nOutputParser.js.map +1 -1
  292. package/dist/utils/output_parsers/N8nStructuredOutputParser.js +5 -4
  293. package/dist/utils/output_parsers/N8nStructuredOutputParser.js.map +1 -1
  294. package/dist/utils/sharedFields.d.ts +2 -2
  295. package/dist/utils/sharedFields.js +9 -8
  296. package/dist/utils/sharedFields.js.map +1 -1
  297. package/package.json +10 -5
  298. package/dist/nodes/chains/ChainLLM/utils.d.ts +0 -5
  299. package/dist/nodes/chains/ChainLLM/utils.js +0 -14
  300. package/dist/nodes/chains/ChainLLM/utils.js.map +0 -1
  301. package/dist/nodes/vector_store/shared/MemoryVectorStoreManager.d.ts +0 -12
  302. package/dist/nodes/vector_store/shared/MemoryVectorStoreManager.js +0 -40
  303. package/dist/nodes/vector_store/shared/MemoryVectorStoreManager.js.map +0 -1
  304. package/dist/nodes/vector_store/shared/createVectorStoreNode.js +0 -369
  305. package/dist/nodes/vector_store/shared/createVectorStoreNode.js.map +0 -1
  306. package/dist/nodes/vector_store/shared/methods/listSearch.js.map +0 -1
  307. /package/dist/nodes/vector_store/shared/{methods → createVectorStoreNode/methods}/listSearch.d.ts +0 -0
  308. /package/dist/nodes/vector_store/shared/{methods → createVectorStoreNode/methods}/listSearch.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ChainLlm.node.js","sourceRoot":"","sources":["../../../../nodes/chains/ChainLLM/ChainLlm.node.ts"],"names":[],"mappings":";;;AAEA,uDAAwD;AACxD,qDAMiC;AACjC,0DAAiE;AACjE,8CAA+C;AAC/C,6CAA4C;AAC5C,6DAAiE;AASjE,+CAKsB;AAEtB,sDAA8E;AAC9E,4CAAsE;AAEtE,2EAAiF;AACjF,sDAA6D;AAC7D,4CAAkD;AAElD,mCAAyE;AACzE,gFAGqD;AAWrD,KAAK,UAAU,eAAe,CAC7B,OAA0B,EAC1B,SAAiB,EACjB,OAAyB;IAEzB,IAAI,OAAO,CAAC,WAAW,KAAK,aAAa,IAAI,OAAO,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;QAEjF,MAAM,IAAI,iCAAkB,CAC3B,OAAO,CAAC,OAAO,EAAE,EACjB,mEAAmE,CACnE,CAAC;IACH,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAChF,IAAI,OAAO,CAA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,2BAAY,IAAI,IAAA,8BAAa,EAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;oBACjE,MAAM,eAAe,GAAwB,KAAK,CAAC,KAAa,CAAC,KAAK,EAAE,IAAI,CAAC;oBAC7E,IAAI,eAAe,EAAE,CAAC;wBACrB,MAAM,aAAa,GAAG,IAAA,sCAA2B,EAAC,eAAe,CAAC,CAAC;wBACnE,IAAI,aAAa,EAAE,CAAC;4BACnB,KAAK,CAAC,OAAO,GAAG,aAAa,CAAC;wBAC/B,CAAC;oBACF,CAAC;gBACF,CAAC;gBAGD,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;oBACrF,SAAS;gBACV,CAAC;gBAED,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAvHD,4BAuHC"}
@@ -0,0 +1,2 @@
1
+ import type { ChainExecutionParams } from './types';
2
+ export declare function executeChain({ context, itemIndex, query, llm, outputParser, messages, }: ChainExecutionParams): Promise<unknown[]>;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeChain = executeChain;
4
+ const output_parsers_1 = require("@langchain/core/output_parsers");
5
+ const tracing_1 = require("../../../../utils/tracing");
6
+ const promptUtils_1 = require("./promptUtils");
7
+ async function executeSimpleChain({ context, llm, query, prompt, }) {
8
+ const chain = prompt
9
+ .pipe(llm)
10
+ .pipe(new output_parsers_1.StringOutputParser())
11
+ .withConfig((0, tracing_1.getTracingConfig)(context));
12
+ const response = await chain.invoke({
13
+ query,
14
+ signal: context.getExecutionCancelSignal(),
15
+ });
16
+ return [response];
17
+ }
18
+ async function executeChain({ context, itemIndex, query, llm, outputParser, messages, }) {
19
+ if (!outputParser) {
20
+ const promptTemplate = await (0, promptUtils_1.createPromptTemplate)({
21
+ context,
22
+ itemIndex,
23
+ llm,
24
+ messages,
25
+ query,
26
+ });
27
+ return await executeSimpleChain({
28
+ context,
29
+ llm,
30
+ query,
31
+ prompt: promptTemplate,
32
+ });
33
+ }
34
+ const formatInstructions = outputParser.getFormatInstructions();
35
+ const promptWithInstructions = await (0, promptUtils_1.createPromptTemplate)({
36
+ context,
37
+ itemIndex,
38
+ llm,
39
+ messages,
40
+ formatInstructions,
41
+ query,
42
+ });
43
+ const chain = promptWithInstructions
44
+ .pipe(llm)
45
+ .pipe(outputParser)
46
+ .withConfig((0, tracing_1.getTracingConfig)(context));
47
+ const response = await chain.invoke({ query }, { signal: context.getExecutionCancelSignal() });
48
+ return Array.isArray(response) ? response : [response];
49
+ }
50
+ //# sourceMappingURL=chainExecutor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chainExecutor.js","sourceRoot":"","sources":["../../../../../nodes/chains/ChainLLM/methods/chainExecutor.ts"],"names":[],"mappings":";;AA0CA,oCA+CC;AAxFD,mEAAoE;AAIpE,4CAAkD;AAElD,+CAAqD;AAMrD,KAAK,UAAU,kBAAkB,CAAC,EACjC,OAAO,EACP,GAAG,EACH,KAAK,EACL,MAAM,GAMN;IACA,MAAM,KAAK,GAAG,MAAM;SAClB,IAAI,CAAC,GAAG,CAAC;SACT,IAAI,CAAC,IAAI,mCAAkB,EAAE,CAAC;SAC9B,UAAU,CAAC,IAAA,0BAAgB,EAAC,OAAO,CAAC,CAAC,CAAC;IAGxC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC;QACnC,KAAK;QACL,MAAM,EAAE,OAAO,CAAC,wBAAwB,EAAE;KAC1C,CAAC,CAAC;IAGH,OAAO,CAAC,QAAQ,CAAC,CAAC;AACnB,CAAC;AAKM,KAAK,UAAU,YAAY,CAAC,EAClC,OAAO,EACP,SAAS,EACT,KAAK,EACL,GAAG,EACH,YAAY,EACZ,QAAQ,GACc;IAEtB,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,MAAM,cAAc,GAAG,MAAM,IAAA,kCAAoB,EAAC;YACjD,OAAO;YACP,SAAS;YACT,GAAG;YACH,QAAQ;YACR,KAAK;SACL,CAAC,CAAC;QAEH,OAAO,MAAM,kBAAkB,CAAC;YAC/B,OAAO;YACP,GAAG;YACH,KAAK;YACL,MAAM,EAAE,cAAc;SACtB,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,kBAAkB,GAAG,YAAY,CAAC,qBAAqB,EAAE,CAAC;IAGhE,MAAM,sBAAsB,GAAG,MAAM,IAAA,kCAAoB,EAAC;QACzD,OAAO;QACP,SAAS;QACT,GAAG;QACH,QAAQ;QACR,kBAAkB;QAClB,KAAK;KACL,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,sBAAsB;SAClC,IAAI,CAAC,GAAG,CAAC;SACT,IAAI,CAAC,YAAY,CAAC;SAClB,UAAU,CAAC,IAAA,0BAAgB,EAAC,OAAO,CAAC,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC;IAI/F,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { IDataObject, INodeInputConfiguration, INodeProperties } from 'n8n-workflow';
2
+ export declare function getInputs(parameters: IDataObject): INodeInputConfiguration[];
3
+ export declare const nodeProperties: INodeProperties[];
@@ -0,0 +1,254 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nodeProperties = void 0;
4
+ exports.getInputs = getInputs;
5
+ const prompts_1 = require("@langchain/core/prompts");
6
+ const n8n_workflow_1 = require("n8n-workflow");
7
+ const descriptions_1 = require("../../../../utils/descriptions");
8
+ const sharedFields_1 = require("../../../../utils/sharedFields");
9
+ function getInputs(parameters) {
10
+ const inputs = [
11
+ { displayName: '', type: 'main' },
12
+ {
13
+ displayName: 'Model',
14
+ maxConnections: 1,
15
+ type: 'ai_languageModel',
16
+ required: true,
17
+ },
18
+ ];
19
+ const hasOutputParser = parameters?.hasOutputParser;
20
+ if (hasOutputParser === undefined || hasOutputParser === true) {
21
+ inputs.push({
22
+ displayName: 'Output Parser',
23
+ type: 'ai_outputParser',
24
+ maxConnections: 1,
25
+ required: false,
26
+ });
27
+ }
28
+ return inputs;
29
+ }
30
+ exports.nodeProperties = [
31
+ (0, sharedFields_1.getTemplateNoticeField)(1978),
32
+ {
33
+ displayName: 'Prompt',
34
+ name: 'prompt',
35
+ type: 'string',
36
+ required: true,
37
+ default: '={{ $json.input }}',
38
+ displayOptions: {
39
+ show: {
40
+ '@version': [1],
41
+ },
42
+ },
43
+ },
44
+ {
45
+ displayName: 'Prompt',
46
+ name: 'prompt',
47
+ type: 'string',
48
+ required: true,
49
+ default: '={{ $json.chat_input }}',
50
+ displayOptions: {
51
+ show: {
52
+ '@version': [1.1, 1.2],
53
+ },
54
+ },
55
+ },
56
+ {
57
+ displayName: 'Prompt',
58
+ name: 'prompt',
59
+ type: 'string',
60
+ required: true,
61
+ default: '={{ $json.chatInput }}',
62
+ displayOptions: {
63
+ show: {
64
+ '@version': [1.3],
65
+ },
66
+ },
67
+ },
68
+ {
69
+ ...descriptions_1.promptTypeOptions,
70
+ displayOptions: {
71
+ hide: {
72
+ '@version': [1, 1.1, 1.2, 1.3],
73
+ },
74
+ },
75
+ },
76
+ {
77
+ ...descriptions_1.textFromPreviousNode,
78
+ displayOptions: { show: { promptType: ['auto'], '@version': [{ _cnd: { gte: 1.5 } }] } },
79
+ },
80
+ {
81
+ displayName: 'Prompt (User Message)',
82
+ name: 'text',
83
+ type: 'string',
84
+ required: true,
85
+ default: '',
86
+ placeholder: 'e.g. Hello, how can you help me?',
87
+ typeOptions: {
88
+ rows: 2,
89
+ },
90
+ displayOptions: {
91
+ show: {
92
+ promptType: ['define'],
93
+ },
94
+ },
95
+ },
96
+ {
97
+ displayName: 'Require Specific Output Format',
98
+ name: 'hasOutputParser',
99
+ type: 'boolean',
100
+ default: false,
101
+ noDataExpression: true,
102
+ displayOptions: {
103
+ hide: {
104
+ '@version': [1, 1.1, 1.3],
105
+ },
106
+ },
107
+ },
108
+ {
109
+ displayName: 'Chat Messages (if Using a Chat Model)',
110
+ name: 'messages',
111
+ type: 'fixedCollection',
112
+ typeOptions: {
113
+ multipleValues: true,
114
+ },
115
+ default: {},
116
+ placeholder: 'Add prompt',
117
+ options: [
118
+ {
119
+ name: 'messageValues',
120
+ displayName: 'Prompt',
121
+ values: [
122
+ {
123
+ displayName: 'Type Name or ID',
124
+ name: 'type',
125
+ type: 'options',
126
+ options: [
127
+ {
128
+ name: 'AI',
129
+ value: prompts_1.AIMessagePromptTemplate.lc_name(),
130
+ },
131
+ {
132
+ name: 'System',
133
+ value: prompts_1.SystemMessagePromptTemplate.lc_name(),
134
+ },
135
+ {
136
+ name: 'User',
137
+ value: prompts_1.HumanMessagePromptTemplate.lc_name(),
138
+ },
139
+ ],
140
+ default: prompts_1.SystemMessagePromptTemplate.lc_name(),
141
+ },
142
+ {
143
+ displayName: 'Message Type',
144
+ name: 'messageType',
145
+ type: 'options',
146
+ displayOptions: {
147
+ show: {
148
+ type: [prompts_1.HumanMessagePromptTemplate.lc_name()],
149
+ },
150
+ },
151
+ options: [
152
+ {
153
+ name: 'Text',
154
+ value: 'text',
155
+ description: 'Simple text message',
156
+ },
157
+ {
158
+ name: 'Image (Binary)',
159
+ value: 'imageBinary',
160
+ description: 'Process the binary input from the previous node',
161
+ },
162
+ {
163
+ name: 'Image (URL)',
164
+ value: 'imageUrl',
165
+ description: 'Process the image from the specified URL',
166
+ },
167
+ ],
168
+ default: 'text',
169
+ },
170
+ {
171
+ displayName: 'Image Data Field Name',
172
+ name: 'binaryImageDataKey',
173
+ type: 'string',
174
+ default: 'data',
175
+ required: true,
176
+ description: "The name of the field in the chain's input that contains the binary image file to be processed",
177
+ displayOptions: {
178
+ show: {
179
+ messageType: ['imageBinary'],
180
+ },
181
+ },
182
+ },
183
+ {
184
+ displayName: 'Image URL',
185
+ name: 'imageUrl',
186
+ type: 'string',
187
+ default: '',
188
+ required: true,
189
+ description: 'URL to the image to be processed',
190
+ displayOptions: {
191
+ show: {
192
+ messageType: ['imageUrl'],
193
+ },
194
+ },
195
+ },
196
+ {
197
+ displayName: 'Image Details',
198
+ description: 'Control how the model processes the image and generates its textual understanding',
199
+ name: 'imageDetail',
200
+ type: 'options',
201
+ displayOptions: {
202
+ show: {
203
+ type: [prompts_1.HumanMessagePromptTemplate.lc_name()],
204
+ messageType: ['imageBinary', 'imageUrl'],
205
+ },
206
+ },
207
+ options: [
208
+ {
209
+ name: 'Auto',
210
+ value: 'auto',
211
+ description: 'Model will use the auto setting which will look at the image input size and decide if it should use the low or high setting',
212
+ },
213
+ {
214
+ name: 'Low',
215
+ value: 'low',
216
+ description: 'The model will receive a low-res 512px x 512px version of the image, and represent the image with a budget of 65 tokens. This allows the API to return faster responses and consume fewer input tokens for use cases that do not require high detail.',
217
+ },
218
+ {
219
+ name: 'High',
220
+ value: 'high',
221
+ description: 'Allows the model to see the low res image and then creates detailed crops of input images as 512px squares based on the input image size. Each of the detailed crops uses twice the token budget (65 tokens) for a total of 129 tokens.',
222
+ },
223
+ ],
224
+ default: 'auto',
225
+ },
226
+ {
227
+ displayName: 'Message',
228
+ name: 'message',
229
+ type: 'string',
230
+ required: true,
231
+ displayOptions: {
232
+ hide: {
233
+ messageType: ['imageBinary', 'imageUrl'],
234
+ },
235
+ },
236
+ default: '',
237
+ },
238
+ ],
239
+ },
240
+ ],
241
+ },
242
+ {
243
+ displayName: `Connect an <a data-action='openSelectiveNodeCreator' data-action-parameter-connectiontype='${n8n_workflow_1.NodeConnectionTypes.AiOutputParser}'>output parser</a> on the canvas to specify the output format you require`,
244
+ name: 'notice',
245
+ type: 'notice',
246
+ default: '',
247
+ displayOptions: {
248
+ show: {
249
+ hasOutputParser: [true],
250
+ },
251
+ },
252
+ },
253
+ ];
254
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../nodes/chains/ChainLLM/methods/config.ts"],"names":[],"mappings":";;;AAcA,8BAwBC;AAtCD,qDAIiC;AAEjC,+CAAmD;AAEnD,sDAA8E;AAC9E,sDAA6D;AAK7D,SAAgB,SAAS,CAAC,UAAuB;IAChD,MAAM,MAAM,GAA8B;QACzC,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;QACjC;YACC,WAAW,EAAE,OAAO;YACpB,cAAc,EAAE,CAAC;YACjB,IAAI,EAAE,kBAAkB;YACxB,QAAQ,EAAE,IAAI;SACd;KACD,CAAC;IAIF,MAAM,eAAe,GAAG,UAAU,EAAE,eAAe,CAAC;IACpD,IAAI,eAAe,KAAK,SAAS,IAAI,eAAe,KAAK,IAAI,EAAE,CAAC;QAC/D,MAAM,CAAC,IAAI,CAAC;YACX,WAAW,EAAE,eAAe;YAC5B,IAAI,EAAE,iBAAiB;YACvB,cAAc,EAAE,CAAC;YACjB,QAAQ,EAAE,KAAK;SACf,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAKY,QAAA,cAAc,GAAsB;IAChD,IAAA,qCAAsB,EAAC,IAAI,CAAC;IAC5B;QACC,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,oBAAoB;QAC7B,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,UAAU,EAAE,CAAC,CAAC,CAAC;aACf;SACD;KACD;IACD;QACC,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;wBACd,cAAc,EAAE;4BACf,IAAI,EAAE;gCACL,WAAW,EAAE,CAAC,aAAa,EAAE,UAAU,CAAC;6BACxC;yBACD;wBACD,OAAO,EAAE,EAAE;qBACX;iBACD;aACD;SACD;KACD;IACD;QACC,WAAW,EAAE,8FAA8F,kCAAmB,CAAC,cAAc,4EAA4E;QACzN,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,eAAe,EAAE,CAAC,IAAI,CAAC;aACvB;SACD;KACD;CACD,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { HumanMessage } from '@langchain/core/messages';
2
+ import type { IExecuteFunctions, IBinaryData } from 'n8n-workflow';
3
+ import { OperationalError } from 'n8n-workflow';
4
+ import type { MessageTemplate } from './types';
5
+ export declare class UnsupportedMimeTypeError extends OperationalError {
6
+ }
7
+ export declare function dataUriFromImageData(binaryData: IBinaryData, bufferData: Buffer): string;
8
+ export declare function createImageMessage({ context, itemIndex, message, }: {
9
+ context: IExecuteFunctions;
10
+ itemIndex: number;
11
+ message: MessageTemplate;
12
+ }): Promise<HumanMessage>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnsupportedMimeTypeError = void 0;
4
+ exports.dataUriFromImageData = dataUriFromImageData;
5
+ exports.createImageMessage = createImageMessage;
6
+ const messages_1 = require("@langchain/core/messages");
7
+ const google_genai_1 = require("@langchain/google-genai");
8
+ const ollama_1 = require("@langchain/ollama");
9
+ const n8n_workflow_1 = require("n8n-workflow");
10
+ class UnsupportedMimeTypeError extends n8n_workflow_1.OperationalError {
11
+ }
12
+ exports.UnsupportedMimeTypeError = UnsupportedMimeTypeError;
13
+ function dataUriFromImageData(binaryData, bufferData) {
14
+ if (!binaryData.mimeType?.startsWith('image/')) {
15
+ throw new UnsupportedMimeTypeError(`${binaryData.mimeType} is not a supported type of binary data. Only images are supported.`);
16
+ }
17
+ return `data:${binaryData.mimeType};base64,${bufferData.toString('base64')}`;
18
+ }
19
+ async function createImageMessage({ context, itemIndex, message, }) {
20
+ if (message.messageType !== 'imageBinary' && message.messageType !== 'imageUrl') {
21
+ throw new n8n_workflow_1.NodeOperationError(context.getNode(), 'Invalid message type. Only imageBinary and imageUrl are supported');
22
+ }
23
+ const detail = message.imageDetail === 'auto' ? undefined : message.imageDetail;
24
+ if (message.messageType === 'imageUrl' && message.imageUrl) {
25
+ return new messages_1.HumanMessage({
26
+ content: [
27
+ {
28
+ type: 'image_url',
29
+ image_url: {
30
+ url: message.imageUrl,
31
+ detail,
32
+ },
33
+ },
34
+ ],
35
+ });
36
+ }
37
+ const binaryDataKey = message.binaryImageDataKey ?? 'data';
38
+ const inputData = context.getInputData()[itemIndex];
39
+ const binaryData = inputData.binary?.[binaryDataKey];
40
+ if (!binaryData) {
41
+ throw new n8n_workflow_1.NodeOperationError(context.getNode(), 'No binary data set.');
42
+ }
43
+ const bufferData = await context.helpers.getBinaryDataBuffer(itemIndex, binaryDataKey);
44
+ const model = (await context.getInputConnectionData(n8n_workflow_1.NodeConnectionTypes.AiLanguageModel, 0));
45
+ try {
46
+ const dataURI = dataUriFromImageData(binaryData, bufferData);
47
+ const directUriModels = [google_genai_1.ChatGoogleGenerativeAI, ollama_1.ChatOllama];
48
+ const imageUrl = directUriModels.some((i) => model instanceof i)
49
+ ? dataURI
50
+ : { url: dataURI, detail };
51
+ return new messages_1.HumanMessage({
52
+ content: [
53
+ {
54
+ type: 'image_url',
55
+ image_url: imageUrl,
56
+ },
57
+ ],
58
+ });
59
+ }
60
+ catch (error) {
61
+ if (error instanceof UnsupportedMimeTypeError)
62
+ throw new n8n_workflow_1.NodeOperationError(context.getNode(), error.message);
63
+ throw error;
64
+ }
65
+ }
66
+ //# sourceMappingURL=imageUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imageUtils.js","sourceRoot":"","sources":["../../../../../nodes/chains/ChainL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 export { getInputs, nodeProperties } from './config';
3
+ export { formatResponse } from './responseFormatter';
4
+ export type { MessageTemplate } from './types';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatResponse = exports.nodeProperties = exports.getInputs = exports.executeChain = void 0;
4
+ var chainExecutor_1 = require("./chainExecutor");
5
+ Object.defineProperty(exports, "executeChain", { enumerable: true, get: function () { return chainExecutor_1.executeChain; } });
6
+ var config_1 = require("./config");
7
+ Object.defineProperty(exports, "getInputs", { enumerable: true, get: function () { return config_1.getInputs; } });
8
+ Object.defineProperty(exports, "nodeProperties", { enumerable: true, get: function () { return config_1.nodeProperties; } });
9
+ var responseFormatter_1 = require("./responseFormatter");
10
+ Object.defineProperty(exports, "formatResponse", { enumerable: true, get: function () { return responseFormatter_1.formatResponse; } });
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/chains/ChainLLM/methods/index.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,mCAAqD;AAA5C,mGAAA,SAAS,OAAA;AAAE,wGAAA,cAAc,OAAA;AAClC,yDAAqD;AAA5C,mHAAA,cAAc,OAAA"}
@@ -0,0 +1,3 @@
1
+ import { PromptTemplate, ChatPromptTemplate } from '@langchain/core/prompts';
2
+ import type { PromptParams } from './types';
3
+ export declare function createPromptTemplate({ context, itemIndex, llm, messages, formatInstructions, query, }: PromptParams): Promise<PromptTemplate<any, any> | ChatPromptTemplate<any, any>>;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPromptTemplate = createPromptTemplate;
4
+ const messages_1 = require("@langchain/core/messages");
5
+ const prompts_1 = require("@langchain/core/prompts");
6
+ const n8n_workflow_1 = require("n8n-workflow");
7
+ const helpers_1 = require("../../../../utils/helpers");
8
+ const imageUtils_1 = require("./imageUtils");
9
+ function buildQueryTemplate(formatInstructions) {
10
+ return new prompts_1.PromptTemplate({
11
+ template: `{query}${formatInstructions ? '\n{formatInstructions}' : ''}`,
12
+ inputVariables: ['query'],
13
+ partialVariables: formatInstructions ? { formatInstructions } : undefined,
14
+ });
15
+ }
16
+ async function processMessageTemplates({ context, itemIndex, messages, }) {
17
+ return await Promise.all(messages.map(async (message) => {
18
+ const messageClass = [
19
+ prompts_1.SystemMessagePromptTemplate,
20
+ prompts_1.AIMessagePromptTemplate,
21
+ prompts_1.HumanMessagePromptTemplate,
22
+ ].find((m) => m.lc_name() === message.type);
23
+ if (!messageClass) {
24
+ throw new n8n_workflow_1.OperationalError('Invalid message type', {
25
+ extra: { messageType: message.type },
26
+ });
27
+ }
28
+ if (messageClass === prompts_1.HumanMessagePromptTemplate && message.messageType !== 'text') {
29
+ return await (0, imageUtils_1.createImageMessage)({ context, itemIndex, message });
30
+ }
31
+ return messageClass.fromTemplate((message.message || '').replace(/[{}]/g, (match) => match + match));
32
+ }));
33
+ }
34
+ async function finalizePromptTemplate({ parsedMessages, queryTemplate, query, }) {
35
+ const lastMessage = parsedMessages[parsedMessages.length - 1];
36
+ if (lastMessage instanceof messages_1.HumanMessage && Array.isArray(lastMessage.content)) {
37
+ const humanMessage = new prompts_1.HumanMessagePromptTemplate(queryTemplate);
38
+ const formattedMessage = await humanMessage.format({ query });
39
+ if (Array.isArray(lastMessage.content)) {
40
+ const updatedContent = [
41
+ ...lastMessage.content,
42
+ {
43
+ text: formattedMessage.content.toString(),
44
+ type: 'text',
45
+ },
46
+ ];
47
+ lastMessage.content = updatedContent;
48
+ }
49
+ }
50
+ else {
51
+ parsedMessages.push(new prompts_1.HumanMessagePromptTemplate(queryTemplate));
52
+ }
53
+ return prompts_1.ChatPromptTemplate.fromMessages(parsedMessages);
54
+ }
55
+ async function createPromptTemplate({ context, itemIndex, llm, messages, formatInstructions, query, }) {
56
+ const queryTemplate = buildQueryTemplate(formatInstructions);
57
+ if (!(0, helpers_1.isChatInstance)(llm)) {
58
+ return queryTemplate;
59
+ }
60
+ const parsedMessages = messages?.length
61
+ ? await processMessageTemplates({ context, itemIndex, messages })
62
+ : [];
63
+ return await finalizePromptTemplate({
64
+ parsedMessages,
65
+ queryTemplate,
66
+ query,
67
+ });
68
+ }
69
+ //# sourceMappingURL=promptUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promptUtils.js","sourceRoot":"","sources":["../../../../../nodes/chains/ChainLLM/methods/promptUtils.ts"],"names":[],"mappings":";;AAqHA,oDA2BC;AAhJD,uDAAwD;AAExD,qDAMiC;AAEjC,+CAAgD;AAEhD,4CAAgD;AAEhD,6CAAkD;AAMlD,SAAS,kBAAkB,CAAC,kBAA2B;IACtD,OAAO,IAAI,wBAAc,CAAC;QACzB,QAAQ,EAAE,UAAU,kBAAkB,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,EAAE;QACxE,cAAc,EAAE,CAAC,OAAO,CAAC;QACzB,gBAAgB,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,SAAS;KACzE,CAAC,CAAC;AACJ,CAAC;AAKD,KAAK,UAAU,uBAAuB,CAAC,EACtC,OAAO,EACP,SAAS,EACT,QAAQ,GAKR;IACA,OAAO,MAAM,OAAO,CAAC,GAAG,CACvB,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAE9B,MAAM,YAAY,GAAG;YACpB,qCAA2B;YAC3B,iCAAuB;YACvB,oCAA0B;SAC1B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QAE5C,IAAI,CAAC,YAAY,EAAE,CAAC;YACnB,MAAM,IAAI,+BAAgB,CAAC,sBAAsB,EAAE;gBAClD,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,IAAI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AAC;IAED,OAAO,4BAAkB,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;AACxD,CAAC;AAMM,KAAK,UAAU,oBAAoB,CAAC,EAC1C,OAAO,EACP,SAAS,EACT,GAAG,EACH,QAAQ,EACR,kBAAkB,EAClB,KAAK,GACS;IAEd,MAAM,aAAa,GAAG,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;IAG7D,IAAI,CAAC,IAAA,wBAAc,EAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,aAAa,CAAC;IACtB,CAAC;IAGD,MAAM,cAAc,GAAG,QAAQ,EAAE,MAAM;QACtC,CAAC,CAAC,MAAM,uBAAuB,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;QACjE,CAAC,CAAC,EAAE,CAAC;IAGN,OAAO,MAAM,sBAAsB,CAAC;QACnC,cAAc;QACd,aAAa;QACb,KAAK;KACL,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { IDataObject } from 'n8n-workflow';
2
+ export declare function formatResponse(response: unknown): IDataObject;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatResponse = formatResponse;
4
+ function formatResponse(response) {
5
+ if (typeof response === 'string') {
6
+ return {
7
+ response: {
8
+ text: response.trim(),
9
+ },
10
+ };
11
+ }
12
+ if (Array.isArray(response)) {
13
+ return {
14
+ data: response,
15
+ };
16
+ }
17
+ if (response instanceof Object) {
18
+ return response;
19
+ }
20
+ return {
21
+ response: {
22
+ text: response,
23
+ },
24
+ };
25
+ }
26
+ //# sourceMappingURL=responseFormatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responseFormatter.js","sourceRoot":"","sources":["../../../../../nodes/chains/ChainLLM/methods/responseFormatter.ts"],"names":[],"mappings":";;AAKA,wCAwBC;AAxBD,SAAgB,cAAc,CAAC,QAAiB;IAC/C,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO;YACN,QAAQ,EAAE;gBACT,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE;aACrB;SACD,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,OAAO;YACN,IAAI,EAAE,QAAQ;SACd,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,YAAY,MAAM,EAAE,CAAC;QAChC,OAAO,QAAuB,CAAC;IAChC,CAAC;IAED,OAAO;QACN,QAAQ,EAAE;YACT,IAAI,EAAE,QAAQ;SACd;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { BaseLanguageModel } from '@langchain/core/language_models/base';
2
+ import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
3
+ import type { IExecuteFunctions } from 'n8n-workflow';
4
+ import type { N8nOutputParser } from '../../../../utils/output_parsers/N8nOutputParser';
5
+ export interface MessageTemplate {
6
+ type: string;
7
+ message: string;
8
+ messageType: 'text' | 'imageBinary' | 'imageUrl';
9
+ binaryImageDataKey?: string;
10
+ imageUrl?: string;
11
+ imageDetail?: 'auto' | 'low' | 'high';
12
+ }
13
+ export interface PromptParams {
14
+ context: IExecuteFunctions;
15
+ itemIndex: number;
16
+ llm: BaseLanguageModel | BaseChatModel;
17
+ messages?: MessageTemplate[];
18
+ formatInstructions?: string;
19
+ query?: string;
20
+ }
21
+ export interface ChainExecutionParams {
22
+ context: IExecuteFunctions;
23
+ itemIndex: number;
24
+ query: string;
25
+ llm: BaseLanguageModel;
26
+ outputParser?: N8nOutputParser;
27
+ messages?: MessageTemplate[];
28
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../nodes/chains/ChainLLM/methods/types.ts"],"names":[],"mappings":""}