Skip to main content

向量数据库

向量数据库接口用于管理和搜索向量数据。所有接口都需要开发者权限。

获取向量数据列表

/dev/vdb/list
获取向量数据列表。

请求参数

参数名类型必选说明
pageinteger页码,默认1
sizeinteger每页数量
GET /dev/vdb/list?page=1&size=10
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

获取向量数据详情

/dev/vdb/:id
获取指定向量数据的详细信息。

请求参数

参数名类型必选说明
idstring向量数据ID
GET /dev/vdb/vdb_123
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

创建向量数据

/dev/vdb
创建新的向量数据。

请求参数

参数名类型必选说明
namestring向量数据名称
descriptionstring向量数据描述
typestring向量数据类型
configobject向量数据配置
POST /dev/vdb
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

{
  "name": "新知识库",
  "description": "这是一个新知识库",
  "type": "text",
  "config": {
    "dimension": 1536,
    "metric": "cosine"
  }
}

更新向量数据

/dev/vdb/:id
更新指定向量数据的信息。

请求参数

参数名类型必选说明
idstring向量数据ID
namestring向量数据名称
descriptionstring向量数据描述
configobject向量数据配置
PUT /dev/vdb/vdb_124
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

{
  "name": "更新后的知识库",
  "description": "这是更新后的知识库描述"
}

删除向量数据

/dev/vdb/:id
删除指定的向量数据。

请求参数

参数名类型必选说明
idstring向量数据ID
DELETE /dev/vdb/vdb_124
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

向量数据搜索

在指定的向量数据中执行相似度搜索。

请求参数

参数名类型必选说明
idstring向量数据ID
querystring搜索查询文本
limitinteger返回结果数量
thresholdfloat相似度阈值
POST /dev/vdb/vdb_123/search
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

{
  "query": "如何使用API",
  "limit": 5,
  "threshold": 0.8
}

错误码说明

错误码说明

错误码说明
400请求参数错误
401未授权或令牌无效
403权限不足(需要开发者权限)
404向量数据不存在
422请求参数验证失败
500服务器错误