I am was trying to figure out a way to use StructuredTool
as a multi-input Tool and used from an Agent; for example, an ZeroShotAgent
.
Sadly, looks like all the agents are defined to use Tool[]
instead of StructuredTool[ ]
or ObjectTool[ ]
. Is there any way I can do that?
This is my code, the final Tool (QuerySpecificFieldSupabaseTool) is an StructuredTool
which is incompatible with the Agents.
export class SupabaseToolkit extends Toolkit {
tools: Tool[];
cli: SupabaseClient
dialect = "supabase"
constructor(cli: SupabaseClient) {
super()
this.cli = cli
this.tools = [
new QuerySupabaseTool(cli),
new ListTablesSupabaseTool(cli),
new ListFieldsSupabaseTool(cli),
new QuerySpecificFieldSupabaseTool(cli),
]
}
}
As of 02 May 2023 (likely subject to change):
Structured Tools can only accept one string argument in order to be compatible with most existing Agents. The one Agent than can accept a structured tool with multiple arguments is the STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION
Agent type, see docs here.
This is discussed in the blog post that introduces Structured Tools.
Q: Can I use structured tools with existing agents?
A: If your structured tool accepts one string argument: YES, it will still work with existing agents. However, structured tool with more than one argument are not directly compatible with the following agents without further customization:
zero-shot-react-description
react-docstore
self-ask-with-search
conversational-react-description
chat-zero-shot-react-description
chat-conversational-react-description