在dify编排中,可以构建自己的工具。工具可以调用已有的rest接口。
定义schema文件,接入已有的rest接口。
注意:这里调用的rest接口为flask的form-data格式的接口
定义schema文件如下。
{
"openapi": "3.1.0",
"info": {
"title": "***工具",
"description": "根据****的工具.",
"version": "v1.0.0"
},
"servers": [
{
"url": "http://ip:port"#ip和端口
}
],
"paths": {
"/engine/algo/agent/apply": {#api接口路径
"post": {
"description": "根据***工具",
"operationId": "gas_plan",
"parameters": [
{
"name": "type",
"in": "query",
"description": "根据***工具",
"required": false,
"schema": {
"type": "string" ,"default": "plan"#这里设置了默认值
}
},
{
"name": "class",
"in": "query",
"description": "根据*******",
"required": true,
"schema": {
"type": "string"
}
}
],
"deprecated": false
}
}
},
"components": {
"schemas": {}
}
}
在参数中,定义参数类型,也可以设置参数默认值。
"schema": {
"type": "string" ,"default": "plan"
}


被折叠的 条评论
为什么被折叠?



