Open aicsun opened 1 year ago
Hi @aicsun,
I'm not able to replicate your error:
Hi @chungyau97 I may not be sure if the Custom tool can only be used for OpenAI Function Agent.
Custom tool is best used with OpenAI Function Agent, might run into errors if use with different agent
Can I use the OpenAI Function Agent with Azure ChatOpenAI for the model?
Can I use the OpenAI Function Agent with Azure ChatOpenAI for the model?
The answer is yes. And make sure your Custom Tool node doesn't have any spaces in the name.
Hi is there any update on this receiving the same issues, but it happens randomly.
The issue is that required true and required false work in the same way. You need to provide all the parameters to your tool, otherwise it would throw this error even if a single parameter is absent. If this issue is assigned to me I can solve it.
I keep getting the same error message with OpenAI Function Agent. It is much more reliable if I use gpt-4, but I intermittently get the error message with both models.
Its the Zod Validation that is failing since the input is not according to the schema. With other than gpt-4, an error is thrown while gpt-4 replies with all the parameters that are necessary to be passed into the tool.
Hey guys, so i am having also problems with this issue. Is there other way to use assistants with functions or add parallel function calling differently ?
I'm getting this with gpt-4-1106-preview. I worked around it for now by marking all custom tool fields as required and adding to the description of each field something like "Field must not be blank. Set to 'not-used' when field is not needed." Then in the tool's javascript I convert 'not-used' to undefined.
For example, instead of this:
const field = $field
I do this:
const fieldFromAI = $field
const field = fieldFromAI === 'not-used' ? undefined : fieldFromAI
Not great but it seems to be working consistently so far.
I think you need to use a conversational retrieval agent instead of a conversational agent. And I'm not sure but the comments about using OpenAI 4 preview may also help.
I am running into this trying to use the Conversational Agent and the included Web Browser tool:
[llm/start] [1:chain:AgentExecutor > 2:chain:RunnableAgent > 9:llm:ChatOllama] Entering LLM run with input: {
"messages": [
[
{
"lc": 1,
"type": "constructor",
"id": [
"langchain_core",
"messages",
"SystemMessage"
],
"kwargs": {
"content": "Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist. However, above all else, all responses must adhere to the format of RESPONSE FORMAT INSTRUCTIONS.",
"additional_kwargs": {}
}
},
{
"lc": 1,
"type": "constructor",
"id": [
"langchain_core",
"messages",
"HumanMessage"
],
"kwargs": {
"content": "TOOLS\n------\nAssistant can ask the user to use tools to look up information that may be helpful in answering the users original question. The tools the human can use are:\n\nweb-browser: useful for when you need to find something on or summarize a webpage. input should be a comma separated list of \"ONE valid http URL including protocol\",\"what you want to find on the page or empty string for a summary\".\ncalculator: Useful for getting the result of a math expression. The input to this tool should be a valid mathematical expression that could be executed by a simple calculator.\n\nRESPONSE FORMAT INSTRUCTIONS\n----------------------------\n\nOutput a JSON markdown code snippet containing a valid JSON object in one of two formats:\n\nOption 1:\nUse this if you want the human to use a tool.\nMarkdown code snippet formatted in the following schema:\n\n
json\n{\n \"action\": string, // The action to take. Must be one of [web-browser, calculator]\n \"action_input\": string // The input to the action. May be a stringified object.\n}\n
\n\nOption #2:\nUse this if you want to respond directly and conversationally to the human. Markdown code snippet formatted in the following schema:\n\njson\n{\n \"action\": \"Final Answer\",\n \"action_input\": string // You should put what you want to return to use here and make sure to use valid json newline characters.\n}\n
\n\nFor both options, remember to always include the surrounding markdown code snippet delimiters (begin with \"json\" and end with \"
\")!\n\n\nUSER'S INPUT\n--------------------\nHere is the user's input (remember to respond with a markdown code snippet of a json blob with a single action, and NOTHING else):\n\nlook at\nhttps://engineering.osu.edu\nand tell me what the three most recent news stories are",
"additional_kwargs": {}
}
}
]
]
}
[chain/start] [1:chain:AgentExecutor > 2:chain:RunnableAgent > 10:parser:ChatConversationalAgentOutputParserWithRetries] Entering Chain run with input: {
"lc": 1,
"type": "constructor",
"id": [
"langchain_core",
"messages",
"AIMessage"
],
"kwargs": {
"content": " json\n{\n \"action\": \"web-browser\",\n \"action_input\": [\"https://engineering.osu.edu\", \"Find the three most recent news stories\"]\n}\n
",
"additional_kwargs": {}
}
}
[chain/end] [1:chain:AgentExecutor > 2:chain:RunnableAgent > 10:parser:ChatConversationalAgentOutputParserWithRetries] [0ms] Exiting Chain run with output: {
"tool": "web-browser",
"toolInput": [
"https://engineering.osu.edu",
"Find the three most recent news stories"
],
"log": " json\n{\n \"action\": \"web-browser\",\n \"action_input\": [\"https://engineering.osu.edu\", \"Find the three most recent news stories\"]\n}\n
"
}
[chain/end] [1:chain:AgentExecutor > 2:chain:RunnableAgent] [1.70s] Exiting Chain run with output: {
"tool": "web-browser",
"toolInput": [
"https://engineering.osu.edu",
"Find the three most recent news stories"
],
"log": " json\n{\n \"action\": \"web-browser\",\n \"action_input\": [\"https://engineering.osu.edu\", \"Find the three most recent news stories\"]\n}\n
"
}
[agent/action] [1:chain:AgentExecutor] Agent selected action: {
"tool": "web-browser",
"toolInput": [
"https://engineering.osu.edu",
"Find the three most recent news stories"
],
"log": " json\n{\n \"action\": \"web-browser\",\n \"action_input\": [\"https://engineering.osu.edu\", \"Find the three most recent news stories\"]\n}\n
"
}
[chain/error] [1:chain:AgentExecutor] [1.70s] Chain run errored with error: "Received tool input did not match expected schema\n\nError: Received tool input did not match expected schema\n at WebBrowser.call (/usr/local/lib/node_modules/flowise/node_modules/@langchain/core/dist/tools.cjs:68:19)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async /usr/local/lib/node_modules/flowise/node_modules/flowise-components/dist/src/agents.js:310:29\n at async Promise.all (index 0)\n at async AgentExecutor._call (/usr/local/lib/node_modules/flowise/node_modules/flowise-components/dist/src/agents.js:296:30)\n at async AgentExecutor.invoke (/usr/local/lib/node_modules/flowise/node_modules/langchain/dist/chains/base.cjs:58:28)\n at async ConversationalAgent_Agents.run (/usr/local/lib/node_modules/flowise/node_modules/flowise-components/dist/nodes/agents/ConversationalAgent/ConversationalAgent.js:81:19)\n at async App.buildChatflow (/usr/local/lib/node_modules/flowise/dist/index.js:1738:19)\n at async /usr/local/lib/node_modules/flowise/dist/index.js:1152:13"
2024-03-05 13:46:42 [ERROR]: [server]: Error: Received tool input did not match expected schema
Error: Received tool input did not match expected schema
at WebBrowser.call (/usr/local/lib/node_modules/flowise/node_modules/@langchain/core/dist/tools.cjs:68:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /usr/local/lib/node_modules/flowise/node_modules/flowise-components/dist/src/agents.js:310:29
at async Promise.all (index 0)
at async AgentExecutor._call (/usr/local/lib/node_modules/flowise/node_modules/flowise-components/dist/src/agents.js:296:30)
at async AgentExecutor.invoke (/usr/local/lib/node_modules/flowise/node_modules/langchain/dist/chains/base.cjs:58:28)
at async ConversationalAgent_Agents.run (/usr/local/lib/node_modules/flowise/node_modules/flowise-components/dist/nodes/agents/ConversationalAgent/ConversationalAgent.js:81:19)
at async App.buildChatflow (/usr/local/lib/node_modules/flowise/dist/index.js:1738:19)
at async /usr/local/lib/node_modules/flowise/dist/index.js:1152:13
When I try this with a conversational retrieval agent, it does not even try to use the Web browser, and does not appear to be told it has one with the default parameters: "Do your best to answer the questions. Feel free to use any tools available to look up relevant information, only if necessary." I just get a hallucination back with three non-extant news stories.
Describe the bug Chain run errored with error: "Received tool input did not match expected schema" 2023-09-30 19:51:00 [ERROR]: [server]: Error: Received tool input did not match expected schema Error: Received tool input did not match expected schema
To Reproduce Steps to reproduce the behavior:
Expected behavior Get todays day, date and time.
Flow Add Custom tool to API Agent
Setup
yarn start
]Additional context catch the exception: { "code": "invalid_type", "expected": "object", "received": "undefined", "path": [], "message": "Required" }