@kyuda/n8n-nodes-databricks 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @kyuda/n8n-nodes-databricks might be problematic. Click here for more details.
- package/LICENSE.md +19 -0
- package/README.md +478 -0
- package/dist/credentials/Databricks.credentials.d.ts +10 -0
- package/dist/credentials/Databricks.credentials.js +51 -0
- package/dist/credentials/Databricks.credentials.js.map +1 -0
- package/dist/credentials/databricks.svg +19 -0
- package/dist/nodes/Databricks/Databricks.node.d.ts +16 -0
- package/dist/nodes/Databricks/Databricks.node.js +1719 -0
- package/dist/nodes/Databricks/Databricks.node.js.map +1 -0
- package/dist/nodes/Databricks/databricks.dark.svg +19 -0
- package/dist/nodes/Databricks/databricks.svg +19 -0
- package/dist/nodes/Databricks/resources/databricksSql/operations.d.ts +2 -0
- package/dist/nodes/Databricks/resources/databricksSql/operations.js +24 -0
- package/dist/nodes/Databricks/resources/databricksSql/operations.js.map +1 -0
- package/dist/nodes/Databricks/resources/databricksSql/parameters.d.ts +2 -0
- package/dist/nodes/Databricks/resources/databricksSql/parameters.js +94 -0
- package/dist/nodes/Databricks/resources/databricksSql/parameters.js.map +1 -0
- package/dist/nodes/Databricks/resources/databricksSql.d.ts +3 -0
- package/dist/nodes/Databricks/resources/databricksSql.js +130 -0
- package/dist/nodes/Databricks/resources/databricksSql.js.map +1 -0
- package/dist/nodes/Databricks/resources/files/operations.d.ts +2 -0
- package/dist/nodes/Databricks/resources/files/operations.js +71 -0
- package/dist/nodes/Databricks/resources/files/operations.js.map +1 -0
- package/dist/nodes/Databricks/resources/files/parameters.d.ts +2 -0
- package/dist/nodes/Databricks/resources/files/parameters.js +124 -0
- package/dist/nodes/Databricks/resources/files/parameters.js.map +1 -0
- package/dist/nodes/Databricks/resources/files.d.ts +3 -0
- package/dist/nodes/Databricks/resources/files.js +183 -0
- package/dist/nodes/Databricks/resources/files.js.map +1 -0
- package/dist/nodes/Databricks/resources/genie/operations.d.ts +2 -0
- package/dist/nodes/Databricks/resources/genie/operations.js +96 -0
- package/dist/nodes/Databricks/resources/genie/operations.js.map +1 -0
- package/dist/nodes/Databricks/resources/genie/parameters.d.ts +2 -0
- package/dist/nodes/Databricks/resources/genie/parameters.js +96 -0
- package/dist/nodes/Databricks/resources/genie/parameters.js.map +1 -0
- package/dist/nodes/Databricks/resources/index.d.ts +12 -0
- package/dist/nodes/Databricks/resources/index.js +29 -0
- package/dist/nodes/Databricks/resources/index.js.map +1 -0
- package/dist/nodes/Databricks/resources/modelServing/operations.d.ts +2 -0
- package/dist/nodes/Databricks/resources/modelServing/operations.js +24 -0
- package/dist/nodes/Databricks/resources/modelServing/operations.js.map +1 -0
- package/dist/nodes/Databricks/resources/modelServing/parameters.d.ts +2 -0
- package/dist/nodes/Databricks/resources/modelServing/parameters.js +76 -0
- package/dist/nodes/Databricks/resources/modelServing/parameters.js.map +1 -0
- package/dist/nodes/Databricks/resources/modelServing.d.ts +3 -0
- package/dist/nodes/Databricks/resources/modelServing.js +176 -0
- package/dist/nodes/Databricks/resources/modelServing.js.map +1 -0
- package/dist/nodes/Databricks/resources/unityCatalog/operations.d.ts +2 -0
- package/dist/nodes/Databricks/resources/unityCatalog/operations.js +233 -0
- package/dist/nodes/Databricks/resources/unityCatalog/operations.js.map +1 -0
- package/dist/nodes/Databricks/resources/unityCatalog/parameters.d.ts +2 -0
- package/dist/nodes/Databricks/resources/unityCatalog/parameters.js +371 -0
- package/dist/nodes/Databricks/resources/unityCatalog/parameters.js.map +1 -0
- package/dist/nodes/Databricks/resources/unityCatalog.d.ts +3 -0
- package/dist/nodes/Databricks/resources/unityCatalog.js +239 -0
- package/dist/nodes/Databricks/resources/unityCatalog.js.map +1 -0
- package/dist/nodes/Databricks/resources/vectorSearch/operations.d.ts +2 -0
- package/dist/nodes/Databricks/resources/vectorSearch/operations.js +48 -0
- package/dist/nodes/Databricks/resources/vectorSearch/operations.js.map +1 -0
- package/dist/nodes/Databricks/resources/vectorSearch/parameters.d.ts +2 -0
- package/dist/nodes/Databricks/resources/vectorSearch/parameters.js +224 -0
- package/dist/nodes/Databricks/resources/vectorSearch/parameters.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/CallbackHandler.d.ts +66 -0
- package/dist/nodes/agents/DatabricksAiAgent/CallbackHandler.js +531 -0
- package/dist/nodes/agents/DatabricksAiAgent/CallbackHandler.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/DatabricksAiAgent.node.d.ts +5 -0
- package/dist/nodes/agents/DatabricksAiAgent/DatabricksAiAgent.node.js +133 -0
- package/dist/nodes/agents/DatabricksAiAgent/DatabricksAiAgent.node.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/DatabricksAiAgentDark.icon.svg +9 -0
- package/dist/nodes/agents/DatabricksAiAgent/DatabricksAiAgentLight.icon.svg +9 -0
- package/dist/nodes/agents/DatabricksAiAgent/description.d.ts +4 -0
- package/dist/nodes/agents/DatabricksAiAgent/description.js +28 -0
- package/dist/nodes/agents/DatabricksAiAgent/description.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/execute.d.ts +2 -0
- package/dist/nodes/agents/DatabricksAiAgent/execute.js +418 -0
- package/dist/nodes/agents/DatabricksAiAgent/execute.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/constants.d.ts +82 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/constants.js +105 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/constants.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/types/types.d.ts +6 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/types/types.js +3 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/types/types.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/N8nOutputParser.d.ts +5 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/N8nOutputParser.js +13 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/N8nOutputParser.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/N8nTool.d.ts +10 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/N8nTool.js +88 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/N8nTool.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/common.d.ts +28 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/common.js +207 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/common.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/descriptions.d.ts +17 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/descriptions.js +135 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/descriptions.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/helpers.d.ts +24 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/helpers.js +221 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/helpers.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/options.d.ts +2 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/options.js +38 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/options.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/output_parsers/N8nStructuredOutputParser.d.ts +12 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/output_parsers/N8nStructuredOutputParser.js +106 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/output_parsers/N8nStructuredOutputParser.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/prompt.d.ts +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/prompt.js +5 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/prompt.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/retry.d.ts +16 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/retry.js +132 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/retry.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/security.d.ts +18 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/security.js +150 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/security.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/sharedFields.d.ts +7 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/sharedFields.js +150 -0
- package/dist/nodes/agents/DatabricksAiAgent/src/utils/sharedFields.js.map +1 -0
- package/dist/nodes/agents/DatabricksAiAgent/utils.d.ts +2 -0
- package/dist/nodes/agents/DatabricksAiAgent/utils.js +52 -0
- package/dist/nodes/agents/DatabricksAiAgent/utils.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsDatabricks/EmbeddingsDatabricks.node.d.ts +5 -0
- package/dist/nodes/embeddings/EmbeddingsDatabricks/EmbeddingsDatabricks.node.js +155 -0
- package/dist/nodes/embeddings/EmbeddingsDatabricks/EmbeddingsDatabricks.node.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsDatabricks/databricks.dark.svg +19 -0
- package/dist/nodes/embeddings/EmbeddingsDatabricks/databricks.svg +19 -0
- package/dist/nodes/llms/LmChatDatabricks/LmChatDatabricks.node.d.ts +10 -0
- package/dist/nodes/llms/LmChatDatabricks/LmChatDatabricks.node.js +265 -0
- package/dist/nodes/llms/LmChatDatabricks/LmChatDatabricks.node.js.map +1 -0
- package/dist/nodes/llms/LmChatDatabricks/databricks.dark.svg +19 -0
- package/dist/nodes/llms/LmChatDatabricks/databricks.svg +19 -0
- package/dist/nodes/llms/N8nLlmTracing.d.ts +44 -0
- package/dist/nodes/llms/N8nLlmTracing.js +140 -0
- package/dist/nodes/llms/N8nLlmTracing.js.map +1 -0
- package/dist/nodes/llms/n8nDefaultFailedAttemptHandler.d.ts +1 -0
- package/dist/nodes/llms/n8nDefaultFailedAttemptHandler.js +31 -0
- package/dist/nodes/llms/n8nDefaultFailedAttemptHandler.js.map +1 -0
- package/dist/nodes/llms/n8nDefaultFailedAttemptHandler.test.d.ts +1 -0
- package/dist/nodes/llms/n8nDefaultFailedAttemptHandler.test.js +53 -0
- package/dist/nodes/llms/n8nDefaultFailedAttemptHandler.test.js.map +1 -0
- package/dist/nodes/llms/n8nLlmFailedAttemptHandler.d.ts +3 -0
- package/dist/nodes/llms/n8nLlmFailedAttemptHandler.js +28 -0
- package/dist/nodes/llms/n8nLlmFailedAttemptHandler.js.map +1 -0
- package/dist/nodes/llms/n8nLlmFailedAttemptHandler.test.d.ts +1 -0
- package/dist/nodes/llms/n8nLlmFailedAttemptHandler.test.js +50 -0
- package/dist/nodes/llms/n8nLlmFailedAttemptHandler.test.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreDatabricks/VectorStoreDatabricks.node.d.ts +15 -0
- package/dist/nodes/vector_store/VectorStoreDatabricks/VectorStoreDatabricks.node.js +98 -0
- package/dist/nodes/vector_store/VectorStoreDatabricks/VectorStoreDatabricks.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreDatabricks/databricks.dark.svg +19 -0
- package/dist/nodes/vector_store/VectorStoreDatabricks/databricks.svg +19 -0
- package/dist/nodes/vector_store/shared/MemoryManager/MemoryCalculator.d.ts +7 -0
- package/dist/nodes/vector_store/shared/MemoryManager/MemoryCalculator.js +50 -0
- package/dist/nodes/vector_store/shared/MemoryManager/MemoryCalculator.js.map +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/MemoryVectorStoreManager.d.ts +32 -0
- package/dist/nodes/vector_store/shared/MemoryManager/MemoryVectorStoreManager.js +175 -0
- package/dist/nodes/vector_store/shared/MemoryManager/MemoryVectorStoreManager.js.map +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/StoreCleanupService.d.ts +16 -0
- package/dist/nodes/vector_store/shared/MemoryManager/StoreCleanupService.js +95 -0
- package/dist/nodes/vector_store/shared/MemoryManager/StoreCleanupService.js.map +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/config.d.ts +4 -0
- package/dist/nodes/vector_store/shared/MemoryManager/config.js +38 -0
- package/dist/nodes/vector_store/shared/MemoryManager/config.js.map +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/test/MemoryCalculator.test.d.ts +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/test/MemoryCalculator.test.js +158 -0
- package/dist/nodes/vector_store/shared/MemoryManager/test/MemoryCalculator.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/test/MemoryVectorStoreManager.test.d.ts +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/test/MemoryVectorStoreManager.test.js +204 -0
- package/dist/nodes/vector_store/shared/MemoryManager/test/MemoryVectorStoreManager.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/test/StoreCleanupService.test.d.ts +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/test/StoreCleanupService.test.js +138 -0
- package/dist/nodes/vector_store/shared/MemoryManager/test/StoreCleanupService.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/test/config.test.d.ts +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/test/config.test.js +57 -0
- package/dist/nodes/vector_store/shared/MemoryManager/test/config.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/MemoryManager/types.d.ts +39 -0
- package/dist/nodes/vector_store/shared/MemoryManager/types.js +3 -0
- package/dist/nodes/vector_store/shared/MemoryManager/types.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/__tests__/utils.test.d.ts +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/__tests__/utils.test.js +156 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/__tests__/utils.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/constants.d.ts +4 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/constants.js +45 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/constants.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.d.ts +15 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.js +227 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.test.d.ts +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.test.js +131 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/createVectorStoreNode.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/methods/listSearch.d.ts +7 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/methods/listSearch.js +32 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/methods/listSearch.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/insertOperation.test.d.ts +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/insertOperation.test.js +190 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/insertOperation.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/loadOperation.test.d.ts +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/loadOperation.test.js +101 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/loadOperation.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/operationHandlers.test.d.ts +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/operationHandlers.test.js +93 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/operationHandlers.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveAsToolOperation.test.d.ts +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveAsToolOperation.test.js +109 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveAsToolOperation.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveOperation.test.d.ts +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveOperation.test.js +60 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/retrieveOperation.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/updateOperation.test.d.ts +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/updateOperation.test.js +108 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/__tests__/updateOperation.test.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/index.d.ts +5 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/index.js +22 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/index.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/insertOperation.d.ts +5 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/insertOperation.js +36 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/insertOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/loadOperation.d.ts +5 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/loadOperation.js +34 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/loadOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.d.ts +5 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js +43 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.d.ts +5 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.js +17 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.d.ts +5 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.js +40 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/updateOperation.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/test-helpers.d.ts +0 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/test-helpers.js +2 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/test-helpers.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/types.d.ts +31 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/types.js +3 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/types.js.map +1 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/utils.d.ts +6 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/utils.js +22 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode/utils.js.map +1 -0
- package/dist/nodes/vector_store/shared/descriptions.d.ts +4 -0
- package/dist/nodes/vector_store/shared/descriptions.js +70 -0
- package/dist/nodes/vector_store/shared/descriptions.js.map +1 -0
- package/dist/nodes/vector_store/shared/processDocuments.d.ts +25 -0
- package/dist/nodes/vector_store/shared/processDocuments.js +42 -0
- package/dist/nodes/vector_store/shared/processDocuments.js.map +1 -0
- package/dist/package.json +93 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/DatabricksVectorStoreLangChain.d.ts +26 -0
- package/dist/utils/DatabricksVectorStoreLangChain.js +114 -0
- package/dist/utils/DatabricksVectorStoreLangChain.js.map +1 -0
- package/dist/utils/N8nBinaryLoader.d.ts +18 -0
- package/dist/utils/N8nBinaryLoader.js +159 -0
- package/dist/utils/N8nBinaryLoader.js.map +1 -0
- package/dist/utils/N8nJsonLoader.d.ts +11 -0
- package/dist/utils/N8nJsonLoader.js +67 -0
- package/dist/utils/N8nJsonLoader.js.map +1 -0
- package/dist/utils/N8nTool.d.ts +10 -0
- package/dist/utils/N8nTool.js +88 -0
- package/dist/utils/N8nTool.js.map +1 -0
- package/dist/utils/descriptions.d.ts +13 -0
- package/dist/utils/descriptions.js +112 -0
- package/dist/utils/descriptions.js.map +1 -0
- package/dist/utils/helpers.d.ts +23 -0
- package/dist/utils/helpers.js +172 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/logWrapper.d.ts +27 -0
- package/dist/utils/logWrapper.js +297 -0
- package/dist/utils/logWrapper.js.map +1 -0
- package/dist/utils/output_parsers/N8nItemListOutputParser.d.ts +13 -0
- package/dist/utils/output_parsers/N8nItemListOutputParser.js +43 -0
- package/dist/utils/output_parsers/N8nItemListOutputParser.js.map +1 -0
- package/dist/utils/output_parsers/N8nOutputFixingParser.d.ts +18 -0
- package/dist/utils/output_parsers/N8nOutputFixingParser.js +68 -0
- package/dist/utils/output_parsers/N8nOutputFixingParser.js.map +1 -0
- package/dist/utils/output_parsers/N8nOutputParser.d.ts +7 -0
- package/dist/utils/output_parsers/N8nOutputParser.js +19 -0
- package/dist/utils/output_parsers/N8nOutputParser.js.map +1 -0
- package/dist/utils/output_parsers/N8nStructuredOutputParser.d.ts +12 -0
- package/dist/utils/output_parsers/N8nStructuredOutputParser.js +84 -0
- package/dist/utils/output_parsers/N8nStructuredOutputParser.js.map +1 -0
- package/dist/utils/output_parsers/prompt.d.ts +3 -0
- package/dist/utils/output_parsers/prompt.js +22 -0
- package/dist/utils/output_parsers/prompt.js.map +1 -0
- package/dist/utils/schemaParsing.d.ts +6 -0
- package/dist/utils/schemaParsing.js +23 -0
- package/dist/utils/schemaParsing.js.map +1 -0
- package/dist/utils/sharedFields.d.ts +6 -0
- package/dist/utils/sharedFields.js +122 -0
- package/dist/utils/sharedFields.js.map +1 -0
- package/dist/utils/tracing.d.ts +7 -0
- package/dist/utils/tracing.js +20 -0
- package/dist/utils/tracing.js.map +1 -0
- package/package.json +93 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, ISupplyDataFunctions } from 'n8n-workflow';
|
|
2
|
+
import { N8nStructuredOutputParser } from './output_parsers/N8nStructuredOutputParser';
|
|
3
|
+
export type N8nOutputParser = N8nStructuredOutputParser;
|
|
4
|
+
export { N8nStructuredOutputParser };
|
|
5
|
+
export declare function getOptionalOutputParser(ctx: IExecuteFunctions | ISupplyDataFunctions, index?: number): Promise<N8nOutputParser | undefined>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.N8nStructuredOutputParser = void 0;
|
|
4
|
+
exports.getOptionalOutputParser = getOptionalOutputParser;
|
|
5
|
+
const N8nStructuredOutputParser_1 = require("./output_parsers/N8nStructuredOutputParser");
|
|
6
|
+
Object.defineProperty(exports, "N8nStructuredOutputParser", { enumerable: true, get: function () { return N8nStructuredOutputParser_1.N8nStructuredOutputParser; } });
|
|
7
|
+
async function getOptionalOutputParser(ctx, index = 0) {
|
|
8
|
+
if (ctx.getNodeParameter('hasOutputParser', 0, true) === true) {
|
|
9
|
+
return (await ctx.getInputConnectionData('ai_outputParser', index));
|
|
10
|
+
}
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=N8nOutputParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"N8nOutputParser.js","sourceRoot":"","sources":["../../../../../../nodes/agents/DatabricksAiAgent/src/utils/N8nOutputParser.ts"],"names":[],"mappings":";;;AAQA,0DAWC;AAjBD,0FAAuF;AAI9E,0GAJA,qDAAyB,OAIA;AAE3B,KAAK,UAAU,uBAAuB,CACzC,GAA6C,EAC7C,QAAgB,CAAC;IAEjB,IAAI,GAAG,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QAC5D,OAAO,CAAC,MAAM,GAAG,CAAC,sBAAsB,CACpC,iBAAiB,EACjB,KAAK,CACR,CAA8B,CAAC;IACpC,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DynamicStructuredToolInput } from '@langchain/core/tools';
|
|
2
|
+
import { DynamicStructuredTool, DynamicTool } from '@langchain/core/tools';
|
|
3
|
+
import type { ISupplyDataFunctions } from 'n8n-workflow';
|
|
4
|
+
import { ZodObject } from 'zod';
|
|
5
|
+
export declare const prepareFallbackToolDescription: (toolDescription: string, schema: ZodObject<any>) => string;
|
|
6
|
+
export declare class N8nTool extends DynamicStructuredTool<any> {
|
|
7
|
+
private context;
|
|
8
|
+
constructor(context: ISupplyDataFunctions, fields: DynamicStructuredToolInput<any>);
|
|
9
|
+
asDynamicTool(): DynamicTool;
|
|
10
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.N8nTool = exports.prepareFallbackToolDescription = void 0;
|
|
4
|
+
const tools_1 = require("@langchain/core/tools");
|
|
5
|
+
const output_parsers_1 = require("@langchain/classic/output_parsers");
|
|
6
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
const getSimplifiedType = (schema) => {
|
|
9
|
+
if (schema instanceof zod_1.ZodObject) {
|
|
10
|
+
return 'object';
|
|
11
|
+
}
|
|
12
|
+
else if (schema instanceof zod_1.ZodNumber) {
|
|
13
|
+
return 'number';
|
|
14
|
+
}
|
|
15
|
+
else if (schema instanceof zod_1.ZodBoolean) {
|
|
16
|
+
return 'boolean';
|
|
17
|
+
}
|
|
18
|
+
else if (schema instanceof zod_1.ZodNullable || schema instanceof zod_1.ZodOptional) {
|
|
19
|
+
return getSimplifiedType(schema.unwrap());
|
|
20
|
+
}
|
|
21
|
+
return 'string';
|
|
22
|
+
};
|
|
23
|
+
const getParametersDescription = (parameters) => parameters
|
|
24
|
+
.map(([name, schema]) => { var _a; return `${name}: (description: ${(_a = schema.description) !== null && _a !== void 0 ? _a : ''}, type: ${getSimplifiedType(schema)}, required: ${!schema.isOptional()})`; })
|
|
25
|
+
.join(',\n ');
|
|
26
|
+
const prepareFallbackToolDescription = (toolDescription, schema) => {
|
|
27
|
+
let description = `${toolDescription}`;
|
|
28
|
+
const toolParameters = Object.entries(schema.shape);
|
|
29
|
+
if (toolParameters.length) {
|
|
30
|
+
description += `
|
|
31
|
+
Tool expects valid stringified JSON object with ${toolParameters.length} properties.
|
|
32
|
+
Property names with description, type and required status:
|
|
33
|
+
${getParametersDescription(toolParameters)}
|
|
34
|
+
ALL parameters marked as required must be provided`;
|
|
35
|
+
}
|
|
36
|
+
return description;
|
|
37
|
+
};
|
|
38
|
+
exports.prepareFallbackToolDescription = prepareFallbackToolDescription;
|
|
39
|
+
class N8nTool extends tools_1.DynamicStructuredTool {
|
|
40
|
+
constructor(context, fields) {
|
|
41
|
+
super(fields);
|
|
42
|
+
this.context = context;
|
|
43
|
+
}
|
|
44
|
+
asDynamicTool() {
|
|
45
|
+
const { name, func, schema, context, description } = this;
|
|
46
|
+
const parser = new output_parsers_1.StructuredOutputParser(schema);
|
|
47
|
+
const wrappedFunc = async function (query) {
|
|
48
|
+
let parsedQuery;
|
|
49
|
+
try {
|
|
50
|
+
parsedQuery = await parser.parse(query);
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
let dataFromModel;
|
|
54
|
+
try {
|
|
55
|
+
dataFromModel = (0, n8n_workflow_1.jsonParse)(query, { acceptJSObject: true });
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
if (Object.keys(schema.shape).length === 1) {
|
|
59
|
+
const parameterName = Object.keys(schema.shape)[0];
|
|
60
|
+
dataFromModel = { [parameterName]: query };
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
64
|
+
throw new n8n_workflow_1.NodeOperationError(context.getNode(), `Input is not a valid JSON: ${errorMessage}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
parsedQuery = schema.parse(dataFromModel);
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
const result = await func(parsedQuery);
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
const { index } = context.addInputData('ai_tool', [[{ json: { query } }]]);
|
|
75
|
+
const errorData = e instanceof Error ? [[{ json: { error: e.message, stack: e.stack } }]] : [[{ json: { error: String(e) } }]];
|
|
76
|
+
void context.addOutputData('ai_tool', index, errorData);
|
|
77
|
+
return e instanceof Error ? e.message : String(e);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
return new tools_1.DynamicTool({
|
|
81
|
+
name,
|
|
82
|
+
description: (0, exports.prepareFallbackToolDescription)(description, schema),
|
|
83
|
+
func: wrappedFunc,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.N8nTool = N8nTool;
|
|
88
|
+
//# sourceMappingURL=N8nTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"N8nTool.js","sourceRoot":"","sources":["../../../../../../nodes/agents/DatabricksAiAgent/src/utils/N8nTool.ts"],"names":[],"mappings":";;;AACA,iDAA2E;AAC3E,sEAA2E;AAE3E,+CAA6D;AAE7D,6BAAiF;AAEjF,MAAM,iBAAiB,GAAG,CAAC,MAAkB,EAAE,EAAE;IAC7C,IAAI,MAAM,YAAY,eAAS,EAAE,CAAC;QAC9B,OAAO,QAAQ,CAAC;IACpB,CAAC;SAAM,IAAI,MAAM,YAAY,eAAS,EAAE,CAAC;QACrC,OAAO,QAAQ,CAAC;IACpB,CAAC;SAAM,IAAI,MAAM,YAAY,gBAAU,EAAE,CAAC;QACtC,OAAO,SAAS,CAAC;IACrB,CAAC;SAAM,IAAI,MAAM,YAAY,iBAAW,IAAI,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AAC,CAAC,CAAC,CAAC;gBAG3E,MAAM,SAAS,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;gBAC/H,KAAK,OAAO,CAAC,aAAa,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;gBAExD,OAAO,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACtD,CAAC;QACL,CAAC,CAAC;QAEF,OAAO,IAAI,mBAAW,CAAC;YACnB,IAAI;YACJ,WAAW,EAAE,IAAA,sCAA8B,EAAC,WAAW,EAAE,MAAM,CAAC;YAChE,IAAI,EAAE,WAAW;SACpB,CAAC,CAAC;IACP,CAAC;CACJ;AApED,0BAoEC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import { HumanMessage } from '@langchain/core/messages';
|
|
3
|
+
import { ChatPromptTemplate, type BaseMessagePromptTemplateLike } from '@langchain/core/prompts';
|
|
4
|
+
import type { AgentAction, AgentFinish } from '@langchain/classic/agents';
|
|
5
|
+
import type { ToolsAgentAction } from '@langchain/classic/dist/agents/tool_calling/output_parser';
|
|
6
|
+
import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';
|
|
7
|
+
import { DynamicStructuredTool, type Tool } from '@langchain/classic/tools';
|
|
8
|
+
import type { IExecuteFunctions, ISupplyDataFunctions } from 'n8n-workflow';
|
|
9
|
+
import type { ZodObject } from 'zod';
|
|
10
|
+
import { type N8nOutputParser } from './N8nOutputParser';
|
|
11
|
+
export declare function getOutputParserSchema(outputParser: N8nOutputParser): ZodObject<any, any, any, any>;
|
|
12
|
+
export declare function extractBinaryMessages(ctx: IExecuteFunctions | ISupplyDataFunctions, itemIndex: number): Promise<HumanMessage>;
|
|
13
|
+
export declare function fixEmptyContentMessage(steps: AgentFinish | ToolsAgentAction[]): AgentFinish | ToolsAgentAction[];
|
|
14
|
+
export declare function handleAgentFinishOutput(steps: AgentFinish | AgentAction[]): AgentFinish | AgentAction[];
|
|
15
|
+
export declare function handleParsedStepOutput(output: Record<string, unknown>, memory?: BaseChatMemory): {
|
|
16
|
+
returnValues: Record<string, unknown>;
|
|
17
|
+
log: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const getAgentStepsParser: (outputParser?: N8nOutputParser, memory?: BaseChatMemory) => (steps: AgentFinish | AgentAction[]) => Promise<AgentFinish | AgentAction[]>;
|
|
20
|
+
export declare function getChatModel(ctx: IExecuteFunctions | ISupplyDataFunctions, index?: number): Promise<BaseChatModel | undefined>;
|
|
21
|
+
export declare function getOptionalMemory(ctx: IExecuteFunctions | ISupplyDataFunctions): Promise<BaseChatMemory | undefined>;
|
|
22
|
+
export declare function getTools(ctx: IExecuteFunctions | ISupplyDataFunctions, outputParser?: N8nOutputParser): Promise<Array<DynamicStructuredTool | Tool>>;
|
|
23
|
+
export declare function prepareMessages(ctx: IExecuteFunctions | ISupplyDataFunctions, itemIndex: number, options: {
|
|
24
|
+
systemMessage?: string;
|
|
25
|
+
passthroughBinaryImages?: boolean;
|
|
26
|
+
outputParser?: N8nOutputParser;
|
|
27
|
+
}): Promise<BaseMessagePromptTemplateLike[]>;
|
|
28
|
+
export declare function preparePrompt(messages: BaseMessagePromptTemplateLike[]): ChatPromptTemplate;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAgentStepsParser = void 0;
|
|
4
|
+
exports.getOutputParserSchema = getOutputParserSchema;
|
|
5
|
+
exports.extractBinaryMessages = extractBinaryMessages;
|
|
6
|
+
exports.fixEmptyContentMessage = fixEmptyContentMessage;
|
|
7
|
+
exports.handleAgentFinishOutput = handleAgentFinishOutput;
|
|
8
|
+
exports.handleParsedStepOutput = handleParsedStepOutput;
|
|
9
|
+
exports.getChatModel = getChatModel;
|
|
10
|
+
exports.getOptionalMemory = getOptionalMemory;
|
|
11
|
+
exports.getTools = getTools;
|
|
12
|
+
exports.prepareMessages = prepareMessages;
|
|
13
|
+
exports.preparePrompt = preparePrompt;
|
|
14
|
+
const messages_1 = require("@langchain/core/messages");
|
|
15
|
+
const prompts_1 = require("@langchain/core/prompts");
|
|
16
|
+
const tools_1 = require("@langchain/classic/tools");
|
|
17
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
18
|
+
const zod_1 = require("zod");
|
|
19
|
+
const helpers_1 = require("./helpers");
|
|
20
|
+
function getOutputParserSchema(outputParser) {
|
|
21
|
+
var _a;
|
|
22
|
+
const schema = (_a = outputParser.getSchema()) !== null && _a !== void 0 ? _a : zod_1.z.object({ text: zod_1.z.string() });
|
|
23
|
+
return schema;
|
|
24
|
+
}
|
|
25
|
+
async function extractBinaryMessages(ctx, itemIndex) {
|
|
26
|
+
var _a, _b, _c;
|
|
27
|
+
const binaryData = (_c = (_b = (_a = ctx.getInputData()) === null || _a === void 0 ? void 0 : _a[itemIndex]) === null || _b === void 0 ? void 0 : _b.binary) !== null && _c !== void 0 ? _c : {};
|
|
28
|
+
const binaryMessages = await Promise.all(Object.values(binaryData)
|
|
29
|
+
.filter((data) => data.mimeType.startsWith('image/'))
|
|
30
|
+
.map(async (data) => {
|
|
31
|
+
let binaryUrlString;
|
|
32
|
+
if (data.id) {
|
|
33
|
+
const binaryBuffer = await ctx.helpers.binaryToBuffer(await ctx.helpers.getBinaryStream(data.id));
|
|
34
|
+
binaryUrlString = `data:${data.mimeType};base64,${Buffer.from(binaryBuffer).toString(n8n_workflow_1.BINARY_ENCODING)}`;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
binaryUrlString = data.data.includes('base64')
|
|
38
|
+
? data.data
|
|
39
|
+
: `data:${data.mimeType};base64,${data.data}`;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
type: 'image_url',
|
|
43
|
+
image_url: {
|
|
44
|
+
url: binaryUrlString,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}));
|
|
48
|
+
return new messages_1.HumanMessage({
|
|
49
|
+
content: [...binaryMessages],
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function fixEmptyContentMessage(steps) {
|
|
53
|
+
if (!Array.isArray(steps))
|
|
54
|
+
return steps;
|
|
55
|
+
steps.forEach((step) => {
|
|
56
|
+
if ('messageLog' in step && step.messageLog !== undefined) {
|
|
57
|
+
if (Array.isArray(step.messageLog)) {
|
|
58
|
+
step.messageLog.forEach((message) => {
|
|
59
|
+
if ('content' in message && Array.isArray(message.content)) {
|
|
60
|
+
message.content.forEach((content) => {
|
|
61
|
+
if (content.input === '') {
|
|
62
|
+
content.input = {};
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return steps;
|
|
71
|
+
}
|
|
72
|
+
function handleAgentFinishOutput(steps) {
|
|
73
|
+
var _a;
|
|
74
|
+
const agentFinishSteps = steps;
|
|
75
|
+
if (agentFinishSteps.returnValues) {
|
|
76
|
+
const isMultiOutput = Array.isArray((_a = agentFinishSteps.returnValues) === null || _a === void 0 ? void 0 : _a.output);
|
|
77
|
+
if (isMultiOutput) {
|
|
78
|
+
const multiOutputSteps = agentFinishSteps.returnValues.output;
|
|
79
|
+
const isTextOnly = multiOutputSteps.every((output) => 'text' in output);
|
|
80
|
+
if (isTextOnly) {
|
|
81
|
+
agentFinishSteps.returnValues.output = multiOutputSteps
|
|
82
|
+
.map((output) => output.text)
|
|
83
|
+
.join('\n')
|
|
84
|
+
.trim();
|
|
85
|
+
}
|
|
86
|
+
return agentFinishSteps;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return agentFinishSteps;
|
|
90
|
+
}
|
|
91
|
+
function handleParsedStepOutput(output, memory) {
|
|
92
|
+
return {
|
|
93
|
+
returnValues: memory ? { output: JSON.stringify(output) } : output,
|
|
94
|
+
log: 'Final response formatted',
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const getAgentStepsParser = (outputParser, memory) => async (steps) => {
|
|
98
|
+
if (Array.isArray(steps)) {
|
|
99
|
+
const responseParserTool = steps.find((step) => step.tool === 'format_final_json_response');
|
|
100
|
+
if (responseParserTool && outputParser) {
|
|
101
|
+
const toolInput = responseParserTool.toolInput;
|
|
102
|
+
const parserInput = toolInput instanceof Object ? JSON.stringify(toolInput) : toolInput;
|
|
103
|
+
const returnValues = (await outputParser.parse(parserInput));
|
|
104
|
+
return handleParsedStepOutput(returnValues, memory);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (outputParser && typeof steps === 'object' && steps.returnValues) {
|
|
108
|
+
const finalResponse = steps.returnValues;
|
|
109
|
+
let parserInput;
|
|
110
|
+
if (finalResponse instanceof Object) {
|
|
111
|
+
if ('output' in finalResponse) {
|
|
112
|
+
try {
|
|
113
|
+
parserInput = JSON.stringify({ output: (0, n8n_workflow_1.jsonParse)(finalResponse.output) });
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
parserInput = finalResponse.output;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
parserInput = JSON.stringify(finalResponse);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
parserInput = finalResponse;
|
|
125
|
+
}
|
|
126
|
+
const returnValues = (await outputParser.parse(parserInput));
|
|
127
|
+
return handleParsedStepOutput(returnValues, memory);
|
|
128
|
+
}
|
|
129
|
+
return handleAgentFinishOutput(steps);
|
|
130
|
+
};
|
|
131
|
+
exports.getAgentStepsParser = getAgentStepsParser;
|
|
132
|
+
async function getChatModel(ctx, index = 0) {
|
|
133
|
+
const connectedModels = await ctx.getInputConnectionData('ai_languageModel', 0);
|
|
134
|
+
let model;
|
|
135
|
+
if (Array.isArray(connectedModels) && index !== undefined) {
|
|
136
|
+
if (connectedModels.length <= index) {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
const reversedModels = [...connectedModels].reverse();
|
|
140
|
+
model = reversedModels[index];
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
model = connectedModels;
|
|
144
|
+
}
|
|
145
|
+
if (!(0, helpers_1.isChatInstance)(model) || !model.bindTools) {
|
|
146
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'Tools Agent requires Chat Model which supports Tools calling');
|
|
147
|
+
}
|
|
148
|
+
return model;
|
|
149
|
+
}
|
|
150
|
+
async function getOptionalMemory(ctx) {
|
|
151
|
+
return (await ctx.getInputConnectionData('ai_memory', 0));
|
|
152
|
+
}
|
|
153
|
+
async function getTools(ctx, outputParser) {
|
|
154
|
+
const tools = (await (0, helpers_1.getConnectedTools)(ctx, true, false));
|
|
155
|
+
tools.forEach((tool, index) => {
|
|
156
|
+
if (!tool.name || typeof tool.name !== 'string') {
|
|
157
|
+
ctx.logger.warn(`Tool at index ${index} missing name, setting default`);
|
|
158
|
+
tool.name = `tool_${index}`;
|
|
159
|
+
}
|
|
160
|
+
if (!tool.description || typeof tool.description !== 'string') {
|
|
161
|
+
ctx.logger.warn(`Tool '${tool.name}' missing description, setting default`);
|
|
162
|
+
tool.description = `Tool: ${tool.name}`;
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
if (outputParser) {
|
|
166
|
+
const schema = getOutputParserSchema(outputParser);
|
|
167
|
+
const structuredOutputParserTool = new tools_1.DynamicStructuredTool({
|
|
168
|
+
schema,
|
|
169
|
+
name: 'format_final_json_response',
|
|
170
|
+
description: 'Use this tool to format your final response to the user in a structured JSON format. This tool validates your output against a schema to ensure it meets the required format. ONLY use this tool when you have completed all necessary reasoning and are ready to provide your final answer. Do not use this tool for intermediate steps or for asking questions. The output from this tool will be directly returned to the user.',
|
|
171
|
+
func: async () => '',
|
|
172
|
+
});
|
|
173
|
+
tools.push(structuredOutputParserTool);
|
|
174
|
+
}
|
|
175
|
+
return tools;
|
|
176
|
+
}
|
|
177
|
+
async function prepareMessages(ctx, itemIndex, options) {
|
|
178
|
+
var _a, _b, _c;
|
|
179
|
+
const useSystemMessage = (_a = options.systemMessage) !== null && _a !== void 0 ? _a : ctx.getNode().typeVersion < 1.9;
|
|
180
|
+
const messages = [];
|
|
181
|
+
if (useSystemMessage) {
|
|
182
|
+
messages.push([
|
|
183
|
+
'system',
|
|
184
|
+
`{system_message}${options.outputParser ? '\n\n{formatting_instructions}' : ''}`,
|
|
185
|
+
]);
|
|
186
|
+
}
|
|
187
|
+
else if (options.outputParser) {
|
|
188
|
+
messages.push(['system', '{formatting_instructions}']);
|
|
189
|
+
}
|
|
190
|
+
messages.push(['placeholder', '{chat_history}'], ['human', '{input}']);
|
|
191
|
+
const hasBinaryData = ((_c = (_b = ctx.getInputData()) === null || _b === void 0 ? void 0 : _b[itemIndex]) === null || _c === void 0 ? void 0 : _c.binary) !== undefined;
|
|
192
|
+
if (hasBinaryData && options.passthroughBinaryImages) {
|
|
193
|
+
const binaryMessage = await extractBinaryMessages(ctx, itemIndex);
|
|
194
|
+
if (binaryMessage.content.length !== 0) {
|
|
195
|
+
messages.push(binaryMessage);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
ctx.logger.debug('Not attaching binary message, since its content was empty');
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
messages.push(['placeholder', '{agent_scratchpad}']);
|
|
202
|
+
return messages;
|
|
203
|
+
}
|
|
204
|
+
function preparePrompt(messages) {
|
|
205
|
+
return prompts_1.ChatPromptTemplate.fromMessages(messages);
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../../nodes/agents/DatabricksAiAgent/src/utils/common.ts"],"names":[],"mappings":";;;AAsBA,sDAMC;AAaD,sDAoCC;AAgBD,wDAsBC;AAiCD,0DA6BC;AAUD,wDAQC;AAmED,oCA0BC;AAQD,8CAMC;AAUD,4BAkCC;AAUD,0CAuCC;AAQD,sCAEC;AApZD,uDAAwD;AAExD,qDAAiG;AAIjG,oDAA4E;AAC5E,+CAA8E;AAG9E,6BAAwB;AAExB,uCAA8D;AAS9D,SAAgB,qBAAqB,CACjC,YAA6B;;IAE7B,MAAM,MAAM,GACR,MAAC,YAAY,CAAC,SAAS,EAAoC,mCAAI,OAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClG,OAAO,MAAM,CAAC;AAClB,CAAC;AAaM,KAAK,UAAU,qBAAqB,CACvC,GAA6C,EAC7C,SAAiB;;IAEjB,MAAM,UAAU,GAAG,MAAA,MAAA,MAAA,GAAG,CAAC,YAAY,EAAE,0CAAG,SAAS,CAAC,0CAAE,MAAM,mCAAI,EAAE,CAAC;IACjE,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,GAAG,CACpC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;SACpB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;SACpD,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAChB,IAAI,eAAuB,CAAC;QAG5B,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;YACV,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,cAAc,CACjD,MAAM,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,C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ameterValue } from 'n8n-workflow';
|
|
2
|
+
export declare const schemaTypeField: INodeProperties;
|
|
3
|
+
export declare const buildJsonSchemaExampleField: (props?: {
|
|
4
|
+
showExtraProps?: Record<string, Array<NodeParameterValue | DisplayCondition> | undefined>;
|
|
5
|
+
}) => INodeProperties;
|
|
6
|
+
export declare const buildJsonSchemaExampleNotice: (props?: {
|
|
7
|
+
showExtraProps?: Record<string, Array<NodeParameterValue | DisplayCondition> | undefined>;
|
|
8
|
+
}) => INodeProperties;
|
|
9
|
+
export declare const jsonSchemaExampleField: INodeProperties;
|
|
10
|
+
export declare const buildInputSchemaField: (props?: {
|
|
11
|
+
showExtraProps?: Record<string, Array<NodeParameterValue | DisplayCondition> | undefined>;
|
|
12
|
+
}) => INodeProperties;
|
|
13
|
+
export declare const inputSchemaField: INodeProperties;
|
|
14
|
+
export declare const promptTypeOptions: INodeProperties;
|
|
15
|
+
export declare const textInput: INodeProperties;
|
|
16
|
+
export declare const textFromPreviousNode: INodeProperties;
|
|
17
|
+
export declare const toolDescription: INodeProperties;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toolDescription = exports.textFromPreviousNode = exports.textInput = exports.promptTypeOptions = exports.inputSchemaField = exports.buildInputSchemaField = exports.jsonSchemaExampleField = exports.buildJsonSchemaExampleNotice = exports.buildJsonSchemaExampleField = exports.schemaTypeField = void 0;
|
|
4
|
+
exports.schemaTypeField = {
|
|
5
|
+
displayName: 'Schema Type',
|
|
6
|
+
name: 'schemaType',
|
|
7
|
+
type: 'options',
|
|
8
|
+
noDataExpression: true,
|
|
9
|
+
options: [
|
|
10
|
+
{
|
|
11
|
+
name: 'Generate From JSON Example',
|
|
12
|
+
value: 'fromJson',
|
|
13
|
+
description: 'Generate a schema from an example JSON object',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'Define Using JSON Schema',
|
|
17
|
+
value: 'manual',
|
|
18
|
+
description: 'Define the JSON schema manually',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
default: 'fromJson',
|
|
22
|
+
description: 'How to specify the schema for the function',
|
|
23
|
+
};
|
|
24
|
+
const buildJsonSchemaExampleField = (props) => ({
|
|
25
|
+
displayName: 'JSON Example',
|
|
26
|
+
name: 'jsonSchemaExample',
|
|
27
|
+
type: 'json',
|
|
28
|
+
default: `{
|
|
29
|
+
"some_input": "some_value"
|
|
30
|
+
}`,
|
|
31
|
+
noDataExpression: true,
|
|
32
|
+
typeOptions: {
|
|
33
|
+
rows: 10,
|
|
34
|
+
},
|
|
35
|
+
displayOptions: {
|
|
36
|
+
show: {
|
|
37
|
+
...props === null || props === void 0 ? void 0 : props.showExtraProps,
|
|
38
|
+
schemaType: ['fromJson'],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
description: 'Example JSON object to use to generate the schema',
|
|
42
|
+
});
|
|
43
|
+
exports.buildJsonSchemaExampleField = buildJsonSchemaExampleField;
|
|
44
|
+
const buildJsonSchemaExampleNotice = (props) => ({
|
|
45
|
+
displayName: "All properties will be required. To make them optional, use the 'JSON Schema' schema type instead",
|
|
46
|
+
name: 'notice',
|
|
47
|
+
type: 'notice',
|
|
48
|
+
default: '',
|
|
49
|
+
displayOptions: {
|
|
50
|
+
show: {
|
|
51
|
+
...props === null || props === void 0 ? void 0 : props.showExtraProps,
|
|
52
|
+
schemaType: ['fromJson'],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
exports.buildJsonSchemaExampleNotice = buildJsonSchemaExampleNotice;
|
|
57
|
+
exports.jsonSchemaExampleField = (0, exports.buildJsonSchemaExampleField)();
|
|
58
|
+
const buildInputSchemaField = (props) => ({
|
|
59
|
+
displayName: 'Input Schema',
|
|
60
|
+
name: 'inputSchema',
|
|
61
|
+
type: 'json',
|
|
62
|
+
default: `{
|
|
63
|
+
"type": "object",
|
|
64
|
+
"properties": {
|
|
65
|
+
"some_input": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"description": "Some input to the function"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}`,
|
|
71
|
+
noDataExpression: false,
|
|
72
|
+
typeOptions: {
|
|
73
|
+
rows: 10,
|
|
74
|
+
},
|
|
75
|
+
displayOptions: {
|
|
76
|
+
show: {
|
|
77
|
+
...props === null || props === void 0 ? void 0 : props.showExtraProps,
|
|
78
|
+
schemaType: ['manual'],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
description: 'Schema to use for the function',
|
|
82
|
+
hint: 'Use <a target="_blank" href="https://json-schema.org/">JSON Schema</a> format (<a target="_blank" href="https://json-schema.org/learn/miscellaneous-examples.html">examples</a>). $refs syntax is currently not supported.',
|
|
83
|
+
});
|
|
84
|
+
exports.buildInputSchemaField = buildInputSchemaField;
|
|
85
|
+
exports.inputSchemaField = (0, exports.buildInputSchemaField)();
|
|
86
|
+
exports.promptTypeOptions = {
|
|
87
|
+
displayName: 'Source for Prompt (User Message)',
|
|
88
|
+
name: 'promptType',
|
|
89
|
+
type: 'options',
|
|
90
|
+
options: [
|
|
91
|
+
{
|
|
92
|
+
name: 'Connected Chat Trigger Node',
|
|
93
|
+
value: 'auto',
|
|
94
|
+
description: "Looks for an input field called 'chatInput' that is coming from a directly connected Chat Trigger",
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'Define Below',
|
|
98
|
+
value: 'define',
|
|
99
|
+
description: 'Use an expression to reference data in previous nodes or enter static text',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
default: 'auto',
|
|
103
|
+
};
|
|
104
|
+
exports.textInput = {
|
|
105
|
+
displayName: 'Prompt (User Message)',
|
|
106
|
+
name: 'text',
|
|
107
|
+
type: 'string',
|
|
108
|
+
required: true,
|
|
109
|
+
default: '',
|
|
110
|
+
placeholder: 'e.g. Hello, how can you help me?',
|
|
111
|
+
typeOptions: {
|
|
112
|
+
rows: 2,
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
exports.textFromPreviousNode = {
|
|
116
|
+
displayName: 'Prompt (User Message)',
|
|
117
|
+
name: 'text',
|
|
118
|
+
type: 'string',
|
|
119
|
+
required: true,
|
|
120
|
+
default: '={{ $json.chatInput }}',
|
|
121
|
+
typeOptions: {
|
|
122
|
+
rows: 2,
|
|
123
|
+
},
|
|
124
|
+
disabledOptions: { show: { promptType: ['auto'] } },
|
|
125
|
+
};
|
|
126
|
+
exports.toolDescription = {
|
|
127
|
+
displayName: 'Description',
|
|
128
|
+
name: 'toolDescription',
|
|
129
|
+
type: 'string',
|
|
130
|
+
default: 'AI Agent that can call other tools',
|
|
131
|
+
required: true,
|
|
132
|
+
typeOptions: { rows: 2 },
|
|
133
|
+
description: 'Explain to the LLM what this tool does, a good, specific description would allow LLMs to produce expected results much more often',
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=descriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptions.js","sourceRoot":"","sources":["../../../../../../nodes/agents/DatabricksAiAgent/src/utils/descriptions.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAoB;IAC5C,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE;QACL;YACI,IAAI,EAAE,4BAA4B;YAClC,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,+CAA+C;SAC/D;QACD;YACI,IAAI,EAAE,0BAA0B;YAChC,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,iCAAiC;SACjD;KACJ;IACD,OAAO,EAAE,UAAU;IACnB,WAAW,EAAE,4CAA4C;CAC5D,CAAC;AAMK,MAAM,2BAA2B,GAAG,CAAC,KAE3C,EAAmB,EAAE,CAAC,CAAC;IACpB,WAAW,EAAE,cAAc;IAC3B,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE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AqB,GAAE,CAAC;AAE3C,QAAA,iBAAiB,GAAoB;IAC9C,WAAW,EAAE,kCAAkC;IAC/C,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE;QACL;YACI,IAAI,EAAE,6BAA6B;YACnC,KAAK,EAAE,MAAM;YACb,WAAW,EACP,mGAAmG;SAC1G;QACD;YACI,IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,4EAA4E;SAC5F;KACJ;IACD,OAAO,EAAE,MAAM;CAClB,CAAC;AAEW,QAAA,SAAS,GAAoB;IACtC,WAAW,EAAE,uBAAuB;IACpC,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,EAAE;IACX,WAAW,EAAE,kCAAkC;IAC/C,WAAW,EAAE;QACT,IAAI,EAAE,CAAC;KACV;CACJ,CAAC;AAEW,QAAA,oBAAoB,GAAoB;IACjD,WAAW,EAAE,uBAAuB;IACpC,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,wBAAwB;IACjC,WAAW,EAAE;QACT,IAAI,EAAE,CAAC;KACV;IACD,eAAe,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE;CACtD,CAAC;AAEW,QAAA,eAAe,GAAoB;IAC5C,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,oCAAoC;IAC7C,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;IACxB,WAAW,EACP,mIAAmI;CAC1I,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BaseChatMessageHistory } from '@langchain/core/chat_history';
|
|
2
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
3
|
+
import type { BaseMessage } from '@langchain/core/messages';
|
|
4
|
+
import type { Tool } from '@langchain/core/tools';
|
|
5
|
+
import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';
|
|
6
|
+
import type { AiEvent, IDataObject, IExecuteFunctions, ISupplyDataFunctions, IWebhookFunctions } from 'n8n-workflow';
|
|
7
|
+
export declare function getMetadataFiltersValues(ctx: IExecuteFunctions | ISupplyDataFunctions, itemIndex: number): Record<string, never> | undefined;
|
|
8
|
+
export declare function isBaseChatMemory(obj: unknown): obj is BaseChatMemory;
|
|
9
|
+
export declare function isBaseChatMessageHistory(obj: unknown): obj is BaseChatMessageHistory;
|
|
10
|
+
export declare function isChatInstance(model: unknown): model is BaseChatModel;
|
|
11
|
+
export declare function isToolsInstance(model: unknown): model is Tool;
|
|
12
|
+
export declare function getPromptInputByType(options: {
|
|
13
|
+
ctx: IExecuteFunctions | ISupplyDataFunctions;
|
|
14
|
+
i: number;
|
|
15
|
+
promptTypeKey: string;
|
|
16
|
+
inputKey: string;
|
|
17
|
+
}): string;
|
|
18
|
+
export declare function getSessionId(ctx: ISupplyDataFunctions | IWebhookFunctions, itemIndex: number, selectorKey?: string, autoSelect?: string, customKey?: string): string;
|
|
19
|
+
export declare function logAiEvent(executeFunctions: IExecuteFunctions | ISupplyDataFunctions, event: AiEvent, data?: IDataObject): void;
|
|
20
|
+
export declare function serializeChatHistory(chatHistory: BaseMessage[]): string;
|
|
21
|
+
export declare function escapeSingleCurlyBrackets(text?: string): string | undefined;
|
|
22
|
+
export declare const getConnectedTools: (ctx: IExecuteFunctions | IWebhookFunctions | ISupplyDataFunctions, enforceUniqueNames: boolean, convertStructuredTool?: boolean, escapeCurlyBrackets?: boolean) => Promise<Tool<any>[]>;
|
|
23
|
+
export declare function unwrapNestedOutput(output: Record<string, unknown>): Record<string, unknown>;
|
|
24
|
+
export declare function hasLongSequentialRepeat(text: string, threshold?: number): boolean;
|