Close httplib2 connections.
rank(rankingConfig, body=None, x__xgafv=None)
Ranks a list of text records based on the given input query.
close()
Close httplib2 connections.
rank(rankingConfig, body=None, x__xgafv=None)
Ranks a list of text records based on the given input query. Args: rankingConfig: string, Required. The resource name of the rank service config, such as `projects/{project_num}/locations/{location}/rankingConfigs/default_ranking_config`. (required) body: object, The request body. The object takes the form of: { # Request message for RankService.Rank method. "ignoreRecordDetailsInResponse": True or False, # If true, the response will contain only record ID and score. By default, it is false, the response will contain record details. "model": "A String", # The identifier of the model to use. It is one of: * `semantic-ranker-512@latest`: Semantic ranking model with maxiumn input token size 512. It is set to `semantic-ranker-512@latest` by default if unspecified. "query": "A String", # The query to use. "records": [ # Required. A list of records to rank. At most 200 records to rank. { # Record message for RankService.Rank method. "content": "A String", # The content of the record. Empty by default. At least one of title or content should be set otherwise an INVALID_ARGUMENT error is thrown. "id": "A String", # The unique ID to represent the record. "score": 3.14, # The score of this record based on the given query and selected model. "title": "A String", # The title of the record. Empty by default. At least one of title or content should be set otherwise an INVALID_ARGUMENT error is thrown. }, ], "topN": 42, # The number of results to return. If this is unset or no bigger than zero, returns all results. "userLabels": { # 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](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) for more details. "a_key": "A String", }, } x__xgafv: string, V1 error format. Allowed values 1 - v1 error format 2 - v2 error format Returns: An object of the form: { # Response message for RankService.Rank method. "records": [ # A list of records sorted by descending score. { # Record message for RankService.Rank method. "content": "A String", # The content of the record. Empty by default. At least one of title or content should be set otherwise an INVALID_ARGUMENT error is thrown. "id": "A String", # The unique ID to represent the record. "score": 3.14, # The score of this record based on the given query and selected model. "title": "A String", # The title of the record. Empty by default. At least one of title or content should be set otherwise an INVALID_ARGUMENT error is thrown. }, ], }