Skip to main content
知识库

更新知识库

修改指定知识库的名称、描述、重排序最低分数等基本信息。

前提

已获取 API Key 和业务空间 ID,并完成鉴权配置,详见API 总览与鉴权说明。

接口

POST /api/v1/indices/rag/index/update 修改指定知识库的名称、描述、重排序最低分数等基本信息。DenseSimilarityTopK、SparseSimilarityTopK、PipelineCommercialType 等字段为 POP 专有,REST 接口不支持,请勿传入。
参数名为 id,不是 index_id 或 indexId。请注意与其他接口的命名差异。

请求体

字段必填类型说明
id是string知识库 ID。注意参数名为 id,不是 index_id 或 indexId
name否string知识库名称。长度 1~20 字符,支持 Unicode letter 分类字符(含英文、中文、数字等),可含半角冒号(:)、下划线(_)、半角句号(.)或短划线(-)
description否string知识库描述信息
rerankMinScore否number重排序最低分数阈值,取值范围 [0, 1]。分数低于该值的切片会被过滤

请求示例

curl -X POST "$BASE_URL/api/v1/indices/rag/index/update" \
  -H "Authorization: Bearer $BAILIAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "your-kb-id",
    "name": "your-kb-name",
    "description": "your-kb-description",
    "rerankMinScore": 0.01
  }'
其中 BASE_URL 为 https://{workspace_id}.cn-beijing.maas.aliyuncs.com({workspace_id} 为业务空间 ID),BAILIAN_API_KEY 为阿里云百炼 API Key。

响应示例

更新成功返回 200。
{
  "code": "Success",
  "status_code": 200,
  "data": {
    "updated_at": 1782191157000,
    "created_at": 1782180218000,
    "id": "your-kb-id"
  },
  "success": true,
  "message": "success",
  "request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "status": "SUCCESS"
}

响应字段

字段类型说明
codestring响应码,成功时为 Success
status_codeintegerHTTP 状态码
request_idstring请求唯一标识,排查问题时请提供此 ID
successboolean请求是否成功
messagestring提示信息,成功时为 success
statusstring请求状态:SUCCESS 或 FAILED
dataobject响应数据。子字段 id(string,知识库 ID)、updated_at(integer,更新时间,毫秒级 Unix 时间戳)、created_at(integer,创建时间,毫秒级 Unix 时间戳)
Managed Agents
Sandbox
Security
RAG
应用调用
长期记忆
ParseX
框架