#[non_exhaustive]pub struct RankRequest {
pub ranking_config: String,
pub model: String,
pub top_n: i32,
pub query: String,
pub records: Vec<RankingRecord>,
pub ignore_record_details_in_response: bool,
pub user_labels: HashMap<String, String>,
/* private fields */
}rank-service only.Expand description
Request message for RankService.Rank method.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.ranking_config: StringRequired. The resource name of the rank service config, such as
projects/{project_num}/locations/{location}/rankingConfigs/default_ranking_config.
model: StringThe identifier of the model to use. It is one of:
semantic-ranker-512@latest: Semantic ranking model with maximum input token size 512.
It is set to semantic-ranker-512@latest by default if unspecified.
top_n: i32The number of results to return. If this is unset or no bigger than zero, returns all results.
query: StringThe query to use.
records: Vec<RankingRecord>Required. A list of records to rank. At most 200 records to rank.
ignore_record_details_in_response: boolIf true, the response will contain only record ID and score. By default, it is false, the response will contain record details.
user_labels: HashMap<String, String>The user labels applied to a resource must meet the following requirements:
- Each resource can have multiple labels, up to a maximum of 64.
- Each label must be a key-value pair.
- Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
- Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
- The key portion of a label must be unique. However, you can use the same key with multiple resources.
- Keys must start with a lowercase letter or international character.
See Google Cloud Document for more details.
Implementations§
Source§impl RankRequest
impl RankRequest
pub fn new() -> Self
Sourcepub fn set_ranking_config<T: Into<String>>(self, v: T) -> Self
pub fn set_ranking_config<T: Into<String>>(self, v: T) -> Self
Sets the value of ranking_config.
§Example
let x = RankRequest::new().set_ranking_config("example");Sourcepub fn set_records<T, V>(self, v: T) -> Self
pub fn set_records<T, V>(self, v: T) -> Self
Sourcepub fn set_ignore_record_details_in_response<T: Into<bool>>(self, v: T) -> Self
pub fn set_ignore_record_details_in_response<T: Into<bool>>(self, v: T) -> Self
Sets the value of ignore_record_details_in_response.
§Example
let x = RankRequest::new().set_ignore_record_details_in_response(true);Sourcepub fn set_user_labels<T, K, V>(self, v: T) -> Self
pub fn set_user_labels<T, K, V>(self, v: T) -> Self
Sets the value of user_labels.
§Example
let x = RankRequest::new().set_user_labels([
("key0", "abc"),
("key1", "xyz"),
]);Trait Implementations§
Source§impl Clone for RankRequest
impl Clone for RankRequest
Source§fn clone(&self) -> RankRequest
fn clone(&self) -> RankRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more