google-cloud-discovery_engine-v1 2.3.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +4 -4
- data/README.md +4 -4
- data/lib/google/cloud/discovery_engine/v1/assistant_service/client.rb +509 -0
- data/lib/google/cloud/discovery_engine/v1/assistant_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/assistant_service/paths.rb +169 -0
- data/lib/google/cloud/discovery_engine/v1/assistant_service/rest/client.rb +478 -0
- data/lib/google/cloud/discovery_engine/v1/assistant_service/rest/service_stub.rb +137 -0
- data/lib/google/cloud/discovery_engine/v1/assistant_service/rest.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1/assistant_service.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +16 -4
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +16 -4
- data/lib/google/cloud/discovery_engine/v1/rest.rb +4 -2
- data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +204 -30
- data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +204 -30
- data/lib/google/cloud/discovery_engine/v1/session_service/client.rb +920 -0
- data/lib/google/cloud/discovery_engine/v1/session_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/session_service/paths.rb +330 -0
- data/lib/google/cloud/discovery_engine/v1/session_service/rest/client.rb +859 -0
- data/lib/google/cloud/discovery_engine/v1/session_service/rest/service_stub.rb +462 -0
- data/lib/google/cloud/discovery_engine/v1/session_service/rest.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1/session_service.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +2 -2
- data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +2 -2
- data/lib/google/cloud/discovery_engine/v1/version.rb +1 -1
- data/lib/google/cloud/discovery_engine/v1.rb +5 -3
- data/lib/google/cloud/discoveryengine/v1/assist_answer_pb.rb +59 -0
- data/lib/google/cloud/discoveryengine/v1/assistant_pb.rb +45 -0
- data/lib/google/cloud/discoveryengine/v1/assistant_service_pb.rb +62 -0
- data/lib/google/cloud/discoveryengine/v1/assistant_service_services_pb.rb +45 -0
- data/lib/google/cloud/discoveryengine/v1/search_service_pb.rb +4 -1
- data/lib/google/cloud/discoveryengine/v1/session_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/session_service_pb.rb +49 -0
- data/lib/google/cloud/discoveryengine/v1/session_service_services_pb.rb +64 -0
- data/proto_docs/google/cloud/discoveryengine/v1/assist_answer.rb +278 -0
- data/proto_docs/google/cloud/discoveryengine/v1/assistant.rb +39 -0
- data/proto_docs/google/cloud/discoveryengine/v1/assistant_service.rb +207 -0
- data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +15 -3
- data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +164 -14
- data/proto_docs/google/cloud/discoveryengine/v1/session.rb +20 -4
- data/proto_docs/google/cloud/discoveryengine/v1/user_event_service.rb +2 -2
- metadata +26 -3
@@ -0,0 +1,137 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 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
|
+
require "google/cloud/discoveryengine/v1/assistant_service_pb"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module DiscoveryEngine
|
24
|
+
module V1
|
25
|
+
module AssistantService
|
26
|
+
module Rest
|
27
|
+
##
|
28
|
+
# REST service stub for the AssistantService service.
|
29
|
+
# Service stub contains baseline method implementations
|
30
|
+
# including transcoding, making the REST call, and deserialing the response.
|
31
|
+
#
|
32
|
+
class ServiceStub
|
33
|
+
# @private
|
34
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
|
35
|
+
# These require statements are intentionally placed here to initialize
|
36
|
+
# the REST modules only when it's required.
|
37
|
+
require "gapic/rest"
|
38
|
+
|
39
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
|
40
|
+
endpoint_template: endpoint_template,
|
41
|
+
universe_domain: universe_domain,
|
42
|
+
credentials: credentials,
|
43
|
+
numeric_enums: true,
|
44
|
+
service_name: self.class,
|
45
|
+
raise_faraday_errors: false,
|
46
|
+
logger: logger
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# The effective universe domain
|
51
|
+
#
|
52
|
+
# @return [String]
|
53
|
+
#
|
54
|
+
def universe_domain
|
55
|
+
@client_stub.universe_domain
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# The effective endpoint
|
60
|
+
#
|
61
|
+
# @return [String]
|
62
|
+
#
|
63
|
+
def endpoint
|
64
|
+
@client_stub.endpoint
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# The logger used for request/response debug logging.
|
69
|
+
#
|
70
|
+
# @return [Logger]
|
71
|
+
#
|
72
|
+
def logger stub: false
|
73
|
+
stub ? @client_stub.stub_logger : @client_stub.logger
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Baseline implementation for the stream_assist REST call
|
78
|
+
#
|
79
|
+
# @param request_pb [::Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest]
|
80
|
+
# A request object representing the call parameters. Required.
|
81
|
+
# @param options [::Gapic::CallOptions]
|
82
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
83
|
+
#
|
84
|
+
# @yieldparam chunk [::String] The chunk of data received during server streaming.
|
85
|
+
#
|
86
|
+
# @return [::Gapic::Rest::TransportOperation]
|
87
|
+
def stream_assist(request_pb, options = nil, &)
|
88
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
89
|
+
|
90
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_stream_assist_request request_pb
|
91
|
+
query_string_params = if query_string_params.any?
|
92
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
93
|
+
else
|
94
|
+
{}
|
95
|
+
end
|
96
|
+
|
97
|
+
response = @client_stub.make_http_request(
|
98
|
+
verb,
|
99
|
+
uri: uri,
|
100
|
+
body: body || "",
|
101
|
+
params: query_string_params,
|
102
|
+
method_name: "stream_assist",
|
103
|
+
options: options,
|
104
|
+
is_server_streaming: true,
|
105
|
+
&
|
106
|
+
)
|
107
|
+
::Gapic::Rest::TransportOperation.new response
|
108
|
+
end
|
109
|
+
|
110
|
+
##
|
111
|
+
# @private
|
112
|
+
#
|
113
|
+
# GRPC transcoding helper method for the stream_assist REST call
|
114
|
+
#
|
115
|
+
# @param request_pb [::Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest]
|
116
|
+
# A request object representing the call parameters. Required.
|
117
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
118
|
+
# Uri, Body, Query string parameters
|
119
|
+
def self.transcode_stream_assist_request request_pb
|
120
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
121
|
+
.with_bindings(
|
122
|
+
uri_method: :post,
|
123
|
+
uri_template: "/v1/{name}:streamAssist",
|
124
|
+
body: "*",
|
125
|
+
matches: [
|
126
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/engines/[^/]+/assistants/[^/]+/?$}, false]
|
127
|
+
]
|
128
|
+
)
|
129
|
+
transcoder.transcode request_pb
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 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
|
+
require "gapic/rest"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/discovery_engine/v1/version"
|
24
|
+
|
25
|
+
require "google/cloud/discovery_engine/v1/assistant_service/credentials"
|
26
|
+
require "google/cloud/discovery_engine/v1/assistant_service/paths"
|
27
|
+
require "google/cloud/discovery_engine/v1/assistant_service/rest/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module DiscoveryEngine
|
32
|
+
module V1
|
33
|
+
##
|
34
|
+
# Service for managing Assistant configuration and assisting users.
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a REST client:
|
37
|
+
#
|
38
|
+
# require "google/cloud/discovery_engine/v1/assistant_service/rest"
|
39
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::AssistantService::Rest::Client.new
|
40
|
+
#
|
41
|
+
module AssistantService
|
42
|
+
# Client for the REST transport
|
43
|
+
module Rest
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
helper_path = ::File.join __dir__, "rest", "helpers.rb"
|
52
|
+
require "google/cloud/discovery_engine/v1/assistant_service/rest/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 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
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/discovery_engine/v1/version"
|
24
|
+
|
25
|
+
require "google/cloud/discovery_engine/v1/assistant_service/credentials"
|
26
|
+
require "google/cloud/discovery_engine/v1/assistant_service/paths"
|
27
|
+
require "google/cloud/discovery_engine/v1/assistant_service/client"
|
28
|
+
require "google/cloud/discovery_engine/v1/assistant_service/rest"
|
29
|
+
|
30
|
+
module Google
|
31
|
+
module Cloud
|
32
|
+
module DiscoveryEngine
|
33
|
+
module V1
|
34
|
+
##
|
35
|
+
# Service for managing Assistant configuration and assisting users.
|
36
|
+
#
|
37
|
+
# @example Load this service and instantiate a gRPC client
|
38
|
+
#
|
39
|
+
# require "google/cloud/discovery_engine/v1/assistant_service"
|
40
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::AssistantService::Client.new
|
41
|
+
#
|
42
|
+
# @example Load this service and instantiate a REST client
|
43
|
+
#
|
44
|
+
# require "google/cloud/discovery_engine/v1/assistant_service/rest"
|
45
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::AssistantService::Rest::Client.new
|
46
|
+
#
|
47
|
+
module AssistantService
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
helper_path = ::File.join __dir__, "assistant_service", "helpers.rb"
|
55
|
+
require "google/cloud/discovery_engine/v1/assistant_service/helpers" if ::File.file? helper_path
|
@@ -1625,11 +1625,23 @@ module Google
|
|
1625
1625
|
# A page token, received from a previous `ListSessions` call.
|
1626
1626
|
# Provide this to retrieve the subsequent page.
|
1627
1627
|
# @param filter [::String]
|
1628
|
-
# A
|
1629
|
-
#
|
1630
|
-
#
|
1631
|
-
#
|
1628
|
+
# A comma-separated list of fields to filter by, in EBNF grammar.
|
1629
|
+
# The supported fields are:
|
1630
|
+
# * `user_pseudo_id`
|
1631
|
+
# * `state`
|
1632
|
+
# * `display_name`
|
1633
|
+
# * `starred`
|
1634
|
+
# * `is_pinned`
|
1635
|
+
# * `labels`
|
1636
|
+
# * `create_time`
|
1637
|
+
# * `update_time`
|
1638
|
+
#
|
1639
|
+
# Examples:
|
1632
1640
|
# "user_pseudo_id = some_id"
|
1641
|
+
# "display_name = \"some_name\""
|
1642
|
+
# "starred = true"
|
1643
|
+
# "is_pinned=true AND (NOT labels:hidden)"
|
1644
|
+
# "create_time > \"1970-01-01T12:00:00Z\""
|
1633
1645
|
# @param order_by [::String]
|
1634
1646
|
# A comma-separated list of fields to order by, sorted in ascending order.
|
1635
1647
|
# Use "desc" after a field name for descending.
|
@@ -1529,11 +1529,23 @@ module Google
|
|
1529
1529
|
# A page token, received from a previous `ListSessions` call.
|
1530
1530
|
# Provide this to retrieve the subsequent page.
|
1531
1531
|
# @param filter [::String]
|
1532
|
-
# A
|
1533
|
-
#
|
1534
|
-
#
|
1535
|
-
#
|
1532
|
+
# A comma-separated list of fields to filter by, in EBNF grammar.
|
1533
|
+
# The supported fields are:
|
1534
|
+
# * `user_pseudo_id`
|
1535
|
+
# * `state`
|
1536
|
+
# * `display_name`
|
1537
|
+
# * `starred`
|
1538
|
+
# * `is_pinned`
|
1539
|
+
# * `labels`
|
1540
|
+
# * `create_time`
|
1541
|
+
# * `update_time`
|
1542
|
+
#
|
1543
|
+
# Examples:
|
1536
1544
|
# "user_pseudo_id = some_id"
|
1545
|
+
# "display_name = \"some_name\""
|
1546
|
+
# "starred = true"
|
1547
|
+
# "is_pinned=true AND (NOT labels:hidden)"
|
1548
|
+
# "create_time > \"1970-01-01T12:00:00Z\""
|
1537
1549
|
# @param order_by [::String]
|
1538
1550
|
# A comma-separated list of fields to order by, sorted in ascending order.
|
1539
1551
|
# Use "desc" after a field name for descending.
|
@@ -16,10 +16,11 @@
|
|
16
16
|
|
17
17
|
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
18
|
|
19
|
+
require "google/cloud/discovery_engine/v1/search_service/rest"
|
20
|
+
require "google/cloud/discovery_engine/v1/assistant_service/rest"
|
19
21
|
require "google/cloud/discovery_engine/v1/cmek_config_service/rest"
|
20
22
|
require "google/cloud/discovery_engine/v1/completion_service/rest"
|
21
23
|
require "google/cloud/discovery_engine/v1/control_service/rest"
|
22
|
-
require "google/cloud/discovery_engine/v1/search_service/rest"
|
23
24
|
require "google/cloud/discovery_engine/v1/conversational_search_service/rest"
|
24
25
|
require "google/cloud/discovery_engine/v1/data_store_service/rest"
|
25
26
|
require "google/cloud/discovery_engine/v1/document_service/rest"
|
@@ -32,6 +33,7 @@ require "google/cloud/discovery_engine/v1/recommendation_service/rest"
|
|
32
33
|
require "google/cloud/discovery_engine/v1/schema_service/rest"
|
33
34
|
require "google/cloud/discovery_engine/v1/search_tuning_service/rest"
|
34
35
|
require "google/cloud/discovery_engine/v1/serving_config_service/rest"
|
36
|
+
require "google/cloud/discovery_engine/v1/session_service/rest"
|
35
37
|
require "google/cloud/discovery_engine/v1/site_search_engine_service/rest"
|
36
38
|
require "google/cloud/discovery_engine/v1/user_event_service/rest"
|
37
39
|
require "google/cloud/discovery_engine/v1/user_license_service/rest"
|
@@ -46,7 +48,7 @@ module Google
|
|
46
48
|
# @example
|
47
49
|
#
|
48
50
|
# require "google/cloud/discovery_engine/v1/rest"
|
49
|
-
# client = ::Google::Cloud::DiscoveryEngine::V1::
|
51
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::SearchService::Rest::Client.new
|
50
52
|
#
|
51
53
|
module V1
|
52
54
|
end
|
@@ -217,7 +217,7 @@ module Google
|
|
217
217
|
# @param options [::Gapic::CallOptions, ::Hash]
|
218
218
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
219
219
|
#
|
220
|
-
# @overload search(serving_config: nil, branch: nil, query: nil, image_query: nil, page_size: nil, page_token: nil, offset: nil, one_box_page_size: nil, data_store_specs: nil, filter: nil, canonical_filter: nil, order_by: nil, user_info: nil, language_code: nil, facet_specs: nil, boost_spec: nil, params: nil, query_expansion_spec: nil, spell_correction_spec: nil, user_pseudo_id: nil, content_search_spec: nil, safe_search: nil, user_labels: nil, search_as_you_type_spec: nil, display_spec: nil, session: nil, session_spec: nil, relevance_threshold: nil, relevance_score_spec: nil)
|
220
|
+
# @overload search(serving_config: nil, branch: nil, query: nil, image_query: nil, page_size: nil, page_token: nil, offset: nil, one_box_page_size: nil, data_store_specs: nil, filter: nil, canonical_filter: nil, order_by: nil, user_info: nil, language_code: nil, facet_specs: nil, boost_spec: nil, params: nil, query_expansion_spec: nil, spell_correction_spec: nil, user_pseudo_id: nil, content_search_spec: nil, safe_search: nil, user_labels: nil, search_as_you_type_spec: nil, display_spec: nil, session: nil, session_spec: nil, relevance_threshold: nil, relevance_score_spec: nil, ranking_expression: nil, ranking_expression_backend: nil)
|
221
221
|
# Pass arguments to `search` via keyword arguments. Note that at
|
222
222
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
223
223
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -415,22 +415,16 @@ module Google
|
|
415
415
|
# between /search API calls and /answer API calls.
|
416
416
|
#
|
417
417
|
# Example #1 (multi-turn /search API calls):
|
418
|
-
#
|
419
|
-
#
|
420
|
-
#
|
421
|
-
#
|
422
|
-
#
|
423
|
-
# be interpreted as "How did Alphabet do in 2023?".
|
418
|
+
# Call /search API with the session ID generated in the first call.
|
419
|
+
# Here, the previous search query gets considered in query
|
420
|
+
# standing. I.e., if the first query is "How did Alphabet do in 2022?"
|
421
|
+
# and the current query is "How about 2023?", the current query will
|
422
|
+
# be interpreted as "How did Alphabet do in 2023?".
|
424
423
|
#
|
425
424
|
# Example #2 (coordination between /search API calls and /answer API calls):
|
426
|
-
#
|
427
|
-
#
|
428
|
-
#
|
429
|
-
# results from the first search call.
|
430
|
-
#
|
431
|
-
# Auto-session mode: when `projects/.../sessions/-` is used, a new session
|
432
|
-
# gets automatically created. Otherwise, users can use the create-session API
|
433
|
-
# to create a session manually.
|
425
|
+
# Call /answer API with the session ID generated in the first call.
|
426
|
+
# Here, the answer generation happens in the context of the search
|
427
|
+
# results from the first search call.
|
434
428
|
#
|
435
429
|
# Multi-turn Search feature is currently at private GA stage. Please use
|
436
430
|
# v1alpha or v1beta version instead before we launch this feature to public
|
@@ -449,6 +443,99 @@ module Google
|
|
449
443
|
# This feature is not supported for healthcare search.
|
450
444
|
# @param relevance_score_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::RelevanceScoreSpec, ::Hash]
|
451
445
|
# Optional. The specification for returning the relevance score.
|
446
|
+
# @param ranking_expression [::String]
|
447
|
+
# The ranking expression controls the customized ranking on retrieval
|
448
|
+
# documents. This overrides
|
449
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ServingConfig#ranking_expression ServingConfig.ranking_expression}.
|
450
|
+
# The syntax and supported features depend on the
|
451
|
+
# `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
452
|
+
# provided, it defaults to `RANK_BY_EMBEDDING`.
|
453
|
+
#
|
454
|
+
# If
|
455
|
+
# {::Google::Cloud::DiscoveryEngine::V1::SearchRequest#ranking_expression_backend ranking_expression_backend}
|
456
|
+
# is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
457
|
+
# function or multiple functions that are joined by "+".
|
458
|
+
#
|
459
|
+
# * ranking_expression = function, { " + ", function };
|
460
|
+
#
|
461
|
+
# Supported functions:
|
462
|
+
#
|
463
|
+
# * double * relevance_score
|
464
|
+
# * double * dotProduct(embedding_field_path)
|
465
|
+
#
|
466
|
+
# Function variables:
|
467
|
+
#
|
468
|
+
# * `relevance_score`: pre-defined keywords, used for measure relevance
|
469
|
+
# between query and document.
|
470
|
+
# * `embedding_field_path`: the document embedding field
|
471
|
+
# used with query embedding vector.
|
472
|
+
# * `dotProduct`: embedding function between `embedding_field_path` and
|
473
|
+
# query embedding vector.
|
474
|
+
#
|
475
|
+
# Example ranking expression:
|
476
|
+
#
|
477
|
+
# If document has an embedding field doc_embedding, the ranking expression
|
478
|
+
# could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
479
|
+
#
|
480
|
+
# If
|
481
|
+
# {::Google::Cloud::DiscoveryEngine::V1::SearchRequest#ranking_expression_backend ranking_expression_backend}
|
482
|
+
# is set to `RANK_BY_FORMULA`, the following expression types (and
|
483
|
+
# combinations of those chained using + or
|
484
|
+
# * operators) are supported:
|
485
|
+
#
|
486
|
+
# * `double`
|
487
|
+
# * `signal`
|
488
|
+
# * `log(signal)`
|
489
|
+
# * `exp(signal)`
|
490
|
+
# * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
491
|
+
# argument being a denominator constant.
|
492
|
+
# * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
493
|
+
# * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
494
|
+
# signal2 | double, else returns signal1.
|
495
|
+
#
|
496
|
+
# Here are a few examples of ranking formulas that use the supported
|
497
|
+
# ranking expression types:
|
498
|
+
#
|
499
|
+
# - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
500
|
+
# -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
501
|
+
# `semantic_smilarity_score` adjustment.
|
502
|
+
# - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
503
|
+
# is_nan(keyword_similarity_score)` -- rank by the exponent of
|
504
|
+
# `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
505
|
+
# add constant 0.3 adjustment to the final score if
|
506
|
+
# `semantic_similarity_score` is NaN.
|
507
|
+
# - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
508
|
+
# rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
509
|
+
# of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
510
|
+
# of `semantic_smilarity_score`.
|
511
|
+
#
|
512
|
+
# The following signals are supported:
|
513
|
+
#
|
514
|
+
# * `semantic_similarity_score`: semantic similarity adjustment that is
|
515
|
+
# calculated using the embeddings generated by a proprietary Google model.
|
516
|
+
# This score determines how semantically similar a search query is to a
|
517
|
+
# document.
|
518
|
+
# * `keyword_similarity_score`: keyword match adjustment uses the Best
|
519
|
+
# Match 25 (BM25) ranking function. This score is calculated using a
|
520
|
+
# probabilistic model to estimate the probability that a document is
|
521
|
+
# relevant to a given query.
|
522
|
+
# * `relevance_score`: semantic relevance adjustment that uses a
|
523
|
+
# proprietary Google model to determine the meaning and intent behind a
|
524
|
+
# user's query in context with the content in the documents.
|
525
|
+
# * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
526
|
+
# predicted Click-through rate (pCTR) to gauge the relevance and
|
527
|
+
# attractiveness of a search result from a user's perspective. A higher
|
528
|
+
# pCTR suggests that the result is more likely to satisfy the user's query
|
529
|
+
# and intent, making it a valuable signal for ranking.
|
530
|
+
# * `freshness_rank`: freshness adjustment as a rank
|
531
|
+
# * `document_age`: The time in hours elapsed since the document was last
|
532
|
+
# updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
533
|
+
# * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
534
|
+
# Google model to determine the keyword-based overlap between the query and
|
535
|
+
# the document.
|
536
|
+
# * `base_rank`: the default rank of the result
|
537
|
+
# @param ranking_expression_backend [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::RankingExpressionBackend]
|
538
|
+
# The backend to use for the ranking expression evaluation.
|
452
539
|
#
|
453
540
|
# @yield [response, operation] Access the result along with the RPC operation
|
454
541
|
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult>]
|
@@ -545,7 +632,7 @@ module Google
|
|
545
632
|
# @param options [::Gapic::CallOptions, ::Hash]
|
546
633
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
547
634
|
#
|
548
|
-
# @overload search_lite(serving_config: nil, branch: nil, query: nil, image_query: nil, page_size: nil, page_token: nil, offset: nil, one_box_page_size: nil, data_store_specs: nil, filter: nil, canonical_filter: nil, order_by: nil, user_info: nil, language_code: nil, facet_specs: nil, boost_spec: nil, params: nil, query_expansion_spec: nil, spell_correction_spec: nil, user_pseudo_id: nil, content_search_spec: nil, safe_search: nil, user_labels: nil, search_as_you_type_spec: nil, display_spec: nil, session: nil, session_spec: nil, relevance_threshold: nil, relevance_score_spec: nil)
|
635
|
+
# @overload search_lite(serving_config: nil, branch: nil, query: nil, image_query: nil, page_size: nil, page_token: nil, offset: nil, one_box_page_size: nil, data_store_specs: nil, filter: nil, canonical_filter: nil, order_by: nil, user_info: nil, language_code: nil, facet_specs: nil, boost_spec: nil, params: nil, query_expansion_spec: nil, spell_correction_spec: nil, user_pseudo_id: nil, content_search_spec: nil, safe_search: nil, user_labels: nil, search_as_you_type_spec: nil, display_spec: nil, session: nil, session_spec: nil, relevance_threshold: nil, relevance_score_spec: nil, ranking_expression: nil, ranking_expression_backend: nil)
|
549
636
|
# Pass arguments to `search_lite` via keyword arguments. Note that at
|
550
637
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
551
638
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -743,22 +830,16 @@ module Google
|
|
743
830
|
# between /search API calls and /answer API calls.
|
744
831
|
#
|
745
832
|
# Example #1 (multi-turn /search API calls):
|
746
|
-
#
|
747
|
-
#
|
748
|
-
#
|
749
|
-
#
|
750
|
-
#
|
751
|
-
# be interpreted as "How did Alphabet do in 2023?".
|
833
|
+
# Call /search API with the session ID generated in the first call.
|
834
|
+
# Here, the previous search query gets considered in query
|
835
|
+
# standing. I.e., if the first query is "How did Alphabet do in 2022?"
|
836
|
+
# and the current query is "How about 2023?", the current query will
|
837
|
+
# be interpreted as "How did Alphabet do in 2023?".
|
752
838
|
#
|
753
839
|
# Example #2 (coordination between /search API calls and /answer API calls):
|
754
|
-
#
|
755
|
-
#
|
756
|
-
#
|
757
|
-
# results from the first search call.
|
758
|
-
#
|
759
|
-
# Auto-session mode: when `projects/.../sessions/-` is used, a new session
|
760
|
-
# gets automatically created. Otherwise, users can use the create-session API
|
761
|
-
# to create a session manually.
|
840
|
+
# Call /answer API with the session ID generated in the first call.
|
841
|
+
# Here, the answer generation happens in the context of the search
|
842
|
+
# results from the first search call.
|
762
843
|
#
|
763
844
|
# Multi-turn Search feature is currently at private GA stage. Please use
|
764
845
|
# v1alpha or v1beta version instead before we launch this feature to public
|
@@ -777,6 +858,99 @@ module Google
|
|
777
858
|
# This feature is not supported for healthcare search.
|
778
859
|
# @param relevance_score_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::RelevanceScoreSpec, ::Hash]
|
779
860
|
# Optional. The specification for returning the relevance score.
|
861
|
+
# @param ranking_expression [::String]
|
862
|
+
# The ranking expression controls the customized ranking on retrieval
|
863
|
+
# documents. This overrides
|
864
|
+
# {::Google::Cloud::DiscoveryEngine::V1::ServingConfig#ranking_expression ServingConfig.ranking_expression}.
|
865
|
+
# The syntax and supported features depend on the
|
866
|
+
# `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
867
|
+
# provided, it defaults to `RANK_BY_EMBEDDING`.
|
868
|
+
#
|
869
|
+
# If
|
870
|
+
# {::Google::Cloud::DiscoveryEngine::V1::SearchRequest#ranking_expression_backend ranking_expression_backend}
|
871
|
+
# is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
872
|
+
# function or multiple functions that are joined by "+".
|
873
|
+
#
|
874
|
+
# * ranking_expression = function, { " + ", function };
|
875
|
+
#
|
876
|
+
# Supported functions:
|
877
|
+
#
|
878
|
+
# * double * relevance_score
|
879
|
+
# * double * dotProduct(embedding_field_path)
|
880
|
+
#
|
881
|
+
# Function variables:
|
882
|
+
#
|
883
|
+
# * `relevance_score`: pre-defined keywords, used for measure relevance
|
884
|
+
# between query and document.
|
885
|
+
# * `embedding_field_path`: the document embedding field
|
886
|
+
# used with query embedding vector.
|
887
|
+
# * `dotProduct`: embedding function between `embedding_field_path` and
|
888
|
+
# query embedding vector.
|
889
|
+
#
|
890
|
+
# Example ranking expression:
|
891
|
+
#
|
892
|
+
# If document has an embedding field doc_embedding, the ranking expression
|
893
|
+
# could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
894
|
+
#
|
895
|
+
# If
|
896
|
+
# {::Google::Cloud::DiscoveryEngine::V1::SearchRequest#ranking_expression_backend ranking_expression_backend}
|
897
|
+
# is set to `RANK_BY_FORMULA`, the following expression types (and
|
898
|
+
# combinations of those chained using + or
|
899
|
+
# * operators) are supported:
|
900
|
+
#
|
901
|
+
# * `double`
|
902
|
+
# * `signal`
|
903
|
+
# * `log(signal)`
|
904
|
+
# * `exp(signal)`
|
905
|
+
# * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
906
|
+
# argument being a denominator constant.
|
907
|
+
# * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
908
|
+
# * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
909
|
+
# signal2 | double, else returns signal1.
|
910
|
+
#
|
911
|
+
# Here are a few examples of ranking formulas that use the supported
|
912
|
+
# ranking expression types:
|
913
|
+
#
|
914
|
+
# - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
915
|
+
# -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
916
|
+
# `semantic_smilarity_score` adjustment.
|
917
|
+
# - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
918
|
+
# is_nan(keyword_similarity_score)` -- rank by the exponent of
|
919
|
+
# `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
920
|
+
# add constant 0.3 adjustment to the final score if
|
921
|
+
# `semantic_similarity_score` is NaN.
|
922
|
+
# - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
923
|
+
# rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
924
|
+
# of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
925
|
+
# of `semantic_smilarity_score`.
|
926
|
+
#
|
927
|
+
# The following signals are supported:
|
928
|
+
#
|
929
|
+
# * `semantic_similarity_score`: semantic similarity adjustment that is
|
930
|
+
# calculated using the embeddings generated by a proprietary Google model.
|
931
|
+
# This score determines how semantically similar a search query is to a
|
932
|
+
# document.
|
933
|
+
# * `keyword_similarity_score`: keyword match adjustment uses the Best
|
934
|
+
# Match 25 (BM25) ranking function. This score is calculated using a
|
935
|
+
# probabilistic model to estimate the probability that a document is
|
936
|
+
# relevant to a given query.
|
937
|
+
# * `relevance_score`: semantic relevance adjustment that uses a
|
938
|
+
# proprietary Google model to determine the meaning and intent behind a
|
939
|
+
# user's query in context with the content in the documents.
|
940
|
+
# * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
941
|
+
# predicted Click-through rate (pCTR) to gauge the relevance and
|
942
|
+
# attractiveness of a search result from a user's perspective. A higher
|
943
|
+
# pCTR suggests that the result is more likely to satisfy the user's query
|
944
|
+
# and intent, making it a valuable signal for ranking.
|
945
|
+
# * `freshness_rank`: freshness adjustment as a rank
|
946
|
+
# * `document_age`: The time in hours elapsed since the document was last
|
947
|
+
# updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
948
|
+
# * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
949
|
+
# Google model to determine the keyword-based overlap between the query and
|
950
|
+
# the document.
|
951
|
+
# * `base_rank`: the default rank of the result
|
952
|
+
# @param ranking_expression_backend [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::RankingExpressionBackend]
|
953
|
+
# The backend to use for the ranking expression evaluation.
|
780
954
|
#
|
781
955
|
# @yield [response, operation] Access the result along with the RPC operation
|
782
956
|
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult>]
|