api/knowledge/pipeline/create 创建一个新的实验版本
pipeline 对应知识库控制台的“实验版本”功能,每个 pipeline 拥有一条独立的离线数据处理流水线,可以通过多个 pipeline 对比同一批数据的不同处理策略,并择优发布成正式版本
完成“签名鉴权方式”页面的注册账号、实名认证、AK/SK 密钥获取和签名获取后,可调用 API 接口实现从知识库创建一个新实验版本的功能。
URI | api/knowledge/pipeline/create | 统一资源标识符 |
|---|---|---|
请求方法 | POST | 客户端向向量数据库服务器请求的操作类型 |
请求头 | Content-Type: application/json | 请求消息类型 |
Authorization: token=********** | 鉴权 |
参数 | 子参数 | 类型 | 必选 | 默认值 | 说明 |
|---|---|---|---|---|---|
collection_name | -- | string | 否 | -- | 知识库名称 |
project | -- | string | 否 | default | 项目名 |
resource_id | -- | string | 否 | -- | 知识库唯一 id
|
name | -- | string | 是 | -- | 实验版本名称
|
index | object | 否 | 索引配置 | ||
index_config | object | 否 | -- | 支持以下字段:
“embedding_model”、”embedding_dimension” 和 “quant” 的可选范围参考 向量化模型及索引算法对照表 | |
index_type | string | 否 | hnsw_hybrid | 指定索引算法 | |
preprocessing | object | 否 | 非结构化文档处理策略
| ||
chunking_strategy | string | 否 | -- | 选用的切片策略,枚举值:["custom_balance", "custom"]
| |
chunking_identifier | list | 否 | -- | 自定义分隔符号 | |
chunk_length | int | 否 | 500 | 切片最大长度 | |
merge_small_chunks | bool | 否 | true | 是否合并短文本片 | |
multi_modal | list | 否 | -- | 图片召回策略
传参示例:
使用旧参数命名“multi_mode”创建的库仍保留原命名,但新创建知识库不推荐继续使用。 | |
data_type | -- | string | 是 | -- | 知识库内的数据类型
|
table_config | -- | object | 否 | -- | 结构化知识库表字段定义,当 data_type 为 “structured_data” 时生效,支持以下字段:
|
auto_sync_doc | -- | bool | 否 | -- | 是否自动同步新增文档 |
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: token=****' \ 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_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" }