QwenLM / Qwen-Agent

Agent framework and applications built upon Qwen>=2.0, featuring Function Calling, Code Interpreter, RAG, and Chrome extension.
https://pypi.org/project/qwen-agent/
Other
3.21k stars 312 forks source link

Tool [code_interpreter] does not exists. #364

Open juhengzhe opened 5 days ago

juhengzhe commented 5 days ago

运行examples/react_data_analysis.py 显示:工具code_interpreter不存在 前端显示: Observation: Tool [code_interpreter] does not exists. Thought: Thought: The code interpreter tool appears to be unavailable or not recognized. Since I cannot use the code interpreter to execute the Python code for loading the CSV file, viewing the first few rows, and plotting the line chart, I will describe the steps needed to perform these actions instead.

1、主要的修改就是用了glm的openapi形式 2、因为glm支持的停止词最多为4个,所以增加了代码:bot.extra_generate_cfg["stop"]=bot.extra_generate_cfg["stop"][0:0] def init_agent_service(): llm_cfg = { "api_key": "xxx", "model_server": "https://open.bigmodel.cn/api/paas/v4/", "model": "glm-4-flash" } tools = ['code_interpreter'] bot = ReActChat(llm=llm_cfg, name='code interpreter', description='This agent can run code to solve the problem', function_list=tools) bot.extra_generate_cfg["stop"]=bot.extra_generate_cfg["stop"][0:0] print(bot.extra_generate_cfg["stop"]) return bot

tuhahaha commented 5 days ago

看起来是stop word设置错误了,不能直接设置bot.extra_generate_cfg["stop"]=bot.extra_generate_cfg["stop"][0:0]。「Observation: Tool [code_interpreter] does not exists.」是glm直接输出的,而不是模型执行代码报的错。

juhengzhe commented 5 days ago

看起来是stop word设置错误了,不能直接设置bot.extra_generate_cfg["stop"]=bot.extra_generate_cfg["stop"][0:0]。「Observation: Tool [code_interpreter] does not exists.」是glm直接输出的,而不是模型执行代码报的错。

@tuhahaha 您好,请问如何设置sotp word,如果我不加这一句bot.extra_generate_cfg["stop"]=bot.extra_generate_cfg["stop"][0:0],glm输出是停用词最多是4个(qwen_agent.llm.base.ModelServiceError: Error code: 400 - {'error': {'code': '1214', 'message': 'stop:最大只能有4个停止词'}}),我应该怎么修改呢。