Skip to content

Commit

Permalink
feat: add TunedModelRef and RebaseTunedModel Api for Vertex GenAiTuni…
Browse files Browse the repository at this point in the history
…ngService

docs: limit comment `SupervisedTuningSpec` for 1p tuning

PiperOrigin-RevId: 676970579

Source-Link: googleapis/googleapis@30009c9

Source-Link: googleapis/googleapis-gen@6d9cc8d
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuQUlQbGF0Zm9ybS5WMUJldGExLy5Pd2xCb3QueWFtbCIsImgiOiI2ZDljYzhkNjBhZmY2NTFhNmM0OGZiMGE5NTFkZDhhODNlMDZhMjY3In0=

feat: A new field `response_logprbs` is added to message `.google.cloud.aiplatform.v1beta1.GenerationConfig`
feat: A new field `logprbs` is added to message `.google.cloud.aiplatform.v1beta1.GenerationConfig`
feat: A new field `logprobs_result` is added to message `.google.cloud.aiplatform.v1beta1.Candidate`
feat: A new field `model_version` is added to message `.google.cloud.aiplatform.v1beta1.GenerateContentResponse`

PiperOrigin-RevId: 676506886

Source-Link: googleapis/googleapis@e88eeaa

Source-Link: googleapis/googleapis-gen@35cac65
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuQUlQbGF0Zm9ybS5WMUJldGExLy5Pd2xCb3QueWFtbCIsImgiOiIzNWNhYzY1ODk1NGQ4ODE0OGEwNGVjMjY1YTJhODBmOWE4NGZhNDkwIn0=

feat: A new field `any_of` is added to message `.google.cloud.aiplatform.v1beta1.Schema`

PiperOrigin-RevId: 676461662

Source-Link: googleapis/googleapis@b86cd1c

Source-Link: googleapis/googleapis-gen@5c6bc1b
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuQUlQbGF0Zm9ybS5WMUJldGExLy5Pd2xCb3QueWFtbCIsImgiOiI1YzZiYzFiOWE2OTBlOWE4ZmI0NzMxYzI0YzA5MDFiNDNiYjAzYjlkIn0=
  • Loading branch information
gcf-owl-bot[bot] authored and amanda-tarafa committed Sep 25, 2024
1 parent 5afbc77 commit 7810c1b
Show file tree
Hide file tree
Showing 18 changed files with 3,719 additions and 484 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1beta1_generated_GenAiTuningService_RebaseTunedModel_async_flattened]
using Google.Cloud.AIPlatform.V1Beta1;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedGenAiTuningServiceClientSnippets
{
/// <summary>Snippet for RebaseTunedModelAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task RebaseTunedModelAsync()
{
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
TunedModelRef tunedModelRef = new TunedModelRef();
// Make the request
Operation<TuningJob, RebaseTunedModelOperationMetadata> response = await genAiTuningServiceClient.RebaseTunedModelAsync(parent, tunedModelRef);

// Poll until the returned long-running operation is complete
Operation<TuningJob, RebaseTunedModelOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
TuningJob 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<TuningJob, RebaseTunedModelOperationMetadata> retrievedResponse = await genAiTuningServiceClient.PollOnceRebaseTunedModelAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
TuningJob retrievedResult = retrievedResponse.Result;
}
}
}
// [END aiplatform_v1beta1_generated_GenAiTuningService_RebaseTunedModel_async_flattened]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1beta1_generated_GenAiTuningService_RebaseTunedModel_async]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.AIPlatform.V1Beta1;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedGenAiTuningServiceClientSnippets
{
/// <summary>Snippet for RebaseTunedModelAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task RebaseTunedModelRequestObjectAsync()
{
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
RebaseTunedModelRequest request = new RebaseTunedModelRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
TunedModelRef = new TunedModelRef(),
TuningJob = new TuningJob(),
ArtifactDestination = new GcsDestination(),
DeployToSameEndpoint = false,
};
// Make the request
Operation<TuningJob, RebaseTunedModelOperationMetadata> response = await genAiTuningServiceClient.RebaseTunedModelAsync(request);

// Poll until the returned long-running operation is complete
Operation<TuningJob, RebaseTunedModelOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
TuningJob 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<TuningJob, RebaseTunedModelOperationMetadata> retrievedResponse = await genAiTuningServiceClient.PollOnceRebaseTunedModelAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
TuningJob retrievedResult = retrievedResponse.Result;
}
}
}
// [END aiplatform_v1beta1_generated_GenAiTuningService_RebaseTunedModel_async]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1beta1_generated_GenAiTuningService_RebaseTunedModel_sync]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.AIPlatform.V1Beta1;
using Google.LongRunning;

