Query a Corpus.
This will return the most relevant Chunks in the Corpus for the given query.
Path Parameters
The ID of the corpus to query.
Request Body required
The ID of the corpus to query.
The query to issue.
The maximum number of chunks to return. The service may return fewer than this value. If unspecified, at most 50 results will be returned. The maximum allowed value is 1000.
Possible values: [RERANK_RESULTS_UNSPECIFIED
, RERANK_RESULTS_ENABLED
, RERANK_RESULTS_DISABLED
]
Whether to re-rank results after the initial query.
- 200
- default
OK
Schema
- Array [
- ]
results object[]
The list of results.
The content of the matching chunk.
The score of the match.
The ID of the matching chunk.
citation object
Information about the original source for a QueryResult. This is primarily metadata from the original source document that an LLM can use for citations.
The source owning the document that initially created this chunk.
The document that initially created this chunk.
The URL of the document that initially created this chunk if the document is publicly available.
The title of the document that initially created this chunk, if any.
{
"results": [
{
"chunkContent": "string",
"score": 0,
"chunkId": "string",
"citation": {
"sourceId": "string",
"documentId": "string",
"publicUrl": "string",
"title": "string"
}
}
]
}
Default error response
Schema
- Array [
- ]
The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
details object[]
A list of messages that carry the error details. There is a common set of message types for APIs to use.
The type of the serialized message.
{
"code": 0,
"message": "string",
"details": [
{
"@type": "string"
}
]
}