@n8n/n8n-nodes-langchain 2.46.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/known/credentials.json +1 -27
- package/dist/known/nodes.json +0 -84
- package/dist/node-definitions/.nodes-hash +1 -1
- package/dist/node-definitions/index.ts +0 -4
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v1.schema.js +5 -7
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v1.ts +13 -65
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v11.schema.js +5 -7
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v11.ts +13 -65
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v12.schema.js +5 -7
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v12.ts +13 -65
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v13.schema.js +4 -7
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v13.ts +13 -70
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v14.schema.js +4 -7
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v14.ts +13 -70
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v15.schema.js +4 -7
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v15.ts +13 -70
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v16.schema.js +4 -7
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v16.ts +13 -70
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v17.schema.js +4 -7
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v17.ts +13 -70
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v18.schema.js +4 -7
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v18.ts +13 -70
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v19.schema.js +4 -7
- package/dist/node-definitions/nodes/n8n-nodes-langchain/agent/v19.ts +13 -70
- package/dist/nodes/Guardrails/helpers/configureNodeInputs.js +0 -2
- package/dist/nodes/Guardrails/helpers/configureNodeInputs.js.map +1 -1
- package/dist/nodes/agents/Agent/Agent.node.js +10 -11
- package/dist/nodes/agents/Agent/Agent.node.js.map +1 -1
- package/dist/nodes/agents/Agent/V2/AgentToolV2.node.js +1 -1
- package/dist/nodes/agents/Agent/V2/AgentToolV2.node.js.map +1 -1
- package/dist/nodes/agents/Agent/V2/AgentV2.node.js +3 -2
- package/dist/nodes/agents/Agent/V2/AgentV2.node.js.map +1 -1
- package/dist/nodes/agents/Agent/V2/utils.js +0 -2
- package/dist/nodes/agents/Agent/V2/utils.js.map +1 -1
- package/dist/nodes/agents/Agent/V3/AgentToolV3.node.js +1 -1
- package/dist/nodes/agents/Agent/V3/AgentToolV3.node.js.map +1 -1
- package/dist/nodes/agents/Agent/V3/AgentV3.node.js +1 -1
- package/dist/nodes/agents/Agent/V3/AgentV3.node.js.map +1 -1
- package/dist/nodes/agents/Agent/agents/utils.d.ts +1 -6
- package/dist/nodes/agents/Agent/agents/utils.js +0 -20
- package/dist/nodes/agents/Agent/agents/utils.js.map +1 -1
- package/dist/nodes/agents/Agent/utils.d.ts +2 -1
- package/dist/nodes/agents/Agent/utils.js +23 -2
- package/dist/nodes/agents/Agent/utils.js.map +1 -1
- package/dist/nodes/chains/ChainSummarization/V1/ChainSummarizationV1.node.js +1 -1
- package/dist/nodes/chains/ChainSummarization/V1/ChainSummarizationV1.node.js.map +1 -1
- package/dist/nodes/chains/ChainSummarization/V2/ChainSummarizationV2.node.js +1 -1
- package/dist/nodes/chains/ChainSummarization/V2/ChainSummarizationV2.node.js.map +1 -1
- package/dist/nodes/mcp/McpClientTool/utils.js +1 -1
- package/dist/nodes/mcp/McpClientTool/utils.js.map +1 -1
- package/dist/nodes/mcp/shared/runtime.js +14 -1
- package/dist/nodes/mcp/shared/runtime.js.map +1 -1
- package/dist/nodes/memory/MemoryXata/MemoryXata.node.js +0 -1
- package/dist/nodes/memory/MemoryXata/MemoryXata.node.js.map +1 -1
- package/dist/nodes/vendors/Microsoft/langchain-utils.js +1 -1
- package/dist/nodes/vendors/Microsoft/langchain-utils.js.map +1 -1
- package/dist/nodes/{agents/Agent/agents/ConversationalAgent → vendors/Microsoft}/prompt.d.ts +0 -1
- package/dist/nodes/{agents/Agent/agents/ConversationalAgent → vendors/Microsoft}/prompt.js +1 -14
- package/dist/nodes/vendors/Microsoft/prompt.js.map +1 -0
- package/dist/typecheck.tsbuildinfo +1 -1
- package/dist/types/credentials.json +1 -4
- package/dist/types/nodes.json +11 -33
- package/dist/utils/agent-execution/createEngineRequests.js +13 -1
- package/dist/utils/agent-execution/createEngineRequests.js.map +1 -1
- package/dist/utils/agent-execution/executeEngineAction.d.ts +1 -1
- package/dist/utils/agent-execution/executeEngineAction.js +10 -1
- package/dist/utils/agent-execution/executeEngineAction.js.map +1 -1
- package/dist/utils/agent-execution/index.d.ts +1 -0
- package/dist/utils/agent-execution/index.js +3 -1
- package/dist/utils/agent-execution/index.js.map +1 -1
- package/dist/utils/agent-execution/processHitlResponses.js +3 -2
- package/dist/utils/agent-execution/processHitlResponses.js.map +1 -1
- package/dist/utils/agent-execution/types.d.ts +2 -0
- package/dist/utils/agent-execution/types.js +2 -0
- package/dist/utils/agent-execution/types.js.map +1 -1
- package/dist/utils/helpers.js +0 -2
- package/dist/utils/helpers.js.map +1 -1
- package/package.json +13 -45
- package/dist/credentials/MotorheadApi.credentials.d.ts +0 -9
- package/dist/credentials/MotorheadApi.credentials.js +0 -49
- package/dist/credentials/MotorheadApi.credentials.js.map +0 -1
- package/dist/credentials/SerpApi.credentials.d.ts +0 -9
- package/dist/credentials/SerpApi.credentials.js +0 -42
- package/dist/credentials/SerpApi.credentials.js.map +0 -1
- package/dist/credentials/ZepApi.credentials.d.ts +0 -9
- package/dist/credentials/ZepApi.credentials.js +0 -61
- package/dist/credentials/ZepApi.credentials.js.map +0 -1
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/index.ts +0 -20
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v1/index.schema.js +0 -26
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v1/index.ts +0 -21
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v1/mode_insert.schema.js +0 -29
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v1/mode_insert.ts +0 -60
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v1/mode_load.schema.js +0 -35
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v1/mode_load.ts +0 -93
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v1/mode_retrieve.schema.js +0 -32
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v1/mode_retrieve.ts +0 -84
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v1/mode_retrieve_as_tool.schema.js +0 -36
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v1/mode_retrieve_as_tool.ts +0 -107
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v11/index.schema.js +0 -26
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v11/index.ts +0 -21
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v11/mode_insert.schema.js +0 -30
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v11/mode_insert.ts +0 -65
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v11/mode_load.schema.js +0 -35
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v11/mode_load.ts +0 -93
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v11/mode_retrieve.schema.js +0 -32
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v11/mode_retrieve.ts +0 -84
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v11/mode_retrieve_as_tool.schema.js +0 -36
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v11/mode_retrieve_as_tool.ts +0 -107
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v12/index.schema.js +0 -26
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v12/index.ts +0 -21
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v12/mode_insert.schema.js +0 -30
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v12/mode_insert.ts +0 -65
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v12/mode_load.schema.js +0 -35
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v12/mode_load.ts +0 -93
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v12/mode_retrieve.schema.js +0 -32
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v12/mode_retrieve.ts +0 -84
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v12/mode_retrieve_as_tool.schema.js +0 -36
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v12/mode_retrieve_as_tool.ts +0 -107
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v13/index.schema.js +0 -26
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v13/index.ts +0 -21
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v13/mode_insert.schema.js +0 -30
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v13/mode_insert.ts +0 -65
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v13/mode_load.schema.js +0 -35
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v13/mode_load.ts +0 -93
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v13/mode_retrieve.schema.js +0 -32
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v13/mode_retrieve.ts +0 -84
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v13/mode_retrieve_as_tool.schema.js +0 -35
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v13/mode_retrieve_as_tool.ts +0 -103
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v14/index.schema.js +0 -26
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v14/index.ts +0 -21
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v14/mode_insert.schema.js +0 -30
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v14/mode_insert.ts +0 -65
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v14/mode_load.schema.js +0 -35
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v14/mode_load.ts +0 -93
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v14/mode_retrieve.schema.js +0 -32
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v14/mode_retrieve.ts +0 -84
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v14/mode_retrieve_as_tool.schema.js +0 -35
- package/dist/node-definitions/nodes/n8n-nodes-langchain/vectorStoreZep/v14/mode_retrieve_as_tool.ts +0 -103
- package/dist/nodes/agents/Agent/V1/AgentV1.node.d.ts +0 -6
- package/dist/nodes/agents/Agent/V1/AgentV1.node.js +0 -422
- package/dist/nodes/agents/Agent/V1/AgentV1.node.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/description.d.ts +0 -2
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/description.js +0 -220
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/description.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/execute.d.ts +0 -2
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/execute.js +0 -96
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/execute.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/prompt.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/description.d.ts +0 -2
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/description.js +0 -210
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/description.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/execute.d.ts +0 -2
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/execute.js +0 -8
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/execute.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/prompt.d.ts +0 -1
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/prompt.js +0 -5
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/prompt.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/description.d.ts +0 -2
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/description.js +0 -196
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/description.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/execute.d.ts +0 -2
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/execute.js +0 -79
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/execute.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/prompt.d.ts +0 -1
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/prompt.js +0 -11
- package/dist/nodes/agents/Agent/agents/PlanAndExecuteAgent/prompt.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/ReActAgent/description.d.ts +0 -2
- package/dist/nodes/agents/Agent/agents/ReActAgent/description.js +0 -240
- package/dist/nodes/agents/Agent/agents/ReActAgent/description.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/ReActAgent/execute.d.ts +0 -2
- package/dist/nodes/agents/Agent/agents/ReActAgent/execute.js +0 -102
- package/dist/nodes/agents/Agent/agents/ReActAgent/execute.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/ReActAgent/prompt.d.ts +0 -4
- package/dist/nodes/agents/Agent/agents/ReActAgent/prompt.js +0 -11
- package/dist/nodes/agents/Agent/agents/ReActAgent/prompt.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/SqlAgent/description.d.ts +0 -2
- package/dist/nodes/agents/Agent/agents/SqlAgent/description.js +0 -329
- package/dist/nodes/agents/Agent/agents/SqlAgent/description.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/SqlAgent/execute.d.ts +0 -3
- package/dist/nodes/agents/Agent/agents/SqlAgent/execute.js +0 -169
- package/dist/nodes/agents/Agent/agents/SqlAgent/execute.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/mysql.d.ts +0 -3
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/mysql.js +0 -20
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/mysql.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/postgres.d.ts +0 -3
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/postgres.js +0 -21
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/postgres.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/sqlite.d.ts +0 -3
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/sqlite.js +0 -72
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/handlers/sqlite.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/prompts.d.ts +0 -2
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/prompts.js +0 -23
- package/dist/nodes/agents/Agent/agents/SqlAgent/other/prompts.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V1/description.d.ts +0 -2
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V1/description.js +0 -20
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V1/description.js.map +0 -1
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V1/execute.d.ts +0 -2
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V1/execute.js +0 -98
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V1/execute.js.map +0 -1
- package/dist/nodes/agents/OpenAiAssistant/OpenAiAssistant.node.d.ts +0 -5
- package/dist/nodes/agents/OpenAiAssistant/OpenAiAssistant.node.js +0 -388
- package/dist/nodes/agents/OpenAiAssistant/OpenAiAssistant.node.js.map +0 -1
- package/dist/nodes/agents/OpenAiAssistant/utils.d.ts +0 -5
- package/dist/nodes/agents/OpenAiAssistant/utils.js +0 -35
- package/dist/nodes/agents/OpenAiAssistant/utils.js.map +0 -1
- package/dist/nodes/code/Code.node.d.ts +0 -10
- package/dist/nodes/code/Code.node.js +0 -381
- package/dist/nodes/code/Code.node.js.map +0 -1
- package/dist/nodes/document_loaders/DocumentBinaryInputLoader/DocumentBinaryInputLoader.node.d.ts +0 -7
- package/dist/nodes/document_loaders/DocumentBinaryInputLoader/DocumentBinaryInputLoader.node.js +0 -174
- package/dist/nodes/document_loaders/DocumentBinaryInputLoader/DocumentBinaryInputLoader.node.js.map +0 -1
- package/dist/nodes/document_loaders/DocumentBinaryInputLoader/binary.svg +0 -1
- package/dist/nodes/document_loaders/DocumentGithubLoader/DocumentGithubLoader.node.d.ts +0 -5
- package/dist/nodes/document_loaders/DocumentGithubLoader/DocumentGithubLoader.node.js +0 -170
- package/dist/nodes/document_loaders/DocumentGithubLoader/DocumentGithubLoader.node.js.map +0 -1
- package/dist/nodes/document_loaders/DocumentGithubLoader/github.svg +0 -1
- package/dist/nodes/document_loaders/DocumentJSONInputLoader/DocumentJsonInputLoader.node.d.ts +0 -5
- package/dist/nodes/document_loaders/DocumentJSONInputLoader/DocumentJsonInputLoader.node.js +0 -84
- package/dist/nodes/document_loaders/DocumentJSONInputLoader/DocumentJsonInputLoader.node.js.map +0 -1
- package/dist/nodes/document_loaders/DocumentJSONInputLoader/json.svg +0 -1
- package/dist/nodes/llms/LMOpenAi/LmOpenAi.node.d.ts +0 -15
- package/dist/nodes/llms/LMOpenAi/LmOpenAi.node.js +0 -247
- package/dist/nodes/llms/LMOpenAi/LmOpenAi.node.js.map +0 -1
- package/dist/nodes/llms/LMOpenAi/openAiLight.dark.svg +0 -3
- package/dist/nodes/llms/LMOpenAi/openAiLight.svg +0 -3
- package/dist/nodes/memory/MemoryChatRetriever/MemoryChatRetriever.node.d.ts +0 -5
- package/dist/nodes/memory/MemoryChatRetriever/MemoryChatRetriever.node.js +0 -93
- package/dist/nodes/memory/MemoryChatRetriever/MemoryChatRetriever.node.js.map +0 -1
- package/dist/nodes/memory/MemoryMotorhead/MemoryMotorhead.node.d.ts +0 -5
- package/dist/nodes/memory/MemoryMotorhead/MemoryMotorhead.node.js +0 -119
- package/dist/nodes/memory/MemoryMotorhead/MemoryMotorhead.node.js.map +0 -1
- package/dist/nodes/memory/MemoryZep/MemoryZep.node.d.ts +0 -5
- package/dist/nodes/memory/MemoryZep/MemoryZep.node.js +0 -151
- package/dist/nodes/memory/MemoryZep/MemoryZep.node.js.map +0 -1
- package/dist/nodes/memory/MemoryZep/zep.png +0 -0
- package/dist/nodes/tools/ToolHttpRequest/ToolHttpRequest.node.d.ts +0 -5
- package/dist/nodes/tools/ToolHttpRequest/ToolHttpRequest.node.js +0 -344
- package/dist/nodes/tools/ToolHttpRequest/ToolHttpRequest.node.js.map +0 -1
- package/dist/nodes/tools/ToolHttpRequest/descriptions.d.ts +0 -7
- package/dist/nodes/tools/ToolHttpRequest/descriptions.js +0 -389
- package/dist/nodes/tools/ToolHttpRequest/descriptions.js.map +0 -1
- package/dist/nodes/tools/ToolHttpRequest/httprequest.dark.svg +0 -3
- package/dist/nodes/tools/ToolHttpRequest/httprequest.svg +0 -1
- package/dist/nodes/tools/ToolHttpRequest/interfaces.d.ts +0 -20
- package/dist/nodes/tools/ToolHttpRequest/interfaces.js +0 -3
- package/dist/nodes/tools/ToolHttpRequest/interfaces.js.map +0 -1
- package/dist/nodes/tools/ToolHttpRequest/utils.d.ts +0 -25
- package/dist/nodes/tools/ToolHttpRequest/utils.js +0 -671
- package/dist/nodes/tools/ToolHttpRequest/utils.js.map +0 -1
- package/dist/nodes/tools/ToolSerpApi/ToolSerpApi.node.d.ts +0 -6
- package/dist/nodes/tools/ToolSerpApi/ToolSerpApi.node.js +0 -143
- package/dist/nodes/tools/ToolSerpApi/ToolSerpApi.node.js.map +0 -1
- package/dist/nodes/tools/ToolSerpApi/serpApi.svg +0 -1
- package/dist/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.d.ts +0 -5
- package/dist/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.js +0 -67
- package/dist/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.js.map +0 -1
- package/dist/nodes/vector_store/VectorStoreInMemoryInsert/VectorStoreInMemoryInsert.node.d.ts +0 -5
- package/dist/nodes/vector_store/VectorStoreInMemoryInsert/VectorStoreInMemoryInsert.node.js +0 -86
- package/dist/nodes/vector_store/VectorStoreInMemoryInsert/VectorStoreInMemoryInsert.node.js.map +0 -1
- package/dist/nodes/vector_store/VectorStoreInMemoryLoad/VectorStoreInMemoryLoad.node.d.ts +0 -5
- package/dist/nodes/vector_store/VectorStoreInMemoryLoad/VectorStoreInMemoryLoad.node.js +0 -65
- package/dist/nodes/vector_store/VectorStoreInMemoryLoad/VectorStoreInMemoryLoad.node.js.map +0 -1
- package/dist/nodes/vector_store/VectorStorePineconeInsert/VectorStorePineconeInsert.node.d.ts +0 -11
- package/dist/nodes/vector_store/VectorStorePineconeInsert/VectorStorePineconeInsert.node.js +0 -113
- package/dist/nodes/vector_store/VectorStorePineconeInsert/VectorStorePineconeInsert.node.js.map +0 -1
- package/dist/nodes/vector_store/VectorStorePineconeInsert/pinecone.svg +0 -1
- package/dist/nodes/vector_store/VectorStorePineconeLoad/VectorStorePineconeLoad.node.d.ts +0 -11
- package/dist/nodes/vector_store/VectorStorePineconeLoad/VectorStorePineconeLoad.node.js +0 -100
- package/dist/nodes/vector_store/VectorStorePineconeLoad/VectorStorePineconeLoad.node.js.map +0 -1
- package/dist/nodes/vector_store/VectorStorePineconeLoad/pinecone.svg +0 -1
- package/dist/nodes/vector_store/VectorStoreSupabaseInsert/VectorStoreSupabaseInsert.node.d.ts +0 -11
- package/dist/nodes/vector_store/VectorStoreSupabaseInsert/VectorStoreSupabaseInsert.node.js +0 -103
- package/dist/nodes/vector_store/VectorStoreSupabaseInsert/VectorStoreSupabaseInsert.node.js.map +0 -1
- package/dist/nodes/vector_store/VectorStoreSupabaseInsert/supabase.svg +0 -1
- package/dist/nodes/vector_store/VectorStoreSupabaseLoad/VectorStoreSupabaseLoad.node.d.ts +0 -11
- package/dist/nodes/vector_store/VectorStoreSupabaseLoad/VectorStoreSupabaseLoad.node.js +0 -96
- package/dist/nodes/vector_store/VectorStoreSupabaseLoad/VectorStoreSupabaseLoad.node.js.map +0 -1
- package/dist/nodes/vector_store/VectorStoreSupabaseLoad/supabase.svg +0 -1
- package/dist/nodes/vector_store/VectorStoreZep/VectorStoreZep.node.d.ts +0 -29
- package/dist/nodes/vector_store/VectorStoreZep/VectorStoreZep.node.js +0 -130
- package/dist/nodes/vector_store/VectorStoreZep/VectorStoreZep.node.js.map +0 -1
- package/dist/nodes/vector_store/VectorStoreZep/zep.png +0 -0
- package/dist/nodes/vector_store/VectorStoreZepInsert/VectorStoreZepInsert.node.d.ts +0 -5
- package/dist/nodes/vector_store/VectorStoreZepInsert/VectorStoreZepInsert.node.js +0 -122
- package/dist/nodes/vector_store/VectorStoreZepInsert/VectorStoreZepInsert.node.js.map +0 -1
- package/dist/nodes/vector_store/VectorStoreZepInsert/zep.png +0 -0
- package/dist/nodes/vector_store/VectorStoreZepLoad/VectorStoreZepLoad.node.d.ts +0 -5
- package/dist/nodes/vector_store/VectorStoreZepLoad/VectorStoreZepLoad.node.js +0 -103
- package/dist/nodes/vector_store/VectorStoreZepLoad/VectorStoreZepLoad.node.js.map +0 -1
- package/dist/nodes/vector_store/VectorStoreZepLoad/zep.png +0 -0
|
@@ -1,671 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.configureToolFunction = exports.prepareToolDescription = exports.updateParametersAndOptions = exports.extractParametersFromText = exports.configureResponseOptimizer = exports.configureHttpRequestFunction = void 0;
|
|
40
|
-
exports.makeToolInputSchema = makeToolInputSchema;
|
|
41
|
-
const readability_1 = require("@mozilla/readability");
|
|
42
|
-
const cheerio = __importStar(require("cheerio"));
|
|
43
|
-
const html_to_text_1 = require("html-to-text");
|
|
44
|
-
const jsdom_1 = require("jsdom");
|
|
45
|
-
const get_1 = __importDefault(require("lodash/get"));
|
|
46
|
-
const set_1 = __importDefault(require("lodash/set"));
|
|
47
|
-
const unset_1 = __importDefault(require("lodash/unset"));
|
|
48
|
-
const GenericFunctions_1 = require("n8n-nodes-base/dist/nodes/HttpRequest/GenericFunctions");
|
|
49
|
-
const n8n_workflow_1 = require("n8n-workflow");
|
|
50
|
-
const zod_1 = require("zod");
|
|
51
|
-
const ai_utilities_1 = require("@n8n/ai-utilities");
|
|
52
|
-
const assertCredentialUrlAllowed = (ctx, credentials, options) => {
|
|
53
|
-
if (!credentials)
|
|
54
|
-
return;
|
|
55
|
-
const allowedDomains = (0, n8n_workflow_1.assertCredentialAllowsUrl)({
|
|
56
|
-
node: ctx.getNode(),
|
|
57
|
-
credentialData: credentials,
|
|
58
|
-
url: options.url,
|
|
59
|
-
});
|
|
60
|
-
if (allowedDomains)
|
|
61
|
-
options.allowedDomains = allowedDomains;
|
|
62
|
-
};
|
|
63
|
-
const genericCredentialRequest = async (ctx, itemIndex) => {
|
|
64
|
-
const genericType = ctx.getNodeParameter('genericAuthType', itemIndex);
|
|
65
|
-
if (genericType === 'httpBasicAuth' || genericType === 'httpDigestAuth') {
|
|
66
|
-
const basicAuth = await ctx.getCredentials('httpBasicAuth', itemIndex);
|
|
67
|
-
const sendImmediately = genericType === 'httpDigestAuth' ? false : undefined;
|
|
68
|
-
return async (options) => {
|
|
69
|
-
assertCredentialUrlAllowed(ctx, basicAuth, options);
|
|
70
|
-
options.auth = {
|
|
71
|
-
username: basicAuth.user,
|
|
72
|
-
password: basicAuth.password,
|
|
73
|
-
sendImmediately,
|
|
74
|
-
};
|
|
75
|
-
return await ctx.helpers.httpRequest(options);
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
if (genericType === 'httpHeaderAuth') {
|
|
79
|
-
const headerAuth = await ctx.getCredentials('httpHeaderAuth', itemIndex);
|
|
80
|
-
return async (options) => {
|
|
81
|
-
assertCredentialUrlAllowed(ctx, headerAuth, options);
|
|
82
|
-
if (!options.headers)
|
|
83
|
-
options.headers = {};
|
|
84
|
-
options.headers[headerAuth.name] = headerAuth.value;
|
|
85
|
-
return await ctx.helpers.httpRequest(options);
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
if (genericType === 'httpQueryAuth') {
|
|
89
|
-
const queryAuth = await ctx.getCredentials('httpQueryAuth', itemIndex);
|
|
90
|
-
return async (options) => {
|
|
91
|
-
assertCredentialUrlAllowed(ctx, queryAuth, options);
|
|
92
|
-
if (!options.qs)
|
|
93
|
-
options.qs = {};
|
|
94
|
-
options.qs[queryAuth.name] = queryAuth.value;
|
|
95
|
-
return await ctx.helpers.httpRequest(options);
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
if (genericType === 'httpCustomAuth') {
|
|
99
|
-
const customAuth = await ctx.getCredentials('httpCustomAuth', itemIndex);
|
|
100
|
-
return async (options) => {
|
|
101
|
-
assertCredentialUrlAllowed(ctx, customAuth, options);
|
|
102
|
-
const auth = (0, n8n_workflow_1.jsonParse)(customAuth.json || '{}', {
|
|
103
|
-
errorMessage: 'Invalid Custom Auth JSON',
|
|
104
|
-
});
|
|
105
|
-
if (auth.headers) {
|
|
106
|
-
options.headers = { ...options.headers, ...auth.headers };
|
|
107
|
-
}
|
|
108
|
-
if (auth.body) {
|
|
109
|
-
options.body = { ...options.body, ...auth.body };
|
|
110
|
-
}
|
|
111
|
-
if (auth.qs) {
|
|
112
|
-
options.qs = { ...options.qs, ...auth.qs };
|
|
113
|
-
}
|
|
114
|
-
return await ctx.helpers.httpRequest(options);
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
if (genericType === 'httpTemplatedCustomAuth') {
|
|
118
|
-
const templatedAuth = await ctx.getCredentials('httpTemplatedCustomAuth', itemIndex);
|
|
119
|
-
return async (options) => {
|
|
120
|
-
assertCredentialUrlAllowed(ctx, templatedAuth, options);
|
|
121
|
-
return await ctx.helpers.httpRequestWithAuthentication.call(ctx, 'httpTemplatedCustomAuth', options);
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
if (genericType === 'oAuth1Api') {
|
|
125
|
-
const oAuth1 = await ctx.getCredentials('oAuth1Api', itemIndex);
|
|
126
|
-
return async (options) => {
|
|
127
|
-
assertCredentialUrlAllowed(ctx, oAuth1, options);
|
|
128
|
-
return await ctx.helpers.requestOAuth1.call(ctx, 'oAuth1Api', options);
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
if (genericType === 'oAuth2Api') {
|
|
132
|
-
const oAuth2 = await ctx.getCredentials('oAuth2Api', itemIndex);
|
|
133
|
-
return async (options) => {
|
|
134
|
-
assertCredentialUrlAllowed(ctx, oAuth2, options);
|
|
135
|
-
return await ctx.helpers.requestOAuth2.call(ctx, 'oAuth2Api', options, {
|
|
136
|
-
tokenType: 'Bearer',
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `The type ${genericType} is not supported`, {
|
|
141
|
-
itemIndex,
|
|
142
|
-
});
|
|
143
|
-
};
|
|
144
|
-
const predefinedCredentialRequest = async (ctx, itemIndex) => {
|
|
145
|
-
const predefinedType = ctx.getNodeParameter('nodeCredentialType', itemIndex);
|
|
146
|
-
const additionalOptions = (0, GenericFunctions_1.getOAuth2AdditionalParameters)(predefinedType);
|
|
147
|
-
const credentials = await ctx.getCredentials(predefinedType, itemIndex);
|
|
148
|
-
return async (options) => {
|
|
149
|
-
assertCredentialUrlAllowed(ctx, credentials, options);
|
|
150
|
-
return await ctx.helpers.httpRequestWithAuthentication.call(ctx, predefinedType, options, additionalOptions && { oauth2: additionalOptions });
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
const configureHttpRequestFunction = async (ctx, credentialsType, itemIndex) => {
|
|
154
|
-
switch (credentialsType) {
|
|
155
|
-
case 'genericCredentialType':
|
|
156
|
-
return await genericCredentialRequest(ctx, itemIndex);
|
|
157
|
-
case 'predefinedCredentialType':
|
|
158
|
-
return await predefinedCredentialRequest(ctx, itemIndex);
|
|
159
|
-
default:
|
|
160
|
-
return async (options) => {
|
|
161
|
-
return await ctx.helpers.httpRequest(options);
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
exports.configureHttpRequestFunction = configureHttpRequestFunction;
|
|
166
|
-
const defaultOptimizer = (response) => {
|
|
167
|
-
if (typeof response === 'string') {
|
|
168
|
-
return response;
|
|
169
|
-
}
|
|
170
|
-
if (typeof response === 'object') {
|
|
171
|
-
return JSON.stringify(response, null, 2);
|
|
172
|
-
}
|
|
173
|
-
return String(response);
|
|
174
|
-
};
|
|
175
|
-
const MAX_ERROR_BODY_LENGTH = 2000;
|
|
176
|
-
const getFailedRequest = (error) => {
|
|
177
|
-
for (const candidate of [error, error?.cause]) {
|
|
178
|
-
const failed = candidate;
|
|
179
|
-
const body = failed?.response?.data ?? failed?.error ?? failed?.context?.data;
|
|
180
|
-
const status = failed?.response?.status;
|
|
181
|
-
if (body !== undefined || status !== undefined) {
|
|
182
|
-
return { status, body };
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return {};
|
|
186
|
-
};
|
|
187
|
-
const serializeErrorBody = (body) => {
|
|
188
|
-
if (body === undefined || body === null || body === '' || isBinary(body)) {
|
|
189
|
-
return undefined;
|
|
190
|
-
}
|
|
191
|
-
let serialized;
|
|
192
|
-
try {
|
|
193
|
-
serialized = defaultOptimizer(body);
|
|
194
|
-
}
|
|
195
|
-
catch {
|
|
196
|
-
return undefined;
|
|
197
|
-
}
|
|
198
|
-
return serialized.trim() ? (0, ai_utilities_1.redactSecrets)(serialized) : undefined;
|
|
199
|
-
};
|
|
200
|
-
function isBinary(data) {
|
|
201
|
-
if (Buffer.isBuffer(data)) {
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
if (typeof data === 'string') {
|
|
205
|
-
if (data.includes('\0')) {
|
|
206
|
-
return true;
|
|
207
|
-
}
|
|
208
|
-
return false;
|
|
209
|
-
}
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
const htmlOptimizer = (ctx, itemIndex, maxLength) => {
|
|
213
|
-
const cssSelector = ctx.getNodeParameter('cssSelector', itemIndex, '');
|
|
214
|
-
const onlyContent = ctx.getNodeParameter('onlyContent', itemIndex, false);
|
|
215
|
-
let elementsToOmit = [];
|
|
216
|
-
if (onlyContent) {
|
|
217
|
-
const elementsToOmitUi = ctx.getNodeParameter('elementsToOmit', itemIndex, '');
|
|
218
|
-
if (typeof elementsToOmitUi === 'string') {
|
|
219
|
-
elementsToOmit = elementsToOmitUi
|
|
220
|
-
.split(',')
|
|
221
|
-
.filter((s) => s)
|
|
222
|
-
.map((s) => s.trim());
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return (response) => {
|
|
226
|
-
if (typeof response !== 'string') {
|
|
227
|
-
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `The response type must be a string. Received: ${typeof response}`, { itemIndex });
|
|
228
|
-
}
|
|
229
|
-
const returnData = [];
|
|
230
|
-
const html = cheerio.load(response);
|
|
231
|
-
const htmlElements = html(cssSelector);
|
|
232
|
-
htmlElements.each((_, el) => {
|
|
233
|
-
let value = html(el).html() || '';
|
|
234
|
-
if (onlyContent) {
|
|
235
|
-
let htmlToTextOptions;
|
|
236
|
-
if (elementsToOmit?.length) {
|
|
237
|
-
htmlToTextOptions = {
|
|
238
|
-
selectors: elementsToOmit.map((selector) => ({
|
|
239
|
-
selector,
|
|
240
|
-
format: 'skip',
|
|
241
|
-
})),
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
value = (0, html_to_text_1.convert)(value, htmlToTextOptions);
|
|
245
|
-
}
|
|
246
|
-
value = value
|
|
247
|
-
.trim()
|
|
248
|
-
.replace(/^\s+|\s+$/g, '')
|
|
249
|
-
.replace(/(\r\n|\n|\r)/gm, '')
|
|
250
|
-
.replace(/\s+/g, ' ');
|
|
251
|
-
returnData.push(value);
|
|
252
|
-
});
|
|
253
|
-
const text = JSON.stringify(returnData, null, 2);
|
|
254
|
-
if (maxLength > 0 && text.length > maxLength) {
|
|
255
|
-
return text.substring(0, maxLength);
|
|
256
|
-
}
|
|
257
|
-
return text;
|
|
258
|
-
};
|
|
259
|
-
};
|
|
260
|
-
const textOptimizer = (ctx, itemIndex, maxLength) => {
|
|
261
|
-
return (response) => {
|
|
262
|
-
if (typeof response === 'object') {
|
|
263
|
-
try {
|
|
264
|
-
response = JSON.stringify(response, null, 2);
|
|
265
|
-
}
|
|
266
|
-
catch (error) { }
|
|
267
|
-
}
|
|
268
|
-
if (typeof response !== 'string') {
|
|
269
|
-
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `The response type must be a string. Received: ${typeof response}`, { itemIndex });
|
|
270
|
-
}
|
|
271
|
-
const dom = new jsdom_1.JSDOM(response);
|
|
272
|
-
const article = new readability_1.Readability(dom.window.document, {
|
|
273
|
-
keepClasses: true,
|
|
274
|
-
}).parse();
|
|
275
|
-
const text = article?.textContent || '';
|
|
276
|
-
if (maxLength > 0 && text.length > maxLength) {
|
|
277
|
-
return text.substring(0, maxLength);
|
|
278
|
-
}
|
|
279
|
-
return text;
|
|
280
|
-
};
|
|
281
|
-
};
|
|
282
|
-
const jsonOptimizer = (ctx, itemIndex) => {
|
|
283
|
-
return (response) => {
|
|
284
|
-
let responseData = response;
|
|
285
|
-
if (typeof responseData === 'string') {
|
|
286
|
-
responseData = (0, n8n_workflow_1.jsonParse)(response);
|
|
287
|
-
}
|
|
288
|
-
if (typeof responseData !== 'object' || !responseData) {
|
|
289
|
-
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'The response type must be an object or an array of objects', { itemIndex });
|
|
290
|
-
}
|
|
291
|
-
const dataField = ctx.getNodeParameter('dataField', itemIndex, '');
|
|
292
|
-
let returnData = [];
|
|
293
|
-
if (!Array.isArray(responseData)) {
|
|
294
|
-
if (dataField) {
|
|
295
|
-
const data = responseData[dataField];
|
|
296
|
-
if (Array.isArray(data)) {
|
|
297
|
-
responseData = data;
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
responseData = [data];
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
else {
|
|
304
|
-
responseData = [responseData];
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
if (dataField) {
|
|
309
|
-
responseData = responseData.map((data) => data[dataField]);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
const fieldsToInclude = ctx.getNodeParameter('fieldsToInclude', itemIndex, 'all');
|
|
313
|
-
let fields = [];
|
|
314
|
-
if (fieldsToInclude !== 'all') {
|
|
315
|
-
fields = ctx.getNodeParameter('fields', itemIndex, []);
|
|
316
|
-
if (typeof fields === 'string') {
|
|
317
|
-
fields = fields.split(',').map((field) => field.trim());
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
else {
|
|
321
|
-
returnData = responseData;
|
|
322
|
-
}
|
|
323
|
-
if (fieldsToInclude === 'selected') {
|
|
324
|
-
for (const item of responseData) {
|
|
325
|
-
const newItem = {};
|
|
326
|
-
for (const field of fields) {
|
|
327
|
-
(0, set_1.default)(newItem, field, (0, get_1.default)(item, field));
|
|
328
|
-
}
|
|
329
|
-
returnData.push(newItem);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
if (fieldsToInclude === 'except') {
|
|
333
|
-
for (const item of responseData) {
|
|
334
|
-
for (const field of fields) {
|
|
335
|
-
(0, unset_1.default)(item, field);
|
|
336
|
-
}
|
|
337
|
-
returnData.push(item);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
return JSON.stringify(returnData, null, 2);
|
|
341
|
-
};
|
|
342
|
-
};
|
|
343
|
-
const configureResponseOptimizer = (ctx, itemIndex) => {
|
|
344
|
-
const optimizeResponse = ctx.getNodeParameter('optimizeResponse', itemIndex, false);
|
|
345
|
-
if (optimizeResponse) {
|
|
346
|
-
const responseType = ctx.getNodeParameter('responseType', itemIndex);
|
|
347
|
-
let maxLength = 0;
|
|
348
|
-
const truncateResponse = ctx.getNodeParameter('truncateResponse', itemIndex, false);
|
|
349
|
-
if (truncateResponse) {
|
|
350
|
-
maxLength = ctx.getNodeParameter('maxLength', itemIndex, 0);
|
|
351
|
-
}
|
|
352
|
-
switch (responseType) {
|
|
353
|
-
case 'html':
|
|
354
|
-
return htmlOptimizer(ctx, itemIndex, maxLength);
|
|
355
|
-
case 'text':
|
|
356
|
-
return textOptimizer(ctx, itemIndex, maxLength);
|
|
357
|
-
case 'json':
|
|
358
|
-
return jsonOptimizer(ctx, itemIndex);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
return defaultOptimizer;
|
|
362
|
-
};
|
|
363
|
-
exports.configureResponseOptimizer = configureResponseOptimizer;
|
|
364
|
-
const extractPlaceholders = (text) => {
|
|
365
|
-
const placeholder = /(\{[a-zA-Z0-9_-]+\})/g;
|
|
366
|
-
const returnData = [];
|
|
367
|
-
const matches = text.matchAll(placeholder);
|
|
368
|
-
for (const match of matches) {
|
|
369
|
-
returnData.push(match[0].replace(/{|}/g, ''));
|
|
370
|
-
}
|
|
371
|
-
return returnData;
|
|
372
|
-
};
|
|
373
|
-
const extractParametersFromText = (placeholders, text, sendIn, key) => {
|
|
374
|
-
if (typeof text !== 'string')
|
|
375
|
-
return [];
|
|
376
|
-
const parameters = extractPlaceholders(text);
|
|
377
|
-
if (parameters.length) {
|
|
378
|
-
const inputParameters = prepareParameters(parameters.map((name) => ({
|
|
379
|
-
name,
|
|
380
|
-
valueProvider: 'modelRequired',
|
|
381
|
-
})), placeholders, 'keypair', sendIn, '');
|
|
382
|
-
return key
|
|
383
|
-
? inputParameters.parameters.map((p) => ({ ...p, key }))
|
|
384
|
-
: inputParameters.parameters;
|
|
385
|
-
}
|
|
386
|
-
return [];
|
|
387
|
-
};
|
|
388
|
-
exports.extractParametersFromText = extractParametersFromText;
|
|
389
|
-
function prepareParameters(rawParameters, placeholders, parametersInputType, sendIn, modelInputDescription, jsonWithPlaceholders) {
|
|
390
|
-
const parameters = [];
|
|
391
|
-
const values = {};
|
|
392
|
-
if (parametersInputType === 'model') {
|
|
393
|
-
return {
|
|
394
|
-
parameters: [
|
|
395
|
-
{
|
|
396
|
-
name: sendIn,
|
|
397
|
-
required: true,
|
|
398
|
-
type: 'json',
|
|
399
|
-
description: modelInputDescription,
|
|
400
|
-
sendIn,
|
|
401
|
-
},
|
|
402
|
-
],
|
|
403
|
-
values: {},
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
if (parametersInputType === 'keypair') {
|
|
407
|
-
for (const entry of rawParameters) {
|
|
408
|
-
if (entry.valueProvider.includes('model')) {
|
|
409
|
-
const placeholder = placeholders.find((p) => p.name === entry.name);
|
|
410
|
-
const parameter = {
|
|
411
|
-
name: entry.name,
|
|
412
|
-
required: entry.valueProvider === 'modelRequired',
|
|
413
|
-
sendIn,
|
|
414
|
-
};
|
|
415
|
-
if (placeholder) {
|
|
416
|
-
parameter.type = placeholder.type;
|
|
417
|
-
parameter.description = placeholder.description;
|
|
418
|
-
}
|
|
419
|
-
parameters.push(parameter);
|
|
420
|
-
}
|
|
421
|
-
else if (entry.value) {
|
|
422
|
-
parameters.push(...(0, exports.extractParametersFromText)(placeholders, entry.value, sendIn, entry.name));
|
|
423
|
-
values[entry.name] = entry.value;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
if (parametersInputType === 'json' && jsonWithPlaceholders) {
|
|
428
|
-
parameters.push(...(0, exports.extractParametersFromText)(placeholders, jsonWithPlaceholders, sendIn, `${sendIn + 'Raw'}`));
|
|
429
|
-
}
|
|
430
|
-
return {
|
|
431
|
-
parameters,
|
|
432
|
-
values,
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
const MODEL_INPUT_DESCRIPTION = {
|
|
436
|
-
qs: 'Query parameters for request as key value pairs',
|
|
437
|
-
headers: 'Headers parameters for request as key value pairs',
|
|
438
|
-
body: 'Body parameters for request as key value pairs',
|
|
439
|
-
};
|
|
440
|
-
const updateParametersAndOptions = (options) => {
|
|
441
|
-
const { ctx, itemIndex, toolParameters, placeholdersDefinitions, requestOptions, rawRequestOptions, requestOptionsProperty, inputTypePropertyName, jsonPropertyName, parametersPropertyName, } = options;
|
|
442
|
-
const inputType = ctx.getNodeParameter(inputTypePropertyName, itemIndex, 'keypair');
|
|
443
|
-
let parametersValues = [];
|
|
444
|
-
if (inputType === 'json') {
|
|
445
|
-
rawRequestOptions[requestOptionsProperty] = ctx.getNodeParameter(jsonPropertyName, itemIndex, '');
|
|
446
|
-
}
|
|
447
|
-
else {
|
|
448
|
-
parametersValues = ctx.getNodeParameter(parametersPropertyName, itemIndex, []);
|
|
449
|
-
}
|
|
450
|
-
const inputParameters = prepareParameters(parametersValues, placeholdersDefinitions, inputType, requestOptionsProperty, MODEL_INPUT_DESCRIPTION[requestOptionsProperty], rawRequestOptions[requestOptionsProperty]);
|
|
451
|
-
toolParameters.push(...inputParameters.parameters);
|
|
452
|
-
requestOptions[requestOptionsProperty] = {
|
|
453
|
-
...requestOptions[requestOptionsProperty],
|
|
454
|
-
...inputParameters.values,
|
|
455
|
-
};
|
|
456
|
-
};
|
|
457
|
-
exports.updateParametersAndOptions = updateParametersAndOptions;
|
|
458
|
-
const getParametersDescription = (parameters) => parameters
|
|
459
|
-
.map((p) => `${p.name}: (description: ${p.description ?? ''}, type: ${p.type ?? 'string'}, required: ${!!p.required})`)
|
|
460
|
-
.join(',\n ');
|
|
461
|
-
const prepareToolDescription = (toolDescription, toolParameters) => {
|
|
462
|
-
let description = `${toolDescription}`;
|
|
463
|
-
if (toolParameters.length) {
|
|
464
|
-
description += `
|
|
465
|
-
Tool expects valid stringified JSON object with ${toolParameters.length} properties.
|
|
466
|
-
Property names with description, type and required status:
|
|
467
|
-
${getParametersDescription(toolParameters)}
|
|
468
|
-
ALL parameters marked as required must be provided`;
|
|
469
|
-
}
|
|
470
|
-
return description;
|
|
471
|
-
};
|
|
472
|
-
exports.prepareToolDescription = prepareToolDescription;
|
|
473
|
-
const configureToolFunction = (ctx, itemIndex, toolParameters, requestOptions, rawRequestOptions, httpRequest, optimizeResponse) => {
|
|
474
|
-
return async (query) => {
|
|
475
|
-
const { index } = ctx.addInputData(n8n_workflow_1.NodeConnectionTypes.AiTool, [[{ json: { query } }]]);
|
|
476
|
-
const options = structuredClone(requestOptions);
|
|
477
|
-
const clonedRawRequestOptions = structuredClone(rawRequestOptions);
|
|
478
|
-
let fullResponse;
|
|
479
|
-
let response = '';
|
|
480
|
-
let executionError = undefined;
|
|
481
|
-
if (!toolParameters.length) {
|
|
482
|
-
query = '{}';
|
|
483
|
-
}
|
|
484
|
-
try {
|
|
485
|
-
if (query) {
|
|
486
|
-
let dataFromModel;
|
|
487
|
-
if (typeof query === 'string') {
|
|
488
|
-
try {
|
|
489
|
-
dataFromModel = (0, n8n_workflow_1.jsonParse)(query);
|
|
490
|
-
}
|
|
491
|
-
catch (error) {
|
|
492
|
-
if (toolParameters.length === 1) {
|
|
493
|
-
dataFromModel = { [toolParameters[0].name]: query };
|
|
494
|
-
}
|
|
495
|
-
else {
|
|
496
|
-
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Input is not a valid JSON: ${error.message}`, { itemIndex });
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
else {
|
|
501
|
-
dataFromModel = query;
|
|
502
|
-
}
|
|
503
|
-
for (const parameter of toolParameters) {
|
|
504
|
-
if (parameter.required &&
|
|
505
|
-
(dataFromModel[parameter.name] === undefined || dataFromModel[parameter.name] === null)) {
|
|
506
|
-
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Model did not provide parameter '${parameter.name}' which is required and must be present in the input`, { itemIndex });
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
for (const parameter of toolParameters) {
|
|
510
|
-
let argument = dataFromModel[parameter.name];
|
|
511
|
-
if (argument &&
|
|
512
|
-
parameter.type === 'json' &&
|
|
513
|
-
!['qsRaw', 'headersRaw', 'bodyRaw'].includes(parameter.key ?? '') &&
|
|
514
|
-
typeof argument !== 'object') {
|
|
515
|
-
try {
|
|
516
|
-
argument = (0, n8n_workflow_1.jsonParse)(String(argument));
|
|
517
|
-
}
|
|
518
|
-
catch (error) {
|
|
519
|
-
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Parameter ${parameter.name} is not a valid JSON: ${error.message}`, {
|
|
520
|
-
itemIndex,
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
if (parameter.sendIn === 'path') {
|
|
525
|
-
argument = String(argument);
|
|
526
|
-
argument = argument.replace(/^['"]+|['"]+$/g, '');
|
|
527
|
-
options.url = options.url.replace(`{${parameter.name}}`, argument);
|
|
528
|
-
continue;
|
|
529
|
-
}
|
|
530
|
-
if (parameter.sendIn === parameter.name) {
|
|
531
|
-
(0, set_1.default)(options, [parameter.sendIn], argument);
|
|
532
|
-
continue;
|
|
533
|
-
}
|
|
534
|
-
if (['qsRaw', 'headersRaw', 'bodyRaw'].includes(parameter.key ?? '')) {
|
|
535
|
-
if (parameter.type === 'string') {
|
|
536
|
-
argument = String(argument);
|
|
537
|
-
if (!argument.startsWith('"') &&
|
|
538
|
-
!clonedRawRequestOptions[parameter.sendIn].includes(`"{${parameter.name}}"`)) {
|
|
539
|
-
argument = `"${argument}"`;
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
if (typeof argument === 'object') {
|
|
543
|
-
argument = JSON.stringify(argument);
|
|
544
|
-
}
|
|
545
|
-
clonedRawRequestOptions[parameter.sendIn] = clonedRawRequestOptions[parameter.sendIn].replace(`{${parameter.name}}`, String(argument));
|
|
546
|
-
continue;
|
|
547
|
-
}
|
|
548
|
-
if (parameter.key) {
|
|
549
|
-
let requestOptionsValue = (0, get_1.default)(options, [parameter.sendIn, parameter.key]);
|
|
550
|
-
if (typeof requestOptionsValue === 'string') {
|
|
551
|
-
requestOptionsValue = requestOptionsValue.replace(`{${parameter.name}}`, String(argument));
|
|
552
|
-
}
|
|
553
|
-
(0, set_1.default)(options, [parameter.sendIn, parameter.key], requestOptionsValue);
|
|
554
|
-
continue;
|
|
555
|
-
}
|
|
556
|
-
(0, set_1.default)(options, [parameter.sendIn, parameter.name], argument);
|
|
557
|
-
}
|
|
558
|
-
for (const [key, value] of Object.entries(clonedRawRequestOptions)) {
|
|
559
|
-
if (value) {
|
|
560
|
-
let parsedValue;
|
|
561
|
-
try {
|
|
562
|
-
parsedValue = (0, n8n_workflow_1.jsonParse)(value, { repairJSON: true });
|
|
563
|
-
}
|
|
564
|
-
catch (error) {
|
|
565
|
-
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Could not replace placeholders in ${key}: ${error.message}`);
|
|
566
|
-
}
|
|
567
|
-
options[key] = parsedValue;
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
if (options) {
|
|
572
|
-
options.url = encodeURI(options.url);
|
|
573
|
-
if (options.headers && !Object.keys(options.headers).length) {
|
|
574
|
-
delete options.headers;
|
|
575
|
-
}
|
|
576
|
-
if (options.qs && !Object.keys(options.qs).length) {
|
|
577
|
-
delete options.qs;
|
|
578
|
-
}
|
|
579
|
-
if (options.body && !Object.keys(options.body).length) {
|
|
580
|
-
delete options.body;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
catch (error) {
|
|
585
|
-
const errorMessage = 'Input provided by model is not valid';
|
|
586
|
-
if (error instanceof n8n_workflow_1.NodeOperationError) {
|
|
587
|
-
executionError = error;
|
|
588
|
-
}
|
|
589
|
-
else {
|
|
590
|
-
executionError = new n8n_workflow_1.NodeOperationError(ctx.getNode(), errorMessage, {
|
|
591
|
-
itemIndex,
|
|
592
|
-
});
|
|
593
|
-
}
|
|
594
|
-
response = errorMessage;
|
|
595
|
-
}
|
|
596
|
-
if (options) {
|
|
597
|
-
try {
|
|
598
|
-
fullResponse = await httpRequest(options);
|
|
599
|
-
}
|
|
600
|
-
catch (error) {
|
|
601
|
-
const { status, body } = getFailedRequest(error);
|
|
602
|
-
const httpCode = error.httpCode ?? status;
|
|
603
|
-
const message = (0, ai_utilities_1.redactSecrets)(error.message);
|
|
604
|
-
response = `${httpCode ? `HTTP ${httpCode} ` : ''}There was an error: "${message}"`;
|
|
605
|
-
const errorBody = serializeErrorBody(body);
|
|
606
|
-
if (errorBody !== undefined && !message.includes(errorBody)) {
|
|
607
|
-
response += `\nResponse body: ${errorBody.slice(0, MAX_ERROR_BODY_LENGTH)}${errorBody.length > MAX_ERROR_BODY_LENGTH ? '... [truncated]' : ''}`;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
if (!response) {
|
|
611
|
-
try {
|
|
612
|
-
if (fullResponse.body && isBinary(fullResponse.body)) {
|
|
613
|
-
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'Binary data is not supported');
|
|
614
|
-
}
|
|
615
|
-
response = optimizeResponse(fullResponse.body ?? fullResponse);
|
|
616
|
-
}
|
|
617
|
-
catch (error) {
|
|
618
|
-
response = `There was an error: "${error.message}"`;
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
if (typeof response !== 'string') {
|
|
623
|
-
executionError = new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'Wrong output type returned', {
|
|
624
|
-
description: `The response property should be a string, but it is an ${typeof response}`,
|
|
625
|
-
});
|
|
626
|
-
response = `There was an error: "${executionError.message}"`;
|
|
627
|
-
}
|
|
628
|
-
if (executionError) {
|
|
629
|
-
void ctx.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiTool, index, executionError);
|
|
630
|
-
}
|
|
631
|
-
else {
|
|
632
|
-
void ctx.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiTool, index, [[{ json: { response } }]]);
|
|
633
|
-
}
|
|
634
|
-
(0, ai_utilities_1.logAiEvent)(ctx, 'ai-tool-called', { query, response });
|
|
635
|
-
return response;
|
|
636
|
-
};
|
|
637
|
-
};
|
|
638
|
-
exports.configureToolFunction = configureToolFunction;
|
|
639
|
-
function makeParameterZodSchema(parameter) {
|
|
640
|
-
let schema;
|
|
641
|
-
if (parameter.type === 'string') {
|
|
642
|
-
schema = zod_1.z.string();
|
|
643
|
-
}
|
|
644
|
-
else if (parameter.type === 'number') {
|
|
645
|
-
schema = zod_1.z.number();
|
|
646
|
-
}
|
|
647
|
-
else if (parameter.type === 'boolean') {
|
|
648
|
-
schema = zod_1.z.boolean();
|
|
649
|
-
}
|
|
650
|
-
else if (parameter.type === 'json') {
|
|
651
|
-
schema = zod_1.z.record(zod_1.z.any());
|
|
652
|
-
}
|
|
653
|
-
else {
|
|
654
|
-
schema = zod_1.z.string();
|
|
655
|
-
}
|
|
656
|
-
if (!parameter.required) {
|
|
657
|
-
schema = schema.optional();
|
|
658
|
-
}
|
|
659
|
-
if (parameter.description) {
|
|
660
|
-
schema = schema.describe(parameter.description);
|
|
661
|
-
}
|
|
662
|
-
return schema;
|
|
663
|
-
}
|
|
664
|
-
function makeToolInputSchema(parameters) {
|
|
665
|
-
const schemaEntries = parameters.map((parameter) => [
|
|
666
|
-
parameter.name,
|
|
667
|
-
makeParameterZodSchema(parameter),
|
|
668
|
-
]);
|
|
669
|
-
return zod_1.z.object(Object.fromEntries(schemaEntries));
|
|
670
|
-
}
|
|
671
|
-
//# sourceMappingURL=utils.js.map
|