Function Call管理
更新时间:2025-10-28
创建Function模板
接口描述
创建Function模板
请求语法
JSON
1POST /api/v{version}/function_templates HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: <bce-authorization-string>
请求头域
除公共头域外,无其它特殊头域。
请求体
| 名称 | 类型 | 是否必选 | 参数位置 | 描述 |
|---|---|---|---|---|
| name | String | 是 | RequestBody | Function模板的名称 |
| description | String | 否 | RequestBody | Function模板的描述 |
| functions | List | 是 | RequestBody | Function项的列表 |
| + name | String | 是 | RequestBody | Function的名称 |
| + description | String | 是 | RequestBody | Function的描述 |
| + examples | List<String> | 是 | RequestBody | Function的例句 |
| + callMode | String | 是 | RequestBody | 请求地址,取值"SDK_MSG":发送SDK消息, "HTTP_PROTOCOL":HTTP协议 |
| + callUrl | String | 否 | RequestBody | HTTP协议的请求地址 |
| + inputs | List | 否 | RequestBody | 输入参数 |
| ++ paramName | String | 是 | RequestBody | 参数名称 |
| ++ paramType | String | 是 | RequestBody | 参数类型,取值String、Number、Boolean、Date |
| ++ paramDescription | String | 是 | RequestBody | 参数描述 |
| ++ required | Boolean | 否 | RequestBody | 是否必填,默认False |
请求示例
JSON
1POST /api/v1/function_templates HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: {bce-authorization-string}
5x-bce-request-id: {bce-request-id}
6
7{
8 "name": "创建Function模板",
9 "description": "",
10 "functions": [
11 {
12 "name": "alarm_clock",
13 "description": "闹钟功能",
14 "examples": [
15 "定下午2点的闹钟"
16 ],
17 "callMode": "HTTP_PROTOCOL",
18 "callUrl": "https://xxx",
19 "inputs": [
20 {
21 "paramName": "action",
22 "paramType": "String",
23 "paramDescription": "设置闹钟,取消闹钟",
24 "required": true
25 }
26 ]
27 }
28 ]
29}
响应头域
除公共头域外,无其它特殊头域。
响应参数
| 名称 | 类型 | 描述 |
|---|---|---|
| functionTemplateId | Long | Function模板Id |
响应示例
JSON
1HTTP/1.1 200 OK
2x-bce-request-id: b06a9214-04d6-4a08-9f5d-966b04604cfb
3date: Mon, 05 Sep 2022 03:25:43 GMT
4transfer-encoding: chunked
5content-type: application/json;charset=UTF-8
6cache-control: no-cache
7
8{
9 "functionTemplateId": 1000000
10}
查询Function模板列表
接口描述
查询Function模板列表
请求语法
JSON
1GET /api/v{version}/function_templates HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: <bce-authorization-string>
请求头域
除公共头域外,无其它特殊头域。
请求参数
| 名称 | 类型 | 是否必选 | 参数位置 | 描述 |
|---|---|---|---|---|
| pageNo | Integer | 是 | RequestBody | 起始页 |
| pageSize | Integer | 是 | RequestBody | 每页的最大值(不超过10) |
| functionTemplateNameOrId | String | 否 | RequestBody | 用于模糊搜索,支持检索 functionTemplateName 或 functionTemplateId |
请求参数
N/A
请求示例
JSON
1GET /api/v1/function_templates?pageNo=1&pageSize=10 HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: {bce-authorization-string}
5x-bce-request-id: {bce-request-id}
响应头域
除公共头域外,无其它特殊头域。
响应参数
| 名称 | 类型 | 描述 |
|---|---|---|
| pageNo | Integer | 当前页 |
| pageSize | Integer | 当前页的音色数量 |
| totalCount | Integer | 总的Function模板数量 |
| data | List | 模板列表数据 |
| + functionTemplateId | Long | Function模板id |
| + name | String | Function模板名称 |
| + createTime | String | 模板的创建时间,北京时间格式,如 2025-04-09 07:40:01 |
响应示例
JSON
1HTTP/1.1 200 OK
2x-bce-request-id: b06a9214-04d6-4a08-9f5d-966b04604cfb
3date: Mon, 05 Sep 2022 03:25:43 GMT
4transfer-encoding: chunked
5content-type: application/json;charset=UTF-8
6cache-control: no-cache
7
8{
9 "pageNo": 1,
10 "pageSize": 10,
11 "totalCount": 1,
12 "data": [
13 {
14 "functionTemplateId": 1000000,
15 "name": "创建Function模板",
16 "createTime": "2025-10-24 19:06:25"
17 }
18 ]
19}
查询Function模板详情
接口描述
查询Function模板详情
请求语法
JSON
1GET /api/v{version}/function_templates/{functionTemplateId} HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: <bce-authorization-string>
请求头域
除公共头域外,无其它特殊头域。
请求路径参数
| 名称 | 类型 | 是否必选 | 参数位置 | 描述 |
|---|---|---|---|---|
| functionTemplateId | Long | 是 | RequestPath | Function模板Id |
请求参数
N/A
请求示例
JSON
1GET /api/v1/function_templates/1000000 HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: {bce-authorization-string}
5x-bce-request-id: {bce-request-id}
响应头域
除公共头域外,无其它特殊头域。
响应参数
| 名称 | 类型 | 描述 |
|---|---|---|
| functionTemplateId | Long | Function模板id |
| name | String | Function模板的名称 |
| description | String | 模板的描述 |
| functions | List | Function项的列表 |
| + id | Long | Function的id |
| + name | String | Function的名称 |
| + description | String | Function的描述 |
| + examples | List | Function的例句 |
| + callMode | String | 请求地址,取值"SDK_MSG":发送SDK消息, "HTTP_PROTOCOL":HTTP协议 |
| + callUrl | String | HTTP协议的请求地址 |
| + inputs | List | 输入参数 |
| ++ paramName | String | 参数名称 |
| ++ paramType | String | 参数类型,取值String、Number、Boolean、Date |
| ++ paramDescription | String | 参数描述 |
| ++ required | Boolean | 是否必填,默认False |
响应示例
JSON
1HTTP/1.1 200 OK
2x-bce-request-id: b06a9214-04d6-4a08-9f5d-966b04604cfb
3date: Mon, 05 Sep 2022 03:25:43 GMT
4transfer-encoding: chunked
5content-type: application/json;charset=UTF-8
6cache-control: no-cache
7
8{
9 "functionTemplateId": 1000000,
10 "name": "创建Function模板",
11 "description": "",
12 "functions": [
13 {
14 "id": 1,
15 "name": "alarm_clock",
16 "description": "闹钟功能",
17 "examples": [
18 "定下午2点的闹钟"
19 ],
20 "callMode": "HTTP_PROTOCOL",
21 "callUrl": "https://xxx",
22 "inputs": [
23 {
24 "paramName": "action",
25 "paramType": "String",
26 "paramDescription": "设置闹钟,取消闹钟"
27 "required": true
28 }
29 ],
30 }
31 ]
32}
删除Function模板
接口描述
删除Function模板
请求语法
JSON
1DELETE /api/v{version}/function_templates/{functionTemplateId} HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: <bce-authorization-string>
请求头域
除公共头域外,无其它特殊头域。
请求路径参数
| 名称 | 类型 | 是否必选 | 参数位置 | 描述 |
|---|---|---|---|---|
| functionTemplateId | Long | 是 | RequestPath | Function模板Id |
请求参数
N/A
请求示例
JSON
1DELETE /api/v1/function_templates/1000000 HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: {bce-authorization-string}
5x-bce-request-id: {bce-request-id}
响应头域
除公共头域外,无其它特殊头域。
响应参数
N/A
响应示例
JSON
1HTTP/1.1 200 OK
2x-bce-request-id: b06a9214-04d6-4a08-9f5d-966b04604cfb
3date: Mon, 05 Sep 2022 03:25:43 GMT
4transfer-encoding: chunked
5content-type: application/json;charset=UTF-8
6cache-control: no-cache
更新Function模板基本信息
接口描述
创建Function模板的名称和描述
请求语法
JSON
1PUT /api/v{version}/function_templates/{functionTemplateId} HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: <bce-authorization-string>
请求头域
除公共头域外,无其它特殊头域。
请求路径参数
| 名称 | 类型 | 是否必选 | 参数位置 | 描述 |
|---|---|---|---|---|
| functionTemplateId | Long | 是 | RequestPath | Function模板Id |
请求体
| 名称 | 类型 | 是否必选 | 参数位置 | 描述 |
|---|---|---|---|---|
| name | String | 是 | RequestBody | Function模板的名称 |
| description | String | 否 | RequestBody | 模板的描述 |
请求示例
JSON
1PUT /api/v1/function_templates/1000000 HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: {bce-authorization-string}
5x-bce-request-id: {bce-request-id}
6
7{
8 "name": "更新Function模板",
9 "description": ""
10}
响应头域
除公共头域外,无其它特殊头域。
响应参数
N/A
响应示例
JSON
1HTTP/1.1 200 OK
2x-bce-request-id: b06a9214-04d6-4a08-9f5d-966b04604cfb
3date: Mon, 05 Sep 2022 03:25:43 GMT
4transfer-encoding: chunked
5content-type: application/json;charset=UTF-8
6cache-control: no-cache
添加Function
接口描述
在已存在的Function模板中添加Function
请求语法
JSON
1PUT /api/v{version}/function_templates/{functionTemplateId}/functions/add HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: <bce-authorization-string>
请求头域
除公共头域外,无其它特殊头域。
请求路径参数
| 名称 | 类型 | 是否必选 | 参数位置 | 描述 |
|---|---|---|---|---|
| functionTemplateId | Long | 是 | RequestPath | Function模板Id |
请求体
| 名称 | 类型 | 是否必选 | 参数位置 | 描述 |
|---|---|---|---|---|
| name | String | 是 | RequestBody | Function的名称 |
| description | String | 是 | RequestBody | Function的描述 |
| examples | List | 是 | RequestBody | Function的例句 |
| callMode | String | 是 | RequestBody | 请求地址,取值"SDK_MSG":发送SDK消息, "HTTP_PROTOCOL":HTTP协议 |
| callUrl | String | 否 | RequestBody | HTTP协议的请求地址 |
| inputs | List | 否 | RequestBody | 输入参数 |
| + paramName | String | 是 | RequestBody | 参数名称 |
| + paramType | String | 是 | RequestBody | 参数类型,取值String、Number、Boolean、Date |
| + paramDescription | String | 是 | RequestBody | 参数描述 |
| + required | Boolean | 否 | RequestBody | 是否必填,默认False |
请求示例
JSON
1PUT /api/v1/function_templates/1000000/functions/add HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: {bce-authorization-string}
5x-bce-request-id: {bce-request-id}
6{
7 "name": "alarm_clock_copy",
8 "description": "闹钟功能",
9 "examples": [
10 "定下午2点的闹钟"
11 ],
12 "callMode": "HTTP_PROTOCOL",
13 "callUrl": "https://xxx",
14 "inputs": [
15 {
16 "paramName": "action",
17 "paramType": "String",
18 "paramDescription": "设置闹钟,取消闹钟",
19 "required": true
20 }
21 ]
22}
响应头域
除公共头域外,无其它特殊头域。
响应参数
| 名称 | 类型 | 描述 |
|---|---|---|
| functionId | Long | Function的id |
响应示例
JSON
1HTTP/1.1 200 OK
2x-bce-request-id: b06a9214-04d6-4a08-9f5d-966b04604cfb
3date: Mon, 05 Sep 2022 03:25:43 GMT
4transfer-encoding: chunked
5content-type: application/json;charset=UTF-8
6cache-control: no-cache
7
8{
9 "functionId": 2
10}
更新Function
接口描述
在已存在的Function模板中更新Function
请求语法
JSON
1PUT /api/v{version}/function_templates/{functionTemplateId}/functions/{functionItemId}/update HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: <bce-authorization-string>
请求头域
除公共头域外,无其它特殊头域。
请求路径参数
| 名称 | 类型 | 是否必选 | 参数位置 | 描述 |
|---|---|---|---|---|
| functionTemplateId | Long | 是 | RequestPath | Function模板Id |
| functionItemId | Long | 是 | RequestPath | Function的Id |
请求体
| 名称 | 类型 | 是否必选 | 参数位置 | 描述 |
|---|---|---|---|---|
| name | String | 否 | RequestBody | Function的名称 |
| description | String | 否 | RequestBody | Function的描述 |
| examples | List | 否 | RequestBody | Function的例句 |
| callMode | String | 否 | RequestBody | 请求地址,取值"SDK_MSG":发送SDK消息, "HTTP_PROTOCOL":HTTP协议 |
| callUrl | String | 否 | RequestBody | HTTP协议的请求地址 |
| inputs | List | 否 | RequestBody | 输入参数 |
| + paramName | String | 是 | RequestBody | 参数名称 |
| + paramType | String | 是 | RequestBody | 参数类型,取值String、Number、Boolean、Date |
| + paramDescription | String | 是 | RequestBody | 参数描述 |
| + required | Boolean | 否 | RequestBody | 是否必填,默认False |
请求示例
JSON
1PUT /api/v1/function_templates/1000000/functions/2/update HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: {bce-authorization-string}
5x-bce-request-id: {bce-request-id}
6{
7 "name": "alarm_clock_copy",
8 "description": "闹钟功能",
9 "examples": [
10 "定下午2点的闹钟"
11 ],
12 "callMode": "HTTP_PROTOCOL",
13 "callUrl": "https://xxx",
14 "inputs": [
15 {
16 "paramName": "action",
17 "paramType": "String",
18 "paramDescription": "设置闹钟,取消闹钟",
19 "required": true
20 }
21 ]
22}
响应头域
除公共头域外,无其它特殊头域。
响应参数
N/A
响应示例
JSON
1HTTP/1.1 200 OK
2x-bce-request-id: b06a9214-04d6-4a08-9f5d-966b04604cfb
3date: Mon, 05 Sep 2022 03:25:43 GMT
4transfer-encoding: chunked
5content-type: application/json;charset=UTF-8
6cache-control: no-cache
删除Function
接口描述
在已存在的Function模板中删除Function
请求语法
JSON
1PUT /api/v{version}/function_templates/{functionTemplateId}/functions/{functionItemId}/remove HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: <bce-authorization-string>
请求头域
除公共头域外,无其它特殊头域。
请求路径参数
| 名称 | 类型 | 是否必选 | 参数位置 | 描述 |
|---|---|---|---|---|
| functionTemplateId | Long | 是 | RequestPath | Function模板Id |
| functionItemId | Long | 是 | RequestPath | Function的Id |
请求体
N/A
请求示例
JSON
1PUT /api/v1/function_templates/1000000/functions/2/update HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: {bce-authorization-string}
5x-bce-request-id: {bce-request-id}
响应头域
除公共头域外,无其它特殊头域。
响应参数
N/A
响应示例
JSON
1HTTP/1.1 200 OK
2x-bce-request-id: b06a9214-04d6-4a08-9f5d-966b04604cfb
3date: Mon, 05 Sep 2022 03:25:43 GMT
4transfer-encoding: chunked
5content-type: application/json;charset=UTF-8
6cache-control: no-cache
