yqcloud-function-calling

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

YQCloud 自定义 Function Calling 格式说明

YQCloud Custom Function Calling Format Specification

本 skill 描述了一套自定义的 function calling 格式,用于 ITSM(IT服务管理)场景下的工单操作。
This skill describes a set of custom function calling formats for ticket operations in ITSM (IT Service Management) scenarios.

格式结构说明

Format Structure Description

每个函数定义包含两层结构:
  • 外层:标准的函数描述(name、description、parameters)
  • 内层
    function
    字段:执行配置(type、url、headers 等)
Each function definition contains two layers of structure:
  • Outer layer: Standard function description (name, description, parameters)
  • Inner
    function
    field: Execution configuration (type, url, headers, etc.)

函数类型(function.type)

Function Type (function.type)

类型说明
manual
手动处理,由前端/系统自行实现逻辑,不发起 HTTP 请求
call_url
自动发起 HTTP 请求到指定 URL
TypeDescription
manual
Manual processing, the logic is implemented by the frontend/system itself, no HTTP request is initiated
call_url
Automatically initiate an HTTP request to the specified URL

通用字段

Common Fields

  • stopAfterFunctionCall
    :调用函数后是否停止 AI 继续生成(true=停止,false=继续)
  • intl
    :国际化配置,包含
    zh_CN
    en_US
  • requestParser
    :JavaScript 代码字符串,
    data
    为 AI 函数调用参数的 JSON 字符串(需
    JSON.parse(data)
    解析)
  • responseParser
    :JavaScript 代码字符串,
    data
    为响应体对象,可使用
    _
    (lodash)
  • stopAfterFunctionCall
    : Whether to stop the AI from continuing to generate after calling the function (true = stop, false = continue)
  • intl
    : Internationalization configuration, including
    zh_CN
    and
    en_US
  • requestParser
    : JavaScript code string,
    data
    is the JSON string of AI function call parameters (needs to be parsed with
    JSON.parse(data)
    )
  • responseParser
    : JavaScript code string,
    data
    is the response body object,
    _
    (lodash) can be used

变量占位符

Variable Placeholders

  • ${STATIC#yqcloud_url}
    :YQCloud 服务基础地址
  • ${tenantId}
    :当前租户 ID
  • ${yqAccessToken}
    :当前用户访问令牌

  • ${STATIC#yqcloud_url}
    : YQCloud service base address
  • ${tenantId}
    : Current tenant ID
  • ${yqAccessToken}
    : Current user access token

函数列表

Function List

1. createTicket — 创建工单

1. createTicket — Create Ticket

  • 类型
    manual
    (前端自行处理,不发 HTTP 请求)
  • stopAfterFunctionCall
    true
  • 参数
    additionalProperties: true
    ,接受任意字段
  • 调用时机:已获取表单 Schema 并从用户处收集完所有字段后调用
  • Type:
    manual
    (handled by the frontend itself, no HTTP request is sent)
  • stopAfterFunctionCall:
    true
  • Parameters:
    additionalProperties: true
    , accepts any fields
  • Calling timing: Called after obtaining the form Schema and collecting all fields from the user

2. getCreateTicketParamJsonSchema — 获取工单参数 Schema

2. getCreateTicketParamJsonSchema — Get Ticket Parameter Schema

  • 类型
    call_url
    ,GET 请求
  • URL
    ${STATIC#yqcloud_url}/ai/v1/${tenantId}/itsmScene/getServiceItemSchema
  • stopAfterFunctionCall
    false
  • 必填参数
    id
    (string,服务项 ID)
  • 调用时机:确定服务项后立即调用,根据返回的 Schema 向用户逐一收集字段
  • Type:
    call_url
    , GET request
  • URL:
    ${STATIC#yqcloud_url}/ai/v1/${tenantId}/itsmScene/getServiceItemSchema
  • stopAfterFunctionCall:
    false
  • Required parameter:
    id
    (string, service item ID)
  • Calling timing: Called immediately after the service item is confirmed, collect fields from the user one by one according to the returned Schema

3. getAllServiceItem — 获取全部服务项

3. getAllServiceItem — Get All Service Items

  • 类型
    call_url
    ,GET 请求
  • URL
    ${STATIC#yqcloud_url}/itsm/v1/${tenantId}/service_items/catalog/page/all?serviceCatalogFlag=true&page=0&size=9999
  • 参数:无必填参数
  • responseParser:过滤
    type === 'SERVICE' || type === 'RECORD'
    ,只保留
    id
    name
    shortDescription
    description
    ,返回
    { allServiceItemList: [...] }
  • 调用时机:用户提出任何工单相关需求后第一步调用
  • Type:
    call_url
    , GET request
  • URL:
    ${STATIC#yqcloud_url}/itsm/v1/${tenantId}/service_items/catalog/page/all?serviceCatalogFlag=true&page=0&size=9999
  • Parameters: No required parameters
  • responseParser: Filter
    type === 'SERVICE' || type === 'RECORD'
    , only retain
    id
    ,
    name
    ,
    shortDescription
    ,
    description
    , return
    { allServiceItemList: [...] }
  • Calling timing: First step call after the user puts forward any ticket-related requirements

4. requestUserSelectServiceItem — 请求用户选择服务项

4. requestUserSelectServiceItem — Request User to Select Service Item

  • 类型
    call_url
    ,POST 请求,URL:
    /transparent
  • stopAfterFunctionCall
    true
  • 必填参数
    serviceItemList
    (array,最多传 1 个最可能匹配的服务项)
  • responseParser
    return data?.serviceItemList ? data : {result: 'no data'}
  • 调用时机:AI 无法确定具体服务项时调用

  • Type:
    call_url
    , POST request, URL:
    /transparent
  • stopAfterFunctionCall:
    true
  • Required parameter:
    serviceItemList
    (array, max 1 most likely matching service item is allowed to be passed)
  • responseParser:
    return data?.serviceItemList ? data : {result: 'no data'}
  • Calling timing: Called when AI cannot determine the specific service item

典型调用流程

Typical Calling Process

用户提出工单需求
调用 getAllServiceItem
AI 分析匹配服务项
       ├─ 能确定 → getCreateTicketParamJsonSchema → 收集字段 → createTicket
       └─ 无法确定 → requestUserSelectServiceItem → 用户选择后重新进入流程
User submits ticket request
Call getAllServiceItem
AI analyzes and matches service items
       ├─ Match confirmed → getCreateTicketParamJsonSchema → Collect fields → createTicket
       └─ Match unconfirmed → requestUserSelectServiceItem → Re-enter the process after user selection

注意事项

Notes

  1. getAllServiceItem
    实际无必填参数,直接调用即可
  2. requestUserSelectServiceItem
    serviceItemList
    最多传 1 个服务项
  3. createTicket
    manual
    类型,实际创建逻辑由前端实现
  4. stopAfterFunctionCall: true
    的函数调用后 AI 不会继续输出
  1. getAllServiceItem
    actually has no required parameters, you can call it directly
  2. The
    serviceItemList
    parameter of
    requestUserSelectServiceItem
    can pass at most 1 service item
  3. createTicket
    is of
    manual
    type, the actual creation logic is implemented by the frontend
  4. After calling a function with
    stopAfterFunctionCall: true
    , the AI will not continue to output