Comments (3)
示例中,模型是每次返回一个Action吗,RolePlay中的prompt如下,也是返回全部步骤,然后调用tool吧
# 工具
## 你拥有如下工具:
test_tool: test_tool API。AI绘画(图像生成)服务,输入文本描述和图像分辨率,返回根据文本信息绘制的图片URL。 输入参数: {"type": "object", "properties": {"text": {"type": "string", "description": "详细描述了希望生成的图像具有什么内容,例如人物、环境、动作等细节描述"}, "resolution": {"type": "string", "description": "格式是 数字*数字,表示希望生成的图像的分辨率大小,选项有[1024*1024, 720*1280, 1280*720]"}}, "required": ["text", "resolution"]} Format the arguments as a JSON object.
test2_tool: test2_tool API。获取对应城市的天气数据 输入参数: {"type": "object", "properties": {"city": {"type": "string", "description": "获取对应城市的天气数据"}}, "required": ["city"]} Format the arguments as a JSON object.
doc_parser: doc_parser API。解析文件 输入参数: {"type": "object", "properties": {"url": {"type": "string", "description": "待解析的文件的路径"}}, "required": []} Format the arguments as a JSON object.
## 当你需要调用工具时,请在你的回复中穿插如下的工具调用命令,可以根据需求调用零次或多次:
工具调用
Action: 工具的名称,必须是[test_tool,test2_tool,doc_parser]之一
Action Input: 工具的输入
Observation: <result>工具返回的结果</result>
Answer: 根据Observation总结本次工具调用返回的结果,如果结果中出现url,请使用如下格式展示出来:![图片](url)
# 指令
你扮演一个天气预报助手,你需要查询相应地区的天气,并调用给你的画图工具绘制一张城市的图。
请注意:不要在回复中说你做不到。
(。你可以使用工具:[test_tool,test2_tool,doc_parser])朝阳区天气怎样?
from modelscope-agent.
你是怎么调用的?用的是api还是agentfabric
from modelscope-agent.
你是怎么调用的?用的是api还是agentfabric
我使用的是本地模型api,如果模型一次生成一个工具调用Action
,执行正常,如果模型一次生成两个工具调用Action
,执行就错了,所以要保证每次模型只生成一个工具调用Action
,是这样理解吗,还是我的模型能力问题呢
from modelscope_agent.agents import RolePlay
role_template = '你扮演一个天气预报助手,你需要查询相应地区的天气,并调用给你的画图工具绘制一张城市的图。'
llm_config = {
'model': 'szgd',
'model_server': 'szgd',
"generate_cfg": {
"max_new_tokens":2048
},
}
function_list = ['test_tool','test2_tool','doc_parser']
bot = RolePlay(function_list=function_list,
llm=llm_config,
instruction=role_template
)
response = bot.run('朝阳区天气怎样?')
text = ''
for chunk in response:
text += chunk
from modelscope-agent.
Related Issues (20)
- [llm]本地LLM选择 HOT 4
- 本地部署疑问 HOT 4
- [<Demos>] Demo for qwen_doc_search_QA based on llama_index and bce_embedding HOT 1
- 中文文档日期标点使用错误 HOT 1
- [<doc>] Doc for agent about tool_cn,start_cn and memory
- [<Agent component: framework|tool|llm|etc...>] Doc for agent about tool_EN, quickstart_EN and memory_EN
- 参照demo/demo_register_new_tool.ipynb注册新工具的时候程序报错:NotImplementedError HOT 5
- [<demo>] add demo about openapi with tool
- examples\agents\modelscopegpt_agent.ipynb 运行报错,找不到工具NotImplementedError HOT 3
- [<doc>] Doc for agent about train_cn and train_agentfabric_llm_tool_use_cn
- [<doc>] Doc for agent about train_cn and train_agentfabric_llm_tool_use_cn
- <sft>llama3上下文支持好像有点问题 HOT 3
- 本地部署 modelscope llm 时,为什么只取message的第0条消息? HOT 8
- [<Agent component: framework|tool|llm|etc...>] [交互式创空间] openai api config save fail, add log
- [<Agent component: framework|tool|llm|etc...>] change tool_contribution_guide_CN.md
- [framework] AgentFabric local deploy has memory leak HOT 1
- 智能体编排 HOT 4
- 无代码创建Agent,使用GLM4的企业api_key 和api_base, 问答无回复。 HOT 3
- 能否增加返回结果的状态,类似langchain的Callbacks/Streaming tokens HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modelscope-agent.