可以使用StructuredTool与任何代理吗?

huangapple go评论59阅读模式
英文:

Is it possible to use StructuredTool with any Agent?

问题

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),
        ]
    }
}
英文:

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),
        ]
    }
}

答案1

得分: 1

以下是您要翻译的内容:

截至2023年5月2日(可能会更改):结构化工具只能接受一个字符串参数,以便与大多数现有的代理兼容。唯一能够接受具有多个参数的结构化工具的代理是STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION代理类型,参见此处的文档

这在介绍结构化工具的博客文章中有讨论。
>问:我可以将结构化工具与现有代理一起使用吗?
>
>答:如果您的结构化工具接受一个字符串参数:是的,它仍然可以与现有代理一起使用。然而,具有多个参数的结构化工具不直接兼容以下代理,除非进行进一步的自定义:
>
>zero-shot-react-description
react-docstore
self-ask-with-search
conversational-react-description
chat-zero-shot-react-description
chat-conversational-react-description

英文:

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

huangapple
  • 本文由 发表于 2023年5月14日 05:24:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/76244938.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定