Skip to content

Commit

Permalink
feat: new model service to manage recommendation models (#304)
Browse files Browse the repository at this point in the history
- [ ] 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
gcf-owl-bot[bot] authored and dandhlee committed Dec 2, 2022
1 parent 778bc16 commit 2815676
Show file tree
Hide file tree
Showing 15 changed files with 1,815 additions and 0 deletions.
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]
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]
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]
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]
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]
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]
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]
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]
Loading

0 comments on commit 2815676

Please sign in to comment.