Skip to content

Commit

Permalink
chore: Copybara Merge: #4441
Browse files Browse the repository at this point in the history
Copybara import of the project:

--
575acc3 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>:

feat: add new `PscInterfaceConfig` field to `pipeline_job.proto`

PiperOrigin-RevId: 680823763

Source-Link: googleapis/googleapis@8f00dab

Source-Link: googleapis/googleapis-gen@e58485b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTU4NDg1YjY3MDU1MGI2Yjc4MzUxZWRlNDk2YWQzY2VkMTUwOTUzNCJ9

feat: add psc_automation_configs to DeployIndex v1

PiperOrigin-RevId: 680742448

Source-Link: googleapis/googleapis@ce31830

Source-Link: googleapis/googleapis-gen@5254135
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTI1NDEzNWNkOTA4OWYzNWM5ZjUzN2FiYTU2N2RkMjlhY2NlNTQxMyJ9

feat: add a dynamic retrieval API

PiperOrigin-RevId: 680475495

Source-Link: googleapis/googleapis@a6a6956

Source-Link: googleapis/googleapis-gen@c9ef9e0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzllZjllMDBmOTBhZTJjNTc0ZjgwMGI2NjZmZTc0ODYyMjBiOWJmMiJ9

fix: annotate PipelineJob and PipelineTaskRerunConfig fields as optional

PiperOrigin-RevId: 679707420

Source-Link: googleapis/googleapis@d6f1848

Source-Link: googleapis/googleapis-gen@f6c16c2
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjZjMTZjMjAwMGIwZGYxNTgxZGFmMjNlNjU1ZjNmYTRlMzNkZmY5OSJ9

feat: add TunedModelRef and RebaseTunedModel Api for Vertex GenAiTuningService
docs: limit comment `SupervisedTuningSpec` for 1p tuning

PiperOrigin-RevId: 676970579

Source-Link: googleapis/googleapis@30009c9

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

feat: add TunedModelRef and RebaseTunedModel Api for Vertex GenAiTuningService
docs: limit comment `SupervisedTuningSpec` for 1p tuning

PiperOrigin-RevId: 676969679

Source-Link: googleapis/googleapis@2a98f79

Source-Link: googleapis/googleapis-gen@eb6e7f5
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWI2ZTdmNTk1YTg2YjM4NWYxZjQ1OTNlNDNjYmUxMDE1YzI5ZWY3OSJ9

--
73b1e23 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>:

🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

--
07b715e by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>:

feat: add enable_secure_private_service_connect in service attachment

PiperOrigin-RevId: 681172589

Source-Link: googleapis/googleapis@16a1580

Source-Link: googleapis/googleapis-gen@87fb5dc
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODdmYjVkYzczOGFkZmE1ZDMxM2E1ODM2ODFlNDc2ZTM0NzBkNjllNSJ9

--
09d0085 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>:

🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

COPYBARA_INTEGRATE_REVIEW=#4441 from googleapis:owl-bot-copy 2fd38f0
PiperOrigin-RevId: 682002210
  • Loading branch information
