文档

CreateKnowledgeBase - 创建知识库

更新时间:
一键部署

通过 OpenAPI 创建通义灵码知识库。

适用版本

企业标准版、企业专属版

服务接入点与授权信息

请求语法

POST  https://<domain>/oapi/v1/lingma/organizations/<organizationId>/knowledgeBases

请求头

参数

类型

是否必填

描述

示例值

x-yunxiao-token

string

个人访问令牌。

pt-0fh3****0fbG_35af****0484

请求参数

参数

类型

位置

是否必填

描述

示例值

organizationId

string

query

所属企业 ID。

9a2b****5ef1

name

string

body

知识库名称,长度小于100。

description

string

body

知识库描述,长度小于200。

sceneType

string

body

知识库场景类型,目前包含以下两种:answer,complement。answer代表智能问答场景,complement代表行间生成场景。

accessLevel

integer

body

知识库可见性,目前包含以下两种:0,10。0代表私有知识库,10代表公开知识库。

creatorId

string

body

知识库创建者 ID。

organizationId

string

body

知识库所属组织 ID。

请求示例

curl -X 'POST' \
  'https://test.rdc.aliyuncs.com/oapi/v1/lingma/organizations/9a2b****5ef1/knowledgeBases' \
  -H 'accept: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "通义灵码知识库",
    "description": "this is a kb",
    "sceneType": "answer",
    "accessLevel": 10,
    "creatorId": "d402****9ae6",
    "organizationId": "9a2b****5ef1"
}

返回参数

参数

类型

描述

示例值

kbId

string

知识库 ID。

3a41****3eca

返回示例

{
    "kbId": "3a41****3eca"
}

错误码

访问错误码中心查看 API 相关错误码。