Discovery Engine v1 API - Class SearchTuningServiceClient (1.4.0)

public abstract class SearchTuningServiceClient

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

SearchTuningService client wrapper, for convenient use.

Inheritance

object > SearchTuningServiceClient

Namespace

Google.Cloud.DiscoveryEngine.V1

Assembly

Google.Cloud.DiscoveryEngine.V1.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
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default SearchTuningService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default SearchTuningService scopes are:

GrpcClient

public virtual SearchTuningService.SearchTuningServiceClient GrpcClient { get; }

The underlying gRPC SearchTuningService client

Property Value
Type Description
SearchTuningServiceSearchTuningServiceClient

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

TrainCustomModelOperationsClient

public virtual OperationsClient TrainCustomModelOperationsClient { get; }

The long-running operations client for TrainCustomModel.

Property Value
Type Description
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
Type Description
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
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskSearchTuningServiceClient

The task representing the created SearchTuningServiceClient.

ListCustomModels(ListCustomModelsRequest, CallSettings)

public virtual ListCustomModelsResponse ListCustomModels(ListCustomModelsRequest request, CallSettings callSettings = null)

Gets a list of all the custom models.

Parameters
Name Description
request ListCustomModelsRequest

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
ListCustomModelsResponse

The RPC response.

Example
// Create client
SearchTuningServiceClient searchTuningServiceClient = SearchTuningServiceClient.Create();
// Initialize request argument(s)
ListCustomModelsRequest request = new ListCustomModelsRequest
{
    DataStoreAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
};
// Make the request
ListCustomModelsResponse response = searchTuningServiceClient.ListCustomModels(request);

ListCustomModelsAsync(ListCustomModelsRequest, CallSettings)

public virtual Task<ListCustomModelsResponse> ListCustomModelsAsync(ListCustomModelsRequest request, CallSettings callSettings = null)

Gets a list of all the custom models.

Parameters
Name Description
request ListCustomModelsRequest

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
TaskListCustomModelsResponse

A Task containing the RPC response.

Example
// Create client
SearchTuningServiceClient searchTuningServiceClient = await SearchTuningServiceClient.CreateAsync();
// Initialize request argument(s)
ListCustomModelsRequest request = new ListCustomModelsRequest
{
    DataStoreAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
};
// Make the request
ListCustomModelsResponse response = await searchTuningServiceClient.ListCustomModelsAsync(request);

ListCustomModelsAsync(ListCustomModelsRequest, CancellationToken)

public virtual Task<ListCustomModelsResponse> ListCustomModelsAsync(ListCustomModelsRequest request, CancellationToken cancellationToken)

Gets a list of all the custom models.

Parameters
Name Description
request ListCustomModelsRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskListCustomModelsResponse

A Task containing the RPC response.

Example
// Create client
SearchTuningServiceClient searchTuningServiceClient = await SearchTuningServiceClient.CreateAsync();
// Initialize request argument(s)
ListCustomModelsRequest request = new ListCustomModelsRequest
{
    DataStoreAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
};
// Make the request
ListCustomModelsResponse response = await searchTuningServiceClient.ListCustomModelsAsync(request);

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
Name Description
operationName string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
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
Name Description
operationName string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
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
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.

TrainCustomModel(TrainCustomModelRequest, CallSettings)

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

Trains a custom model.

Parameters
Name Description
request TrainCustomModelRequest

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
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(),
    ModelId = "",
};
// 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
Name Description
request TrainCustomModelRequest

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
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(),
    ModelId = "",
};
// 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
Name Description
request TrainCustomModelRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
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(),
    ModelId = "",
};
// 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;
}