gcf-owl-bot[bot] authored and copybara-github committed Oct 3, 2024
1 parent 2565a33 commit 44df243
Show file tree
Hide file tree
Showing 49 changed files with 8,867 additions and 1,106 deletions.
8 changes: 8 additions & 0 deletions google/cloud/aiplatform_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@
from .types.genai_tuning_service import GetTuningJobRequest
from .types.genai_tuning_service import ListTuningJobsRequest
from .types.genai_tuning_service import ListTuningJobsResponse
from .types.genai_tuning_service import RebaseTunedModelOperationMetadata
from .types.genai_tuning_service import RebaseTunedModelRequest
from .types.hyperparameter_tuning_job import HyperparameterTuningJob
from .types.index import Index
from .types.index import IndexDatapoint
Expand Down Expand Up @@ -789,6 +791,7 @@
from .types.schedule_service import UpdateScheduleRequest
from .types.service_networking import PrivateServiceConnectConfig
from .types.service_networking import PscAutomatedEndpoints
from .types.service_networking import PSCAutomationConfig
from .types.specialist_pool import SpecialistPool
from .types.specialist_pool_service import CreateSpecialistPoolOperationMetadata
from .types.specialist_pool_service import CreateSpecialistPoolRequest
Expand Down Expand Up @@ -881,6 +884,7 @@
from .types.tuning_job import SupervisedTuningDataStats
from .types.tuning_job import SupervisedTuningSpec
from .types.tuning_job import TunedModel
from .types.tuning_job import TunedModelRef
from .types.tuning_job import TuningDataStats
from .types.tuning_job import TuningJob
from .types.types import BoolArray
Expand Down Expand Up @@ -1481,6 +1485,7 @@
"NotebookRuntimeTemplateRef",
"NotebookRuntimeType",
"NotebookServiceClient",
"PSCAutomationConfig",
"PairwiseChoice",
"PairwiseMetricInput",
"PairwiseMetricInstance",
Expand Down Expand Up @@ -1573,6 +1578,8 @@
"ReadTensorboardTimeSeriesDataResponse",
"ReadTensorboardUsageRequest",
"ReadTensorboardUsageResponse",
"RebaseTunedModelOperationMetadata",
"RebaseTunedModelRequest",
"RebootPersistentResourceOperationMetadata",
"RebootPersistentResourceRequest",
"RemoveContextChildrenRequest",
Expand Down Expand Up @@ -1710,6 +1717,7 @@
"Trial",
"TrialContext",
"TunedModel",
"TunedModelRef",
"TuningDataStats",
"TuningJob",
"Type",
Expand Down
15 changes: 15 additions & 0 deletions google/cloud/aiplatform_v1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,11 @@
"methods": [
"list_tuning_jobs"
]
},
"RebaseTunedModel": {
"methods": [
"rebase_tuned_model"
]
}
}
},
Expand All @@ -1470,6 +1475,11 @@
"methods": [
"list_tuning_jobs"
]
},
"RebaseTunedModel": {
"methods": [
"rebase_tuned_model"
]
}
}
},
Expand All @@ -1495,6 +1505,11 @@
"methods": [
"list_tuning_jobs"
]
},
"RebaseTunedModel": {
"methods": [
"rebase_tuned_model"
]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore

from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.aiplatform_v1.services.gen_ai_tuning_service import pagers
from google.cloud.aiplatform_v1.types import encryption_spec
from google.cloud.aiplatform_v1.types import genai_tuning_service
Expand Down Expand Up @@ -78,6 +80,10 @@ class GenAiTuningServiceAsyncClient:
parse_endpoint_path = staticmethod(GenAiTuningServiceClient.parse_endpoint_path)
model_path = staticmethod(GenAiTuningServiceClient.model_path)
parse_model_path = staticmethod(GenAiTuningServiceClient.parse_model_path)
pipeline_job_path = staticmethod(GenAiTuningServiceClient.pipeline_job_path)
parse_pipeline_job_path = staticmethod(
GenAiTuningServiceClient.parse_pipeline_job_path
)
tuning_job_path = staticmethod(GenAiTuningServiceClient.tuning_job_path)
parse_tuning_job_path = staticmethod(GenAiTuningServiceClient.parse_tuning_job_path)
common_billing_account_path = staticmethod(
Expand Down Expand Up @@ -735,6 +741,148 @@ async def sample_cancel_tuning_job():
metadata=metadata,
)

async def rebase_tuned_model(
self,
request: Optional[
Union[genai_tuning_service.RebaseTunedModelRequest, dict]
] = None,
*,
parent: Optional[str] = None,
tuned_model_ref: Optional[tuning_job.TunedModelRef] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Rebase a TunedModel.
Creates a LongRunningOperation that takes a legacy Tuned
GenAI model Reference and creates a TuningJob based on
newly available model.
.. code-block:: python
# 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://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import aiplatform_v1
async def sample_rebase_tuned_model():
# Create a client
client = aiplatform_v1.GenAiTuningServiceAsyncClient()
# Initialize request argument(s)
tuned_model_ref = aiplatform_v1.TunedModelRef()
tuned_model_ref.tuned_model = "tuned_model_value"
request = aiplatform_v1.RebaseTunedModelRequest(
parent="parent_value",
tuned_model_ref=tuned_model_ref,
)
# Make the request
operation = client.rebase_tuned_model(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Args:
request (Optional[Union[google.cloud.aiplatform_v1.types.RebaseTunedModelRequest, dict]]):
The request object. Request message for
[GenAiTuningService.RebaseTunedModel][google.cloud.aiplatform.v1.GenAiTuningService.RebaseTunedModel].
parent (:class:`str`):
Required. The resource name of the Location into which
to rebase the Model. Format:
``projects/{project}/locations/{location}``
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
tuned_model_ref (:class:`google.cloud.aiplatform_v1.types.TunedModelRef`):
Required. TunedModel reference to
retrieve the legacy model information.
This corresponds to the ``tuned_model_ref`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.
The result type for the operation will be
:class:`google.cloud.aiplatform_v1.types.TuningJob`
Represents a TuningJob that runs with Google owned
models.
"""
# Create or coerce a protobuf request object.
# - Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent, tuned_model_ref])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# - Use the request object if provided (there's no risk of modifying the input as
# there are no flattened fields), or create one.
if not isinstance(request, genai_tuning_service.RebaseTunedModelRequest):
request = genai_tuning_service.RebaseTunedModelRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if tuned_model_ref is not None:
request.tuned_model_ref = tuned_model_ref

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.rebase_tuned_model
]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Wrap the response in an operation future.
response = operation_async.from_gapic(
response,
self._client._transport.operations_client,
tuning_job.TuningJob,
metadata_type=genai_tuning_service.RebaseTunedModelOperationMetadata,
)

# Done; return the response.
return response

async def list_operations(
self,
request: Optional[operations_pb2.ListOperationsRequest] = None,
Expand Down
Loading

0 comments on commit 44df243

Please sign in to comment.