This API retrieves results for retrieval-augmented generation (RAG) from one or more folder or file IDs. You can then process these results and embed them in your business logic.
Try it now
Test
RAM authorization
Request syntax
POST /api/v2/aidoc/knowledgebase/retrieve HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| body |
object |
No |
The request body. |
|
| query |
string |
Yes |
The query statement. |
"What's the meaning of the file?" |
| useReranker |
boolean |
No |
Specifies whether to use the reranker. Default: true. |
|
| rerankerThreshold |
number |
No |
The reranking score threshold. Results with scores below this threshold are filtered out. Default: 0.0. |
0.0 |
| topK |
integer |
No |
The number of top-ranked retrieval results to return. Default: 10. |
10 |
| preRetrieveTopK |
integer |
No |
The number of pre-retrieval results to return. Default: 0. |
0 |
| documentIds |
array |
No |
Specify either documentIds or folderIds, but not both. |
|
|
integer |
No |
The file ID. You can get the ID from the Software as a Service (SaaS) page or through an SDK operation. |
3456 |
|
| folderIds |
array |
No |
Specify either folderIds or documentIds, but not both. |
|
|
string |
No |
The folder ID. You can get the ID from the SaaS page or through an SDK operation. |
adafb91d4e014e2eb4d0a5375b547115 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| requestId |
string |
Id of the request |
83A5A7DD-8974-5769-952E-590A97BEA34E |
| data |
object |
The returned data. |
|
| jobId |
string |
The job ID. |
76cd1691-daf6-4113-8444-4998a25a5323 |
| results |
array |
A list of retrieval results. |
|
| ChunkItem |
A retrieval result. |
Examples
Success response
JSON format
{
"requestId": "83A5A7DD-8974-5769-952E-590A97BEA34E",
"data": {
"jobId": "76cd1691-daf6-4113-8444-4998a25a5323",
"results": [
{
"score": 0.4295678,
"docName": "临时场地协议-APM.pdf",
"rerankScore": 0.5053711,
"docId": "b4620821aea92c062d8d19ad793243669cf9ae2b900e6967dee6ee9f3bf5feed",
"docUrl": "jobs/a4123b3f-9287-4c61-b59d-32e40fcb0a31/document/8b24a2e06669427fb3dc9812374d9d1a.pdf",
"weightedScore": 0.47252458,
"chunkId": "b0x7,b1x10",
"chunkContent": "\\\\n## 第三条 场地占用费(含物业管理费和市场推广费)\\\\n\\\\n3.2 乙方应于本协议签订后 20 个工作日内或该场地交付乙方的同时(以日期在先者为准),\\\\n向甲方一次性支付该场地四个月的场地占用费。\\\\n\\\\n3.3 乙方应向甲方支付的协议价款(场地占用费、物业管理费、市场推广费及本协议约定的其 他费用)以及实际发生的各种性质的价外费用(根据适用税法的相关规定,价外费用包括 但不限于违约金、赔偿金、代收款项、代垫款项)均为含增值税价格。",
"docElsIds": [
"b0x7"
]
}
]
}
}
Error codes
See for a complete list.
Release notes
See Release Notes for a complete list.