Performs semantic search over a Document
.
HTTP request
POST https://generativelanguage.googleapis.com/v1beta/{name=corpora/*/documents/*}:query
Path parameters
Parameters | |
---|---|
name |
Required. The name of the |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{
"query": string,
"resultsCount": integer,
"metadataFilters": [
{
object ( |
Fields | |
---|---|
query |
Required. Query string to perform semantic search. |
resultsCount |
Optional. The maximum number of If unspecified, at most 10 |
metadataFilters[] |
Optional. Filter for Note: Example query: (year >= 2020 OR year < 2010) AND (genre = drama OR genre = action)
Example query for a numeric range of values: (year > 2015 AND year <= 2020)
Note: "AND"s for the same key are only supported for numeric values. String values only support "OR"s for the same key. |
Response body
Response from documents.query
containing a list of relevant chunks.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{
"relevantChunks": [
{
object ( |
Fields | |
---|---|
relevantChunks[] |
The returned relevant chunks. |
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/generative-language.retriever
https://www.googleapis.com/auth/generative-language.retriever.readonly
For more information, see the Authentication Overview.