Discovery Engine v1beta API - Class RankServiceClient (1.0.0-beta18)

public abstract class RankServiceClient

Reference documentation and code samples for the Discovery Engine v1beta API class RankServiceClient.

RankService client wrapper, for convenient use.

Inheritance

object > RankServiceClient

Derived Types

Namespace

Google.Cloud.DiscoveryEngine.V1Beta

Assembly

Google.Cloud.DiscoveryEngine.V1Beta.dll

Remarks

Service for ranking text records.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the RankService service, which is a host of "discoveryengine.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default RankService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default RankService scopes are:

GrpcClient

public virtual RankService.RankServiceClient GrpcClient { get; }

The underlying gRPC RankService client

Property Value
Type Description
RankServiceRankServiceClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static RankServiceClient Create()

Synchronously creates a RankServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use RankServiceClientBuilder.

Returns
Type Description
RankServiceClient

The created RankServiceClient.

CreateAsync(CancellationToken)

public static Task<RankServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a RankServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use RankServiceClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskRankServiceClient

The task representing the created RankServiceClient.

Rank(RankRequest, CallSettings)

public virtual RankResponse Rank(RankRequest request, CallSettings callSettings = null)

Ranks a list of text records based on the given input query.

Parameters
Name Description
request RankRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
RankResponse

The RPC response.

Example
// Create client
RankServiceClient rankServiceClient = RankServiceClient.Create();
// Initialize request argument(s)
RankRequest request = new RankRequest
{
    RankingConfigAsRankingConfigName = RankingConfigName.FromProjectLocationRankingConfig("[PROJECT]", "[LOCATION]", "[RANKING_CONFIG]"),
    Model = "",
    TopN = 0,
    Query = "",
    Records =
    {
        new RankingRecord(),
    },
    IgnoreRecordDetailsInResponse = false,
    UserLabels = { { "", "" }, },
};
// Make the request
RankResponse response = rankServiceClient.Rank(request);

RankAsync(RankRequest, CallSettings)

public virtual Task<RankResponse> RankAsync(RankRequest request, CallSettings callSettings = null)

Ranks a list of text records based on the given input query.

Parameters
Name Description
request RankRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskRankResponse

A Task containing the RPC response.

Example
// Create client
RankServiceClient rankServiceClient = await RankServiceClient.CreateAsync();
// Initialize request argument(s)
RankRequest request = new RankRequest
{
    RankingConfigAsRankingConfigName = RankingConfigName.FromProjectLocationRankingConfig("[PROJECT]", "[LOCATION]", "[RANKING_CONFIG]"),
    Model = "",
    TopN = 0,
    Query = "",
    Records =
    {
        new RankingRecord(),
    },
    IgnoreRecordDetailsInResponse = false,
    UserLabels = { { "", "" }, },
};
// Make the request
RankResponse response = await rankServiceClient.RankAsync(request);

RankAsync(RankRequest, CancellationToken)

public virtual Task<RankResponse> RankAsync(RankRequest request, CancellationToken cancellationToken)

Ranks a list of text records based on the given input query.

Parameters
Name Description
request RankRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskRankResponse

A Task containing the RPC response.

Example
// Create client
RankServiceClient rankServiceClient = await RankServiceClient.CreateAsync();
// Initialize request argument(s)
RankRequest request = new RankRequest
{
    RankingConfigAsRankingConfigName = RankingConfigName.FromProjectLocationRankingConfig("[PROJECT]", "[LOCATION]", "[RANKING_CONFIG]"),
    Model = "",
    TopN = 0,
    Query = "",
    Records =
    {
        new RankingRecord(),
    },
    IgnoreRecordDetailsInResponse = false,
    UserLabels = { { "", "" }, },
};
// Make the request
RankResponse response = await rankServiceClient.RankAsync(request);

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.