-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new model service to manage recommendation models (#304)
- [ ] Regenerate this pull request now. feat: support case insensitive match on search facets feat: allow disabling spell check in search requests feat: allow adding labels in search requests feat: allow returning min/max values on search numeric facets feat: allow using serving configs as an alias of placements feat: allow enabling recommendation filtering on custom attributes feat: return output BigQuery table on product / event export response feat: allow skiping default branch protection when doing product full import docs: keep the API doc up-to-date with recent changes PiperOrigin-RevId: 464664497 Source-Link: googleapis/googleapis@c30c9cc Source-Link: googleapis/googleapis-gen@a7fe8d6 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTdmZThkNjcyYjhjYmJhZGM1YWIzMjI1M2RlYTUwZTRjM2Q4ZTM5MCJ9 feat: support case insensitive match on search facets feat: allow to return min/max values on search numeric facets feat: allow to use serving configs as an alias of placements docs: keep the API doc up-to-date with recent changes PiperOrigin-RevId: 464560246 Source-Link: googleapis/googleapis@139f56e Source-Link: googleapis/googleapis-gen@eca9b7e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWNhOWI3ZWNiZGMyYzY0YzJkMGVjMmU2Njg4ZjYzNTNhZmYxNjJlZiJ9
- Loading branch information
1 parent
778bc16
commit 2815676
Showing
15 changed files
with
1,815 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
...ed_samples/generated_samples/retail_v2alpha_generated_model_service_create_model_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2022 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 | ||
# | ||
# http://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! | ||
# | ||
# Snippet for CreateModel | ||
# NOTE: This snippet has been automatically generated for illustrative purposes only. | ||
# It may require modifications to work in your environment. | ||
|
||
# To install the latest published package dependency, execute the following: | ||
# python3 -m pip install google-cloud-retail | ||
|
||
|
||
# [START retail_v2alpha_generated_ModelService_CreateModel_async] | ||
from google.cloud import retail_v2alpha | ||
|
||
|
||
async def sample_create_model(): | ||
# Create a client | ||
client = retail_v2alpha.ModelServiceAsyncClient() | ||
|
||
# Initialize request argument(s) | ||
model = retail_v2alpha.Model() | ||
model.page_optimization_config.page_optimization_event_type = "page_optimization_event_type_value" | ||
model.page_optimization_config.panels.candidates.serving_config_id = "serving_config_id_value" | ||
model.page_optimization_config.panels.default_candidate.serving_config_id = "serving_config_id_value" | ||
model.name = "name_value" | ||
model.display_name = "display_name_value" | ||
model.type_ = "type__value" | ||
|
||
request = retail_v2alpha.CreateModelRequest( | ||
parent="parent_value", | ||
model=model, | ||
) | ||
|
||
# Make the request | ||
operation = client.create_model(request=request) | ||
|
||
print("Waiting for operation to complete...") | ||
|
||
response = await operation.result() | ||
|
||
# Handle the response | ||
print(response) | ||
|
||
# [END retail_v2alpha_generated_ModelService_CreateModel_async] |
58 changes: 58 additions & 0 deletions
58
...ted_samples/generated_samples/retail_v2alpha_generated_model_service_create_model_sync.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2022 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 | ||
# | ||
# http://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! | ||
# | ||
# Snippet for CreateModel | ||
# NOTE: This snippet has been automatically generated for illustrative purposes only. | ||
# It may require modifications to work in your environment. | ||
|
||
# To install the latest published package dependency, execute the following: | ||
# python3 -m pip install google-cloud-retail | ||
|
||
|
||
# [START retail_v2alpha_generated_ModelService_CreateModel_sync] | ||
from google.cloud import retail_v2alpha | ||
|
||
|
||
def sample_create_model(): | ||
# Create a client | ||
client = retail_v2alpha.ModelServiceClient() | ||
|
||
# Initialize request argument(s) | ||
model = retail_v2alpha.Model() | ||
model.page_optimization_config.page_optimization_event_type = "page_optimization_event_type_value" | ||
model.page_optimization_config.panels.candidates.serving_config_id = "serving_config_id_value" | ||
model.page_optimization_config.panels.default_candidate.serving_config_id = "serving_config_id_value" | ||
model.name = "name_value" | ||
model.display_name = "display_name_value" | ||
model.type_ = "type__value" | ||
|
||
request = retail_v2alpha.CreateModelRequest( | ||
parent="parent_value", | ||
model=model, | ||
) | ||
|
||
# Make the request | ||
operation = client.create_model(request=request) | ||
|
||
print("Waiting for operation to complete...") | ||
|
||
response = operation.result() | ||
|
||
# Handle the response | ||
print(response) | ||
|
||
# [END retail_v2alpha_generated_ModelService_CreateModel_sync] |
43 changes: 43 additions & 0 deletions
43
...ed_samples/generated_samples/retail_v2alpha_generated_model_service_delete_model_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2022 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 | ||
# | ||
# http://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! | ||
# | ||
# Snippet for DeleteModel | ||
# NOTE: This snippet has been automatically generated for illustrative purposes only. | ||
# It may require modifications to work in your environment. | ||
|
||
# To install the latest published package dependency, execute the following: | ||
# python3 -m pip install google-cloud-retail | ||
|
||
|
||
# [START retail_v2alpha_generated_ModelService_DeleteModel_async] | ||
from google.cloud import retail_v2alpha | ||
|
||
|
||
async def sample_delete_model(): | ||
# Create a client | ||
client = retail_v2alpha.ModelServiceAsyncClient() | ||
|
||
# Initialize request argument(s) | ||
request = retail_v2alpha.DeleteModelRequest( | ||
name="name_value", | ||
) | ||
|
||
# Make the request | ||
await client.delete_model(request=request) | ||
|
||
|
||
# [END retail_v2alpha_generated_ModelService_DeleteModel_async] |
43 changes: 43 additions & 0 deletions
43
...ted_samples/generated_samples/retail_v2alpha_generated_model_service_delete_model_sync.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2022 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 | ||
# | ||
# http://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! | ||
# | ||
# Snippet for DeleteModel | ||
# NOTE: This snippet has been automatically generated for illustrative purposes only. | ||
# It may require modifications to work in your environment. | ||
|
||
# To install the latest published package dependency, execute the following: | ||
# python3 -m pip install google-cloud-retail | ||
|
||
|
||
# [START retail_v2alpha_generated_ModelService_DeleteModel_sync] | ||
from google.cloud import retail_v2alpha | ||
|
||
|
||
def sample_delete_model(): | ||
# Create a client | ||
client = retail_v2alpha.ModelServiceClient() | ||
|
||
# Initialize request argument(s) | ||
request = retail_v2alpha.DeleteModelRequest( | ||
name="name_value", | ||
) | ||
|
||
# Make the request | ||
client.delete_model(request=request) | ||
|
||
|
||
# [END retail_v2alpha_generated_ModelService_DeleteModel_sync] |
46 changes: 46 additions & 0 deletions
46
...ted_samples/generated_samples/retail_v2alpha_generated_model_service_list_models_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2022 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 | ||
# | ||
# http://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! | ||
# | ||
# Snippet for ListModels | ||
# NOTE: This snippet has been automatically generated for illustrative purposes only. | ||
# It may require modifications to work in your environment. | ||
|
||
# To install the latest published package dependency, execute the following: | ||
# python3 -m pip install google-cloud-retail | ||
|
||
|
||
# [START retail_v2alpha_generated_ModelService_ListModels_async] | ||
from google.cloud import retail_v2alpha | ||
|
||
|
||
async def sample_list_models(): | ||
# Create a client | ||
client = retail_v2alpha.ModelServiceAsyncClient() | ||
|
||
# Initialize request argument(s) | ||
request = retail_v2alpha.ListModelsRequest( | ||
parent="parent_value", | ||
) | ||
|
||
# Make the request | ||
page_result = client.list_models(request=request) | ||
|
||
# Handle the response | ||
async for response in page_result: | ||
print(response) | ||
|
||
# [END retail_v2alpha_generated_ModelService_ListModels_async] |
46 changes: 46 additions & 0 deletions
46
...ated_samples/generated_samples/retail_v2alpha_generated_model_service_list_models_sync.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2022 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 | ||
# | ||
# http://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! | ||
# | ||
# Snippet for ListModels | ||
# NOTE: This snippet has been automatically generated for illustrative purposes only. | ||
# It may require modifications to work in your environment. | ||
|
||
# To install the latest published package dependency, execute the following: | ||
# python3 -m pip install google-cloud-retail | ||
|
||
|
||
# [START retail_v2alpha_generated_ModelService_ListModels_sync] | ||
from google.cloud import retail_v2alpha | ||
|
||
|
||
def sample_list_models(): | ||
# Create a client | ||
client = retail_v2alpha.ModelServiceClient() | ||
|
||
# Initialize request argument(s) | ||
request = retail_v2alpha.ListModelsRequest( | ||
parent="parent_value", | ||
) | ||
|
||
# Make the request | ||
page_result = client.list_models(request=request) | ||
|
||
# Handle the response | ||
for response in page_result: | ||
print(response) | ||
|
||
# [END retail_v2alpha_generated_ModelService_ListModels_sync] |
45 changes: 45 additions & 0 deletions
45
...ted_samples/generated_samples/retail_v2alpha_generated_model_service_pause_model_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2022 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 | ||
# | ||
# http://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! | ||
# | ||
# Snippet for PauseModel | ||
# NOTE: This snippet has been automatically generated for illustrative purposes only. | ||
# It may require modifications to work in your environment. | ||
|
||
# To install the latest published package dependency, execute the following: | ||
# python3 -m pip install google-cloud-retail | ||
|
||
|
||
# [START retail_v2alpha_generated_ModelService_PauseModel_async] | ||
from google.cloud import retail_v2alpha | ||
|
||
|
||
async def sample_pause_model(): | ||
# Create a client | ||
client = retail_v2alpha.ModelServiceAsyncClient() | ||
|
||
# Initialize request argument(s) | ||
request = retail_v2alpha.PauseModelRequest( | ||
name="name_value", | ||
) | ||
|
||
# Make the request | ||
response = await client.pause_model(request=request) | ||
|
||
# Handle the response | ||
print(response) | ||
|
||
# [END retail_v2alpha_generated_ModelService_PauseModel_async] |
45 changes: 45 additions & 0 deletions
45
...ated_samples/generated_samples/retail_v2alpha_generated_model_service_pause_model_sync.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2022 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 | ||
# | ||
# http://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! | ||
# | ||
# Snippet for PauseModel | ||
# NOTE: This snippet has been automatically generated for illustrative purposes only. | ||
# It may require modifications to work in your environment. | ||
|
||
# To install the latest published package dependency, execute the following: | ||
# python3 -m pip install google-cloud-retail | ||
|
||
|
||
# [START retail_v2alpha_generated_ModelService_PauseModel_sync] | ||
from google.cloud import retail_v2alpha | ||
|
||
|
||
def sample_pause_model(): | ||
# Create a client | ||
client = retail_v2alpha.ModelServiceClient() | ||
|
||
# Initialize request argument(s) | ||
request = retail_v2alpha.PauseModelRequest( | ||
name="name_value", | ||
) | ||
|
||
# Make the request | ||
response = client.pause_model(request=request) | ||
|
||
# Handle the response | ||
print(response) | ||
|
||
# [END retail_v2alpha_generated_ModelService_PauseModel_sync] |
Oops, something went wrong.