google-cloud-retail-v2 0.3.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +8 -8
- data/README.md +1 -1
- data/lib/google/cloud/retail/v2.rb +2 -0
- data/lib/google/cloud/retail/v2/catalog_pb.rb +2 -0
- data/lib/google/cloud/retail/v2/catalog_service/client.rb +242 -45
- data/lib/google/cloud/retail/v2/catalog_service/paths.rb +21 -0
- data/lib/google/cloud/retail/v2/catalog_service_pb.rb +16 -0
- data/lib/google/cloud/retail/v2/catalog_service_services_pb.rb +47 -1
- data/lib/google/cloud/retail/v2/common_pb.rb +46 -0
- data/lib/google/cloud/retail/v2/completion_service.rb +54 -0
- data/lib/google/cloud/retail/v2/completion_service/client.rb +543 -0
- data/lib/google/cloud/retail/v2/completion_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/completion_service/operations.rb +664 -0
- data/lib/google/cloud/retail/v2/completion_service/paths.rb +52 -0
- data/lib/google/cloud/retail/v2/completion_service_pb.rb +50 -0
- data/lib/google/cloud/retail/v2/completion_service_services_pb.rb +61 -0
- data/lib/google/cloud/retail/v2/import_config_pb.rb +32 -0
- data/lib/google/cloud/retail/v2/prediction_service/client.rb +68 -75
- data/lib/google/cloud/retail/v2/prediction_service_services_pb.rb +1 -1
- data/lib/google/cloud/retail/v2/product_pb.rb +21 -0
- data/lib/google/cloud/retail/v2/product_service/client.rb +684 -48
- data/lib/google/cloud/retail/v2/product_service/operations.rb +34 -25
- data/lib/google/cloud/retail/v2/product_service_pb.rb +56 -0
- data/lib/google/cloud/retail/v2/product_service_services_pb.rb +76 -1
- data/lib/google/cloud/retail/v2/search_service.rb +53 -0
- data/lib/google/cloud/retail/v2/search_service/client.rb +531 -0
- data/lib/google/cloud/retail/v2/search_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/search_service/paths.rb +54 -0
- data/lib/google/cloud/retail/v2/search_service_pb.rb +131 -0
- data/lib/google/cloud/retail/v2/search_service_services_pb.rb +53 -0
- data/lib/google/cloud/retail/v2/user_event_pb.rb +11 -0
- data/lib/google/cloud/retail/v2/user_event_service/client.rb +47 -47
- data/lib/google/cloud/retail/v2/user_event_service/operations.rb +34 -25
- data/lib/google/cloud/retail/v2/user_event_service/paths.rb +19 -0
- data/lib/google/cloud/retail/v2/user_event_service_services_pb.rb +1 -1
- data/lib/google/cloud/retail/v2/version.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +7 -1
- data/proto_docs/google/api/httpbody.rb +4 -3
- data/proto_docs/google/cloud/retail/v2/catalog.rb +6 -6
- data/proto_docs/google/cloud/retail/v2/catalog_service.rb +53 -4
- data/proto_docs/google/cloud/retail/v2/common.rb +272 -4
- data/proto_docs/google/cloud/retail/v2/completion_service.rb +162 -0
- data/proto_docs/google/cloud/retail/v2/import_config.rb +122 -6
- data/proto_docs/google/cloud/retail/v2/prediction_service.rb +32 -31
- data/proto_docs/google/cloud/retail/v2/product.rb +266 -10
- data/proto_docs/google/cloud/retail/v2/product_service.rb +362 -2
- data/proto_docs/google/cloud/retail/v2/purge_config.rb +1 -1
- data/proto_docs/google/cloud/retail/v2/search_service.rb +681 -0
- data/proto_docs/google/cloud/retail/v2/user_event.rb +95 -3
- data/proto_docs/google/type/date.rb +53 -0
- metadata +20 -4
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module Retail
|
23
|
+
module V2
|
24
|
+
module CompletionService
|
25
|
+
# Path helper methods for the CompletionService API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified Catalog resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `projects/{project}/locations/{location}/catalogs/{catalog}`
|
33
|
+
#
|
34
|
+
# @param project [String]
|
35
|
+
# @param location [String]
|
36
|
+
# @param catalog [String]
|
37
|
+
#
|
38
|
+
# @return [::String]
|
39
|
+
def catalog_path project:, location:, catalog:
|
40
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
41
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
42
|
+
|
43
|
+
"projects/#{project}/locations/#{location}/catalogs/#{catalog}"
|
44
|
+
end
|
45
|
+
|
46
|
+
extend self
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/retail/v2/completion_service.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
require 'google/api/client_pb'
|
8
|
+
require 'google/api/field_behavior_pb'
|
9
|
+
require 'google/api/resource_pb'
|
10
|
+
require 'google/cloud/retail/v2/common_pb'
|
11
|
+
require 'google/cloud/retail/v2/import_config_pb'
|
12
|
+
require 'google/longrunning/operations_pb'
|
13
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
14
|
+
add_file("google/cloud/retail/v2/completion_service.proto", :syntax => :proto3) do
|
15
|
+
add_message "google.cloud.retail.v2.CompleteQueryRequest" do
|
16
|
+
optional :catalog, :string, 1
|
17
|
+
optional :query, :string, 2
|
18
|
+
optional :visitor_id, :string, 7
|
19
|
+
repeated :language_codes, :string, 3
|
20
|
+
optional :device_type, :string, 4
|
21
|
+
optional :dataset, :string, 6
|
22
|
+
optional :max_suggestions, :int32, 5
|
23
|
+
end
|
24
|
+
add_message "google.cloud.retail.v2.CompleteQueryResponse" do
|
25
|
+
repeated :completion_results, :message, 1, "google.cloud.retail.v2.CompleteQueryResponse.CompletionResult"
|
26
|
+
optional :attribution_token, :string, 2
|
27
|
+
repeated :recent_search_results, :message, 3, "google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult"
|
28
|
+
end
|
29
|
+
add_message "google.cloud.retail.v2.CompleteQueryResponse.CompletionResult" do
|
30
|
+
optional :suggestion, :string, 1
|
31
|
+
map :attributes, :string, :message, 2, "google.cloud.retail.v2.CustomAttribute"
|
32
|
+
end
|
33
|
+
add_message "google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult" do
|
34
|
+
optional :recent_search, :string, 1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
module Google
|
40
|
+
module Cloud
|
41
|
+
module Retail
|
42
|
+
module V2
|
43
|
+
CompleteQueryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryRequest").msgclass
|
44
|
+
CompleteQueryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryResponse").msgclass
|
45
|
+
CompleteQueryResponse::CompletionResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryResponse.CompletionResult").msgclass
|
46
|
+
CompleteQueryResponse::RecentSearchResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult").msgclass
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: google/cloud/retail/v2/completion_service.proto for package 'Google.Cloud.Retail.V2'
|
3
|
+
# Original file comments:
|
4
|
+
# Copyright 2020 Google LLC
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'grpc'
|
20
|
+
require 'google/cloud/retail/v2/completion_service_pb'
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Retail
|
25
|
+
module V2
|
26
|
+
module CompletionService
|
27
|
+
# Auto-completion service for retail.
|
28
|
+
#
|
29
|
+
# This feature is only available for users who have Retail Search enabled.
|
30
|
+
# Contact Retail Support (retail-search-support@google.com) if you are
|
31
|
+
# interested in using Retail Search.
|
32
|
+
class Service
|
33
|
+
|
34
|
+
include GRPC::GenericService
|
35
|
+
|
36
|
+
self.marshal_class_method = :encode
|
37
|
+
self.unmarshal_class_method = :decode
|
38
|
+
self.service_name = 'google.cloud.retail.v2.CompletionService'
|
39
|
+
|
40
|
+
# Completes the specified prefix with keyword suggestions.
|
41
|
+
#
|
42
|
+
# This feature is only available for users who have Retail Search enabled.
|
43
|
+
# Contact Retail Support (retail-search-support@google.com) if you are
|
44
|
+
# interested in using Retail Search.
|
45
|
+
rpc :CompleteQuery, ::Google::Cloud::Retail::V2::CompleteQueryRequest, ::Google::Cloud::Retail::V2::CompleteQueryResponse
|
46
|
+
# Bulk import of processed completion dataset.
|
47
|
+
#
|
48
|
+
# Request processing may be synchronous. Partial updating is not supported.
|
49
|
+
#
|
50
|
+
# This feature is only available for users who have Retail Search enabled.
|
51
|
+
# Contact Retail Support (retail-search-support@google.com) if you are
|
52
|
+
# interested in using Retail Search.
|
53
|
+
rpc :ImportCompletionData, ::Google::Cloud::Retail::V2::ImportCompletionDataRequest, ::Google::Longrunning::Operation
|
54
|
+
end
|
55
|
+
|
56
|
+
Stub = Service.rpc_stub_class
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -5,11 +5,13 @@ require 'google/protobuf'
|
|
5
5
|
|
6
6
|
require 'google/api/annotations_pb'
|
7
7
|
require 'google/api/field_behavior_pb'
|
8
|
+
require 'google/api/resource_pb'
|
8
9
|
require 'google/cloud/retail/v2/product_pb'
|
9
10
|
require 'google/cloud/retail/v2/user_event_pb'
|
10
11
|
require 'google/protobuf/field_mask_pb'
|
11
12
|
require 'google/protobuf/timestamp_pb'
|
12
13
|
require 'google/rpc/status_pb'
|
14
|
+
require 'google/type/date_pb'
|
13
15
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
14
16
|
add_file("google/cloud/retail/v2/import_config.proto", :syntax => :proto3) do
|
15
17
|
add_message "google.cloud.retail.v2.GcsSource" do
|
@@ -22,6 +24,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
22
24
|
optional :table_id, :string, 2
|
23
25
|
optional :gcs_staging_dir, :string, 3
|
24
26
|
optional :data_schema, :string, 4
|
27
|
+
oneof :partition do
|
28
|
+
optional :partition_date, :message, 6, "google.type.Date"
|
29
|
+
end
|
25
30
|
end
|
26
31
|
add_message "google.cloud.retail.v2.ProductInlineSource" do
|
27
32
|
repeated :products, :message, 1, "google.cloud.retail.v2.Product"
|
@@ -36,15 +41,28 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
36
41
|
end
|
37
42
|
add_message "google.cloud.retail.v2.ImportProductsRequest" do
|
38
43
|
optional :parent, :string, 1
|
44
|
+
optional :request_id, :string, 6
|
39
45
|
optional :input_config, :message, 2, "google.cloud.retail.v2.ProductInputConfig"
|
40
46
|
optional :errors_config, :message, 3, "google.cloud.retail.v2.ImportErrorsConfig"
|
41
47
|
optional :update_mask, :message, 4, "google.protobuf.FieldMask"
|
48
|
+
optional :reconciliation_mode, :enum, 5, "google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode"
|
49
|
+
optional :notification_pubsub_topic, :string, 7
|
50
|
+
end
|
51
|
+
add_enum "google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode" do
|
52
|
+
value :RECONCILIATION_MODE_UNSPECIFIED, 0
|
53
|
+
value :INCREMENTAL, 1
|
54
|
+
value :FULL, 2
|
42
55
|
end
|
43
56
|
add_message "google.cloud.retail.v2.ImportUserEventsRequest" do
|
44
57
|
optional :parent, :string, 1
|
45
58
|
optional :input_config, :message, 2, "google.cloud.retail.v2.UserEventInputConfig"
|
46
59
|
optional :errors_config, :message, 3, "google.cloud.retail.v2.ImportErrorsConfig"
|
47
60
|
end
|
61
|
+
add_message "google.cloud.retail.v2.ImportCompletionDataRequest" do
|
62
|
+
optional :parent, :string, 1
|
63
|
+
optional :input_config, :message, 2, "google.cloud.retail.v2.CompletionDataInputConfig"
|
64
|
+
optional :notification_pubsub_topic, :string, 3
|
65
|
+
end
|
48
66
|
add_message "google.cloud.retail.v2.ProductInputConfig" do
|
49
67
|
oneof :source do
|
50
68
|
optional :product_inline_source, :message, 1, "google.cloud.retail.v2.ProductInlineSource"
|
@@ -59,11 +77,18 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
59
77
|
optional :big_query_source, :message, 3, "google.cloud.retail.v2.BigQuerySource"
|
60
78
|
end
|
61
79
|
end
|
80
|
+
add_message "google.cloud.retail.v2.CompletionDataInputConfig" do
|
81
|
+
oneof :source do
|
82
|
+
optional :big_query_source, :message, 1, "google.cloud.retail.v2.BigQuerySource"
|
83
|
+
end
|
84
|
+
end
|
62
85
|
add_message "google.cloud.retail.v2.ImportMetadata" do
|
63
86
|
optional :create_time, :message, 1, "google.protobuf.Timestamp"
|
64
87
|
optional :update_time, :message, 2, "google.protobuf.Timestamp"
|
65
88
|
optional :success_count, :int64, 3
|
66
89
|
optional :failure_count, :int64, 4
|
90
|
+
optional :request_id, :string, 5
|
91
|
+
optional :notification_pubsub_topic, :string, 6
|
67
92
|
end
|
68
93
|
add_message "google.cloud.retail.v2.ImportProductsResponse" do
|
69
94
|
repeated :error_samples, :message, 1, "google.rpc.Status"
|
@@ -78,6 +103,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
78
103
|
optional :joined_events_count, :int64, 1
|
79
104
|
optional :unjoined_events_count, :int64, 2
|
80
105
|
end
|
106
|
+
add_message "google.cloud.retail.v2.ImportCompletionDataResponse" do
|
107
|
+
repeated :error_samples, :message, 1, "google.rpc.Status"
|
108
|
+
end
|
81
109
|
end
|
82
110
|
end
|
83
111
|
|
@@ -91,13 +119,17 @@ module Google
|
|
91
119
|
UserEventInlineSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventInlineSource").msgclass
|
92
120
|
ImportErrorsConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportErrorsConfig").msgclass
|
93
121
|
ImportProductsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportProductsRequest").msgclass
|
122
|
+
ImportProductsRequest::ReconciliationMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode").enummodule
|
94
123
|
ImportUserEventsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportUserEventsRequest").msgclass
|
124
|
+
ImportCompletionDataRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportCompletionDataRequest").msgclass
|
95
125
|
ProductInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductInputConfig").msgclass
|
96
126
|
UserEventInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventInputConfig").msgclass
|
127
|
+
CompletionDataInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompletionDataInputConfig").msgclass
|
97
128
|
ImportMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportMetadata").msgclass
|
98
129
|
ImportProductsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportProductsResponse").msgclass
|
99
130
|
ImportUserEventsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportUserEventsResponse").msgclass
|
100
131
|
UserEventImportSummary = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventImportSummary").msgclass
|
132
|
+
ImportCompletionDataResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportCompletionDataResponse").msgclass
|
101
133
|
end
|
102
134
|
end
|
103
135
|
end
|
@@ -41,13 +41,12 @@ module Google
|
|
41
41
|
# See {::Google::Cloud::Retail::V2::PredictionService::Client::Configuration}
|
42
42
|
# for a description of the configuration fields.
|
43
43
|
#
|
44
|
-
#
|
44
|
+
# @example
|
45
45
|
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
# end
|
46
|
+
# # Modify the configuration for all PredictionService clients
|
47
|
+
# ::Google::Cloud::Retail::V2::PredictionService::Client.configure do |config|
|
48
|
+
# config.timeout = 10.0
|
49
|
+
# end
|
51
50
|
#
|
52
51
|
# @yield [config] Configure the Client client.
|
53
52
|
# @yieldparam config [Client::Configuration]
|
@@ -67,10 +66,7 @@ module Google
|
|
67
66
|
|
68
67
|
default_config.timeout = 60.0
|
69
68
|
default_config.retry_policy = {
|
70
|
-
initial_delay: 0.1,
|
71
|
-
max_delay: 60.0,
|
72
|
-
multiplier: 1.3,
|
73
|
-
retry_codes: [14, 4]
|
69
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
74
70
|
}
|
75
71
|
|
76
72
|
default_config
|
@@ -102,19 +98,15 @@ module Google
|
|
102
98
|
##
|
103
99
|
# Create a new PredictionService client object.
|
104
100
|
#
|
105
|
-
#
|
106
|
-
#
|
107
|
-
# To create a new PredictionService client with the default
|
108
|
-
# configuration:
|
101
|
+
# @example
|
109
102
|
#
|
110
|
-
#
|
103
|
+
# # Create a client using the default configuration
|
104
|
+
# client = ::Google::Cloud::Retail::V2::PredictionService::Client.new
|
111
105
|
#
|
112
|
-
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
116
|
-
# config.timeout = 10.0
|
117
|
-
# end
|
106
|
+
# # Create a client using a custom configuration
|
107
|
+
# client = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config|
|
108
|
+
# config.timeout = 10.0
|
109
|
+
# end
|
118
110
|
#
|
119
111
|
# @yield [config] Configure the PredictionService client.
|
120
112
|
# @yieldparam config [Client::Configuration]
|
@@ -134,14 +126,13 @@ module Google
|
|
134
126
|
|
135
127
|
# Create credentials
|
136
128
|
credentials = @config.credentials
|
137
|
-
# Use self-signed JWT if the
|
129
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
138
130
|
# but only if the default endpoint does not have a region prefix.
|
139
|
-
enable_self_signed_jwt = @config.
|
140
|
-
@config.endpoint == Client.configure.endpoint &&
|
131
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
141
132
|
!@config.endpoint.split(".").first.include?("-")
|
142
133
|
credentials ||= Credentials.default scope: @config.scope,
|
143
134
|
enable_self_signed_jwt: enable_self_signed_jwt
|
144
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
135
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
145
136
|
credentials = Credentials.new credentials, scope: @config.scope
|
146
137
|
end
|
147
138
|
@quota_project_id = @config.quota_project
|
@@ -179,30 +170,10 @@ module Google
|
|
179
170
|
# @param placement [::String]
|
180
171
|
# Required. Full resource name of the format:
|
181
172
|
# \\{name=projects/*/locations/global/catalogs/default_catalog/placements/*}
|
182
|
-
# The
|
183
|
-
#
|
184
|
-
#
|
185
|
-
#
|
186
|
-
#
|
187
|
-
# * `shopping_cart`: Predicts products frequently bought together with one or
|
188
|
-
# more products in the same shopping session. Commonly displayed after
|
189
|
-
# `add-to-cart` events, on product detail pages, or on the shopping cart
|
190
|
-
# page.
|
191
|
-
#
|
192
|
-
# * `home_page`: Predicts the next product that a user will most likely
|
193
|
-
# engage with or purchase based on the shopping or viewing history of the
|
194
|
-
# specified `userId` or `visitorId`. For example - Recommendations for you.
|
195
|
-
#
|
196
|
-
# * `product_detail`: Predicts the next product that a user will most likely
|
197
|
-
# engage with or purchase. The prediction is based on the shopping or
|
198
|
-
# viewing history of the specified `userId` or `visitorId` and its
|
199
|
-
# relevance to a specified `CatalogItem`. Typically used on product detail
|
200
|
-
# pages. For example - More products like this.
|
201
|
-
#
|
202
|
-
# * `recently_viewed_default`: Returns up to 75 products recently viewed by
|
203
|
-
# the specified `userId` or `visitorId`, most recent ones first. Returns
|
204
|
-
# nothing if neither of them has viewed any products yet. For example -
|
205
|
-
# Recently viewed.
|
173
|
+
# The ID of the Recommendations AI placement. Before you can request
|
174
|
+
# predictions from your model, you must create at least one placement for it.
|
175
|
+
# For more information, see [Managing
|
176
|
+
# placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements).
|
206
177
|
#
|
207
178
|
# The full list of available placements can be seen at
|
208
179
|
# https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements
|
@@ -229,6 +200,9 @@ module Google
|
|
229
200
|
# `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
|
230
201
|
# with a size limit of 1,000 characters.
|
231
202
|
#
|
203
|
+
# Note: "Recently viewed" models don't support tag filtering at the
|
204
|
+
# moment.
|
205
|
+
#
|
232
206
|
# * filterOutOfStockItems. Restricts predictions to products that do not
|
233
207
|
# have a
|
234
208
|
# stockState value of OUT_OF_STOCK.
|
@@ -263,16 +237,34 @@ module Google
|
|
263
237
|
# * `strictFiltering`: Boolean. True by default. If set to false, the service
|
264
238
|
# will return generic (unfiltered) popular products instead of empty if
|
265
239
|
# your filter blocks all prediction results.
|
240
|
+
# * `priceRerankLevel`: String. Default empty. If set to be non-empty, then
|
241
|
+
# it needs to be one of {'no-price-reranking', 'low-price-reranking',
|
242
|
+
# 'medium-price-reranking', 'high-price-reranking'}. This gives
|
243
|
+
# request-level control and adjusts prediction results based on product
|
244
|
+
# price.
|
245
|
+
# * `diversityLevel`: String. Default empty. If set to be non-empty, then
|
246
|
+
# it needs to be one of {'no-diversity', 'low-diversity',
|
247
|
+
# 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives
|
248
|
+
# request-level control and adjusts prediction results based on product
|
249
|
+
# category.
|
266
250
|
# @param labels [::Hash{::String => ::String}]
|
267
|
-
# The labels
|
268
|
-
#
|
269
|
-
#
|
270
|
-
#
|
271
|
-
#
|
272
|
-
#
|
273
|
-
#
|
274
|
-
#
|
275
|
-
#
|
251
|
+
# The labels applied to a resource must meet the following requirements:
|
252
|
+
#
|
253
|
+
# * Each resource can have multiple labels, up to a maximum of 64.
|
254
|
+
# * Each label must be a key-value pair.
|
255
|
+
# * Keys have a minimum length of 1 character and a maximum length of 63
|
256
|
+
# characters, and cannot be empty. Values can be empty, and have a maximum
|
257
|
+
# length of 63 characters.
|
258
|
+
# * Keys and values can contain only lowercase letters, numeric characters,
|
259
|
+
# underscores, and dashes. All characters must use UTF-8 encoding, and
|
260
|
+
# international characters are allowed.
|
261
|
+
# * The key portion of a label must be unique. However, you can use the same
|
262
|
+
# key with multiple resources.
|
263
|
+
# * Keys must start with a lowercase letter or international character.
|
264
|
+
#
|
265
|
+
# See [Google Cloud
|
266
|
+
# Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
|
267
|
+
# for more details.
|
276
268
|
#
|
277
269
|
# @yield [response, operation] Access the result along with the RPC operation
|
278
270
|
# @yieldparam response [::Google::Cloud::Retail::V2::PredictResponse]
|
@@ -308,7 +300,9 @@ module Google
|
|
308
300
|
options.apply_defaults timeout: @config.rpcs.predict.timeout,
|
309
301
|
metadata: metadata,
|
310
302
|
retry_policy: @config.rpcs.predict.retry_policy
|
311
|
-
|
303
|
+
|
304
|
+
options.apply_defaults timeout: @config.timeout,
|
305
|
+
metadata: @config.metadata,
|
312
306
|
retry_policy: @config.retry_policy
|
313
307
|
|
314
308
|
@prediction_service_stub.call_rpc :predict, request, options: options do |response, operation|
|
@@ -332,22 +326,21 @@ module Google
|
|
332
326
|
# Configuration can be applied globally to all clients, or to a single client
|
333
327
|
# on construction.
|
334
328
|
#
|
335
|
-
#
|
336
|
-
#
|
337
|
-
#
|
338
|
-
# to 20 seconds,
|
339
|
-
#
|
340
|
-
#
|
341
|
-
#
|
342
|
-
#
|
343
|
-
#
|
344
|
-
#
|
345
|
-
#
|
346
|
-
#
|
347
|
-
#
|
348
|
-
#
|
349
|
-
#
|
350
|
-
# end
|
329
|
+
# @example
|
330
|
+
#
|
331
|
+
# # Modify the global config, setting the timeout for
|
332
|
+
# # predict to 20 seconds,
|
333
|
+
# # and all remaining timeouts to 10 seconds.
|
334
|
+
# ::Google::Cloud::Retail::V2::PredictionService::Client.configure do |config|
|
335
|
+
# config.timeout = 10.0
|
336
|
+
# config.rpcs.predict.timeout = 20.0
|
337
|
+
# end
|
338
|
+
#
|
339
|
+
# # Apply the above configuration only to a new client.
|
340
|
+
# client = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config|
|
341
|
+
# config.timeout = 10.0
|
342
|
+
# config.rpcs.predict.timeout = 20.0
|
343
|
+
# end
|
351
344
|
#
|
352
345
|
# @!attribute [rw] endpoint
|
353
346
|
# The hostname or hostname:port of the service endpoint.
|