Send feedback
google.ai.generativelanguage.QueryCorpusRequest
Stay organized with collections
Save and categorize content based on your preferences.
Request for querying a Corpus
.
View aliases
Main aliases
`google.ai.generativelanguage_v1beta.QueryCorpusRequest`
Attributes
name
str
Required. The name of the Corpus
to query. Example:
corpora/my-corpus-123
query
str
Required. Query string to perform semantic
search.
metadata_filters
MutableSequence[google.ai.generativelanguage.MetadataFilter]
Optional. Filter for Chunk
and Document
metadata.
Each MetadataFilter
object should correspond to a unique
key. Multiple MetadataFilter
objects are joined by
logical "AND"s.
Example query at document level: (year >= 2020 OR year <
2010) AND (genre = drama OR genre = action)
MetadataFilter
object list: metadata_filters = [ {key =
"document.custom_metadata.year" conditions = [{int_value =
2020, operation = GREATER_EQUAL}, {int_value = 2010,
operation = LESS}]}, {key = "document.custom_metadata.year"
conditions = [{int_value = 2020, operation = GREATER_EQUAL},
{int_value = 2010, operation = LESS}]}, {key =
"document.custom_metadata.genre" conditions = [{string_value
= "drama", operation = EQUAL}, {string_value = "action",
operation = EQUAL}]}]
Example query at chunk level for a numeric range of values:
(year > 2015 AND year <= 2020)
MetadataFilter
object list: metadata_filters = [ {key =
"chunk.custom_metadata.year" conditions = [{int_value =
2015, operation = GREATER}]}, {key =
"chunk.custom_metadata.year" conditions = [{int_value =
2020, operation = LESS_EQUAL}]}]
Note: "AND"s for the same key are only supported for numeric
values. String values only support "OR"s for the same key.
results_count
int
Optional. The maximum number of Chunk
\ s to return. The
service may return fewer Chunk
\ s.
If unspecified, at most 10 Chunk
\ s will be returned.
The maximum specified result count is 100.
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-12-13 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?