Cloud AI Platform v1 API - Class GenAiTuningServiceClient (3.0.0)

public abstract class GenAiTuningServiceClient

Reference documentation and code samples for the Cloud AI Platform v1 API class GenAiTuningServiceClient.

GenAiTuningService client wrapper, for convenient use.

Inheritance

object > GenAiTuningServiceClient

Namespace

Google.Cloud.AIPlatform.V1

Assembly

Google.Cloud.AIPlatform.V1.dll

Remarks

A service for creating and managing GenAI Tuning Jobs.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default GenAiTuningService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default GenAiTuningService scopes are:

GrpcClient

public virtual GenAiTuningService.GenAiTuningServiceClient GrpcClient { get; }

The underlying gRPC GenAiTuningService client

Property Value
Type Description
GenAiTuningServiceGenAiTuningServiceClient

IAMPolicyClient

public virtual IAMPolicyClient IAMPolicyClient { get; }

The IAMPolicyClient associated with this client.

Property Value
Type Description
IAMPolicyClient

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

CancelTuningJob(CancelTuningJobRequest, CallSettings)

public virtual void CancelTuningJob(CancelTuningJobRequest request, CallSettings callSettings = null)

Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but success is not guaranteed. Clients can use [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob] or other methods to check whether the cancellation succeeded or whether the job completed despite cancellation. On successful cancellation, the TuningJob is not deleted; instead it becomes a job with a [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to Code.CANCELLED, and [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to CANCELLED.

Parameters
Name Description
request CancelTuningJobRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
CancelTuningJobRequest request = new CancelTuningJobRequest
{
    TuningJobName = TuningJobName.FromProjectLocationTuningJob("[PROJECT]", "[LOCATION]", "[TUNING_JOB]"),
};
// Make the request
genAiTuningServiceClient.CancelTuningJob(request);

CancelTuningJob(TuningJobName, CallSettings)

public virtual void CancelTuningJob(TuningJobName name, CallSettings callSettings = null)

Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but success is not guaranteed. Clients can use [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob] or other methods to check whether the cancellation succeeded or whether the job completed despite cancellation. On successful cancellation, the TuningJob is not deleted; instead it becomes a job with a [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to Code.CANCELLED, and [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to CANCELLED.

Parameters
Name Description
name TuningJobName

Required. The name of the TuningJob to cancel. Format: projects/{project}/locations/{location}/tuningJobs/{tuning_job}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
TuningJobName name = TuningJobName.FromProjectLocationTuningJob("[PROJECT]", "[LOCATION]", "[TUNING_JOB]");
// Make the request
genAiTuningServiceClient.CancelTuningJob(name);

CancelTuningJob(string, CallSettings)

public virtual void CancelTuningJob(string name, CallSettings callSettings = null)

Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but success is not guaranteed. Clients can use [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob] or other methods to check whether the cancellation succeeded or whether the job completed despite cancellation. On successful cancellation, the TuningJob is not deleted; instead it becomes a job with a [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to Code.CANCELLED, and [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to CANCELLED.

Parameters
Name Description
name string

Required. The name of the TuningJob to cancel. Format: projects/{project}/locations/{location}/tuningJobs/{tuning_job}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/tuningJobs/[TUNING_JOB]";
// Make the request
genAiTuningServiceClient.CancelTuningJob(name);

CancelTuningJobAsync(CancelTuningJobRequest, CallSettings)

public virtual Task CancelTuningJobAsync(CancelTuningJobRequest request, CallSettings callSettings = null)

Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but success is not guaranteed. Clients can use [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob] or other methods to check whether the cancellation succeeded or whether the job completed despite cancellation. On successful cancellation, the TuningJob is not deleted; instead it becomes a job with a [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to Code.CANCELLED, and [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to CANCELLED.

Parameters
Name Description
request CancelTuningJobRequest

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
Task

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
CancelTuningJobRequest request = new CancelTuningJobRequest
{
    TuningJobName = TuningJobName.FromProjectLocationTuningJob("[PROJECT]", "[LOCATION]", "[TUNING_JOB]"),
};
// Make the request
await genAiTuningServiceClient.CancelTuningJobAsync(request);

CancelTuningJobAsync(CancelTuningJobRequest, CancellationToken)

public virtual Task CancelTuningJobAsync(CancelTuningJobRequest request, CancellationToken cancellationToken)

Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but success is not guaranteed. Clients can use [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob] or other methods to check whether the cancellation succeeded or whether the job completed despite cancellation. On successful cancellation, the TuningJob is not deleted; instead it becomes a job with a [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to Code.CANCELLED, and [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to CANCELLED.

Parameters
Name Description
request CancelTuningJobRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
CancelTuningJobRequest request = new CancelTuningJobRequest
{
    TuningJobName = TuningJobName.FromProjectLocationTuningJob("[PROJECT]", "[LOCATION]", "[TUNING_JOB]"),
};
// Make the request
await genAiTuningServiceClient.CancelTuningJobAsync(request);

CancelTuningJobAsync(TuningJobName, CallSettings)

public virtual Task CancelTuningJobAsync(TuningJobName name, CallSettings callSettings = null)

Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but success is not guaranteed. Clients can use [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob] or other methods to check whether the cancellation succeeded or whether the job completed despite cancellation. On successful cancellation, the TuningJob is not deleted; instead it becomes a job with a [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to Code.CANCELLED, and [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to CANCELLED.

Parameters
Name Description
name TuningJobName

Required. The name of the TuningJob to cancel. Format: projects/{project}/locations/{location}/tuningJobs/{tuning_job}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
TuningJobName name = TuningJobName.FromProjectLocationTuningJob("[PROJECT]", "[LOCATION]", "[TUNING_JOB]");
// Make the request
await genAiTuningServiceClient.CancelTuningJobAsync(name);

CancelTuningJobAsync(TuningJobName, CancellationToken)

public virtual Task CancelTuningJobAsync(TuningJobName name, CancellationToken cancellationToken)

Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but success is not guaranteed. Clients can use [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob] or other methods to check whether the cancellation succeeded or whether the job completed despite cancellation. On successful cancellation, the TuningJob is not deleted; instead it becomes a job with a [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to Code.CANCELLED, and [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to CANCELLED.

Parameters
Name Description
name TuningJobName

Required. The name of the TuningJob to cancel. Format: projects/{project}/locations/{location}/tuningJobs/{tuning_job}

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
TuningJobName name = TuningJobName.FromProjectLocationTuningJob("[PROJECT]", "[LOCATION]", "[TUNING_JOB]");
// Make the request
await genAiTuningServiceClient.CancelTuningJobAsync(name);

CancelTuningJobAsync(string, CallSettings)

public virtual Task CancelTuningJobAsync(string name, CallSettings callSettings = null)

Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but success is not guaranteed. Clients can use [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob] or other methods to check whether the cancellation succeeded or whether the job completed despite cancellation. On successful cancellation, the TuningJob is not deleted; instead it becomes a job with a [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to Code.CANCELLED, and [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to CANCELLED.

Parameters
Name Description
name string

Required. The name of the TuningJob to cancel. Format: projects/{project}/locations/{location}/tuningJobs/{tuning_job}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/tuningJobs/[TUNING_JOB]";
// Make the request
await genAiTuningServiceClient.CancelTuningJobAsync(name);

CancelTuningJobAsync(string, CancellationToken)

public virtual Task CancelTuningJobAsync(string name, CancellationToken cancellationToken)

Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but success is not guaranteed. Clients can use [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob] or other methods to check whether the cancellation succeeded or whether the job completed despite cancellation. On successful cancellation, the TuningJob is not deleted; instead it becomes a job with a [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to Code.CANCELLED, and [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to CANCELLED.

Parameters
Name Description
name string

Required. The name of the TuningJob to cancel. Format: projects/{project}/locations/{location}/tuningJobs/{tuning_job}

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/tuningJobs/[TUNING_JOB]";
// Make the request
await genAiTuningServiceClient.CancelTuningJobAsync(name);

Create()

public static GenAiTuningServiceClient Create()

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

Returns
Type Description
GenAiTuningServiceClient

The created GenAiTuningServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskGenAiTuningServiceClient

The task representing the created GenAiTuningServiceClient.

CreateTuningJob(LocationName, TuningJob, CallSettings)

public virtual TuningJob CreateTuningJob(LocationName parent, TuningJob tuningJob, CallSettings callSettings = null)

Creates a TuningJob. A created TuningJob right away will be attempted to be run.

Parameters
Name Description
parent LocationName

Required. The resource name of the Location to create the TuningJob in. Format: projects/{project}/locations/{location}

tuningJob TuningJob

Required. The TuningJob to create.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TuningJob

The RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
TuningJob tuningJob = new TuningJob();
// Make the request
TuningJob response = genAiTuningServiceClient.CreateTuningJob(parent, tuningJob);

CreateTuningJob(CreateTuningJobRequest, CallSettings)

public virtual TuningJob CreateTuningJob(CreateTuningJobRequest request, CallSettings callSettings = null)

Creates a TuningJob. A created TuningJob right away will be attempted to be run.

Parameters
Name Description
request CreateTuningJobRequest

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
TuningJob

The RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
CreateTuningJobRequest request = new CreateTuningJobRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    TuningJob = new TuningJob(),
};
// Make the request
TuningJob response = genAiTuningServiceClient.CreateTuningJob(request);

CreateTuningJob(string, TuningJob, CallSettings)

public virtual TuningJob CreateTuningJob(string parent, TuningJob tuningJob, CallSettings callSettings = null)

Creates a TuningJob. A created TuningJob right away will be attempted to be run.

Parameters
Name Description
parent string

Required. The resource name of the Location to create the TuningJob in. Format: projects/{project}/locations/{location}

tuningJob TuningJob

Required. The TuningJob to create.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TuningJob

The RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
TuningJob tuningJob = new TuningJob();
// Make the request
TuningJob response = genAiTuningServiceClient.CreateTuningJob(parent, tuningJob);

CreateTuningJobAsync(LocationName, TuningJob, CallSettings)

public virtual Task<TuningJob> CreateTuningJobAsync(LocationName parent, TuningJob tuningJob, CallSettings callSettings = null)

Creates a TuningJob. A created TuningJob right away will be attempted to be run.

Parameters
Name Description
parent LocationName

Required. The resource name of the Location to create the TuningJob in. Format: projects/{project}/locations/{location}

tuningJob TuningJob

Required. The TuningJob to create.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskTuningJob

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
TuningJob tuningJob = new TuningJob();
// Make the request
TuningJob response = await genAiTuningServiceClient.CreateTuningJobAsync(parent, tuningJob);

CreateTuningJobAsync(LocationName, TuningJob, CancellationToken)

public virtual Task<TuningJob> CreateTuningJobAsync(LocationName parent, TuningJob tuningJob, CancellationToken cancellationToken)

Creates a TuningJob. A created TuningJob right away will be attempted to be run.

Parameters
Name Description
parent LocationName

Required. The resource name of the Location to create the TuningJob in. Format: projects/{project}/locations/{location}

tuningJob TuningJob

Required. The TuningJob to create.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskTuningJob

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
TuningJob tuningJob = new TuningJob();
// Make the request
TuningJob response = await genAiTuningServiceClient.CreateTuningJobAsync(parent, tuningJob);

CreateTuningJobAsync(CreateTuningJobRequest, CallSettings)

public virtual Task<TuningJob> CreateTuningJobAsync(CreateTuningJobRequest request, CallSettings callSettings = null)

Creates a TuningJob. A created TuningJob right away will be attempted to be run.

Parameters
Name Description
request CreateTuningJobRequest

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
TaskTuningJob

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
CreateTuningJobRequest request = new CreateTuningJobRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    TuningJob = new TuningJob(),
};
// Make the request
TuningJob response = await genAiTuningServiceClient.CreateTuningJobAsync(request);

CreateTuningJobAsync(CreateTuningJobRequest, CancellationToken)

public virtual Task<TuningJob> CreateTuningJobAsync(CreateTuningJobRequest request, CancellationToken cancellationToken)

Creates a TuningJob. A created TuningJob right away will be attempted to be run.

Parameters
Name Description
request CreateTuningJobRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskTuningJob

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
CreateTuningJobRequest request = new CreateTuningJobRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    TuningJob = new TuningJob(),
};
// Make the request
TuningJob response = await genAiTuningServiceClient.CreateTuningJobAsync(request);

CreateTuningJobAsync(string, TuningJob, CallSettings)

public virtual Task<TuningJob> CreateTuningJobAsync(string parent, TuningJob tuningJob, CallSettings callSettings = null)

Creates a TuningJob. A created TuningJob right away will be attempted to be run.

Parameters
Name Description
parent string

Required. The resource name of the Location to create the TuningJob in. Format: projects/{project}/locations/{location}

tuningJob TuningJob

Required. The TuningJob to create.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskTuningJob

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
TuningJob tuningJob = new TuningJob();
// Make the request
TuningJob response = await genAiTuningServiceClient.CreateTuningJobAsync(parent, tuningJob);

CreateTuningJobAsync(string, TuningJob, CancellationToken)

public virtual Task<TuningJob> CreateTuningJobAsync(string parent, TuningJob tuningJob, CancellationToken cancellationToken)

Creates a TuningJob. A created TuningJob right away will be attempted to be run.

Parameters
Name Description
parent string

Required. The resource name of the Location to create the TuningJob in. Format: projects/{project}/locations/{location}

tuningJob TuningJob

Required. The TuningJob to create.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskTuningJob

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
TuningJob tuningJob = new TuningJob();
// Make the request
TuningJob response = await genAiTuningServiceClient.CreateTuningJobAsync(parent, tuningJob);

GetTuningJob(GetTuningJobRequest, CallSettings)

public virtual TuningJob GetTuningJob(GetTuningJobRequest request, CallSettings callSettings = null)

Gets a TuningJob.

Parameters
Name Description
request GetTuningJobRequest

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
TuningJob

The RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
GetTuningJobRequest request = new GetTuningJobRequest
{
    TuningJobName = TuningJobName.FromProjectLocationTuningJob("[PROJECT]", "[LOCATION]", "[TUNING_JOB]"),
};
// Make the request
TuningJob response = genAiTuningServiceClient.GetTuningJob(request);

GetTuningJob(TuningJobName, CallSettings)

public virtual TuningJob GetTuningJob(TuningJobName name, CallSettings callSettings = null)

Gets a TuningJob.

Parameters
Name Description
name TuningJobName

Required. The name of the TuningJob resource. Format: projects/{project}/locations/{location}/tuningJobs/{tuning_job}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TuningJob

The RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
TuningJobName name = TuningJobName.FromProjectLocationTuningJob("[PROJECT]", "[LOCATION]", "[TUNING_JOB]");
// Make the request
TuningJob response = genAiTuningServiceClient.GetTuningJob(name);

GetTuningJob(string, CallSettings)

public virtual TuningJob GetTuningJob(string name, CallSettings callSettings = null)

Gets a TuningJob.

Parameters
Name Description
name string

Required. The name of the TuningJob resource. Format: projects/{project}/locations/{location}/tuningJobs/{tuning_job}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TuningJob

The RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/tuningJobs/[TUNING_JOB]";
// Make the request
TuningJob response = genAiTuningServiceClient.GetTuningJob(name);

GetTuningJobAsync(GetTuningJobRequest, CallSettings)

public virtual Task<TuningJob> GetTuningJobAsync(GetTuningJobRequest request, CallSettings callSettings = null)

Gets a TuningJob.

Parameters
Name Description
request GetTuningJobRequest

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
TaskTuningJob

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
GetTuningJobRequest request = new GetTuningJobRequest
{
    TuningJobName = TuningJobName.FromProjectLocationTuningJob("[PROJECT]", "[LOCATION]", "[TUNING_JOB]"),
};
// Make the request
TuningJob response = await genAiTuningServiceClient.GetTuningJobAsync(request);

GetTuningJobAsync(GetTuningJobRequest, CancellationToken)

public virtual Task<TuningJob> GetTuningJobAsync(GetTuningJobRequest request, CancellationToken cancellationToken)

Gets a TuningJob.

Parameters
Name Description
request GetTuningJobRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskTuningJob

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
GetTuningJobRequest request = new GetTuningJobRequest
{
    TuningJobName = TuningJobName.FromProjectLocationTuningJob("[PROJECT]", "[LOCATION]", "[TUNING_JOB]"),
};
// Make the request
TuningJob response = await genAiTuningServiceClient.GetTuningJobAsync(request);

GetTuningJobAsync(TuningJobName, CallSettings)

public virtual Task<TuningJob> GetTuningJobAsync(TuningJobName name, CallSettings callSettings = null)

Gets a TuningJob.

Parameters
Name Description
name TuningJobName

Required. The name of the TuningJob resource. Format: projects/{project}/locations/{location}/tuningJobs/{tuning_job}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskTuningJob

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
TuningJobName name = TuningJobName.FromProjectLocationTuningJob("[PROJECT]", "[LOCATION]", "[TUNING_JOB]");
// Make the request
TuningJob response = await genAiTuningServiceClient.GetTuningJobAsync(name);

GetTuningJobAsync(TuningJobName, CancellationToken)

public virtual Task<TuningJob> GetTuningJobAsync(TuningJobName name, CancellationToken cancellationToken)

Gets a TuningJob.

Parameters
Name Description
name TuningJobName

Required. The name of the TuningJob resource. Format: projects/{project}/locations/{location}/tuningJobs/{tuning_job}

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskTuningJob

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
TuningJobName name = TuningJobName.FromProjectLocationTuningJob("[PROJECT]", "[LOCATION]", "[TUNING_JOB]");
// Make the request
TuningJob response = await genAiTuningServiceClient.GetTuningJobAsync(name);

GetTuningJobAsync(string, CallSettings)

public virtual Task<TuningJob> GetTuningJobAsync(string name, CallSettings callSettings = null)

Gets a TuningJob.

Parameters
Name Description
name string

Required. The name of the TuningJob resource. Format: projects/{project}/locations/{location}/tuningJobs/{tuning_job}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskTuningJob

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/tuningJobs/[TUNING_JOB]";
// Make the request
TuningJob response = await genAiTuningServiceClient.GetTuningJobAsync(name);

GetTuningJobAsync(string, CancellationToken)

public virtual Task<TuningJob> GetTuningJobAsync(string name, CancellationToken cancellationToken)

Gets a TuningJob.

Parameters
Name Description
name string

Required. The name of the TuningJob resource. Format: projects/{project}/locations/{location}/tuningJobs/{tuning_job}

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskTuningJob

A Task containing the RPC response.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/tuningJobs/[TUNING_JOB]";
// Make the request
TuningJob response = await genAiTuningServiceClient.GetTuningJobAsync(name);

ListTuningJobs(LocationName, string, int?, CallSettings)

public virtual PagedEnumerable<ListTuningJobsResponse, TuningJob> ListTuningJobs(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists TuningJobs in a Location.

Parameters
Name Description
parent LocationName

Required. The resource name of the Location to list the TuningJobs from. Format: projects/{project}/locations/{location}

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListTuningJobsResponseTuningJob

A pageable sequence of TuningJob resources.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListTuningJobsResponse, TuningJob> response = genAiTuningServiceClient.ListTuningJobs(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (TuningJob item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListTuningJobsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (TuningJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<TuningJob> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (TuningJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListTuningJobs(ListTuningJobsRequest, CallSettings)

public virtual PagedEnumerable<ListTuningJobsResponse, TuningJob> ListTuningJobs(ListTuningJobsRequest request, CallSettings callSettings = null)

Lists TuningJobs in a Location.

Parameters
Name Description
request ListTuningJobsRequest

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
PagedEnumerableListTuningJobsResponseTuningJob

A pageable sequence of TuningJob resources.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
ListTuningJobsRequest request = new ListTuningJobsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
};
// Make the request
PagedEnumerable<ListTuningJobsResponse, TuningJob> response = genAiTuningServiceClient.ListTuningJobs(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (TuningJob item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListTuningJobsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (TuningJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<TuningJob> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (TuningJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListTuningJobs(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListTuningJobsResponse, TuningJob> ListTuningJobs(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists TuningJobs in a Location.

Parameters
Name Description
parent string

Required. The resource name of the Location to list the TuningJobs from. Format: projects/{project}/locations/{location}

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListTuningJobsResponseTuningJob

A pageable sequence of TuningJob resources.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListTuningJobsResponse, TuningJob> response = genAiTuningServiceClient.ListTuningJobs(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (TuningJob item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListTuningJobsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (TuningJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<TuningJob> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (TuningJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListTuningJobsAsync(LocationName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListTuningJobsResponse, TuningJob> ListTuningJobsAsync(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists TuningJobs in a Location.

Parameters
Name Description
parent LocationName

Required. The resource name of the Location to list the TuningJobs from. Format: projects/{project}/locations/{location}

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListTuningJobsResponseTuningJob

A pageable asynchronous sequence of TuningJob resources.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListTuningJobsResponse, TuningJob> response = genAiTuningServiceClient.ListTuningJobsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((TuningJob item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTuningJobsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (TuningJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<TuningJob> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (TuningJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListTuningJobsAsync(ListTuningJobsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListTuningJobsResponse, TuningJob> ListTuningJobsAsync(ListTuningJobsRequest request, CallSettings callSettings = null)

Lists TuningJobs in a Location.

Parameters
Name Description
request ListTuningJobsRequest

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
PagedAsyncEnumerableListTuningJobsResponseTuningJob

A pageable asynchronous sequence of TuningJob resources.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
ListTuningJobsRequest request = new ListTuningJobsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
};
// Make the request
PagedAsyncEnumerable<ListTuningJobsResponse, TuningJob> response = genAiTuningServiceClient.ListTuningJobsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((TuningJob item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTuningJobsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (TuningJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<TuningJob> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (TuningJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListTuningJobsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListTuningJobsResponse, TuningJob> ListTuningJobsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists TuningJobs in a Location.

Parameters
Name Description
parent string

Required. The resource name of the Location to list the TuningJobs from. Format: projects/{project}/locations/{location}

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListTuningJobsResponseTuningJob

A pageable asynchronous sequence of TuningJob resources.

Example
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListTuningJobsResponse, TuningJob> response = genAiTuningServiceClient.ListTuningJobsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((TuningJob item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTuningJobsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (TuningJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<TuningJob> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (TuningJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

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.