Skip to content

无法进入tools调用 #1349

Description

@wu1boy

System Info / 系統信息

transformers==4.44.2
python==3.11.8
系统==Linux DESKTOP-C6C4GPF 5.15.167.4-microsoft-standard-WSL2 x86_64 x86_64 x86_64 GNU/Linux
CUDA Version==12.8
    llm = ChatGLM4()
    llm.load_model("/home/le/glm4-9b/")
    prompt = hub.pull("hwchase17/structured-chat-agent")
    tools = [Calculator(), OnlineSearch(), Weather()]
    agent = create_structured_chat_agent(
        llm=llm,
        tools=tools,
        prompt=prompt,
    )
    agent_executor = AgentExecutor(
        agent=agent,
        # max_iterations=3,
        tools=tools,
        verbose=True)
    ans = agent_executor.invoke({"input": "1+2=?"})

输出:

> Entering new AgentExecutor chain...

Action: 

{"action": "Final Answer", "action_input": "json\n{\n \"question\": \"1+2=?\",\n \"answer\": 3\n}\n"}


> Finished chain.
{'input': '1+2=?', 'output': '```json\n{\n  "question": "1+2=?",\n  "answer": 3\n}\n```'}

无法调用tool工具。直接进入Final Answer了。

Who can help? / 谁可以帮助到您?

No response

Information / 问题信息

  • The official example scripts / 官方的示例脚本
  • My own modified scripts / 我自己修改的脚本和任务

Reproduction / 复现过程

1.根据官方demo操作

Expected behavior / 期待表现

能正常调用tools

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions