LLMFactory错误
ImportError: cannot import name 'LLMFactory' from 'modelscope_agent.llm' (/mnt/workspace/modelscope-agent/modelscope_agent/llm/init.py)
which branch are you using?
i have the same problem
master branch
Could you please provide your code, in order to repeat the error. Thanks.
master branch
A start.py file was created in the root directory, but an error occurred while importing the package. This code can run normally in previous versionsA start.py file was created in the root directory, but an error occurred while importing the package. This code can run normally in previous versions。
本地LLM配置
import os from modelscope.utils.config import Config from modelscope_agent.llm import LLMFactory from modelscope_agent.agent import AgentExecutor from modelscope_agent.tools import SearchKnowledgeTool import json import requests import torch
model_name = 'meetingroom-7b' model_cfg = { 'meetingroom-7b':{ 'type': 'modelscope', 'model_id': 'meetingroom-7b', 'model_revision': 'v1.0.0', 'use_raw_generation_config': True, 'custom_chat': True } }
tool_cfg_file = os.getenv('TOOL_CONFIG_FILE', 'config/cfg_tool_template.json') tool_cfg = Config.from_file(tool_cfg_file) llm = LLMFactory.build_llm(model_name, model_cfg) agent = AgentExecutor(llm, tool_cfg,tool_retrieval=False)
#agent.set_available_tools(available_tool_list)
Single-step tool-use
first = agent.run("预定一下明天下午三点的大型会议室", remote=False)
I am very sorry that we have an upgrading from 0.2.x to 0.3.x which is backward incompatible upgrading. So, some of the api have changed. Your case is a 0.2.x‘s example, so it will not run on 0.3.x. Could you please run a demo on https://github.com/modelscope/modelscope-agent/blob/master/demo/demo_modelscopegpt_agent.ipynb and try again?
We will avoid such problem in the rest of upgrading.