public sealed partial class GeneratedGenAiTuningServiceClientSnippets
{
/// <summary>Snippet for RebaseTunedModel</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void RebaseTunedModelRequestObject()
{
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
RebaseTunedModelRequest request = new RebaseTunedModelRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
TunedModelRef = new TunedModelRef(),
TuningJob = new TuningJob(),
ArtifactDestination = new GcsDestination(),
DeployToSameEndpoint = false,
};
// Make the request
Operation<TuningJob, RebaseTunedModelOperationMetadata> response = genAiTuningServiceClient.RebaseTunedModel(request);

// Poll until the returned long-running operation is complete
Operation<TuningJob, RebaseTunedModelOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
TuningJob 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<TuningJob, RebaseTunedModelOperationMetadata> retrievedResponse = genAiTuningServiceClient.PollOnceRebaseTunedModel(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
TuningJob retrievedResult = retrievedResponse.Result;
}
}
}
// [END aiplatform_v1beta1_generated_GenAiTuningService_RebaseTunedModel_sync]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1beta1_generated_GenAiTuningService_RebaseTunedModel_async_flattened_resourceNames]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.AIPlatform.V1Beta1;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedGenAiTuningServiceClientSnippets
{
/// <summary>Snippet for RebaseTunedModelAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task RebaseTunedModelResourceNamesAsync()
{
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = await GenAiTuningServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
TunedModelRef tunedModelRef = new TunedModelRef();
// Make the request
Operation<TuningJob, RebaseTunedModelOperationMetadata> response = await genAiTuningServiceClient.RebaseTunedModelAsync(parent, tunedModelRef);

// Poll until the returned long-running operation is complete
Operation<TuningJob, RebaseTunedModelOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
TuningJob 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<TuningJob, RebaseTunedModelOperationMetadata> retrievedResponse = await genAiTuningServiceClient.PollOnceRebaseTunedModelAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
TuningJob retrievedResult = retrievedResponse.Result;
}
}
}
// [END aiplatform_v1beta1_generated_GenAiTuningService_RebaseTunedModel_async_flattened_resourceNames]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1beta1_generated_GenAiTuningService_RebaseTunedModel_sync_flattened_resourceNames]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.AIPlatform.V1Beta1;
using Google.LongRunning;

public sealed partial class GeneratedGenAiTuningServiceClientSnippets
{
/// <summary>Snippet for RebaseTunedModel</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void RebaseTunedModelResourceNames()
{
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
TunedModelRef tunedModelRef = new TunedModelRef();
// Make the request
Operation<TuningJob, RebaseTunedModelOperationMetadata> response = genAiTuningServiceClient.RebaseTunedModel(parent, tunedModelRef);

// Poll until the returned long-running operation is complete
Operation<TuningJob, RebaseTunedModelOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
TuningJob 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<TuningJob, RebaseTunedModelOperationMetadata> retrievedResponse = genAiTuningServiceClient.PollOnceRebaseTunedModel(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
TuningJob retrievedResult = retrievedResponse.Result;
}
}
}
// [END aiplatform_v1beta1_generated_GenAiTuningService_RebaseTunedModel_sync_flattened_resourceNames]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1beta1_generated_GenAiTuningService_RebaseTunedModel_sync_flattened]
using Google.Cloud.AIPlatform.V1Beta1;
using Google.LongRunning;

public sealed partial class GeneratedGenAiTuningServiceClientSnippets
{
/// <summary>Snippet for RebaseTunedModel</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void RebaseTunedModel()
{
// Create client
GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
TunedModelRef tunedModelRef = new TunedModelRef();
// Make the request
Operation<TuningJob, RebaseTunedModelOperationMetadata> response = genAiTuningServiceClient.RebaseTunedModel(parent, tunedModelRef);

// Poll until the returned long-running operation is complete
Operation<TuningJob, RebaseTunedModelOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
TuningJob 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<TuningJob, RebaseTunedModelOperationMetadata> retrievedResponse = genAiTuningServiceClient.PollOnceRebaseTunedModel(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
TuningJob retrievedResult = retrievedResponse.Result;
}
}
}
// [END aiplatform_v1beta1_generated_GenAiTuningService_RebaseTunedModel_sync_flattened]
}
Loading

0 comments on commit 7810c1b

Please sign in to comment.