You need to enable JavaScript to run this app.
导航

info

最近更新时间2024.04.16 13:11:58

首次发布时间2024.03.27 17:09:22

概述

/api/knowledge/collection/info 接口用于查看知识库详情,根据知识库名称返回知识库的描述,以及知识库配置的pipeline详细信息。

前提条件

完成“对接指南“页面的注册账号、实名认证、AK/SK 密钥获取和签名获取后,可调用 API 接口实现知识库信息更新的功能。

请求接口

URI

http://api-knowledgebase.ml_platform.cn-beijing.volces.com/api/knowledge/collection/info

统一资源标识符

请求方法

POST

客户端对向量数据库服务器请求的操作类型

请求头

Content-Type: application/json

请求消息类型

Authorization: HMAC-SHA256 ***

鉴权

请求参数

参数

类型

是否必选

默认值

参数说明

name

string

知识库的名字

响应消息

参数

参数说明

code

状态码

message

返回信息

request_id

标识每个请求的唯一标识符

data

返回的详细信息
{
"collection_name":知识库名称
"description":知识库描述信息
"doc_num":知识库下入库文档数量
"create_time":知识库创建时间
"update_time":知识库最新更新时间
"creator": 知识库创建人(火山子账号名称)
"pipeline_list": [
{
"pipeline_type": "default"
"pipeline_stat": {
"doc_num": 文档数量
"finish_doc_num": 处理完成的文档数量
"point_num": 知识点数量
}
"index_list": [
{
"index_type": "hnsw" // 索引类型
"index_config":{ //索引配置
"vector_field": 对知识点的哪个字段建立的索引
"cpu_quota": 2 // cpu限额
"distance": "ip" // 距离类型
"quant" : "int8" // 量化方式
"fields": 过滤字段
}
"status": 索引状态 // 枚举值,0 表示初始化中,1表示就绪,2表示失败
}
]
}
]
}

状态码说明

状态码

http状态码

返回信息

状态码说明

0

200

success

成功

1000001

401

unauthorized

鉴权失败

1000002

403

no permission

权限不足

1000003

400

invalid request:%s

非法参数

1000005

400

collection not exist

collection不存在

完整示例

请求消息

curl -i -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: HMAC-SHA256 ***' \
  http://api-knowledgebase.ml_platform.cn-beijing.volces.com/api/knowledge/collection/update \
  -d '{
    "name": "test_collection_name"
}'

响应消息

执行成功返回:

HTTP/1.1 200 OK
Content-Length: 43
Content-Type: application/json
 
{
    "code":0,
    "data":{
        "collection_name": "test_collection_name",
        "description": "abc",
        "create_time": 1711359075,
        "update_time": 1711359979,
        "creator": "xxx",
        "pipeline_list": [
            {
                "pipeline_type": "default",
                "pipeline_stat": {
                    "doc_num": 0,
                    "finish_doc_num": 0,
                    "point_num": 0
                },
                "index_list": [
                    {
                        "index_type": "hnsw",
                        "index_config": {
                            "vector_field": {
                                "field_name": "_sys_auto_content_vector",
                                "field_type": "vector",
                                "dim":1024
                        },
                                "cpu_quota": 2,
                                "distance": "ip",
                                "quant": "int8",
                                "embedding_model": "bge-large-zh",
                                "fields":[
                                    {
                                        "field_name": "_sys_auto_id",
                                        "field_type": "string"
                                    },
                                    {
                                        "field_name": "_sys_auto_doc_id",
                                        "field_type": "string"
                                    },
                                    {
                                        "field_name": "_sys_auto_doc_type",
                                        "field_type": "string"
                                    },
                                    {
                                        "field_name": "_sys_auto_add_type",
                                        "field_type": "string"
                                    }
                                ]
                            },
                        "status": 1
                    }
                ]
            }
        ]
    },
    "message":"success",
    "request_id":"02171136054666600000000000000000000ffff0a0060163f95e1"
}

执行失败返回:

HTTP/1.1 400 OK
Content-Length: 43
Content-Type: application/json
 
{"code":1000003, "message":"invalid request:%s", "request_id": "021695029757920fd001de6666600000000000000000002569b8f"}