Query a knowledge base
Try it now
Test
RAM authorization
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| KbUuid |
string |
Yes |
The ID of the knowledge base. |
kb-*** |
| Query |
string |
Yes |
The query text. |
What is GraphRAG? |
| TopK |
integer |
No |
The number of top-ranked results to return. |
10 |
| Filter |
string |
No |
A filter for the data, specified as a SQL |
title = 'test' AND name like 'test%' |
| Metrics |
string |
No |
The distance metric for retrieval. If unspecified, this defaults to the metric configured for the knowledge base. Only set this parameter if you have specific requirements. Valid values:
|
cosine |
| HybridSearch |
string |
No |
The hybrid search algorithm. If this parameter is not set, the system directly compares and ranks the scores from the dense vector and full-text searches. Valid values:
|
RRF |
| HybridSearchArgs |
string |
No |
Parameters for the specified
|
{ \"Weight\": { \"alpha\": 0.5 } } |
| IncludeVector |
boolean |
No |
Specifies whether to include the vector in the results. The default value is Note
|
false |
| IncludeMetadataFields |
string |
No |
The metadata fields to return, separated by commas. By default, no metadata fields are returned. |
title,page |
| RerankFactor |
number |
No |
The factor used to rerank vector search results. The value must be in the range (1, 5]. Note
|
2 |
| RecallWindow |
string |
No |
The recall window. If specified, this parameter expands the context of the retrieved results. The format is a two-element array Note
|
[-5,5] |
| OrderBy |
string |
No |
The field to use for sorting the results. By default, this parameter is empty. The field must be a metadata field or a default table field, such as You can specify a single field (for example, |
created_at |
| Offset |
integer |
No |
The offset for pagination. |
0 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response object. |
||
| RequestId |
string |
The unique request ID. Use this ID to troubleshoot errors. |
67E910F2-4B62-5B0C-ACA3-7547695C**** |
| Data |
object |
The response payload. |
|
| Results |
array<object> |
The retrieved results. |
|
|
array<object> |
A single retrieval result. |
||
| Id |
string |
The unique ID of the vector. |
3b35c95-57f3-442f-9220-xxxxx |
| Content |
string |
The content of the retrieved text chunk. |
GraphRAG (Graph Retrieval-Augmented Generation) is an advanced AI framework that combines Knowledge Graphs with Large Language Models (LLMs) to improve the accuracy, context, and reasoning capabilities of information retrieval and generation. |
| FileName |
string |
The name of the source document. |
1.txt |
| LoaderMetadata |
string |
The metadata generated by the document loader. |
{"page_pos": 1} |
| Score |
number |
The similarity score of the result. This score depends on the distance metric ( |
0.81 |
| Vector |
array |
The vector data as an array of floating-point numbers. |
|
|
number |
A single floating-point value from the vector. |
1.2123 |
|
| Metadata |
object |
A key-value map of the metadata. |
{"title":"test"} |
| RerankScore |
number |
The rerank score. |
6.2345 |
| RetrievalSource |
integer |
The method used for retrieval. Valid values: |
1 |
| Matches |
array<object> |
Matched items from the windowing process. |
|
|
array<object> |
A matched data object. |
||
| Content |
string |
The text content. |
GraphRAG (Graph Retrieval-Augmented Generation) is an advanced AI framework that combines Knowledge Graphs with Large Language Models (LLMs) to improve the accuracy, context, and reasoning capabilities of information retrieval and generation. |
| FileName |
string |
The name of the source document. |
1.txt |
| Id |
string |
The unique ID of the vector. |
3b35c95-57f3-442f-9220-xxxxx |
| LoaderMetadata |
string |
The metadata generated by the document loader. |
{"page_pos": 1} |
| Metadata |
object |
A key-value map of the metadata. |
{"title":"test"} |
| ErrorCode |
string |
The error code for a failed request. |
KnowledgeBaseNotFound |
| Success |
boolean |
Indicates whether the request was successful. Valid values:
|
true |
| ErrorMessage |
string |
The error message for a failed request. |
Resource not found kb-*** |
Examples
Success response
JSON format
{
"RequestId": "67E910F2-4B62-5B0C-ACA3-7547695C****",
"Data": {
"Results": [
{
"Id": "3b35c95-57f3-442f-9220-xxxxx",
"Content": "GraphRAG (Graph Retrieval-Augmented Generation) is an advanced AI framework that combines Knowledge Graphs with Large Language Models (LLMs) to improve the accuracy, context, and reasoning capabilities of information retrieval and generation.",
"FileName": "1.txt",
"LoaderMetadata": "{\"page_pos\": 1}",
"Score": 0.81,
"Vector": [
1.2123
],
"Metadata": {
"title": "test"
},
"RerankScore": 6.2345,
"RetrievalSource": 1
}
],
"Matches": [
{
"Content": "GraphRAG (Graph Retrieval-Augmented Generation) is an advanced AI framework that combines Knowledge Graphs with Large Language Models (LLMs) to improve the accuracy, context, and reasoning capabilities of information retrieval and generation.",
"FileName": "1.txt",
"Id": "3b35c95-57f3-442f-9220-xxxxx",
"LoaderMetadata": "{\"page_pos\": 1}",
"Metadata": {
"title": "test"
}
}
]
},
"ErrorCode": "KnowledgeBaseNotFound",
"Success": true,
"ErrorMessage": "Resource not found kb-***"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.