Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from langchain.agents.tools import Tool 报错 #190

Open
zhangxnan opened this issue Nov 7, 2024 · 1 comment
Open

from langchain.agents.tools import Tool 报错 #190

zhangxnan opened this issue Nov 7, 2024 · 1 comment

Comments

@zhangxnan
Copy link

zhangxnan commented Nov 7, 2024

` def as_langchain_tool(self):

    from langchain.agents.tools import Tool

    .....

    return Tool(
        name=self.agent_model.info.get("name"),
        func=self.langchain_run,
        description=self.agent_model.info.get("description") + args_description
    )`

这里面可能由于langchain.agents.tools 包的升级,这行代码已经不适用了,运行使用工具的agent将会跑错。应该修改为:
` def as_langchain_tool(self):

    from langchain.agents.tools import InvalidTool

     ......

    return InvalidTool(
        name=self.agent_model.info.get("name"),
        func=self.langchain_run,
        description=self.agent_model.info.get("description") + args_description
    )`
@LandJerry
Copy link
Collaborator

langchain = "0.1.20"
langchain-core = "0.1.52"
langchain-community = "0.0.38"

这个是目前v0.0.13版本au使用的langchain版本,可以检查一下是否一致。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants