Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

feat: release Model Services to v2beta version #333

Merged
merged 2 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/retail_v2beta/model_service.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ModelService
------------------------------

.. automodule:: google.cloud.retail_v2beta.services.model_service
:members:
:inherited-members:

.. automodule:: google.cloud.retail_v2beta.services.model_service.pagers
:members:
:inherited-members:
1 change: 1 addition & 0 deletions docs/retail_v2beta/services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Services for Google Cloud Retail v2beta API
catalog_service
completion_service
control_service
model_service
prediction_service
product_service
search_service
Expand Down
33 changes: 33 additions & 0 deletions google/cloud/retail_v2beta/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
CompletionServiceClient,
)
from .services.control_service import ControlServiceAsyncClient, ControlServiceClient
from .services.model_service import ModelServiceAsyncClient, ModelServiceClient
from .services.prediction_service import (
PredictionServiceAsyncClient,
PredictionServiceClient,
Expand All @@ -45,6 +46,8 @@
)
from .types.catalog_service import (
AddCatalogAttributeRequest,
BatchRemoveCatalogAttributesRequest,
BatchRemoveCatalogAttributesResponse,
GetAttributesConfigRequest,
GetCompletionConfigRequest,
GetDefaultBranchRequest,
Expand Down Expand Up @@ -112,6 +115,20 @@
UserEventInlineSource,
UserEventInputConfig,
)
from .types.model import Model
from .types.model_service import (
CreateModelMetadata,
CreateModelRequest,
DeleteModelRequest,
ListModelsRequest,
ListModelsResponse,
PauseModelRequest,
ResumeModelRequest,
TuneModelMetadata,
TuneModelRequest,
TuneModelResponse,
UpdateModelRequest,
)
from .types.prediction_service import PredictRequest, PredictResponse
from .types.product import Product
from .types.product_service import (
Expand Down Expand Up @@ -173,6 +190,7 @@
"CatalogServiceAsyncClient",
"CompletionServiceAsyncClient",
"ControlServiceAsyncClient",
"ModelServiceAsyncClient",
"PredictionServiceAsyncClient",
"ProductServiceAsyncClient",
"SearchServiceAsyncClient",
Expand All @@ -189,6 +207,8 @@
"AttributeConfigLevel",
"AttributesConfig",
"Audience",
"BatchRemoveCatalogAttributesRequest",
"BatchRemoveCatalogAttributesResponse",
"BigQueryOutputResult",
"BigQuerySource",
"Catalog",
Expand All @@ -206,10 +226,13 @@
"Control",
"ControlServiceClient",
"CreateControlRequest",
"CreateModelMetadata",
"CreateModelRequest",
"CreateProductRequest",
"CreateServingConfigRequest",
"CustomAttribute",
"DeleteControlRequest",
"DeleteModelRequest",
"DeleteProductRequest",
"DeleteServingConfigRequest",
"ExportErrorsConfig",
Expand Down Expand Up @@ -239,14 +262,19 @@
"ListCatalogsResponse",
"ListControlsRequest",
"ListControlsResponse",
"ListModelsRequest",
"ListModelsResponse",
"ListProductsRequest",
"ListProductsResponse",
"ListServingConfigsRequest",
"ListServingConfigsResponse",
"LocalInventory",
"MerchantCenterLink",
"MerchantCenterLinkingConfig",
"Model",
"ModelServiceClient",
"OutputResult",
"PauseModelRequest",
"PredictRequest",
"PredictResponse",
"PredictionServiceClient",
Expand Down Expand Up @@ -276,6 +304,7 @@
"RemoveLocalInventoriesRequest",
"RemoveLocalInventoriesResponse",
"ReplaceCatalogAttributeRequest",
"ResumeModelRequest",
"Rule",
"SearchRequest",
"SearchResponse",
Expand All @@ -288,10 +317,14 @@
"SetInventoryRequest",
"SetInventoryResponse",
"SolutionType",
"TuneModelMetadata",
"TuneModelRequest",
"TuneModelResponse",
"UpdateAttributesConfigRequest",
"UpdateCatalogRequest",
"UpdateCompletionConfigRequest",
"UpdateControlRequest",
"UpdateModelRequest",
"UpdateProductRequest",
"UpdateServingConfigRequest",
"UserEvent",
Expand Down
94 changes: 94 additions & 0 deletions google/cloud/retail_v2beta/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"add_catalog_attribute"
]
},
"BatchRemoveCatalogAttributes": {
"methods": [
"batch_remove_catalog_attributes"
]
},
"GetAttributesConfig": {
"methods": [
"get_attributes_config"
Expand Down Expand Up @@ -75,6 +80,11 @@
"add_catalog_attribute"
]
},
"BatchRemoveCatalogAttributes": {
"methods": [
"batch_remove_catalog_attributes"
]
},
"GetAttributesConfig": {
"methods": [
"get_attributes_config"
Expand Down Expand Up @@ -227,6 +237,90 @@
}
}
},
"ModelService": {
"clients": {
"grpc": {
"libraryClient": "ModelServiceClient",
"rpcs": {
"CreateModel": {
"methods": [
"create_model"
]
},
"DeleteModel": {
"methods": [
"delete_model"
]
},
"ListModels": {
"methods": [
"list_models"
]
},
"PauseModel": {
"methods": [
"pause_model"
]
},
"ResumeModel": {
"methods": [
"resume_model"
]
},
"TuneModel": {
"methods": [
"tune_model"
]
},
"UpdateModel": {
"methods": [
"update_model"
]
}
}
},
"grpc-async": {
"libraryClient": "ModelServiceAsyncClient",
"rpcs": {
"CreateModel": {
"methods": [
"create_model"
]
},
"DeleteModel": {
"methods": [
"delete_model"
]
},
"ListModels": {
"methods": [
"list_models"
]
},
"PauseModel": {
"methods": [
"pause_model"
]
},
"ResumeModel": {
"methods": [
"resume_model"
]
},
"TuneModel": {
"methods": [
"tune_model"
]
},
"UpdateModel": {
"methods": [
"update_model"
]
}
}
}
}
},
"PredictionService": {
"clients": {
"grpc": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ async def sample_get_completion_config():
method.
name (:class:`str`):
Required. Full CompletionConfig resource name. Format:
projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig
``projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig``

This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -1282,6 +1282,88 @@ async def sample_remove_catalog_attribute():
# Done; return the response.
return response

async def batch_remove_catalog_attributes(
self,
request: Union[
catalog_service.BatchRemoveCatalogAttributesRequest, dict
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> catalog_service.BatchRemoveCatalogAttributesResponse:
r"""Removes all specified
[CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute]s
from the
[AttributesConfig][google.cloud.retail.v2beta.AttributesConfig].

.. code-block:: python

from google.cloud import retail_v2beta

async def sample_batch_remove_catalog_attributes():
# Create a client
client = retail_v2beta.CatalogServiceAsyncClient()

# Initialize request argument(s)
request = retail_v2beta.BatchRemoveCatalogAttributesRequest(
attributes_config="attributes_config_value",
attribute_keys=['attribute_keys_value_1', 'attribute_keys_value_2'],
)

# Make the request
response = await client.batch_remove_catalog_attributes(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.retail_v2beta.types.BatchRemoveCatalogAttributesRequest, dict]):
The request object. Request for
[CatalogService.BatchRemoveCatalogAttributes][google.cloud.retail.v2beta.CatalogService.BatchRemoveCatalogAttributes]
method.
retry (google.api_core.retry.Retry): 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.cloud.retail_v2beta.types.BatchRemoveCatalogAttributesResponse:
Response of the
[CatalogService.BatchRemoveCatalogAttributes][google.cloud.retail.v2beta.CatalogService.BatchRemoveCatalogAttributes].

"""
# Create or coerce a protobuf request object.
request = catalog_service.BatchRemoveCatalogAttributesRequest(request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.batch_remove_catalog_attributes,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

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

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

# Done; return the response.
return response

async def replace_catalog_attribute(
self,
request: Union[catalog_service.ReplaceCatalogAttributeRequest, dict] = None,
Expand Down
Loading