FlowiseAI / Flowise

Drag & drop UI to build your customized LLM flow
https://flowiseai.com
Apache License 2.0
27.37k stars 14.15k forks source link

[BUG] MRKLAgent is not compatible with Custom Tool #763

Closed zhengxiang5965 closed 3 months ago

zhengxiang5965 commented 11 months ago

Describe the bug MRKLAgent is not compatible with Custom Tool

To Reproduce Simultaneously using MRKLAgent and Custom Tool to form a stream

Expected behavior A clear and concise description of what you expected to happen.

Screenshots image

Flow Setup

Additional context Add any other context about the problem here.

2023-08-14 05:14:53 [ERROR]: [server]: Error: [ { "code": "invalid_type", "expected": "object", "received": "string", "path": [], "message": "Expected object, received string" } ] ZodError: [ { "code": "invalid_type", "expected": "object", "received": "string", "path": [], "message": "Expected object, received string" } ] at get error [as error] (/usr/local/lib/node_modules/flowise/node_modules/zod/lib/types.js:43:31) at ZodObject.parseAsync (/usr/local/lib/node_modules/flowise/node_modules/zod/lib/types.js:164:22) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async DynamicStructuredTool.call (/usr/local/lib/node_modules/flowise/node_modules/langchain/dist/tools/base.cjs:29:24) at async /usr/local/lib/node_modules/flowise/node_modules/langchain/dist/agents/executor.cjs:104:23 at async Promise.all (index 0) at async AgentExecutor._call (/usr/local/lib/node_modules/flowise/node_modules/langchain/dist/agents/executor.cjs:100:30) at async AgentExecutor.call (/usr/local/lib/node_modules/flowise/node_modules/langchain/dist/chains/base.cjs:98:28) at async MRKLAgentLLM_Agents.run (/usr/local/lib/node_modules/flowise/node_modules/flowise-components/dist/nodes/agents/MRKLAgentLLM/MRKLAgentLLM.js:42:24) at async App.processPrediction (/usr/local/lib/node_modules/flowise/dist/index.js:873:23) error: unexpected EOF

chungyau97 commented 11 months ago

Hi @zhengxiang5965,

Try using OpenAI Function Agent node.

zhengxiang5965 commented 11 months ago

Hi @zhengxiang5965,

Try using OpenAI Function Agent node.

Why are you doing it so rigidly? @chungyau97 Langflow's PythonFunctionTool can support multiple agents

HenryHengZJ commented 10 months ago

Hi @zhengxiang5965, Try using OpenAI Function Agent node.

Why are you doing it so rigidly? @chungyau97 Langflow's PythonFunctionTool can support multiple agents

Custom Tool is meant to work with Conversation Agent or better with OpenAI Function Agent. Why? Because underlying its a Zod Schema similar to Pydantic, and works best with OpenAI Function Calling. That's why it's recommended to use OpenAI Function Agent

zhengxiang5965 commented 10 months ago

The react prompt agent needs to be used in combination with "custom tools", and I believe it can be fully implemented technically, which has already been implemented in Langflow

@HenryHengZJ

and there will be no problem with "expected object, received string". This problem seems to be easy to solve

https://python.langchain.com/docs/modules/agents/tools/custom_tools image

Obviously, ZERO SHOT REACT_ DESCRIPTION can be combined with 'customers tools'