Discovery Engine v1beta API - Class SearchTuningServiceClient (1.0.0-beta12)

public abstract class SearchTuningServiceClient

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

SearchTuningService client wrapper, for convenient use.

Inheritance

object > SearchTuningServiceClient

Namespace

Google.Cloud.DiscoveryEngine.V1Beta

Assembly

Google.Cloud.DiscoveryEngine.V1Beta.dll

Remarks

Service for search tuning.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default SearchTuningService scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

The default SearchTuningService scopes are:

GrpcClient

public virtual SearchTuningService.SearchTuningServiceClient GrpcClient { get; }

The underlying gRPC SearchTuningService client

Property Value
TypeDescription
SearchTuningServiceSearchTuningServiceClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
TypeDescription
LocationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

TrainCustomModelOperationsClient

public virtual OperationsClient TrainCustomModelOperationsClient { get; }

The long-running operations client for TrainCustomModel.

Property Value
TypeDescription
OperationsClient

Methods

Create()

public static SearchTuningServiceClient Create()

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

Returns
TypeDescription
SearchTuningServiceClient

The created SearchTuningServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskSearchTuningServiceClient

The task representing the created SearchTuningServiceClient.

PollOnceTrainCustomModel(string, CallSettings)

public virtual Operation<TrainCustomModelResponse, TrainCustomModelMetadata> PollOnceTrainCustomModel(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of TrainCustomModel.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationTrainCustomModelResponseTrainCustomModelMetadata

The result of polling the operation.

PollOnceTrainCustomModelAsync(string, CallSettings)

public virtual Task<Operation<TrainCustomModelResponse, TrainCustomModelMetadata>> PollOnceTrainCustomModelAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of TrainCustomModel.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationTrainCustomModelResponseTrainCustomModelMetadata

A task representing the result of polling the operation.

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
TypeDescription
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.

TrainCustomModel(TrainCustomModelRequest, CallSettings)

public virtual Operation<TrainCustomModelResponse, TrainCustomModelMetadata> TrainCustomModel(TrainCustomModelRequest request, CallSettings callSettings = null)

Trains a custom model.

Parameters
NameDescription
requestTrainCustomModelRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationTrainCustomModelResponseTrainCustomModelMetadata

The RPC response.

Example
// Create client
SearchTuningServiceClient searchTuningServiceClient = SearchTuningServiceClient.Create();
// Initialize request argument(s)
TrainCustomModelRequest request = new TrainCustomModelRequest
{
    DataStoreAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
    GcsTrainingInput = new TrainCustomModelRequest.Types.GcsTrainingInput(),
    ModelType = "",
    ErrorConfig = new ImportErrorConfig(),
};
// Make the request
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> response = searchTuningServiceClient.TrainCustomModel(request);

// Poll until the returned long-running operation is complete
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
TrainCustomModelResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> retrievedResponse = searchTuningServiceClient.PollOnceTrainCustomModel(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    TrainCustomModelResponse retrievedResult = retrievedResponse.Result;
}

TrainCustomModelAsync(TrainCustomModelRequest, CallSettings)

public virtual Task<Operation<TrainCustomModelResponse, TrainCustomModelMetadata>> TrainCustomModelAsync(TrainCustomModelRequest request, CallSettings callSettings = null)

Trains a custom model.

Parameters
NameDescription
requestTrainCustomModelRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationTrainCustomModelResponseTrainCustomModelMetadata

A Task containing the RPC response.

Example
// Create client
SearchTuningServiceClient searchTuningServiceClient = await SearchTuningServiceClient.CreateAsync();
// Initialize request argument(s)
TrainCustomModelRequest request = new TrainCustomModelRequest
{
    DataStoreAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
    GcsTrainingInput = new TrainCustomModelRequest.Types.GcsTrainingInput(),
    ModelType = "",
    ErrorConfig = new ImportErrorConfig(),
};
// Make the request
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> response = await searchTuningServiceClient.TrainCustomModelAsync(request);

// Poll until the returned long-running operation is complete
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
TrainCustomModelResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> retrievedResponse = await searchTuningServiceClient.PollOnceTrainCustomModelAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    TrainCustomModelResponse retrievedResult = retrievedResponse.Result;
}

TrainCustomModelAsync(TrainCustomModelRequest, CancellationToken)

public virtual Task<Operation<TrainCustomModelResponse, TrainCustomModelMetadata>> TrainCustomModelAsync(TrainCustomModelRequest request, CancellationToken cancellationToken)

Trains a custom model.

Parameters
NameDescription
requestTrainCustomModelRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationTrainCustomModelResponseTrainCustomModelMetadata

A Task containing the RPC response.

Example
// Create client
SearchTuningServiceClient searchTuningServiceClient = await SearchTuningServiceClient.CreateAsync();
// Initialize request argument(s)
TrainCustomModelRequest request = new TrainCustomModelRequest
{
    DataStoreAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
    GcsTrainingInput = new TrainCustomModelRequest.Types.GcsTrainingInput(),
    ModelType = "",
    ErrorConfig = new ImportErrorConfig(),
};
// Make the request
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> response = await searchTuningServiceClient.TrainCustomModelAsync(request);

// Poll until the returned long-running operation is complete
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
TrainCustomModelResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> retrievedResponse = await searchTuningServiceClient.PollOnceTrainCustomModelAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    TrainCustomModelResponse retrievedResult = retrievedResponse.Result;
}