ToB企服应用市场:ToB评测及商务社交产业平台

标题: 腾讯云大模子知识引擎 (LKE) 指南:从 0 到 1 创建一个属于自己的插件 [打印本页]

作者: 立山    时间: 9 小时前
标题: 腾讯云大模子知识引擎 (LKE) 指南:从 0 到 1 创建一个属于自己的插件
媒介


相关概念

腾讯云大模子知识引擎 (LKE)


腾讯云大模子知识引擎 (LKE) - 插件


实战案例

创建插件:以“本日热榜新闻插件”为例


需求分析


需求功能


数据接口实现

  1. url: https://api-hot.imsyy.top/platform
  2. method: GET
  3. params:
  4.   limit: 5
  5.   cache: true
  6. # 使用示例 zhihu
  7. url: https://api-hot.imsyy.top/zhihu
  8. method: GET
  9. params:
  10.   limit: 5
  11.   cache: true
复制代码
插件实现





  1. 授权方式支持 “无需授权” 和 “API Key” 两种方式,可选择配置。
复制代码


  1. # API 工具字段说明
  2. openapi: "3.0.0"
  3. info:
  4.   title: "今日热点API"  # API 的名称
  5.   version: "1.0.0"  # API 的版本号
  6.   description: "获取全网热点新闻"  # API 的描述
  7. servers:
  8.   - url: "https://api-hot.imsyy.top"  # 服务器的基础 URL
  9.     description: "热点新闻服务端"  # 服务器的描述
  10. paths:
  11.   "/zhihu":
  12.     get:
  13.       summary: "知乎热榜新闻"  # 简要说明此操作
  14.       description: "获取知乎热榜新闻"  # 详细描述此操作
  15.       operationId: "zhihu"  # 操作的唯一标识符
  16.       parameters:
  17.         - name: "limit"
  18.           in: "query"
  19.           description: "返回新闻条数,默认为 5"  # 参数的描述
  20.           required: false
  21.           schema:
  22.             type: "integer"  # 参数的数据类型
  23.             default: 5  # 参数的默认值
  24.         - name: "cache"
  25.           in: "query"
  26.           description: "是否使用缓存,默认为 true"  # 参数的描述
  27.           required: false
  28.           schema:
  29.             type: "boolean"  # 参数的数据类型
  30.             default: true  # 参数的默认值
  31.       responses:
  32.         "200":
  33.           description: "成功的响应"  # 响应的描述
  34.           content:
  35.             application/json:
  36.               schema:
  37.                 type: "object"  # 响应内容的数据类型
  38.                 properties:
  39.                   code:
  40.                     type: "integer"
  41.                     description: "返回状态,200 表示成功"  # 字段的描述
  42.                   name:
  43.                     type: "string"
  44.                     description: "新闻来源名称,例如 '知乎'"  # 字段的描述
  45.                   title:
  46.                     type: "string"
  47.                     description: "新闻标题"  # 字段的描述
  48.                   type:
  49.                     type: "string"
  50.                     description: "新闻类型,例如 '热榜'"  # 字段的描述
  51.                   link:
  52.                     type: "string"
  53.                     description: "新闻的链接 URL"  # 字段的描述
  54.                   total:
  55.                     type: "integer"
  56.                     description: "新闻条目总数"  # 字段的描述
  57.                   fromCache:
  58.                     type: "boolean"
  59.                     description: "数据是否来自缓存"  # 字段的描述
  60.                   updateTime:
  61.                     type: "string"
  62.                     format: "date-time"
  63.                     description: "数据的更新时间,格式为 ISO 8601"  # 字段的描述
  64.                   data:
  65.                     type: "array"
  66.                     description: "新闻数据列表"  # 字段的描述
  67.                     items:
  68.                       type: "object"
  69.                       properties:
  70.                         id:
  71.                           type: "integer"
  72.                           description: "新闻的唯一标识符"  # 字段的描述
  73.                         title:
  74.                           type: "string"
  75.                           description: "新闻标题"  # 字段的描述
  76.                         desc:
  77.                           type: "string"
  78.                           description: "新闻描述或摘要"  # 字段的描述
  79.                         cover:
  80.                           type: "string"
  81.                           description: "新闻封面图片的 URL"  # 字段的描述
  82.                         timestamp:
  83.                           type: "integer"
  84.                           description: "新闻发布时间的时间戳"  # 字段的描述
  85.                         hot:
  86.                           type: "integer"
  87.                           description: "新闻的热度值"  # 字段的描述
  88.                         url:
  89.                           type: "string"
  90.                           description: "新闻的网页链接"  # 字段的描述
  91.                         mobileUrl:
  92.                           type: "string"
  93.                           description: "新闻的移动端链接"  # 字段的描述
  94.         "400":
  95.           description: "错误的请求,通常由于参数不正确"  # 响应的描述
  96.         "401":
  97.           description: "未授权,表示需要提供有效的认证信息"  # 响应的描述
  98.         "500":
  99.           description: "服务器内部错误,表示服务器遇到未知错误"  # 响应的描述
复制代码







集成到 Agent 模式应用:新闻助手

创建应用








应用演示


总结


个人简介






欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4