-
Notifications
You must be signed in to change notification settings - Fork 347
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
[Feature]: 请问如何用agentscope studio以托拽的形式 实现agent通过代码调用外部接口? #503
Comments
"在agentscope studio中添加tool"指的是?是说workstation添加新的工具么 |
Adding external tools potentially means that the workflow execution engine may run untrusted code, which is a relatively risky operation, and therefore is not currently supported on our maintained website. We will consider adding this feature in the local version ASAP. |
thx!!! but can I make it happen in local agentscope studio? cause I already made it on code level, my leader told me to achieve on studio. |
Here, we take BingServiceTest as an example to show how to add a new service. You can refer to the steps below. FrontEnd
<li class="workstation-sidebar-dragitem unselectable-text"
data-node="BingSearchServiceTest"
draggable="true" ondragstart="drag(event)">
Bing Search Test
</li>
// add mapping
let nameToHtmlFile ={
...
'BingSearchServiceTest': 'service-bing-search_test.html',
}
....
// add drag event
case 'BingSearchServiceTest':
editor.addNode('BingSearchServiceTest', 0, 0,
pos_x, pos_y, 'BingSearchServiceTest', {
"args": {
"api_key": "",
"num_results": 3,
}
}, htmlSourceCode);
break; BackEnd
# add nodes mapping
NODE_NAME_MAPPING = {
....
"BingSearchServiceTest": BingSearchServiceTestNode,
}
# source code
class BingSearchServiceTestNode(WorkflowNode):
"""
Bing Search Test Node
"""
node_type = WorkflowNodeType.SERVICE
def __init__(
self,
node_id: str,
opt_kwargs: dict,
source_kwargs: dict,
dep_opts: list,
) -> None:
super().__init__(node_id, opt_kwargs, source_kwargs, dep_opts)
self.service_func = partial(bing_search, **self.opt_kwargs)
def compile(self) -> dict:
return {
"imports": "from agentscope.service import ServiceToolkit\n"
"from functools import partial\n"
"from agentscope.service import bing_search",
"inits": f"{self.var_name} = partial(bing_search,"
f" {kwarg_converter(self.opt_kwargs)})",
"execs": "",
} |
请问如何在agentscope studio中 添加tool。以及如何用agentscope studio以托拽的形式 实现agent通过代码调用外部接口?
The text was updated successfully, but these errors were encountered: