知识库列表
更新时间:2025-04-07
接口描述
获取知识库列表
在线调试
百度智能云千帆提供了 API在线调试平台-示例代码 ,用于帮助开发者调试接口,平台集成快速检索、查看开发文档、查看在线调用的请求内容和返回结果、复制和下载示例代码等功能,支持Python、Java、PHP、C#、Go、Node.js、C++ 7种主流语言示例代码自动生成。
权限说明
Authorization需要填写密钥
接口定义
Path | /v2/knowledgeBase?Action=DescribeKnowledgeBases |
---|---|
Method | POST |
Content-Type | application/json |
Authorization | 请求签名(Bearer <AppBuilder API Key>) |
请求结构
Plain Text
1POST /v2/knowledgeBase?Action=DescribeKnowledgeBases HTTP/1.1
2HOST: qianfan.baidubce.com
3Authorization: Bearer <AppBuilder API Key>
4Content-Type: application/json
5
6{
7 "marker": "知识库起始位置id",
8 "maxKeys": 10,
9 "keyword": "搜索关键字"
10}
请求头域
除公共头域外,无其它特殊头域。
请求参数
字段 | 类型 | 是否必须 | 说明 |
---|---|---|---|
keyword | string | 否 | 搜索关键字 |
marker | string | 否 | 起始位置 |
maxKeys | integer | 否 | 数据大小,默认10,最大值100 |
响应头域
除公共头域外,无其它特殊头域。
响应参数
字段 | 类型 | 必然存在 | 说明 |
---|---|---|---|
requestId | string | 是 | 请求 id |
data | []dict | 是 | 知识库列表 |
data \ id | string | 是 | 知识库id |
data \ name | string | 是 | 知识库名称 |
data \ createAt | string | 是 | 知识库创建时间,例:2023-12-15T17:01:07Z |
data \ description | string | 是 | 知识库描述 |
data \ config \ index | dict | 是 | 知识库配置 |
data \ config \ index \ type | string | 是 | 知识库索引存储配置 (public | bes | vdb) |
data \ config \ index \ esUrl | dict | 是 | bes 访问地址 |
marker | string | 是 | 起始位置 |
isTruncated | bool | 是 | true表示后面还有数据,false表示已经是最后一页 |
nextMarker | string | 是 | nextMarker下次查询的起始位置 |
maxKeys | int | 是 | 本次查询包含的最大结果集数量 |
integer | int | 是 | 知识库总数 |
请求curl 示例
Plain Text
1curl --location 'https://qianfan.baidubce.com/v2/knowledgeBase?Action=DescribeKnowledgeBases' \
2--header 'Authorization: Bearer <AppBuilder API Key>' \
3--header 'Content-Type: application/json' \
4--data '{
5 "marker": "",
6 "maxKeys": 10,
7 "keyword":""
8}'
正确响应示例
Plain Text
1HTTP/1.1 200 OK
2{
3 "requestId": "095b353d-44da-4844-bf5f-965aa5103459",
4 "data": [
5 {
6 "id": "5e12955f-6b45-4f54-b2b6-84369f068a3d",
7 "name": "knowledge_base",
8 "description": "knowledge_base description",
9 "config": {
10 "index": {
11 "type": "public",
12 "esUrl": ""
13 }
14 }
15 }
16 ],
17 "marker": "",
18 "isTruncated": true,
19 "nextMarker": "f1e93884-bfa6-4ebe-8581-fc3c1461adaf",
20 "maxKeys": 10
21}
错误响应示例
Plain Text
1HTTP/1.1 400
2{
3 "code": "InvalidRequestArgumentError",
4 "message": "marker is not valid",
5 "requestId": "a69c5c0c-1170-43ed-a425-d62990286dc1"
6}