Dify 中的工具是指其平台内置或支持集成的功能插件,用于扩展 AI 应用的能力。
Dify 中工具分为以下 3 种类型:
内置工具可以点击“插件”、“市场”,通过浏览或搜索进行安装,如下图所示:
自定义工具实现分为以下两步:
自定义的服务器端使用任何语言都可以,只要是 HTTP 协议即可,OpenAI/Swagger 协议如下。
例如添加一个天气预报的协议:
配置如下:
{
"openapi": "3.1.0",
"info": {
"title": "Get weather data",
"description": "Retrieves current weather data for a location.",
"version": "v1.0.0"
},
"servers": [
{
"url": "https://weather.example.com"
}
],
"paths": {
"/location": {
"get": {
"description": "Get temperature for a specific location",
"operationId": "GetCurrentWeather",
"parameters": [
{
"name": "location",
"in": "query",
"description": "The city and state to retrieve the weather for",
"required": true,
"schema": {
"type": "string"
}
}
],
"deprecated": false
}
}
},
"components": {
"schemas": {}
}
}
工作流就是将 Dify 中创建的 WorkFlow 发布为工具,让 Dify 其他地方进行调用:
工具是扩展大模型能力边界的主要手段,也是实现复杂任务的核心机制,正确、灵活的使用工具是我们开发 AI 应用中必不可少的技能。一起行动起来,体验一下 Dify 中好玩又有用的这些插件吧。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有