Skip to content

Commit 67358fa

Browse files
gcf-owl-bot[bot]copybara-github
authored andcommitted
feat: add a new thought field in content proto
feat: add Model Garden deploy API docs: A comment for field `labels` in message `.google.cloud.aiplatform.v1beta1.PublisherModel` is changed COPYBARA_INTEGRATE_REVIEW=#4795 from googleapis:owl-bot-copy cb74124 PiperOrigin-RevId: 711486245
1 parent 1eb493b commit 67358fa

22 files changed

+6681
-286
lines changed

google/cloud/aiplatform_v1beta1/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,9 @@
741741
)
742742
from .types.model_evaluation import ModelEvaluation
743743
from .types.model_evaluation_slice import ModelEvaluationSlice
744+
from .types.model_garden_service import DeployPublisherModelOperationMetadata
745+
from .types.model_garden_service import DeployPublisherModelRequest
746+
from .types.model_garden_service import DeployPublisherModelResponse
744747
from .types.model_garden_service import GetPublisherModelRequest
745748
from .types.model_garden_service import ListPublisherModelsRequest
746749
from .types.model_garden_service import ListPublisherModelsResponse
@@ -1411,6 +1414,9 @@
14111414
"DeployModelOperationMetadata",
14121415
"DeployModelRequest",
14131416
"DeployModelResponse",
1417+
"DeployPublisherModelOperationMetadata",
1418+
"DeployPublisherModelRequest",
1419+
"DeployPublisherModelResponse",
14141420
"DeployedIndex",
14151421
"DeployedIndexAuthConfig",
14161422
"DeployedIndexRef",

google/cloud/aiplatform_v1beta1/gapic_metadata.json

