Retrieves content from a knowledge base bound to a Luma Agent and returns relevant text chunks along with their relevance scores.
Operation description
Retrieves content from a knowledge base bound to a Luma Agent and returns relevant text chunks along with their relevance scores.
Try it now
Test
RAM authorization
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| AgentName |
string |
Yes |
The name of the Agent. |
my_agent |
| Catalog |
string |
Yes |
The name of the data catalog bound to the Agent. You can call ListLumaCatalogs to obtain the catalog name. |
my_catalog |
| Namespace |
string |
Yes |
The name of the namespace bound to the Agent. You can call ListLumaNamespaces to obtain the namespace name. |
my_namespace |
| KnowledgeBaseName |
string |
Yes |
The name of the knowledge base bound to the Agent. You can call ListLumaKnowledgeBases to obtain the knowledge base name. |
my-knowledge-base |
| Query |
string |
Yes |
The natural language query for retrieval. |
How to configure event rules |
| Mode |
string |
No |
Valid values: vector (AISearch), keyword (keyword match), hybrid (hybrid search). If not specified, the retrieve configuration of the knowledge base is used. |
hybrid |
| TopK |
integer |
No |
Valid values: 1 to 100. If not specified, the retrieval configuration of the knowledge base is used. |
5 |
| Rerank |
boolean |
No |
Specifies whether to enable reranking for the retrieved results. Reranking improves accuracy but increases latency. If not specified, the retrieval configuration of the knowledge base is used. |
true |
| MetadataFilter |
string |
No |
A JSON string that filters the retrieval scope based on document metadata. For available fields, refer to the MetadataSchema of the knowledge base. |
{"category":"faq"} |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Message |
string |
The message returned by the operation. The value is Operation success if the call succeeds, or a specific error description if the call fails. |
Operation success |
| RequestId |
string |
The unique identifier of the request, used for troubleshooting and ticket feedback. |
34AD682D-5B91-5773-8132-AA38C130**** |
| Data |
object |
The retrieval result from the knowledge base bound to the Agent. |
|
| Chunks |
array |
The list of matched text chunks, sorted by relevance. |
[{"DocumentId":"doc-bp1xxxxxxxxxxxx","ChunkSeq":3,"Content":"EventBridge supports event routing"}] |
| KnowledgeBaseSearchChunk |
The details of a matched text chunk, including the relevance score, chunk content, and location information. |
||
| TimeSpent |
integer |
The time spent on the retrieval, in milliseconds. |
1200 |
| Code |
string |
The response code. A value of Success indicates a successful call. If the call fails, a specific error code is returned. |
Success |
| Success |
boolean |
Indicates whether the call was successful. A value of true indicates success. |
true |
Examples
Success response
JSON format
{
"Message": "Operation success",
"RequestId": "34AD682D-5B91-5773-8132-AA38C130****",
"Data": {
"Chunks": [
{
"ChunkSeq": 12,
"Content": "EventBridge supports routing events to multiple target services",
"DocumentId": "doc-bp1xxxxxxxxxxxx",
"FileName": "product-handbook.pdf",
"Score": 0.92,
"Scores": {
"Fusion": 0.78,
"Keyword": 0.62,
"Rerank": 0.91,
"Vector": 0.85
},
"SourceLocation": "p.3",
"TitlePath": "Installation Guide>Prerequisites"
}
],
"TimeSpent": 1200
},
"Code": "Success",
"Success": true
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter | The specified parameter is invalid | |
| 403 | ServiceNotEnable | Service not enable | |
| 404 | AgentNotFound | Agent not found | |
| 404 | ResourceNotFound | The specified resource is not bound to the agent |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.