api/knowledge/pipeline/create 创建一个新的实验版本
pipeline 对应知识库控制台的“实验版本”功能,每个 pipeline 拥有一条独立的离线数据处理流水线,可以通过多个 pipeline 对比同一批数据的不同处理策略,并择优发布成正式版本
完成“签名鉴权方式”页面的注册账号、实名认证、AK/SK 密钥获取和签名获取后,可调用 API 接口实现从知识库创建一个新实验版本的功能。
| URI | api/knowledge/pipeline/create | 统一资源标识符 |
|---|---|---|
| 请求方法 | POST | 客户端向向量数据库服务器请求的操作类型 |
| 请求头 | Content-Type: application/json | 请求消息类型 |
| Authorization: HMAC-SHA256 *** | 鉴权 |
| 参数 | 子参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|---|
| collection_name | -- | string | 否 | -- | 知识库名称 |
| project | -- | string | 否 | default | 知识库所属的已有项目名;值不能为空,且必须是当前账号下已存在并可访问的项目。该接口不创建项目,不传时使用 default;接口层未额外限制字符集或长度。 |
| resource_id | -- | string | 二选一 | -- | 知识库唯一 ID;与 collection_name 至少传一个,都不传返回参数错误,同时传入时优先使用 resource_id。 |
name | -- | string | 是 | -- | 实验版本名称
|
| index | object | 否 | 索引配置 | ||
| index_config | object | 否 | -- | 索引配置对象,所有子字段均为选填:fields(list<object>,默认空)、cpu_quota(int,单位核,范围 [1,100],默认 1)、embedding_model(string,默认 doubao-embedding-and-m3)、embedding_dimension(int,默认模型维度)、quant(string,默认 int8)。模型、维度和量化范围见创建知识库接口的对照表。 | |
index_type | string | 否 | hnsw_hybrid | 指定索引算法 | |
preprocessing | object | 否 | 非结构化文档处理策略
| ||
chunking_strategy | string | 否 | -- | 选用的切片策略,枚举值:["custom_balance", "custom"]
| |
| chunking_identifier | list<string> | 否 | -- | 自定义分隔符号。列表长度 [1,20],每项长度 [1,10] 个字符且不能包含 \|。 | |
| chunk_length | int | 否 | 500 | 切片最大长度,单位为字节;取值范围随 embedding_model 变化。 | |
merge_small_chunks | bool | 否 | true | 是否合并短文本片 | |
multi_modal | list | 否 | -- | 图片召回策略
| |
data_type | -- | string | 是 | -- | 知识库内的数据类型
|
table_config | -- | object | 否 | -- | 结构化知识库表字段定义,当 data_type 为 “structured_data” 时生效,支持以下字段:
|
| auto_sync_doc | -- | bool | 否 | true | 是否自动同步新增文档。true 时后续上传文档自动进入当前实验版本;false 时新文档不会自动同步,需通过批量同步或重处理接口导入。 |
| doc_summary_config | object | 否 | -- | 知识库摘要配置 | |
enabled | bool | 否 | false | 是否开启文档 AI 摘要功能 | |
pipeline_strategy_sync_type | -- | string | 否 | -- | 同步策略选择,枚举值:
|
| 参数 | 参数说明 |
|---|---|
| code | 状态码 |
| message | 返回信息 |
| 状态码 | http状态码 | 返回信息 | 状态码说明 |
|---|---|---|---|
| 0 | 200 | success | 成功 |
| 1000001 | 403 | unauthorized | 鉴权失败 |
| 1000002 | 403 | no permission | 权限不足 |
1000003 | 400 | invalid request:%s | 非法参数
|
| 1709905 | 400 | A parameter specified in the request is not valid: %s | 请求参数异常 |
| 1709900 | 500 | Service has some internal Error. Pls Contact With Admin. %s | 内部异常 |
curl -i -X POST \ -H 'Content-Type: application/json' \ -H 'Authorization: HMAC-SHA256 ***' \ https://api-knowledgebase.mlp.cn-beijing.volces.com/api/knowledge/pipeline/create \ -d '{ "collection_name": "test_collection_name", "project": "default", "name": "custom_pipeline_01", "data_type": "unstructured_data", "index": { "index_type": "hnsw_hybrid", "index_config": { "embedding_dimension": 2048, "quant": "int8", "cpu_quota": 1, "fields": [ { "field_name": "type", "field_type": "string", "default_val": "instruction" } ] } }, "preprocessing": { "chunking_strategy": "custom_balance", "chunk_length": 800, "merge_small_chunks": true, "multi_modal": ["image_ocr"] }, "auto_sync_doc": true }'
执行成功返回:
HTTP/1.1 200 OK Content-Length: 78 Content-Type: application/json {"code":0,"message":"success","request_id":"021695029537650fd001de666660000000000000000000230da93"}
执行失败返回:
HTTP/1.1 400 Bad Request Content-Length: 105 Content-Type: application/json { "code": 1000003, "message": "invalid request: pipeline name cannot be 'default'", "request_id": "021695029757920fd001de6666600000000000000000002569b8f" }