+15
Original file line numberDiff line numberDiff line change
@@ -3345,6 +3345,11 @@
33453345
"grpc": {
33463346
"libraryClient": "ModelGardenServiceClient",
33473347
"rpcs": {
3348+
"DeployPublisherModel": {
3349+
"methods": [
3350+
"deploy_publisher_model"
3351+
]
3352+
},
33483353
"GetPublisherModel": {
33493354
"methods": [
33503355
"get_publisher_model"
@@ -3360,6 +3365,11 @@
33603365
"grpc-async": {
33613366
"libraryClient": "ModelGardenServiceAsyncClient",
33623367
"rpcs": {
3368+
"DeployPublisherModel": {
3369+
"methods": [
3370+
"deploy_publisher_model"
3371+
]
3372+
},
33633373
"GetPublisherModel": {
33643374
"methods": [
33653375
"get_publisher_model"
@@ -3375,6 +3385,11 @@
33753385
"rest": {
33763386
"libraryClient": "ModelGardenServiceClient",
33773387
"rpcs": {
3388+
"DeployPublisherModel": {
3389+
"methods": [
3390+
"deploy_publisher_model"
3391+
]
3392+
},
33783393
"GetPublisherModel": {
33793394
"methods": [
33803395
"get_publisher_model"

google/cloud/aiplatform_v1beta1/services/migration_service/client.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -240,18 +240,23 @@ def parse_annotated_dataset_path(path: str) -> Dict[str, str]:
240240
@staticmethod
241241
def dataset_path(
242242
project: str,
243+
location: str,
243244
dataset: str,
244245
) -> str:
245246
"""Returns a fully-qualified dataset string."""
246-
return "projects/{project}/datasets/{dataset}".format(
247+
return "projects/{project}/locations/{location}/datasets/{dataset}".format(
247248
project=project,
249+
location=location,
248250
dataset=dataset,
249251
)
250252

251253
@staticmethod
252254
def parse_dataset_path(path: str) -> Dict[str, str]:
253255
"""Parses a dataset path into its component segments."""
254-
m = re.match(r"^projects/(?P<project>.+?)/datasets/(?P<dataset>.+?)$", path)
256+
m = re.match(
257+
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/datasets/(?P<dataset>.+?)$",
258+
path,
259+
)
255260
return m.groupdict() if m else {}
256261

257262
@staticmethod
@@ -279,23 +284,18 @@ def parse_dataset_path(path: str) -> Dict[str, str]:
279284
@staticmethod
280285
def dataset_path(
281286
project: str,
282-
location: str,
283287
dataset: str,
284288
) -> str:
285289
"""Returns a fully-qualified dataset string."""
286-
return "projects/{project}/locations/{location}/datasets/{dataset}".format(
290+
return "projects/{project}/datasets/{dataset}".format(
287291
project=project,
288-
location=location,
289292
dataset=dataset,
290293
)
291294

292295
@staticmethod
293296
def parse_dataset_path(path: str) -> Dict[str, str]:
294297
"""Parses a dataset path into its component segments."""
295-
m = re.match(
296-
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/datasets/(?P<dataset>.+?)$",
297-
path,
298-
)
298+
m = re.match(r"^projects/(?P<project>.+?)/datasets/(?P<dataset>.+?)$", path)
299299
return m.groupdict() if m else {}
300300

301301
@staticmethod

google/cloud/aiplatform_v1beta1/services/model_garden_service/async_client.py

+111
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
except AttributeError: # pragma: NO COVER
4545
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
4646

47+
from google.api_core import operation # type: ignore
48+
from google.api_core import operation_async # type: ignore
4749
from google.cloud.aiplatform_v1beta1.services.model_garden_service import pagers
4850
from google.cloud.aiplatform_v1beta1.types import model
4951
from google.cloud.aiplatform_v1beta1.types import model_garden_service
@@ -78,6 +80,10 @@ class ModelGardenServiceAsyncClient:
7880
_DEFAULT_ENDPOINT_TEMPLATE = ModelGardenServiceClient._DEFAULT_ENDPOINT_TEMPLATE
7981
_DEFAULT_UNIVERSE = ModelGardenServiceClient._DEFAULT_UNIVERSE
8082

83+
endpoint_path = staticmethod(ModelGardenServiceClient.endpoint_path)
84+
parse_endpoint_path = staticmethod(ModelGardenServiceClient.parse_endpoint_path)
85+
model_path = staticmethod(ModelGardenServiceClient.model_path)
86+
parse_model_path = staticmethod(ModelGardenServiceClient.parse_model_path)
8187
publisher_model_path = staticmethod(ModelGardenServiceClient.publisher_model_path)
8288
parse_publisher_model_path = staticmethod(
8389
ModelGardenServiceClient.parse_publisher_model_path
@@ -536,6 +542,111 @@ async def sample_list_publisher_models():
536542
# Done; return the response.
537543
return response
538544

545+
async def deploy_publisher_model(
546+
self,
547+
request: Optional[
548+
Union[model_garden_service.DeployPublisherModelRequest, dict]
549+
] = None,
550+
*,
551+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
552+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
553+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
554+
) -> operation_async.AsyncOperation:
555+
r"""Deploys publisher models.
556+
557+
.. code-block:: python
558+
559+
# This snippet has been automatically generated and should be regarded as a
560+
# code template only.
561+
# It will require modifications to work:
562+
# - It may require correct/in-range values for request initialization.
563+
# - It may require specifying regional endpoints when creating the service
564+
# client as shown in:
565+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
566+
from google.cloud import aiplatform_v1beta1
567+
568+
async def sample_deploy_publisher_model():
569+
# Create a client
570+
client = aiplatform_v1beta1.ModelGardenServiceAsyncClient()
571+
572+
# Initialize request argument(s)
573+
request = aiplatform_v1beta1.DeployPublisherModelRequest(
574+
model="model_value",
575+
destination="destination_value",
576+
)
577+
578+
# Make the request
579+
operation = client.deploy_publisher_model(request=request)
580+
581+
print("Waiting for operation to complete...")
582+
583+
response = (await operation).result()
584+
585+
# Handle the response
586+
print(response)
587+
588+
Args:
589+
request (Optional[Union[google.cloud.aiplatform_v1beta1.types.DeployPublisherModelRequest, dict]]):
590+
The request object. Request message for
591+
[ModelGardenService.DeployPublisherModel][google.cloud.aiplatform.v1beta1.ModelGardenService.DeployPublisherModel].
592+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
593+
should be retried.
594+
timeout (float): The timeout for this request.
595+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
596+
sent along with the request as metadata. Normally, each value must be of type `str`,
597+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
598+
be of type `bytes`.
599+
600+
Returns:
601+
google.api_core.operation_async.AsyncOperation:
602+
An object representing a long-running operation.
603+
604+
The result type for the operation will be :class:`google.cloud.aiplatform_v1beta1.types.DeployPublisherModelResponse` Response message for
605+
[ModelGardenService.DeployPublisherModel][google.cloud.aiplatform.v1beta1.ModelGardenService.DeployPublisherModel].
606+
607+
"""
608+
# Create or coerce a protobuf request object.
609+
# - Use the request object if provided (there's no risk of modifying the input as
610+
# there are no flattened fields), or create one.
611+
if not isinstance(request, model_garden_service.DeployPublisherModelRequest):
612+
request = model_garden_service.DeployPublisherModelRequest(request)
613+
614+
# Wrap the RPC method; this adds retry and timeout information,
615+
# and friendly error handling.
616+
rpc = self._client._transport._wrapped_methods[
617+
self._client._transport.deploy_publisher_model
618+
]
619+
620+
# Certain fields should be provided within the metadata header;
621+
# add these here.
622+
metadata = tuple(metadata) + (
623+
gapic_v1.routing_header.to_grpc_metadata(
624+
(("destination", request.destination),)
625+
),
626+
)
627+
628+
# Validate the universe domain.
629+
self._client._validate_universe_domain()
630+
631+
# Send the request.
632+
response = await rpc(
633+
request,
634+
retry=retry,
635+
timeout=timeout,
636+
metadata=metadata,
637+
)
638+
639+
# Wrap the response in an operation future.
640+
response = operation_async.from_gapic(
641+
response,
642+
self._client._transport.operations_client,
643+
model_garden_service.DeployPublisherModelResponse,
644+
metadata_type=model_garden_service.DeployPublisherModelOperationMetadata,
645+
)
646+
647+
# Done; return the response.
648+
return response
649+
539650
async def list_operations(
540651
self,
541652
request: Optional[operations_pb2.ListOperationsRequest] = None,

0 commit comments

Comments
 (0)