You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use the ReActAgent together with Llama3 via Ollama. If I ask a normal question like "Hello. How are you?" the agent crashes, since it's searching for a tool to use. I guess it should not throw an error if no tool needs to be used. Here is the stack trace:
Starting step(id, 0cf7f648-3c0c-4651-90a2-e3713085e94d).
Enqueueing output for step(id, 0cf7f648-3c0c-4651-90a2-e3713085e94d).
/Users/alex/dev/research/llamaindex-ts/node_modules/llamaindex/dist/cjs/agent/react.js:63
throw new Error(`Could not extract tool use from input text: "${inputText}"`);
^
Error: Could not extract tool use from input text: "I need to use a tool to help me answer the question.
Action: None
Action Input: None
Please let me know how I can assist you with your task or question."
at extractToolUse (/Users/alex/dev/research/llamaindex-ts/node_modules/llamaindex/dist/cjs/agent/react.js:63:15)
at reACTOutputParser (/Users/alex/dev/research/llamaindex-ts/node_modules/llamaindex/dist/cjs/agent/react.js:176:54)
at taskHandler (/Users/alex/dev/research/llamaindex-ts/node_modules/llamaindex/dist/cjs/agent/react.js:283:30)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.pull (/Users/alex/dev/research/llamaindex-ts/node_modules/llamaindex/dist/cjs/agent/base.js:432:13)
Here is the code for reproducing:
import{FunctionTool,Ollama,ReActAgent}from"llamaindex"functionadd({ a, b }: {a: number;b: number}){return`${a+b}`}constsumJSON={type: "object",properties: {a: {type: "number",description: "The first number",},b: {type: "number",description: "The second number",},},required: ["a","b"],}asconstconstsumTool=newFunctionTool(add,{name: "sumTool",description: "Add two integers and returns the result integer",parameters: sumJSON,})functionmultiply({ a, b }: {a: number;b: number}){return`${a*b}`}constmultiplyJSON={type: "object",properties: {a: {type: "number",description: "The first number",},b: {type: "number",description: "The second number",},},required: ["a","b"],}asconstconstmultiplyTool=newFunctionTool(multiply,{name: "multiplyTool",description: "Multiply two integers and returns the result integer",parameters: multiplyJSON,})asyncfunctionmain(){constcontext=`You're an agent that function as a calculator. Use the tools only if you're asked to calculate something. Don't provide more information than it was asked for. Do not rely on prior knowledge.`constollama=newOllama({model: "llama3",})constagent=newReActAgent({llm: ollama,tools: [sumTool,multiplyTool],systemPrompt: context,verbose: true,})constprompt="Hello. How are you?"const{ response }=awaitagent.chat({message: prompt,verbose: true,})console.log("ANSWER:",response.message.content)}voidmain().then(()=>{console.log("Done")})
The text was updated successfully, but these errors were encountered:
I use the ReActAgent together with Llama3 via Ollama. If I ask a normal question like "Hello. How are you?" the agent crashes, since it's searching for a tool to use. I guess it should not throw an error if no tool needs to be used. Here is the stack trace:
Here is the code for reproducing:
The text was updated successfully, but these errors were encountered: