techprotrade commited on
Commit
679dec2
·
verified ·
1 Parent(s): a3c93f0

Add loan-advisor-agent (part 5)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/__init__.py +22 -0
  2. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/async_client.py +1079 -0
  3. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/client.py +1597 -0
  4. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/pagers.py +204 -0
  5. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/transports/__init__.py +36 -0
  6. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/transports/base.py +271 -0
  7. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/transports/grpc.py +539 -0
  8. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/transports/grpc_asyncio.py +601 -0
  9. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/transports/rest.py +1647 -0
  10. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/transports/rest_base.py +593 -0
  11. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/__init__.py +22 -0
  12. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/async_client.py +0 -0
  13. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/client.py +0 -0
  14. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/pagers.py +375 -0
  15. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/transports/__init__.py +41 -0
  16. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/transports/base.py +425 -0
  17. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/transports/grpc.py +857 -0
  18. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/transports/grpc_asyncio.py +972 -0
  19. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/transports/rest.py +0 -0
  20. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/transports/rest_base.py +1148 -0
  21. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/__init__.py +22 -0
  22. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/async_client.py +939 -0
  23. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/client.py +1415 -0
  24. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/transports/__init__.py +36 -0
  25. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/transports/base.py +271 -0
  26. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/transports/grpc.py +530 -0
  27. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/transports/grpc_asyncio.py +600 -0
  28. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/transports/rest.py +1746 -0
  29. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/transports/rest_base.py +545 -0
  30. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/__init__.py +516 -0
  31. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/answer.py +749 -0
  32. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/chunk.py +190 -0
  33. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/common.py +303 -0
  34. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/completion.py +143 -0
  35. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/completion_service.py +601 -0
  36. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/control.py +345 -0
  37. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/control_service.py +202 -0
  38. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/conversation.py +250 -0
  39. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/conversational_search_service.py +1388 -0
  40. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/custom_tuning_model.py +133 -0
  41. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/data_store.py +427 -0
  42. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/data_store_service.py +340 -0
  43. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/document.py +240 -0
  44. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/document_processing_config.py +213 -0
  45. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/document_service.py +491 -0
  46. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/engine.py +347 -0
  47. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/engine_service.py +354 -0
  48. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/evaluation.py +337 -0
  49. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/evaluation_service.py +287 -0
  50. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/grounded_generation_service.py +942 -0
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/__init__.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from .async_client import SessionServiceAsyncClient
17
+ from .client import SessionServiceClient
18
+
19
+ __all__ = (
20
+ "SessionServiceClient",
21
+ "SessionServiceAsyncClient",
22
+ )
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/async_client.py ADDED
@@ -0,0 +1,1079 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from collections import OrderedDict
17
+ import logging as std_logging
18
+ import re
19
+ from typing import (
20
+ Callable,
21
+ Dict,
22
+ Mapping,
23
+ MutableMapping,
24
+ MutableSequence,
25
+ Optional,
26
+ Sequence,
27
+ Tuple,
28
+ Type,
29
+ Union,
30
+ )
31
+
32
+ from google.api_core import exceptions as core_exceptions
33
+ from google.api_core import gapic_v1
34
+ from google.api_core import retry_async as retries
35
+ from google.api_core.client_options import ClientOptions
36
+ from google.auth import credentials as ga_credentials # type: ignore
37
+ from google.oauth2 import service_account # type: ignore
38
+ import google.protobuf
39
+
40
+ from google.cloud.discoveryengine_v1beta import gapic_version as package_version
41
+
42
+ try:
43
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
44
+ except AttributeError: # pragma: NO COVER
45
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
46
+
47
+ from google.cloud.location import locations_pb2 # type: ignore
48
+ from google.longrunning import operations_pb2 # type: ignore
49
+ from google.protobuf import field_mask_pb2 # type: ignore
50
+ from google.protobuf import timestamp_pb2 # type: ignore
51
+
52
+ from google.cloud.discoveryengine_v1beta.services.session_service import pagers
53
+ from google.cloud.discoveryengine_v1beta.types import conversational_search_service
54
+ from google.cloud.discoveryengine_v1beta.types import session
55
+ from google.cloud.discoveryengine_v1beta.types import session as gcd_session
56
+
57
+ from .client import SessionServiceClient
58
+ from .transports.base import DEFAULT_CLIENT_INFO, SessionServiceTransport
59
+ from .transports.grpc_asyncio import SessionServiceGrpcAsyncIOTransport
60
+
61
+ try:
62
+ from google.api_core import client_logging # type: ignore
63
+
64
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
65
+ except ImportError: # pragma: NO COVER
66
+ CLIENT_LOGGING_SUPPORTED = False
67
+
68
+ _LOGGER = std_logging.getLogger(__name__)
69
+
70
+
71
+ class SessionServiceAsyncClient:
72
+ """Service for managing Sessions and Session-related resources."""
73
+
74
+ _client: SessionServiceClient
75
+
76
+ # Copy defaults from the synchronous client for use here.
77
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
78
+ DEFAULT_ENDPOINT = SessionServiceClient.DEFAULT_ENDPOINT
79
+ DEFAULT_MTLS_ENDPOINT = SessionServiceClient.DEFAULT_MTLS_ENDPOINT
80
+ _DEFAULT_ENDPOINT_TEMPLATE = SessionServiceClient._DEFAULT_ENDPOINT_TEMPLATE
81
+ _DEFAULT_UNIVERSE = SessionServiceClient._DEFAULT_UNIVERSE
82
+
83
+ answer_path = staticmethod(SessionServiceClient.answer_path)
84
+ parse_answer_path = staticmethod(SessionServiceClient.parse_answer_path)
85
+ chunk_path = staticmethod(SessionServiceClient.chunk_path)
86
+ parse_chunk_path = staticmethod(SessionServiceClient.parse_chunk_path)
87
+ data_store_path = staticmethod(SessionServiceClient.data_store_path)
88
+ parse_data_store_path = staticmethod(SessionServiceClient.parse_data_store_path)
89
+ document_path = staticmethod(SessionServiceClient.document_path)
90
+ parse_document_path = staticmethod(SessionServiceClient.parse_document_path)
91
+ session_path = staticmethod(SessionServiceClient.session_path)
92
+ parse_session_path = staticmethod(SessionServiceClient.parse_session_path)
93
+ common_billing_account_path = staticmethod(
94
+ SessionServiceClient.common_billing_account_path
95
+ )
96
+ parse_common_billing_account_path = staticmethod(
97
+ SessionServiceClient.parse_common_billing_account_path
98
+ )
99
+ common_folder_path = staticmethod(SessionServiceClient.common_folder_path)
100
+ parse_common_folder_path = staticmethod(
101
+ SessionServiceClient.parse_common_folder_path
102
+ )
103
+ common_organization_path = staticmethod(
104
+ SessionServiceClient.common_organization_path
105
+ )
106
+ parse_common_organization_path = staticmethod(
107
+ SessionServiceClient.parse_common_organization_path
108
+ )
109
+ common_project_path = staticmethod(SessionServiceClient.common_project_path)
110
+ parse_common_project_path = staticmethod(
111
+ SessionServiceClient.parse_common_project_path
112
+ )
113
+ common_location_path = staticmethod(SessionServiceClient.common_location_path)
114
+ parse_common_location_path = staticmethod(
115
+ SessionServiceClient.parse_common_location_path
116
+ )
117
+
118
+ @classmethod
119
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
120
+ """Creates an instance of this client using the provided credentials
121
+ info.
122
+
123
+ Args:
124
+ info (dict): The service account private key info.
125
+ args: Additional arguments to pass to the constructor.
126
+ kwargs: Additional arguments to pass to the constructor.
127
+
128
+ Returns:
129
+ SessionServiceAsyncClient: The constructed client.
130
+ """
131
+ return SessionServiceClient.from_service_account_info.__func__(SessionServiceAsyncClient, info, *args, **kwargs) # type: ignore
132
+
133
+ @classmethod
134
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
135
+ """Creates an instance of this client using the provided credentials
136
+ file.
137
+
138
+ Args:
139
+ filename (str): The path to the service account private key json
140
+ file.
141
+ args: Additional arguments to pass to the constructor.
142
+ kwargs: Additional arguments to pass to the constructor.
143
+
144
+ Returns:
145
+ SessionServiceAsyncClient: The constructed client.
146
+ """
147
+ return SessionServiceClient.from_service_account_file.__func__(SessionServiceAsyncClient, filename, *args, **kwargs) # type: ignore
148
+
149
+ from_service_account_json = from_service_account_file
150
+
151
+ @classmethod
152
+ def get_mtls_endpoint_and_cert_source(
153
+ cls, client_options: Optional[ClientOptions] = None
154
+ ):
155
+ """Return the API endpoint and client cert source for mutual TLS.
156
+
157
+ The client cert source is determined in the following order:
158
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
159
+ client cert source is None.
160
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
161
+ default client cert source exists, use the default one; otherwise the client cert
162
+ source is None.
163
+
164
+ The API endpoint is determined in the following order:
165
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
166
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
167
+ default mTLS endpoint; if the environment variable is "never", use the default API
168
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
169
+ use the default API endpoint.
170
+
171
+ More details can be found at https://google.aip.dev/auth/4114.
172
+
173
+ Args:
174
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
175
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
176
+ in this method.
177
+
178
+ Returns:
179
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
180
+ client cert source to use.
181
+
182
+ Raises:
183
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
184
+ """
185
+ return SessionServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
186
+
187
+ @property
188
+ def transport(self) -> SessionServiceTransport:
189
+ """Returns the transport used by the client instance.
190
+
191
+ Returns:
192
+ SessionServiceTransport: The transport used by the client instance.
193
+ """
194
+ return self._client.transport
195
+
196
+ @property
197
+ def api_endpoint(self):
198
+ """Return the API endpoint used by the client instance.
199
+
200
+ Returns:
201
+ str: The API endpoint used by the client instance.
202
+ """
203
+ return self._client._api_endpoint
204
+
205
+ @property
206
+ def universe_domain(self) -> str:
207
+ """Return the universe domain used by the client instance.
208
+
209
+ Returns:
210
+ str: The universe domain used
211
+ by the client instance.
212
+ """
213
+ return self._client._universe_domain
214
+
215
+ get_transport_class = SessionServiceClient.get_transport_class
216
+
217
+ def __init__(
218
+ self,
219
+ *,
220
+ credentials: Optional[ga_credentials.Credentials] = None,
221
+ transport: Optional[
222
+ Union[str, SessionServiceTransport, Callable[..., SessionServiceTransport]]
223
+ ] = "grpc_asyncio",
224
+ client_options: Optional[ClientOptions] = None,
225
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
226
+ ) -> None:
227
+ """Instantiates the session service async client.
228
+
229
+ Args:
230
+ credentials (Optional[google.auth.credentials.Credentials]): The
231
+ authorization credentials to attach to requests. These
232
+ credentials identify the application to the service; if none
233
+ are specified, the client will attempt to ascertain the
234
+ credentials from the environment.
235
+ transport (Optional[Union[str,SessionServiceTransport,Callable[..., SessionServiceTransport]]]):
236
+ The transport to use, or a Callable that constructs and returns a new transport to use.
237
+ If a Callable is given, it will be called with the same set of initialization
238
+ arguments as used in the SessionServiceTransport constructor.
239
+ If set to None, a transport is chosen automatically.
240
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
241
+ Custom options for the client.
242
+
243
+ 1. The ``api_endpoint`` property can be used to override the
244
+ default endpoint provided by the client when ``transport`` is
245
+ not explicitly provided. Only if this property is not set and
246
+ ``transport`` was not explicitly provided, the endpoint is
247
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
248
+ variable, which have one of the following values:
249
+ "always" (always use the default mTLS endpoint), "never" (always
250
+ use the default regular endpoint) and "auto" (auto-switch to the
251
+ default mTLS endpoint if client certificate is present; this is
252
+ the default value).
253
+
254
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
255
+ is "true", then the ``client_cert_source`` property can be used
256
+ to provide a client certificate for mTLS transport. If
257
+ not provided, the default SSL client certificate will be used if
258
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
259
+ set, no client certificate will be used.
260
+
261
+ 3. The ``universe_domain`` property can be used to override the
262
+ default "googleapis.com" universe. Note that ``api_endpoint``
263
+ property still takes precedence; and ``universe_domain`` is
264
+ currently not supported for mTLS.
265
+
266
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
267
+ The client info used to send a user-agent string along with
268
+ API requests. If ``None``, then default info will be used.
269
+ Generally, you only need to set this if you're developing
270
+ your own client library.
271
+
272
+ Raises:
273
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
274
+ creation failed for any reason.
275
+ """
276
+ self._client = SessionServiceClient(
277
+ credentials=credentials,
278
+ transport=transport,
279
+ client_options=client_options,
280
+ client_info=client_info,
281
+ )
282
+
283
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
284
+ std_logging.DEBUG
285
+ ): # pragma: NO COVER
286
+ _LOGGER.debug(
287
+ "Created client `google.cloud.discoveryengine_v1beta.SessionServiceAsyncClient`.",
288
+ extra={
289
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
290
+ "universeDomain": getattr(
291
+ self._client._transport._credentials, "universe_domain", ""
292
+ ),
293
+ "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
294
+ "credentialsInfo": getattr(
295
+ self.transport._credentials, "get_cred_info", lambda: None
296
+ )(),
297
+ }
298
+ if hasattr(self._client._transport, "_credentials")
299
+ else {
300
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
301
+ "credentialsType": None,
302
+ },
303
+ )
304
+
305
+ async def create_session(
306
+ self,
307
+ request: Optional[
308
+ Union[conversational_search_service.CreateSessionRequest, dict]
309
+ ] = None,
310
+ *,
311
+ parent: Optional[str] = None,
312
+ session: Optional[gcd_session.Session] = None,
313
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
314
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
315
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
316
+ ) -> gcd_session.Session:
317
+ r"""Creates a Session.
318
+
319
+ If the [Session][google.cloud.discoveryengine.v1beta.Session] to
320
+ create already exists, an ALREADY_EXISTS error is returned.
321
+
322
+ .. code-block:: python
323
+
324
+ # This snippet has been automatically generated and should be regarded as a
325
+ # code template only.
326
+ # It will require modifications to work:
327
+ # - It may require correct/in-range values for request initialization.
328
+ # - It may require specifying regional endpoints when creating the service
329
+ # client as shown in:
330
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
331
+ from google.cloud import discoveryengine_v1beta
332
+
333
+ async def sample_create_session():
334
+ # Create a client
335
+ client = discoveryengine_v1beta.SessionServiceAsyncClient()
336
+
337
+ # Initialize request argument(s)
338
+ request = discoveryengine_v1beta.CreateSessionRequest(
339
+ parent="parent_value",
340
+ )
341
+
342
+ # Make the request
343
+ response = await client.create_session(request=request)
344
+
345
+ # Handle the response
346
+ print(response)
347
+
348
+ Args:
349
+ request (Optional[Union[google.cloud.discoveryengine_v1beta.types.CreateSessionRequest, dict]]):
350
+ The request object. Request for CreateSession method.
351
+ parent (:class:`str`):
352
+ Required. Full resource name of parent data store.
353
+ Format:
354
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}``
355
+
356
+ This corresponds to the ``parent`` field
357
+ on the ``request`` instance; if ``request`` is provided, this
358
+ should not be set.
359
+ session (:class:`google.cloud.discoveryengine_v1beta.types.Session`):
360
+ Required. The session to create.
361
+ This corresponds to the ``session`` field
362
+ on the ``request`` instance; if ``request`` is provided, this
363
+ should not be set.
364
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
365
+ should be retried.
366
+ timeout (float): The timeout for this request.
367
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
368
+ sent along with the request as metadata. Normally, each value must be of type `str`,
369
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
370
+ be of type `bytes`.
371
+
372
+ Returns:
373
+ google.cloud.discoveryengine_v1beta.types.Session:
374
+ External session proto definition.
375
+ """
376
+ # Create or coerce a protobuf request object.
377
+ # - Quick check: If we got a request object, we should *not* have
378
+ # gotten any keyword arguments that map to the request.
379
+ flattened_params = [parent, session]
380
+ has_flattened_params = (
381
+ len([param for param in flattened_params if param is not None]) > 0
382
+ )
383
+ if request is not None and has_flattened_params:
384
+ raise ValueError(
385
+ "If the `request` argument is set, then none of "
386
+ "the individual field arguments should be set."
387
+ )
388
+
389
+ # - Use the request object if provided (there's no risk of modifying the input as
390
+ # there are no flattened fields), or create one.
391
+ if not isinstance(request, conversational_search_service.CreateSessionRequest):
392
+ request = conversational_search_service.CreateSessionRequest(request)
393
+
394
+ # If we have keyword arguments corresponding to fields on the
395
+ # request, apply these.
396
+ if parent is not None:
397
+ request.parent = parent
398
+ if session is not None:
399
+ request.session = session
400
+
401
+ # Wrap the RPC method; this adds retry and timeout information,
402
+ # and friendly error handling.
403
+ rpc = self._client._transport._wrapped_methods[
404
+ self._client._transport.create_session
405
+ ]
406
+
407
+ # Certain fields should be provided within the metadata header;
408
+ # add these here.
409
+ metadata = tuple(metadata) + (
410
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
411
+ )
412
+
413
+ # Validate the universe domain.
414
+ self._client._validate_universe_domain()
415
+
416
+ # Send the request.
417
+ response = await rpc(
418
+ request,
419
+ retry=retry,
420
+ timeout=timeout,
421
+ metadata=metadata,
422
+ )
423
+
424
+ # Done; return the response.
425
+ return response
426
+
427
+ async def delete_session(
428
+ self,
429
+ request: Optional[
430
+ Union[conversational_search_service.DeleteSessionRequest, dict]
431
+ ] = None,
432
+ *,
433
+ name: Optional[str] = None,
434
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
435
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
436
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
437
+ ) -> None:
438
+ r"""Deletes a Session.
439
+
440
+ If the [Session][google.cloud.discoveryengine.v1beta.Session] to
441
+ delete does not exist, a NOT_FOUND error is returned.
442
+
443
+ .. code-block:: python
444
+
445
+ # This snippet has been automatically generated and should be regarded as a
446
+ # code template only.
447
+ # It will require modifications to work:
448
+ # - It may require correct/in-range values for request initialization.
449
+ # - It may require specifying regional endpoints when creating the service
450
+ # client as shown in:
451
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
452
+ from google.cloud import discoveryengine_v1beta
453
+
454
+ async def sample_delete_session():
455
+ # Create a client
456
+ client = discoveryengine_v1beta.SessionServiceAsyncClient()
457
+
458
+ # Initialize request argument(s)
459
+ request = discoveryengine_v1beta.DeleteSessionRequest(
460
+ name="name_value",
461
+ )
462
+
463
+ # Make the request
464
+ await client.delete_session(request=request)
465
+
466
+ Args:
467
+ request (Optional[Union[google.cloud.discoveryengine_v1beta.types.DeleteSessionRequest, dict]]):
468
+ The request object. Request for DeleteSession method.
469
+ name (:class:`str`):
470
+ Required. The resource name of the Session to delete.
471
+ Format:
472
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}``
473
+
474
+ This corresponds to the ``name`` field
475
+ on the ``request`` instance; if ``request`` is provided, this
476
+ should not be set.
477
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
478
+ should be retried.
479
+ timeout (float): The timeout for this request.
480
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
481
+ sent along with the request as metadata. Normally, each value must be of type `str`,
482
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
483
+ be of type `bytes`.
484
+ """
485
+ # Create or coerce a protobuf request object.
486
+ # - Quick check: If we got a request object, we should *not* have
487
+ # gotten any keyword arguments that map to the request.
488
+ flattened_params = [name]
489
+ has_flattened_params = (
490
+ len([param for param in flattened_params if param is not None]) > 0
491
+ )
492
+ if request is not None and has_flattened_params:
493
+ raise ValueError(
494
+ "If the `request` argument is set, then none of "
495
+ "the individual field arguments should be set."
496
+ )
497
+
498
+ # - Use the request object if provided (there's no risk of modifying the input as
499
+ # there are no flattened fields), or create one.
500
+ if not isinstance(request, conversational_search_service.DeleteSessionRequest):
501
+ request = conversational_search_service.DeleteSessionRequest(request)
502
+
503
+ # If we have keyword arguments corresponding to fields on the
504
+ # request, apply these.
505
+ if name is not None:
506
+ request.name = name
507
+
508
+ # Wrap the RPC method; this adds retry and timeout information,
509
+ # and friendly error handling.
510
+ rpc = self._client._transport._wrapped_methods[
511
+ self._client._transport.delete_session
512
+ ]
513
+
514
+ # Certain fields should be provided within the metadata header;
515
+ # add these here.
516
+ metadata = tuple(metadata) + (
517
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
518
+ )
519
+
520
+ # Validate the universe domain.
521
+ self._client._validate_universe_domain()
522
+
523
+ # Send the request.
524
+ await rpc(
525
+ request,
526
+ retry=retry,
527
+ timeout=timeout,
528
+ metadata=metadata,
529
+ )
530
+
531
+ async def update_session(
532
+ self,
533
+ request: Optional[
534
+ Union[conversational_search_service.UpdateSessionRequest, dict]
535
+ ] = None,
536
+ *,
537
+ session: Optional[gcd_session.Session] = None,
538
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
539
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
540
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
541
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
542
+ ) -> gcd_session.Session:
543
+ r"""Updates a Session.
544
+
545
+ [Session][google.cloud.discoveryengine.v1beta.Session] action
546
+ type cannot be changed. If the
547
+ [Session][google.cloud.discoveryengine.v1beta.Session] to update
548
+ does not exist, a NOT_FOUND error is returned.
549
+
550
+ .. code-block:: python
551
+
552
+ # This snippet has been automatically generated and should be regarded as a
553
+ # code template only.
554
+ # It will require modifications to work:
555
+ # - It may require correct/in-range values for request initialization.
556
+ # - It may require specifying regional endpoints when creating the service
557
+ # client as shown in:
558
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
559
+ from google.cloud import discoveryengine_v1beta
560
+
561
+ async def sample_update_session():
562
+ # Create a client
563
+ client = discoveryengine_v1beta.SessionServiceAsyncClient()
564
+
565
+ # Initialize request argument(s)
566
+ request = discoveryengine_v1beta.UpdateSessionRequest(
567
+ )
568
+
569
+ # Make the request
570
+ response = await client.update_session(request=request)
571
+
572
+ # Handle the response
573
+ print(response)
574
+
575
+ Args:
576
+ request (Optional[Union[google.cloud.discoveryengine_v1beta.types.UpdateSessionRequest, dict]]):
577
+ The request object. Request for UpdateSession method.
578
+ session (:class:`google.cloud.discoveryengine_v1beta.types.Session`):
579
+ Required. The Session to update.
580
+ This corresponds to the ``session`` field
581
+ on the ``request`` instance; if ``request`` is provided, this
582
+ should not be set.
583
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
584
+ Indicates which fields in the provided
585
+ [Session][google.cloud.discoveryengine.v1beta.Session]
586
+ to update. The following are NOT supported:
587
+
588
+ - [Session.name][google.cloud.discoveryengine.v1beta.Session.name]
589
+
590
+ If not set or empty, all supported fields are updated.
591
+
592
+ This corresponds to the ``update_mask`` field
593
+ on the ``request`` instance; if ``request`` is provided, this
594
+ should not be set.
595
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
596
+ should be retried.
597
+ timeout (float): The timeout for this request.
598
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
599
+ sent along with the request as metadata. Normally, each value must be of type `str`,
600
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
601
+ be of type `bytes`.
602
+
603
+ Returns:
604
+ google.cloud.discoveryengine_v1beta.types.Session:
605
+ External session proto definition.
606
+ """
607
+ # Create or coerce a protobuf request object.
608
+ # - Quick check: If we got a request object, we should *not* have
609
+ # gotten any keyword arguments that map to the request.
610
+ flattened_params = [session, update_mask]
611
+ has_flattened_params = (
612
+ len([param for param in flattened_params if param is not None]) > 0
613
+ )
614
+ if request is not None and has_flattened_params:
615
+ raise ValueError(
616
+ "If the `request` argument is set, then none of "
617
+ "the individual field arguments should be set."
618
+ )
619
+
620
+ # - Use the request object if provided (there's no risk of modifying the input as
621
+ # there are no flattened fields), or create one.
622
+ if not isinstance(request, conversational_search_service.UpdateSessionRequest):
623
+ request = conversational_search_service.UpdateSessionRequest(request)
624
+
625
+ # If we have keyword arguments corresponding to fields on the
626
+ # request, apply these.
627
+ if session is not None:
628
+ request.session = session
629
+ if update_mask is not None:
630
+ request.update_mask = update_mask
631
+
632
+ # Wrap the RPC method; this adds retry and timeout information,
633
+ # and friendly error handling.
634
+ rpc = self._client._transport._wrapped_methods[
635
+ self._client._transport.update_session
636
+ ]
637
+
638
+ # Certain fields should be provided within the metadata header;
639
+ # add these here.
640
+ metadata = tuple(metadata) + (
641
+ gapic_v1.routing_header.to_grpc_metadata(
642
+ (("session.name", request.session.name),)
643
+ ),
644
+ )
645
+
646
+ # Validate the universe domain.
647
+ self._client._validate_universe_domain()
648
+
649
+ # Send the request.
650
+ response = await rpc(
651
+ request,
652
+ retry=retry,
653
+ timeout=timeout,
654
+ metadata=metadata,
655
+ )
656
+
657
+ # Done; return the response.
658
+ return response
659
+
660
+ async def get_session(
661
+ self,
662
+ request: Optional[
663
+ Union[conversational_search_service.GetSessionRequest, dict]
664
+ ] = None,
665
+ *,
666
+ name: Optional[str] = None,
667
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
668
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
669
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
670
+ ) -> session.Session:
671
+ r"""Gets a Session.
672
+
673
+ .. code-block:: python
674
+
675
+ # This snippet has been automatically generated and should be regarded as a
676
+ # code template only.
677
+ # It will require modifications to work:
678
+ # - It may require correct/in-range values for request initialization.
679
+ # - It may require specifying regional endpoints when creating the service
680
+ # client as shown in:
681
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
682
+ from google.cloud import discoveryengine_v1beta
683
+
684
+ async def sample_get_session():
685
+ # Create a client
686
+ client = discoveryengine_v1beta.SessionServiceAsyncClient()
687
+
688
+ # Initialize request argument(s)
689
+ request = discoveryengine_v1beta.GetSessionRequest(
690
+ name="name_value",
691
+ )
692
+
693
+ # Make the request
694
+ response = await client.get_session(request=request)
695
+
696
+ # Handle the response
697
+ print(response)
698
+
699
+ Args:
700
+ request (Optional[Union[google.cloud.discoveryengine_v1beta.types.GetSessionRequest, dict]]):
701
+ The request object. Request for GetSession method.
702
+ name (:class:`str`):
703
+ Required. The resource name of the Session to get.
704
+ Format:
705
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}``
706
+
707
+ This corresponds to the ``name`` field
708
+ on the ``request`` instance; if ``request`` is provided, this
709
+ should not be set.
710
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
711
+ should be retried.
712
+ timeout (float): The timeout for this request.
713
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
714
+ sent along with the request as metadata. Normally, each value must be of type `str`,
715
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
716
+ be of type `bytes`.
717
+
718
+ Returns:
719
+ google.cloud.discoveryengine_v1beta.types.Session:
720
+ External session proto definition.
721
+ """
722
+ # Create or coerce a protobuf request object.
723
+ # - Quick check: If we got a request object, we should *not* have
724
+ # gotten any keyword arguments that map to the request.
725
+ flattened_params = [name]
726
+ has_flattened_params = (
727
+ len([param for param in flattened_params if param is not None]) > 0
728
+ )
729
+ if request is not None and has_flattened_params:
730
+ raise ValueError(
731
+ "If the `request` argument is set, then none of "
732
+ "the individual field arguments should be set."
733
+ )
734
+
735
+ # - Use the request object if provided (there's no risk of modifying the input as
736
+ # there are no flattened fields), or create one.
737
+ if not isinstance(request, conversational_search_service.GetSessionRequest):
738
+ request = conversational_search_service.GetSessionRequest(request)
739
+
740
+ # If we have keyword arguments corresponding to fields on the
741
+ # request, apply these.
742
+ if name is not None:
743
+ request.name = name
744
+
745
+ # Wrap the RPC method; this adds retry and timeout information,
746
+ # and friendly error handling.
747
+ rpc = self._client._transport._wrapped_methods[
748
+ self._client._transport.get_session
749
+ ]
750
+
751
+ # Certain fields should be provided within the metadata header;
752
+ # add these here.
753
+ metadata = tuple(metadata) + (
754
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
755
+ )
756
+
757
+ # Validate the universe domain.
758
+ self._client._validate_universe_domain()
759
+
760
+ # Send the request.
761
+ response = await rpc(
762
+ request,
763
+ retry=retry,
764
+ timeout=timeout,
765
+ metadata=metadata,
766
+ )
767
+
768
+ # Done; return the response.
769
+ return response
770
+
771
+ async def list_sessions(
772
+ self,
773
+ request: Optional[
774
+ Union[conversational_search_service.ListSessionsRequest, dict]
775
+ ] = None,
776
+ *,
777
+ parent: Optional[str] = None,
778
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
779
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
780
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
781
+ ) -> pagers.ListSessionsAsyncPager:
782
+ r"""Lists all Sessions by their parent
783
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
784
+
785
+ .. code-block:: python
786
+
787
+ # This snippet has been automatically generated and should be regarded as a
788
+ # code template only.
789
+ # It will require modifications to work:
790
+ # - It may require correct/in-range values for request initialization.
791
+ # - It may require specifying regional endpoints when creating the service
792
+ # client as shown in:
793
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
794
+ from google.cloud import discoveryengine_v1beta
795
+
796
+ async def sample_list_sessions():
797
+ # Create a client
798
+ client = discoveryengine_v1beta.SessionServiceAsyncClient()
799
+
800
+ # Initialize request argument(s)
801
+ request = discoveryengine_v1beta.ListSessionsRequest(
802
+ parent="parent_value",
803
+ )
804
+
805
+ # Make the request
806
+ page_result = client.list_sessions(request=request)
807
+
808
+ # Handle the response
809
+ async for response in page_result:
810
+ print(response)
811
+
812
+ Args:
813
+ request (Optional[Union[google.cloud.discoveryengine_v1beta.types.ListSessionsRequest, dict]]):
814
+ The request object. Request for ListSessions method.
815
+ parent (:class:`str`):
816
+ Required. The data store resource name. Format:
817
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}``
818
+
819
+ This corresponds to the ``parent`` field
820
+ on the ``request`` instance; if ``request`` is provided, this
821
+ should not be set.
822
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
823
+ should be retried.
824
+ timeout (float): The timeout for this request.
825
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
826
+ sent along with the request as metadata. Normally, each value must be of type `str`,
827
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
828
+ be of type `bytes`.
829
+
830
+ Returns:
831
+ google.cloud.discoveryengine_v1beta.services.session_service.pagers.ListSessionsAsyncPager:
832
+ Response for ListSessions method.
833
+
834
+ Iterating over this object will yield
835
+ results and resolve additional pages
836
+ automatically.
837
+
838
+ """
839
+ # Create or coerce a protobuf request object.
840
+ # - Quick check: If we got a request object, we should *not* have
841
+ # gotten any keyword arguments that map to the request.
842
+ flattened_params = [parent]
843
+ has_flattened_params = (
844
+ len([param for param in flattened_params if param is not None]) > 0
845
+ )
846
+ if request is not None and has_flattened_params:
847
+ raise ValueError(
848
+ "If the `request` argument is set, then none of "
849
+ "the individual field arguments should be set."
850
+ )
851
+
852
+ # - Use the request object if provided (there's no risk of modifying the input as
853
+ # there are no flattened fields), or create one.
854
+ if not isinstance(request, conversational_search_service.ListSessionsRequest):
855
+ request = conversational_search_service.ListSessionsRequest(request)
856
+
857
+ # If we have keyword arguments corresponding to fields on the
858
+ # request, apply these.
859
+ if parent is not None:
860
+ request.parent = parent
861
+
862
+ # Wrap the RPC method; this adds retry and timeout information,
863
+ # and friendly error handling.
864
+ rpc = self._client._transport._wrapped_methods[
865
+ self._client._transport.list_sessions
866
+ ]
867
+
868
+ # Certain fields should be provided within the metadata header;
869
+ # add these here.
870
+ metadata = tuple(metadata) + (
871
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
872
+ )
873
+
874
+ # Validate the universe domain.
875
+ self._client._validate_universe_domain()
876
+
877
+ # Send the request.
878
+ response = await rpc(
879
+ request,
880
+ retry=retry,
881
+ timeout=timeout,
882
+ metadata=metadata,
883
+ )
884
+
885
+ # This method is paged; wrap the response in a pager, which provides
886
+ # an `__aiter__` convenience method.
887
+ response = pagers.ListSessionsAsyncPager(
888
+ method=rpc,
889
+ request=request,
890
+ response=response,
891
+ retry=retry,
892
+ timeout=timeout,
893
+ metadata=metadata,
894
+ )
895
+
896
+ # Done; return the response.
897
+ return response
898
+
899
+ async def list_operations(
900
+ self,
901
+ request: Optional[operations_pb2.ListOperationsRequest] = None,
902
+ *,
903
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
904
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
905
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
906
+ ) -> operations_pb2.ListOperationsResponse:
907
+ r"""Lists operations that match the specified filter in the request.
908
+
909
+ Args:
910
+ request (:class:`~.operations_pb2.ListOperationsRequest`):
911
+ The request object. Request message for
912
+ `ListOperations` method.
913
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
914
+ if any, should be retried.
915
+ timeout (float): The timeout for this request.
916
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
917
+ sent along with the request as metadata. Normally, each value must be of type `str`,
918
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
919
+ be of type `bytes`.
920
+ Returns:
921
+ ~.operations_pb2.ListOperationsResponse:
922
+ Response message for ``ListOperations`` method.
923
+ """
924
+ # Create or coerce a protobuf request object.
925
+ # The request isn't a proto-plus wrapped type,
926
+ # so it must be constructed via keyword expansion.
927
+ if isinstance(request, dict):
928
+ request = operations_pb2.ListOperationsRequest(**request)
929
+
930
+ # Wrap the RPC method; this adds retry and timeout information,
931
+ # and friendly error handling.
932
+ rpc = self.transport._wrapped_methods[self._client._transport.list_operations]
933
+
934
+ # Certain fields should be provided within the metadata header;
935
+ # add these here.
936
+ metadata = tuple(metadata) + (
937
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
938
+ )
939
+
940
+ # Validate the universe domain.
941
+ self._client._validate_universe_domain()
942
+
943
+ # Send the request.
944
+ response = await rpc(
945
+ request,
946
+ retry=retry,
947
+ timeout=timeout,
948
+ metadata=metadata,
949
+ )
950
+
951
+ # Done; return the response.
952
+ return response
953
+
954
+ async def get_operation(
955
+ self,
956
+ request: Optional[operations_pb2.GetOperationRequest] = None,
957
+ *,
958
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
959
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
960
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
961
+ ) -> operations_pb2.Operation:
962
+ r"""Gets the latest state of a long-running operation.
963
+
964
+ Args:
965
+ request (:class:`~.operations_pb2.GetOperationRequest`):
966
+ The request object. Request message for
967
+ `GetOperation` method.
968
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
969
+ if any, should be retried.
970
+ timeout (float): The timeout for this request.
971
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
972
+ sent along with the request as metadata. Normally, each value must be of type `str`,
973
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
974
+ be of type `bytes`.
975
+ Returns:
976
+ ~.operations_pb2.Operation:
977
+ An ``Operation`` object.
978
+ """
979
+ # Create or coerce a protobuf request object.
980
+ # The request isn't a proto-plus wrapped type,
981
+ # so it must be constructed via keyword expansion.
982
+ if isinstance(request, dict):
983
+ request = operations_pb2.GetOperationRequest(**request)
984
+
985
+ # Wrap the RPC method; this adds retry and timeout information,
986
+ # and friendly error handling.
987
+ rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
988
+
989
+ # Certain fields should be provided within the metadata header;
990
+ # add these here.
991
+ metadata = tuple(metadata) + (
992
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
993
+ )
994
+
995
+ # Validate the universe domain.
996
+ self._client._validate_universe_domain()
997
+
998
+ # Send the request.
999
+ response = await rpc(
1000
+ request,
1001
+ retry=retry,
1002
+ timeout=timeout,
1003
+ metadata=metadata,
1004
+ )
1005
+
1006
+ # Done; return the response.
1007
+ return response
1008
+
1009
+ async def cancel_operation(
1010
+ self,
1011
+ request: Optional[operations_pb2.CancelOperationRequest] = None,
1012
+ *,
1013
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1014
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1015
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1016
+ ) -> None:
1017
+ r"""Starts asynchronous cancellation on a long-running operation.
1018
+
1019
+ The server makes a best effort to cancel the operation, but success
1020
+ is not guaranteed. If the server doesn't support this method, it returns
1021
+ `google.rpc.Code.UNIMPLEMENTED`.
1022
+
1023
+ Args:
1024
+ request (:class:`~.operations_pb2.CancelOperationRequest`):
1025
+ The request object. Request message for
1026
+ `CancelOperation` method.
1027
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1028
+ if any, should be retried.
1029
+ timeout (float): The timeout for this request.
1030
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1031
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1032
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1033
+ be of type `bytes`.
1034
+ Returns:
1035
+ None
1036
+ """
1037
+ # Create or coerce a protobuf request object.
1038
+ # The request isn't a proto-plus wrapped type,
1039
+ # so it must be constructed via keyword expansion.
1040
+ if isinstance(request, dict):
1041
+ request = operations_pb2.CancelOperationRequest(**request)
1042
+
1043
+ # Wrap the RPC method; this adds retry and timeout information,
1044
+ # and friendly error handling.
1045
+ rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation]
1046
+
1047
+ # Certain fields should be provided within the metadata header;
1048
+ # add these here.
1049
+ metadata = tuple(metadata) + (
1050
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1051
+ )
1052
+
1053
+ # Validate the universe domain.
1054
+ self._client._validate_universe_domain()
1055
+
1056
+ # Send the request.
1057
+ await rpc(
1058
+ request,
1059
+ retry=retry,
1060
+ timeout=timeout,
1061
+ metadata=metadata,
1062
+ )
1063
+
1064
+ async def __aenter__(self) -> "SessionServiceAsyncClient":
1065
+ return self
1066
+
1067
+ async def __aexit__(self, exc_type, exc, tb):
1068
+ await self.transport.close()
1069
+
1070
+
1071
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1072
+ gapic_version=package_version.__version__
1073
+ )
1074
+
1075
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1076
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1077
+
1078
+
1079
+ __all__ = ("SessionServiceAsyncClient",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/client.py ADDED
@@ -0,0 +1,1597 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from collections import OrderedDict
17
+ from http import HTTPStatus
18
+ import json
19
+ import logging as std_logging
20
+ import os
21
+ import re
22
+ from typing import (
23
+ Callable,
24
+ Dict,
25
+ Mapping,
26
+ MutableMapping,
27
+ MutableSequence,
28
+ Optional,
29
+ Sequence,
30
+ Tuple,
31
+ Type,
32
+ Union,
33
+ cast,
34
+ )
35
+ import warnings
36
+
37
+ from google.api_core import client_options as client_options_lib
38
+ from google.api_core import exceptions as core_exceptions
39
+ from google.api_core import gapic_v1
40
+ from google.api_core import retry as retries
41
+ from google.auth import credentials as ga_credentials # type: ignore
42
+ from google.auth.exceptions import MutualTLSChannelError # type: ignore
43
+ from google.auth.transport import mtls # type: ignore
44
+ from google.auth.transport.grpc import SslCredentials # type: ignore
45
+ from google.oauth2 import service_account # type: ignore
46
+ import google.protobuf
47
+
48
+ from google.cloud.discoveryengine_v1beta import gapic_version as package_version
49
+
50
+ try:
51
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
52
+ except AttributeError: # pragma: NO COVER
53
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
54
+
55
+ try:
56
+ from google.api_core import client_logging # type: ignore
57
+
58
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
59
+ except ImportError: # pragma: NO COVER
60
+ CLIENT_LOGGING_SUPPORTED = False
61
+
62
+ _LOGGER = std_logging.getLogger(__name__)
63
+
64
+ from google.cloud.location import locations_pb2 # type: ignore
65
+ from google.longrunning import operations_pb2 # type: ignore
66
+ from google.protobuf import field_mask_pb2 # type: ignore
67
+ from google.protobuf import timestamp_pb2 # type: ignore
68
+
69
+ from google.cloud.discoveryengine_v1beta.services.session_service import pagers
70
+ from google.cloud.discoveryengine_v1beta.types import conversational_search_service
71
+ from google.cloud.discoveryengine_v1beta.types import session
72
+ from google.cloud.discoveryengine_v1beta.types import session as gcd_session
73
+
74
+ from .transports.base import DEFAULT_CLIENT_INFO, SessionServiceTransport
75
+ from .transports.grpc import SessionServiceGrpcTransport
76
+ from .transports.grpc_asyncio import SessionServiceGrpcAsyncIOTransport
77
+ from .transports.rest import SessionServiceRestTransport
78
+
79
+
80
+ class SessionServiceClientMeta(type):
81
+ """Metaclass for the SessionService client.
82
+
83
+ This provides class-level methods for building and retrieving
84
+ support objects (e.g. transport) without polluting the client instance
85
+ objects.
86
+ """
87
+
88
+ _transport_registry = (
89
+ OrderedDict()
90
+ ) # type: Dict[str, Type[SessionServiceTransport]]
91
+ _transport_registry["grpc"] = SessionServiceGrpcTransport
92
+ _transport_registry["grpc_asyncio"] = SessionServiceGrpcAsyncIOTransport
93
+ _transport_registry["rest"] = SessionServiceRestTransport
94
+
95
+ def get_transport_class(
96
+ cls,
97
+ label: Optional[str] = None,
98
+ ) -> Type[SessionServiceTransport]:
99
+ """Returns an appropriate transport class.
100
+
101
+ Args:
102
+ label: The name of the desired transport. If none is
103
+ provided, then the first transport in the registry is used.
104
+
105
+ Returns:
106
+ The transport class to use.
107
+ """
108
+ # If a specific transport is requested, return that one.
109
+ if label:
110
+ return cls._transport_registry[label]
111
+
112
+ # No transport is requested; return the default (that is, the first one
113
+ # in the dictionary).
114
+ return next(iter(cls._transport_registry.values()))
115
+
116
+
117
+ class SessionServiceClient(metaclass=SessionServiceClientMeta):
118
+ """Service for managing Sessions and Session-related resources."""
119
+
120
+ @staticmethod
121
+ def _get_default_mtls_endpoint(api_endpoint):
122
+ """Converts api endpoint to mTLS endpoint.
123
+
124
+ Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
125
+ "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
126
+ Args:
127
+ api_endpoint (Optional[str]): the api endpoint to convert.
128
+ Returns:
129
+ str: converted mTLS api endpoint.
130
+ """
131
+ if not api_endpoint:
132
+ return api_endpoint
133
+
134
+ mtls_endpoint_re = re.compile(
135
+ r"(?P<name>[^.]+)(?P<mtls>\.mtls)?(?P<sandbox>\.sandbox)?(?P<googledomain>\.googleapis\.com)?"
136
+ )
137
+
138
+ m = mtls_endpoint_re.match(api_endpoint)
139
+ name, mtls, sandbox, googledomain = m.groups()
140
+ if mtls or not googledomain:
141
+ return api_endpoint
142
+
143
+ if sandbox:
144
+ return api_endpoint.replace(
145
+ "sandbox.googleapis.com", "mtls.sandbox.googleapis.com"
146
+ )
147
+
148
+ return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")
149
+
150
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
151
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
152
+ DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore
153
+ DEFAULT_ENDPOINT
154
+ )
155
+
156
+ _DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.{UNIVERSE_DOMAIN}"
157
+ _DEFAULT_UNIVERSE = "googleapis.com"
158
+
159
+ @classmethod
160
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
161
+ """Creates an instance of this client using the provided credentials
162
+ info.
163
+
164
+ Args:
165
+ info (dict): The service account private key info.
166
+ args: Additional arguments to pass to the constructor.
167
+ kwargs: Additional arguments to pass to the constructor.
168
+
169
+ Returns:
170
+ SessionServiceClient: The constructed client.
171
+ """
172
+ credentials = service_account.Credentials.from_service_account_info(info)
173
+ kwargs["credentials"] = credentials
174
+ return cls(*args, **kwargs)
175
+
176
+ @classmethod
177
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
178
+ """Creates an instance of this client using the provided credentials
179
+ file.
180
+
181
+ Args:
182
+ filename (str): The path to the service account private key json
183
+ file.
184
+ args: Additional arguments to pass to the constructor.
185
+ kwargs: Additional arguments to pass to the constructor.
186
+
187
+ Returns:
188
+ SessionServiceClient: The constructed client.
189
+ """
190
+ credentials = service_account.Credentials.from_service_account_file(filename)
191
+ kwargs["credentials"] = credentials
192
+ return cls(*args, **kwargs)
193
+
194
+ from_service_account_json = from_service_account_file
195
+
196
+ @property
197
+ def transport(self) -> SessionServiceTransport:
198
+ """Returns the transport used by the client instance.
199
+
200
+ Returns:
201
+ SessionServiceTransport: The transport used by the client
202
+ instance.
203
+ """
204
+ return self._transport
205
+
206
+ @staticmethod
207
+ def answer_path(
208
+ project: str,
209
+ location: str,
210
+ data_store: str,
211
+ session: str,
212
+ answer: str,
213
+ ) -> str:
214
+ """Returns a fully-qualified answer string."""
215
+ return "projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}/answers/{answer}".format(
216
+ project=project,
217
+ location=location,
218
+ data_store=data_store,
219
+ session=session,
220
+ answer=answer,
221
+ )
222
+
223
+ @staticmethod
224
+ def parse_answer_path(path: str) -> Dict[str, str]:
225
+ """Parses a answer path into its component segments."""
226
+ m = re.match(
227
+ r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/dataStores/(?P<data_store>.+?)/sessions/(?P<session>.+?)/answers/(?P<answer>.+?)$",
228
+ path,
229
+ )
230
+ return m.groupdict() if m else {}
231
+
232
+ @staticmethod
233
+ def chunk_path(
234
+ project: str,
235
+ location: str,
236
+ data_store: str,
237
+ branch: str,
238
+ document: str,
239
+ chunk: str,
240
+ ) -> str:
241
+ """Returns a fully-qualified chunk string."""
242
+ return "projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}/chunks/{chunk}".format(
243
+ project=project,
244
+ location=location,
245
+ data_store=data_store,
246
+ branch=branch,
247
+ document=document,
248
+ chunk=chunk,
249
+ )
250
+
251
+ @staticmethod
252
+ def parse_chunk_path(path: str) -> Dict[str, str]:
253
+ """Parses a chunk path into its component segments."""
254
+ m = re.match(
255
+ r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/dataStores/(?P<data_store>.+?)/branches/(?P<branch>.+?)/documents/(?P<document>.+?)/chunks/(?P<chunk>.+?)$",
256
+ path,
257
+ )
258
+ return m.groupdict() if m else {}
259
+
260
+ @staticmethod
261
+ def data_store_path(
262
+ project: str,
263
+ location: str,
264
+ data_store: str,
265
+ ) -> str:
266
+ """Returns a fully-qualified data_store string."""
267
+ return "projects/{project}/locations/{location}/dataStores/{data_store}".format(
268
+ project=project,
269
+ location=location,
270
+ data_store=data_store,
271
+ )
272
+
273
+ @staticmethod
274
+ def parse_data_store_path(path: str) -> Dict[str, str]:
275
+ """Parses a data_store path into its component segments."""
276
+ m = re.match(
277
+ r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/dataStores/(?P<data_store>.+?)$",
278
+ path,
279
+ )
280
+ return m.groupdict() if m else {}
281
+
282
+ @staticmethod
283
+ def document_path(
284
+ project: str,
285
+ location: str,
286
+ data_store: str,
287
+ branch: str,
288
+ document: str,
289
+ ) -> str:
290
+ """Returns a fully-qualified document string."""
291
+ return "projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}".format(
292
+ project=project,
293
+ location=location,
294
+ data_store=data_store,
295
+ branch=branch,
296
+ document=document,
297
+ )
298
+
299
+ @staticmethod
300
+ def parse_document_path(path: str) -> Dict[str, str]:
301
+ """Parses a document path into its component segments."""
302
+ m = re.match(
303
+ r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/dataStores/(?P<data_store>.+?)/branches/(?P<branch>.+?)/documents/(?P<document>.+?)$",
304
+ path,
305
+ )
306
+ return m.groupdict() if m else {}
307
+
308
+ @staticmethod
309
+ def session_path(
310
+ project: str,
311
+ location: str,
312
+ data_store: str,
313
+ session: str,
314
+ ) -> str:
315
+ """Returns a fully-qualified session string."""
316
+ return "projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}".format(
317
+ project=project,
318
+ location=location,
319
+ data_store=data_store,
320
+ session=session,
321
+ )
322
+
323
+ @staticmethod
324
+ def parse_session_path(path: str) -> Dict[str, str]:
325
+ """Parses a session path into its component segments."""
326
+ m = re.match(
327
+ r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/dataStores/(?P<data_store>.+?)/sessions/(?P<session>.+?)$",
328
+ path,
329
+ )
330
+ return m.groupdict() if m else {}
331
+
332
+ @staticmethod
333
+ def common_billing_account_path(
334
+ billing_account: str,
335
+ ) -> str:
336
+ """Returns a fully-qualified billing_account string."""
337
+ return "billingAccounts/{billing_account}".format(
338
+ billing_account=billing_account,
339
+ )
340
+
341
+ @staticmethod
342
+ def parse_common_billing_account_path(path: str) -> Dict[str, str]:
343
+ """Parse a billing_account path into its component segments."""
344
+ m = re.match(r"^billingAccounts/(?P<billing_account>.+?)$", path)
345
+ return m.groupdict() if m else {}
346
+
347
+ @staticmethod
348
+ def common_folder_path(
349
+ folder: str,
350
+ ) -> str:
351
+ """Returns a fully-qualified folder string."""
352
+ return "folders/{folder}".format(
353
+ folder=folder,
354
+ )
355
+
356
+ @staticmethod
357
+ def parse_common_folder_path(path: str) -> Dict[str, str]:
358
+ """Parse a folder path into its component segments."""
359
+ m = re.match(r"^folders/(?P<folder>.+?)$", path)
360
+ return m.groupdict() if m else {}
361
+
362
+ @staticmethod
363
+ def common_organization_path(
364
+ organization: str,
365
+ ) -> str:
366
+ """Returns a fully-qualified organization string."""
367
+ return "organizations/{organization}".format(
368
+ organization=organization,
369
+ )
370
+
371
+ @staticmethod
372
+ def parse_common_organization_path(path: str) -> Dict[str, str]:
373
+ """Parse a organization path into its component segments."""
374
+ m = re.match(r"^organizations/(?P<organization>.+?)$", path)
375
+ return m.groupdict() if m else {}
376
+
377
+ @staticmethod
378
+ def common_project_path(
379
+ project: str,
380
+ ) -> str:
381
+ """Returns a fully-qualified project string."""
382
+ return "projects/{project}".format(
383
+ project=project,
384
+ )
385
+
386
+ @staticmethod
387
+ def parse_common_project_path(path: str) -> Dict[str, str]:
388
+ """Parse a project path into its component segments."""
389
+ m = re.match(r"^projects/(?P<project>.+?)$", path)
390
+ return m.groupdict() if m else {}
391
+
392
+ @staticmethod
393
+ def common_location_path(
394
+ project: str,
395
+ location: str,
396
+ ) -> str:
397
+ """Returns a fully-qualified location string."""
398
+ return "projects/{project}/locations/{location}".format(
399
+ project=project,
400
+ location=location,
401
+ )
402
+
403
+ @staticmethod
404
+ def parse_common_location_path(path: str) -> Dict[str, str]:
405
+ """Parse a location path into its component segments."""
406
+ m = re.match(r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)$", path)
407
+ return m.groupdict() if m else {}
408
+
409
+ @classmethod
410
+ def get_mtls_endpoint_and_cert_source(
411
+ cls, client_options: Optional[client_options_lib.ClientOptions] = None
412
+ ):
413
+ """Deprecated. Return the API endpoint and client cert source for mutual TLS.
414
+
415
+ The client cert source is determined in the following order:
416
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
417
+ client cert source is None.
418
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
419
+ default client cert source exists, use the default one; otherwise the client cert
420
+ source is None.
421
+
422
+ The API endpoint is determined in the following order:
423
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
424
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
425
+ default mTLS endpoint; if the environment variable is "never", use the default API
426
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
427
+ use the default API endpoint.
428
+
429
+ More details can be found at https://google.aip.dev/auth/4114.
430
+
431
+ Args:
432
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
433
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
434
+ in this method.
435
+
436
+ Returns:
437
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
438
+ client cert source to use.
439
+
440
+ Raises:
441
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
442
+ """
443
+
444
+ warnings.warn(
445
+ "get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.",
446
+ DeprecationWarning,
447
+ )
448
+ if client_options is None:
449
+ client_options = client_options_lib.ClientOptions()
450
+ use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")
451
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
452
+ if use_client_cert not in ("true", "false"):
453
+ raise ValueError(
454
+ "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
455
+ )
456
+ if use_mtls_endpoint not in ("auto", "never", "always"):
457
+ raise MutualTLSChannelError(
458
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
459
+ )
460
+
461
+ # Figure out the client cert source to use.
462
+ client_cert_source = None
463
+ if use_client_cert == "true":
464
+ if client_options.client_cert_source:
465
+ client_cert_source = client_options.client_cert_source
466
+ elif mtls.has_default_client_cert_source():
467
+ client_cert_source = mtls.default_client_cert_source()
468
+
469
+ # Figure out which api endpoint to use.
470
+ if client_options.api_endpoint is not None:
471
+ api_endpoint = client_options.api_endpoint
472
+ elif use_mtls_endpoint == "always" or (
473
+ use_mtls_endpoint == "auto" and client_cert_source
474
+ ):
475
+ api_endpoint = cls.DEFAULT_MTLS_ENDPOINT
476
+ else:
477
+ api_endpoint = cls.DEFAULT_ENDPOINT
478
+
479
+ return api_endpoint, client_cert_source
480
+
481
+ @staticmethod
482
+ def _read_environment_variables():
483
+ """Returns the environment variables used by the client.
484
+
485
+ Returns:
486
+ Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE,
487
+ GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables.
488
+
489
+ Raises:
490
+ ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not
491
+ any of ["true", "false"].
492
+ google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
493
+ is not any of ["auto", "never", "always"].
494
+ """
495
+ use_client_cert = os.getenv(
496
+ "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
497
+ ).lower()
498
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
499
+ universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
500
+ if use_client_cert not in ("true", "false"):
501
+ raise ValueError(
502
+ "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
503
+ )
504
+ if use_mtls_endpoint not in ("auto", "never", "always"):
505
+ raise MutualTLSChannelError(
506
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
507
+ )
508
+ return use_client_cert == "true", use_mtls_endpoint, universe_domain_env
509
+
510
+ @staticmethod
511
+ def _get_client_cert_source(provided_cert_source, use_cert_flag):
512
+ """Return the client cert source to be used by the client.
513
+
514
+ Args:
515
+ provided_cert_source (bytes): The client certificate source provided.
516
+ use_cert_flag (bool): A flag indicating whether to use the client certificate.
517
+
518
+ Returns:
519
+ bytes or None: The client cert source to be used by the client.
520
+ """
521
+ client_cert_source = None
522
+ if use_cert_flag:
523
+ if provided_cert_source:
524
+ client_cert_source = provided_cert_source
525
+ elif mtls.has_default_client_cert_source():
526
+ client_cert_source = mtls.default_client_cert_source()
527
+ return client_cert_source
528
+
529
+ @staticmethod
530
+ def _get_api_endpoint(
531
+ api_override, client_cert_source, universe_domain, use_mtls_endpoint
532
+ ):
533
+ """Return the API endpoint used by the client.
534
+
535
+ Args:
536
+ api_override (str): The API endpoint override. If specified, this is always
537
+ the return value of this function and the other arguments are not used.
538
+ client_cert_source (bytes): The client certificate source used by the client.
539
+ universe_domain (str): The universe domain used by the client.
540
+ use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters.
541
+ Possible values are "always", "auto", or "never".
542
+
543
+ Returns:
544
+ str: The API endpoint to be used by the client.
545
+ """
546
+ if api_override is not None:
547
+ api_endpoint = api_override
548
+ elif use_mtls_endpoint == "always" or (
549
+ use_mtls_endpoint == "auto" and client_cert_source
550
+ ):
551
+ _default_universe = SessionServiceClient._DEFAULT_UNIVERSE
552
+ if universe_domain != _default_universe:
553
+ raise MutualTLSChannelError(
554
+ f"mTLS is not supported in any universe other than {_default_universe}."
555
+ )
556
+ api_endpoint = SessionServiceClient.DEFAULT_MTLS_ENDPOINT
557
+ else:
558
+ api_endpoint = SessionServiceClient._DEFAULT_ENDPOINT_TEMPLATE.format(
559
+ UNIVERSE_DOMAIN=universe_domain
560
+ )
561
+ return api_endpoint
562
+
563
+ @staticmethod
564
+ def _get_universe_domain(
565
+ client_universe_domain: Optional[str], universe_domain_env: Optional[str]
566
+ ) -> str:
567
+ """Return the universe domain used by the client.
568
+
569
+ Args:
570
+ client_universe_domain (Optional[str]): The universe domain configured via the client options.
571
+ universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable.
572
+
573
+ Returns:
574
+ str: The universe domain to be used by the client.
575
+
576
+ Raises:
577
+ ValueError: If the universe domain is an empty string.
578
+ """
579
+ universe_domain = SessionServiceClient._DEFAULT_UNIVERSE
580
+ if client_universe_domain is not None:
581
+ universe_domain = client_universe_domain
582
+ elif universe_domain_env is not None:
583
+ universe_domain = universe_domain_env
584
+ if len(universe_domain.strip()) == 0:
585
+ raise ValueError("Universe Domain cannot be an empty string.")
586
+ return universe_domain
587
+
588
+ def _validate_universe_domain(self):
589
+ """Validates client's and credentials' universe domains are consistent.
590
+
591
+ Returns:
592
+ bool: True iff the configured universe domain is valid.
593
+
594
+ Raises:
595
+ ValueError: If the configured universe domain is not valid.
596
+ """
597
+
598
+ # NOTE (b/349488459): universe validation is disabled until further notice.
599
+ return True
600
+
601
+ def _add_cred_info_for_auth_errors(
602
+ self, error: core_exceptions.GoogleAPICallError
603
+ ) -> None:
604
+ """Adds credential info string to error details for 401/403/404 errors.
605
+
606
+ Args:
607
+ error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
608
+ """
609
+ if error.code not in [
610
+ HTTPStatus.UNAUTHORIZED,
611
+ HTTPStatus.FORBIDDEN,
612
+ HTTPStatus.NOT_FOUND,
613
+ ]:
614
+ return
615
+
616
+ cred = self._transport._credentials
617
+
618
+ # get_cred_info is only available in google-auth>=2.35.0
619
+ if not hasattr(cred, "get_cred_info"):
620
+ return
621
+
622
+ # ignore the type check since pypy test fails when get_cred_info
623
+ # is not available
624
+ cred_info = cred.get_cred_info() # type: ignore
625
+ if cred_info and hasattr(error._details, "append"):
626
+ error._details.append(json.dumps(cred_info))
627
+
628
+ @property
629
+ def api_endpoint(self):
630
+ """Return the API endpoint used by the client instance.
631
+
632
+ Returns:
633
+ str: The API endpoint used by the client instance.
634
+ """
635
+ return self._api_endpoint
636
+
637
+ @property
638
+ def universe_domain(self) -> str:
639
+ """Return the universe domain used by the client instance.
640
+
641
+ Returns:
642
+ str: The universe domain used by the client instance.
643
+ """
644
+ return self._universe_domain
645
+
646
+ def __init__(
647
+ self,
648
+ *,
649
+ credentials: Optional[ga_credentials.Credentials] = None,
650
+ transport: Optional[
651
+ Union[str, SessionServiceTransport, Callable[..., SessionServiceTransport]]
652
+ ] = None,
653
+ client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
654
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
655
+ ) -> None:
656
+ """Instantiates the session service client.
657
+
658
+ Args:
659
+ credentials (Optional[google.auth.credentials.Credentials]): The
660
+ authorization credentials to attach to requests. These
661
+ credentials identify the application to the service; if none
662
+ are specified, the client will attempt to ascertain the
663
+ credentials from the environment.
664
+ transport (Optional[Union[str,SessionServiceTransport,Callable[..., SessionServiceTransport]]]):
665
+ The transport to use, or a Callable that constructs and returns a new transport.
666
+ If a Callable is given, it will be called with the same set of initialization
667
+ arguments as used in the SessionServiceTransport constructor.
668
+ If set to None, a transport is chosen automatically.
669
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
670
+ Custom options for the client.
671
+
672
+ 1. The ``api_endpoint`` property can be used to override the
673
+ default endpoint provided by the client when ``transport`` is
674
+ not explicitly provided. Only if this property is not set and
675
+ ``transport`` was not explicitly provided, the endpoint is
676
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
677
+ variable, which have one of the following values:
678
+ "always" (always use the default mTLS endpoint), "never" (always
679
+ use the default regular endpoint) and "auto" (auto-switch to the
680
+ default mTLS endpoint if client certificate is present; this is
681
+ the default value).
682
+
683
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
684
+ is "true", then the ``client_cert_source`` property can be used
685
+ to provide a client certificate for mTLS transport. If
686
+ not provided, the default SSL client certificate will be used if
687
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
688
+ set, no client certificate will be used.
689
+
690
+ 3. The ``universe_domain`` property can be used to override the
691
+ default "googleapis.com" universe. Note that the ``api_endpoint``
692
+ property still takes precedence; and ``universe_domain`` is
693
+ currently not supported for mTLS.
694
+
695
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
696
+ The client info used to send a user-agent string along with
697
+ API requests. If ``None``, then default info will be used.
698
+ Generally, you only need to set this if you're developing
699
+ your own client library.
700
+
701
+ Raises:
702
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
703
+ creation failed for any reason.
704
+ """
705
+ self._client_options = client_options
706
+ if isinstance(self._client_options, dict):
707
+ self._client_options = client_options_lib.from_dict(self._client_options)
708
+ if self._client_options is None:
709
+ self._client_options = client_options_lib.ClientOptions()
710
+ self._client_options = cast(
711
+ client_options_lib.ClientOptions, self._client_options
712
+ )
713
+
714
+ universe_domain_opt = getattr(self._client_options, "universe_domain", None)
715
+
716
+ (
717
+ self._use_client_cert,
718
+ self._use_mtls_endpoint,
719
+ self._universe_domain_env,
720
+ ) = SessionServiceClient._read_environment_variables()
721
+ self._client_cert_source = SessionServiceClient._get_client_cert_source(
722
+ self._client_options.client_cert_source, self._use_client_cert
723
+ )
724
+ self._universe_domain = SessionServiceClient._get_universe_domain(
725
+ universe_domain_opt, self._universe_domain_env
726
+ )
727
+ self._api_endpoint = None # updated below, depending on `transport`
728
+
729
+ # Initialize the universe domain validation.
730
+ self._is_universe_domain_valid = False
731
+
732
+ if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER
733
+ # Setup logging.
734
+ client_logging.initialize_logging()
735
+
736
+ api_key_value = getattr(self._client_options, "api_key", None)
737
+ if api_key_value and credentials:
738
+ raise ValueError(
739
+ "client_options.api_key and credentials are mutually exclusive"
740
+ )
741
+
742
+ # Save or instantiate the transport.
743
+ # Ordinarily, we provide the transport, but allowing a custom transport
744
+ # instance provides an extensibility point for unusual situations.
745
+ transport_provided = isinstance(transport, SessionServiceTransport)
746
+ if transport_provided:
747
+ # transport is a SessionServiceTransport instance.
748
+ if credentials or self._client_options.credentials_file or api_key_value:
749
+ raise ValueError(
750
+ "When providing a transport instance, "
751
+ "provide its credentials directly."
752
+ )
753
+ if self._client_options.scopes:
754
+ raise ValueError(
755
+ "When providing a transport instance, provide its scopes "
756
+ "directly."
757
+ )
758
+ self._transport = cast(SessionServiceTransport, transport)
759
+ self._api_endpoint = self._transport.host
760
+
761
+ self._api_endpoint = (
762
+ self._api_endpoint
763
+ or SessionServiceClient._get_api_endpoint(
764
+ self._client_options.api_endpoint,
765
+ self._client_cert_source,
766
+ self._universe_domain,
767
+ self._use_mtls_endpoint,
768
+ )
769
+ )
770
+
771
+ if not transport_provided:
772
+ import google.auth._default # type: ignore
773
+
774
+ if api_key_value and hasattr(
775
+ google.auth._default, "get_api_key_credentials"
776
+ ):
777
+ credentials = google.auth._default.get_api_key_credentials(
778
+ api_key_value
779
+ )
780
+
781
+ transport_init: Union[
782
+ Type[SessionServiceTransport], Callable[..., SessionServiceTransport]
783
+ ] = (
784
+ SessionServiceClient.get_transport_class(transport)
785
+ if isinstance(transport, str) or transport is None
786
+ else cast(Callable[..., SessionServiceTransport], transport)
787
+ )
788
+ # initialize with the provided callable or the passed in class
789
+ self._transport = transport_init(
790
+ credentials=credentials,
791
+ credentials_file=self._client_options.credentials_file,
792
+ host=self._api_endpoint,
793
+ scopes=self._client_options.scopes,
794
+ client_cert_source_for_mtls=self._client_cert_source,
795
+ quota_project_id=self._client_options.quota_project_id,
796
+ client_info=client_info,
797
+ always_use_jwt_access=True,
798
+ api_audience=self._client_options.api_audience,
799
+ )
800
+
801
+ if "async" not in str(self._transport):
802
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
803
+ std_logging.DEBUG
804
+ ): # pragma: NO COVER
805
+ _LOGGER.debug(
806
+ "Created client `google.cloud.discoveryengine_v1beta.SessionServiceClient`.",
807
+ extra={
808
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
809
+ "universeDomain": getattr(
810
+ self._transport._credentials, "universe_domain", ""
811
+ ),
812
+ "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}",
813
+ "credentialsInfo": getattr(
814
+ self.transport._credentials, "get_cred_info", lambda: None
815
+ )(),
816
+ }
817
+ if hasattr(self._transport, "_credentials")
818
+ else {
819
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
820
+ "credentialsType": None,
821
+ },
822
+ )
823
+
824
+ def create_session(
825
+ self,
826
+ request: Optional[
827
+ Union[conversational_search_service.CreateSessionRequest, dict]
828
+ ] = None,
829
+ *,
830
+ parent: Optional[str] = None,
831
+ session: Optional[gcd_session.Session] = None,
832
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
833
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
834
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
835
+ ) -> gcd_session.Session:
836
+ r"""Creates a Session.
837
+
838
+ If the [Session][google.cloud.discoveryengine.v1beta.Session] to
839
+ create already exists, an ALREADY_EXISTS error is returned.
840
+
841
+ .. code-block:: python
842
+
843
+ # This snippet has been automatically generated and should be regarded as a
844
+ # code template only.
845
+ # It will require modifications to work:
846
+ # - It may require correct/in-range values for request initialization.
847
+ # - It may require specifying regional endpoints when creating the service
848
+ # client as shown in:
849
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
850
+ from google.cloud import discoveryengine_v1beta
851
+
852
+ def sample_create_session():
853
+ # Create a client
854
+ client = discoveryengine_v1beta.SessionServiceClient()
855
+
856
+ # Initialize request argument(s)
857
+ request = discoveryengine_v1beta.CreateSessionRequest(
858
+ parent="parent_value",
859
+ )
860
+
861
+ # Make the request
862
+ response = client.create_session(request=request)
863
+
864
+ # Handle the response
865
+ print(response)
866
+
867
+ Args:
868
+ request (Union[google.cloud.discoveryengine_v1beta.types.CreateSessionRequest, dict]):
869
+ The request object. Request for CreateSession method.
870
+ parent (str):
871
+ Required. Full resource name of parent data store.
872
+ Format:
873
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}``
874
+
875
+ This corresponds to the ``parent`` field
876
+ on the ``request`` instance; if ``request`` is provided, this
877
+ should not be set.
878
+ session (google.cloud.discoveryengine_v1beta.types.Session):
879
+ Required. The session to create.
880
+ This corresponds to the ``session`` field
881
+ on the ``request`` instance; if ``request`` is provided, this
882
+ should not be set.
883
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
884
+ should be retried.
885
+ timeout (float): The timeout for this request.
886
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
887
+ sent along with the request as metadata. Normally, each value must be of type `str`,
888
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
889
+ be of type `bytes`.
890
+
891
+ Returns:
892
+ google.cloud.discoveryengine_v1beta.types.Session:
893
+ External session proto definition.
894
+ """
895
+ # Create or coerce a protobuf request object.
896
+ # - Quick check: If we got a request object, we should *not* have
897
+ # gotten any keyword arguments that map to the request.
898
+ flattened_params = [parent, session]
899
+ has_flattened_params = (
900
+ len([param for param in flattened_params if param is not None]) > 0
901
+ )
902
+ if request is not None and has_flattened_params:
903
+ raise ValueError(
904
+ "If the `request` argument is set, then none of "
905
+ "the individual field arguments should be set."
906
+ )
907
+
908
+ # - Use the request object if provided (there's no risk of modifying the input as
909
+ # there are no flattened fields), or create one.
910
+ if not isinstance(request, conversational_search_service.CreateSessionRequest):
911
+ request = conversational_search_service.CreateSessionRequest(request)
912
+ # If we have keyword arguments corresponding to fields on the
913
+ # request, apply these.
914
+ if parent is not None:
915
+ request.parent = parent
916
+ if session is not None:
917
+ request.session = session
918
+
919
+ # Wrap the RPC method; this adds retry and timeout information,
920
+ # and friendly error handling.
921
+ rpc = self._transport._wrapped_methods[self._transport.create_session]
922
+
923
+ # Certain fields should be provided within the metadata header;
924
+ # add these here.
925
+ metadata = tuple(metadata) + (
926
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
927
+ )
928
+
929
+ # Validate the universe domain.
930
+ self._validate_universe_domain()
931
+
932
+ # Send the request.
933
+ response = rpc(
934
+ request,
935
+ retry=retry,
936
+ timeout=timeout,
937
+ metadata=metadata,
938
+ )
939
+
940
+ # Done; return the response.
941
+ return response
942
+
943
+ def delete_session(
944
+ self,
945
+ request: Optional[
946
+ Union[conversational_search_service.DeleteSessionRequest, dict]
947
+ ] = None,
948
+ *,
949
+ name: Optional[str] = None,
950
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
951
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
952
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
953
+ ) -> None:
954
+ r"""Deletes a Session.
955
+
956
+ If the [Session][google.cloud.discoveryengine.v1beta.Session] to
957
+ delete does not exist, a NOT_FOUND error is returned.
958
+
959
+ .. code-block:: python
960
+
961
+ # This snippet has been automatically generated and should be regarded as a
962
+ # code template only.
963
+ # It will require modifications to work:
964
+ # - It may require correct/in-range values for request initialization.
965
+ # - It may require specifying regional endpoints when creating the service
966
+ # client as shown in:
967
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
968
+ from google.cloud import discoveryengine_v1beta
969
+
970
+ def sample_delete_session():
971
+ # Create a client
972
+ client = discoveryengine_v1beta.SessionServiceClient()
973
+
974
+ # Initialize request argument(s)
975
+ request = discoveryengine_v1beta.DeleteSessionRequest(
976
+ name="name_value",
977
+ )
978
+
979
+ # Make the request
980
+ client.delete_session(request=request)
981
+
982
+ Args:
983
+ request (Union[google.cloud.discoveryengine_v1beta.types.DeleteSessionRequest, dict]):
984
+ The request object. Request for DeleteSession method.
985
+ name (str):
986
+ Required. The resource name of the Session to delete.
987
+ Format:
988
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}``
989
+
990
+ This corresponds to the ``name`` field
991
+ on the ``request`` instance; if ``request`` is provided, this
992
+ should not be set.
993
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
994
+ should be retried.
995
+ timeout (float): The timeout for this request.
996
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
997
+ sent along with the request as metadata. Normally, each value must be of type `str`,
998
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
999
+ be of type `bytes`.
1000
+ """
1001
+ # Create or coerce a protobuf request object.
1002
+ # - Quick check: If we got a request object, we should *not* have
1003
+ # gotten any keyword arguments that map to the request.
1004
+ flattened_params = [name]
1005
+ has_flattened_params = (
1006
+ len([param for param in flattened_params if param is not None]) > 0
1007
+ )
1008
+ if request is not None and has_flattened_params:
1009
+ raise ValueError(
1010
+ "If the `request` argument is set, then none of "
1011
+ "the individual field arguments should be set."
1012
+ )
1013
+
1014
+ # - Use the request object if provided (there's no risk of modifying the input as
1015
+ # there are no flattened fields), or create one.
1016
+ if not isinstance(request, conversational_search_service.DeleteSessionRequest):
1017
+ request = conversational_search_service.DeleteSessionRequest(request)
1018
+ # If we have keyword arguments corresponding to fields on the
1019
+ # request, apply these.
1020
+ if name is not None:
1021
+ request.name = name
1022
+
1023
+ # Wrap the RPC method; this adds retry and timeout information,
1024
+ # and friendly error handling.
1025
+ rpc = self._transport._wrapped_methods[self._transport.delete_session]
1026
+
1027
+ # Certain fields should be provided within the metadata header;
1028
+ # add these here.
1029
+ metadata = tuple(metadata) + (
1030
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1031
+ )
1032
+
1033
+ # Validate the universe domain.
1034
+ self._validate_universe_domain()
1035
+
1036
+ # Send the request.
1037
+ rpc(
1038
+ request,
1039
+ retry=retry,
1040
+ timeout=timeout,
1041
+ metadata=metadata,
1042
+ )
1043
+
1044
+ def update_session(
1045
+ self,
1046
+ request: Optional[
1047
+ Union[conversational_search_service.UpdateSessionRequest, dict]
1048
+ ] = None,
1049
+ *,
1050
+ session: Optional[gcd_session.Session] = None,
1051
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
1052
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1053
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1054
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1055
+ ) -> gcd_session.Session:
1056
+ r"""Updates a Session.
1057
+
1058
+ [Session][google.cloud.discoveryengine.v1beta.Session] action
1059
+ type cannot be changed. If the
1060
+ [Session][google.cloud.discoveryengine.v1beta.Session] to update
1061
+ does not exist, a NOT_FOUND error is returned.
1062
+
1063
+ .. code-block:: python
1064
+
1065
+ # This snippet has been automatically generated and should be regarded as a
1066
+ # code template only.
1067
+ # It will require modifications to work:
1068
+ # - It may require correct/in-range values for request initialization.
1069
+ # - It may require specifying regional endpoints when creating the service
1070
+ # client as shown in:
1071
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1072
+ from google.cloud import discoveryengine_v1beta
1073
+
1074
+ def sample_update_session():
1075
+ # Create a client
1076
+ client = discoveryengine_v1beta.SessionServiceClient()
1077
+
1078
+ # Initialize request argument(s)
1079
+ request = discoveryengine_v1beta.UpdateSessionRequest(
1080
+ )
1081
+
1082
+ # Make the request
1083
+ response = client.update_session(request=request)
1084
+
1085
+ # Handle the response
1086
+ print(response)
1087
+
1088
+ Args:
1089
+ request (Union[google.cloud.discoveryengine_v1beta.types.UpdateSessionRequest, dict]):
1090
+ The request object. Request for UpdateSession method.
1091
+ session (google.cloud.discoveryengine_v1beta.types.Session):
1092
+ Required. The Session to update.
1093
+ This corresponds to the ``session`` field
1094
+ on the ``request`` instance; if ``request`` is provided, this
1095
+ should not be set.
1096
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
1097
+ Indicates which fields in the provided
1098
+ [Session][google.cloud.discoveryengine.v1beta.Session]
1099
+ to update. The following are NOT supported:
1100
+
1101
+ - [Session.name][google.cloud.discoveryengine.v1beta.Session.name]
1102
+
1103
+ If not set or empty, all supported fields are updated.
1104
+
1105
+ This corresponds to the ``update_mask`` field
1106
+ on the ``request`` instance; if ``request`` is provided, this
1107
+ should not be set.
1108
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1109
+ should be retried.
1110
+ timeout (float): The timeout for this request.
1111
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1112
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1113
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1114
+ be of type `bytes`.
1115
+
1116
+ Returns:
1117
+ google.cloud.discoveryengine_v1beta.types.Session:
1118
+ External session proto definition.
1119
+ """
1120
+ # Create or coerce a protobuf request object.
1121
+ # - Quick check: If we got a request object, we should *not* have
1122
+ # gotten any keyword arguments that map to the request.
1123
+ flattened_params = [session, update_mask]
1124
+ has_flattened_params = (
1125
+ len([param for param in flattened_params if param is not None]) > 0
1126
+ )
1127
+ if request is not None and has_flattened_params:
1128
+ raise ValueError(
1129
+ "If the `request` argument is set, then none of "
1130
+ "the individual field arguments should be set."
1131
+ )
1132
+
1133
+ # - Use the request object if provided (there's no risk of modifying the input as
1134
+ # there are no flattened fields), or create one.
1135
+ if not isinstance(request, conversational_search_service.UpdateSessionRequest):
1136
+ request = conversational_search_service.UpdateSessionRequest(request)
1137
+ # If we have keyword arguments corresponding to fields on the
1138
+ # request, apply these.
1139
+ if session is not None:
1140
+ request.session = session
1141
+ if update_mask is not None:
1142
+ request.update_mask = update_mask
1143
+
1144
+ # Wrap the RPC method; this adds retry and timeout information,
1145
+ # and friendly error handling.
1146
+ rpc = self._transport._wrapped_methods[self._transport.update_session]
1147
+
1148
+ # Certain fields should be provided within the metadata header;
1149
+ # add these here.
1150
+ metadata = tuple(metadata) + (
1151
+ gapic_v1.routing_header.to_grpc_metadata(
1152
+ (("session.name", request.session.name),)
1153
+ ),
1154
+ )
1155
+
1156
+ # Validate the universe domain.
1157
+ self._validate_universe_domain()
1158
+
1159
+ # Send the request.
1160
+ response = rpc(
1161
+ request,
1162
+ retry=retry,
1163
+ timeout=timeout,
1164
+ metadata=metadata,
1165
+ )
1166
+
1167
+ # Done; return the response.
1168
+ return response
1169
+
1170
+ def get_session(
1171
+ self,
1172
+ request: Optional[
1173
+ Union[conversational_search_service.GetSessionRequest, dict]
1174
+ ] = None,
1175
+ *,
1176
+ name: Optional[str] = None,
1177
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1178
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1179
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1180
+ ) -> session.Session:
1181
+ r"""Gets a Session.
1182
+
1183
+ .. code-block:: python
1184
+
1185
+ # This snippet has been automatically generated and should be regarded as a
1186
+ # code template only.
1187
+ # It will require modifications to work:
1188
+ # - It may require correct/in-range values for request initialization.
1189
+ # - It may require specifying regional endpoints when creating the service
1190
+ # client as shown in:
1191
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1192
+ from google.cloud import discoveryengine_v1beta
1193
+
1194
+ def sample_get_session():
1195
+ # Create a client
1196
+ client = discoveryengine_v1beta.SessionServiceClient()
1197
+
1198
+ # Initialize request argument(s)
1199
+ request = discoveryengine_v1beta.GetSessionRequest(
1200
+ name="name_value",
1201
+ )
1202
+
1203
+ # Make the request
1204
+ response = client.get_session(request=request)
1205
+
1206
+ # Handle the response
1207
+ print(response)
1208
+
1209
+ Args:
1210
+ request (Union[google.cloud.discoveryengine_v1beta.types.GetSessionRequest, dict]):
1211
+ The request object. Request for GetSession method.
1212
+ name (str):
1213
+ Required. The resource name of the Session to get.
1214
+ Format:
1215
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}``
1216
+
1217
+ This corresponds to the ``name`` field
1218
+ on the ``request`` instance; if ``request`` is provided, this
1219
+ should not be set.
1220
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1221
+ should be retried.
1222
+ timeout (float): The timeout for this request.
1223
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1224
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1225
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1226
+ be of type `bytes`.
1227
+
1228
+ Returns:
1229
+ google.cloud.discoveryengine_v1beta.types.Session:
1230
+ External session proto definition.
1231
+ """
1232
+ # Create or coerce a protobuf request object.
1233
+ # - Quick check: If we got a request object, we should *not* have
1234
+ # gotten any keyword arguments that map to the request.
1235
+ flattened_params = [name]
1236
+ has_flattened_params = (
1237
+ len([param for param in flattened_params if param is not None]) > 0
1238
+ )
1239
+ if request is not None and has_flattened_params:
1240
+ raise ValueError(
1241
+ "If the `request` argument is set, then none of "
1242
+ "the individual field arguments should be set."
1243
+ )
1244
+
1245
+ # - Use the request object if provided (there's no risk of modifying the input as
1246
+ # there are no flattened fields), or create one.
1247
+ if not isinstance(request, conversational_search_service.GetSessionRequest):
1248
+ request = conversational_search_service.GetSessionRequest(request)
1249
+ # If we have keyword arguments corresponding to fields on the
1250
+ # request, apply these.
1251
+ if name is not None:
1252
+ request.name = name
1253
+
1254
+ # Wrap the RPC method; this adds retry and timeout information,
1255
+ # and friendly error handling.
1256
+ rpc = self._transport._wrapped_methods[self._transport.get_session]
1257
+
1258
+ # Certain fields should be provided within the metadata header;
1259
+ # add these here.
1260
+ metadata = tuple(metadata) + (
1261
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1262
+ )
1263
+
1264
+ # Validate the universe domain.
1265
+ self._validate_universe_domain()
1266
+
1267
+ # Send the request.
1268
+ response = rpc(
1269
+ request,
1270
+ retry=retry,
1271
+ timeout=timeout,
1272
+ metadata=metadata,
1273
+ )
1274
+
1275
+ # Done; return the response.
1276
+ return response
1277
+
1278
+ def list_sessions(
1279
+ self,
1280
+ request: Optional[
1281
+ Union[conversational_search_service.ListSessionsRequest, dict]
1282
+ ] = None,
1283
+ *,
1284
+ parent: Optional[str] = None,
1285
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1286
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1287
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1288
+ ) -> pagers.ListSessionsPager:
1289
+ r"""Lists all Sessions by their parent
1290
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
1291
+
1292
+ .. code-block:: python
1293
+
1294
+ # This snippet has been automatically generated and should be regarded as a
1295
+ # code template only.
1296
+ # It will require modifications to work:
1297
+ # - It may require correct/in-range values for request initialization.
1298
+ # - It may require specifying regional endpoints when creating the service
1299
+ # client as shown in:
1300
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1301
+ from google.cloud import discoveryengine_v1beta
1302
+
1303
+ def sample_list_sessions():
1304
+ # Create a client
1305
+ client = discoveryengine_v1beta.SessionServiceClient()
1306
+
1307
+ # Initialize request argument(s)
1308
+ request = discoveryengine_v1beta.ListSessionsRequest(
1309
+ parent="parent_value",
1310
+ )
1311
+
1312
+ # Make the request
1313
+ page_result = client.list_sessions(request=request)
1314
+
1315
+ # Handle the response
1316
+ for response in page_result:
1317
+ print(response)
1318
+
1319
+ Args:
1320
+ request (Union[google.cloud.discoveryengine_v1beta.types.ListSessionsRequest, dict]):
1321
+ The request object. Request for ListSessions method.
1322
+ parent (str):
1323
+ Required. The data store resource name. Format:
1324
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}``
1325
+
1326
+ This corresponds to the ``parent`` field
1327
+ on the ``request`` instance; if ``request`` is provided, this
1328
+ should not be set.
1329
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1330
+ should be retried.
1331
+ timeout (float): The timeout for this request.
1332
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1333
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1334
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1335
+ be of type `bytes`.
1336
+
1337
+ Returns:
1338
+ google.cloud.discoveryengine_v1beta.services.session_service.pagers.ListSessionsPager:
1339
+ Response for ListSessions method.
1340
+
1341
+ Iterating over this object will yield
1342
+ results and resolve additional pages
1343
+ automatically.
1344
+
1345
+ """
1346
+ # Create or coerce a protobuf request object.
1347
+ # - Quick check: If we got a request object, we should *not* have
1348
+ # gotten any keyword arguments that map to the request.
1349
+ flattened_params = [parent]
1350
+ has_flattened_params = (
1351
+ len([param for param in flattened_params if param is not None]) > 0
1352
+ )
1353
+ if request is not None and has_flattened_params:
1354
+ raise ValueError(
1355
+ "If the `request` argument is set, then none of "
1356
+ "the individual field arguments should be set."
1357
+ )
1358
+
1359
+ # - Use the request object if provided (there's no risk of modifying the input as
1360
+ # there are no flattened fields), or create one.
1361
+ if not isinstance(request, conversational_search_service.ListSessionsRequest):
1362
+ request = conversational_search_service.ListSessionsRequest(request)
1363
+ # If we have keyword arguments corresponding to fields on the
1364
+ # request, apply these.
1365
+ if parent is not None:
1366
+ request.parent = parent
1367
+
1368
+ # Wrap the RPC method; this adds retry and timeout information,
1369
+ # and friendly error handling.
1370
+ rpc = self._transport._wrapped_methods[self._transport.list_sessions]
1371
+
1372
+ # Certain fields should be provided within the metadata header;
1373
+ # add these here.
1374
+ metadata = tuple(metadata) + (
1375
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1376
+ )
1377
+
1378
+ # Validate the universe domain.
1379
+ self._validate_universe_domain()
1380
+
1381
+ # Send the request.
1382
+ response = rpc(
1383
+ request,
1384
+ retry=retry,
1385
+ timeout=timeout,
1386
+ metadata=metadata,
1387
+ )
1388
+
1389
+ # This method is paged; wrap the response in a pager, which provides
1390
+ # an `__iter__` convenience method.
1391
+ response = pagers.ListSessionsPager(
1392
+ method=rpc,
1393
+ request=request,
1394
+ response=response,
1395
+ retry=retry,
1396
+ timeout=timeout,
1397
+ metadata=metadata,
1398
+ )
1399
+
1400
+ # Done; return the response.
1401
+ return response
1402
+
1403
+ def __enter__(self) -> "SessionServiceClient":
1404
+ return self
1405
+
1406
+ def __exit__(self, type, value, traceback):
1407
+ """Releases underlying transport's resources.
1408
+
1409
+ .. warning::
1410
+ ONLY use as a context manager if the transport is NOT shared
1411
+ with other clients! Exiting the with block will CLOSE the transport
1412
+ and may cause errors in other clients!
1413
+ """
1414
+ self.transport.close()
1415
+
1416
+ def list_operations(
1417
+ self,
1418
+ request: Optional[operations_pb2.ListOperationsRequest] = None,
1419
+ *,
1420
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1421
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1422
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1423
+ ) -> operations_pb2.ListOperationsResponse:
1424
+ r"""Lists operations that match the specified filter in the request.
1425
+
1426
+ Args:
1427
+ request (:class:`~.operations_pb2.ListOperationsRequest`):
1428
+ The request object. Request message for
1429
+ `ListOperations` method.
1430
+ retry (google.api_core.retry.Retry): Designation of what errors,
1431
+ if any, should be retried.
1432
+ timeout (float): The timeout for this request.
1433
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1434
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1435
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1436
+ be of type `bytes`.
1437
+ Returns:
1438
+ ~.operations_pb2.ListOperationsResponse:
1439
+ Response message for ``ListOperations`` method.
1440
+ """
1441
+ # Create or coerce a protobuf request object.
1442
+ # The request isn't a proto-plus wrapped type,
1443
+ # so it must be constructed via keyword expansion.
1444
+ if isinstance(request, dict):
1445
+ request = operations_pb2.ListOperationsRequest(**request)
1446
+
1447
+ # Wrap the RPC method; this adds retry and timeout information,
1448
+ # and friendly error handling.
1449
+ rpc = self._transport._wrapped_methods[self._transport.list_operations]
1450
+
1451
+ # Certain fields should be provided within the metadata header;
1452
+ # add these here.
1453
+ metadata = tuple(metadata) + (
1454
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1455
+ )
1456
+
1457
+ # Validate the universe domain.
1458
+ self._validate_universe_domain()
1459
+
1460
+ try:
1461
+ # Send the request.
1462
+ response = rpc(
1463
+ request,
1464
+ retry=retry,
1465
+ timeout=timeout,
1466
+ metadata=metadata,
1467
+ )
1468
+
1469
+ # Done; return the response.
1470
+ return response
1471
+ except core_exceptions.GoogleAPICallError as e:
1472
+ self._add_cred_info_for_auth_errors(e)
1473
+ raise e
1474
+
1475
+ def get_operation(
1476
+ self,
1477
+ request: Optional[operations_pb2.GetOperationRequest] = None,
1478
+ *,
1479
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1480
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1481
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1482
+ ) -> operations_pb2.Operation:
1483
+ r"""Gets the latest state of a long-running operation.
1484
+
1485
+ Args:
1486
+ request (:class:`~.operations_pb2.GetOperationRequest`):
1487
+ The request object. Request message for
1488
+ `GetOperation` method.
1489
+ retry (google.api_core.retry.Retry): Designation of what errors,
1490
+ if any, should be retried.
1491
+ timeout (float): The timeout for this request.
1492
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1493
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1494
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1495
+ be of type `bytes`.
1496
+ Returns:
1497
+ ~.operations_pb2.Operation:
1498
+ An ``Operation`` object.
1499
+ """
1500
+ # Create or coerce a protobuf request object.
1501
+ # The request isn't a proto-plus wrapped type,
1502
+ # so it must be constructed via keyword expansion.
1503
+ if isinstance(request, dict):
1504
+ request = operations_pb2.GetOperationRequest(**request)
1505
+
1506
+ # Wrap the RPC method; this adds retry and timeout information,
1507
+ # and friendly error handling.
1508
+ rpc = self._transport._wrapped_methods[self._transport.get_operation]
1509
+
1510
+ # Certain fields should be provided within the metadata header;
1511
+ # add these here.
1512
+ metadata = tuple(metadata) + (
1513
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1514
+ )
1515
+
1516
+ # Validate the universe domain.
1517
+ self._validate_universe_domain()
1518
+
1519
+ try:
1520
+ # Send the request.
1521
+ response = rpc(
1522
+ request,
1523
+ retry=retry,
1524
+ timeout=timeout,
1525
+ metadata=metadata,
1526
+ )
1527
+
1528
+ # Done; return the response.
1529
+ return response
1530
+ except core_exceptions.GoogleAPICallError as e:
1531
+ self._add_cred_info_for_auth_errors(e)
1532
+ raise e
1533
+
1534
+ def cancel_operation(
1535
+ self,
1536
+ request: Optional[operations_pb2.CancelOperationRequest] = None,
1537
+ *,
1538
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1539
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1540
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1541
+ ) -> None:
1542
+ r"""Starts asynchronous cancellation on a long-running operation.
1543
+
1544
+ The server makes a best effort to cancel the operation, but success
1545
+ is not guaranteed. If the server doesn't support this method, it returns
1546
+ `google.rpc.Code.UNIMPLEMENTED`.
1547
+
1548
+ Args:
1549
+ request (:class:`~.operations_pb2.CancelOperationRequest`):
1550
+ The request object. Request message for
1551
+ `CancelOperation` method.
1552
+ retry (google.api_core.retry.Retry): Designation of what errors,
1553
+ if any, should be retried.
1554
+ timeout (float): The timeout for this request.
1555
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1556
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1557
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1558
+ be of type `bytes`.
1559
+ Returns:
1560
+ None
1561
+ """
1562
+ # Create or coerce a protobuf request object.
1563
+ # The request isn't a proto-plus wrapped type,
1564
+ # so it must be constructed via keyword expansion.
1565
+ if isinstance(request, dict):
1566
+ request = operations_pb2.CancelOperationRequest(**request)
1567
+
1568
+ # Wrap the RPC method; this adds retry and timeout information,
1569
+ # and friendly error handling.
1570
+ rpc = self._transport._wrapped_methods[self._transport.cancel_operation]
1571
+
1572
+ # Certain fields should be provided within the metadata header;
1573
+ # add these here.
1574
+ metadata = tuple(metadata) + (
1575
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1576
+ )
1577
+
1578
+ # Validate the universe domain.
1579
+ self._validate_universe_domain()
1580
+
1581
+ # Send the request.
1582
+ rpc(
1583
+ request,
1584
+ retry=retry,
1585
+ timeout=timeout,
1586
+ metadata=metadata,
1587
+ )
1588
+
1589
+
1590
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1591
+ gapic_version=package_version.__version__
1592
+ )
1593
+
1594
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1595
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1596
+
1597
+ __all__ = ("SessionServiceClient",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/pagers.py ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from typing import (
17
+ Any,
18
+ AsyncIterator,
19
+ Awaitable,
20
+ Callable,
21
+ Iterator,
22
+ Optional,
23
+ Sequence,
24
+ Tuple,
25
+ Union,
26
+ )
27
+
28
+ from google.api_core import gapic_v1
29
+ from google.api_core import retry as retries
30
+ from google.api_core import retry_async as retries_async
31
+
32
+ try:
33
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
34
+ OptionalAsyncRetry = Union[
35
+ retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None
36
+ ]
37
+ except AttributeError: # pragma: NO COVER
38
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
39
+ OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore
40
+
41
+ from google.cloud.discoveryengine_v1beta.types import (
42
+ conversational_search_service,
43
+ session,
44
+ )
45
+
46
+
47
+ class ListSessionsPager:
48
+ """A pager for iterating through ``list_sessions`` requests.
49
+
50
+ This class thinly wraps an initial
51
+ :class:`google.cloud.discoveryengine_v1beta.types.ListSessionsResponse` object, and
52
+ provides an ``__iter__`` method to iterate through its
53
+ ``sessions`` field.
54
+
55
+ If there are more pages, the ``__iter__`` method will make additional
56
+ ``ListSessions`` requests and continue to iterate
57
+ through the ``sessions`` field on the
58
+ corresponding responses.
59
+
60
+ All the usual :class:`google.cloud.discoveryengine_v1beta.types.ListSessionsResponse`
61
+ attributes are available on the pager. If multiple requests are made, only
62
+ the most recent response is retained, and thus used for attribute lookup.
63
+ """
64
+
65
+ def __init__(
66
+ self,
67
+ method: Callable[..., conversational_search_service.ListSessionsResponse],
68
+ request: conversational_search_service.ListSessionsRequest,
69
+ response: conversational_search_service.ListSessionsResponse,
70
+ *,
71
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
72
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
73
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
74
+ ):
75
+ """Instantiate the pager.
76
+
77
+ Args:
78
+ method (Callable): The method that was originally called, and
79
+ which instantiated this pager.
80
+ request (google.cloud.discoveryengine_v1beta.types.ListSessionsRequest):
81
+ The initial request object.
82
+ response (google.cloud.discoveryengine_v1beta.types.ListSessionsResponse):
83
+ The initial response object.
84
+ retry (google.api_core.retry.Retry): Designation of what errors,
85
+ if any, should be retried.
86
+ timeout (float): The timeout for this request.
87
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
88
+ sent along with the request as metadata. Normally, each value must be of type `str`,
89
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
90
+ be of type `bytes`.
91
+ """
92
+ self._method = method
93
+ self._request = conversational_search_service.ListSessionsRequest(request)
94
+ self._response = response
95
+ self._retry = retry
96
+ self._timeout = timeout
97
+ self._metadata = metadata
98
+
99
+ def __getattr__(self, name: str) -> Any:
100
+ return getattr(self._response, name)
101
+
102
+ @property
103
+ def pages(self) -> Iterator[conversational_search_service.ListSessionsResponse]:
104
+ yield self._response
105
+ while self._response.next_page_token:
106
+ self._request.page_token = self._response.next_page_token
107
+ self._response = self._method(
108
+ self._request,
109
+ retry=self._retry,
110
+ timeout=self._timeout,
111
+ metadata=self._metadata,
112
+ )
113
+ yield self._response
114
+
115
+ def __iter__(self) -> Iterator[session.Session]:
116
+ for page in self.pages:
117
+ yield from page.sessions
118
+
119
+ def __repr__(self) -> str:
120
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
121
+
122
+
123
+ class ListSessionsAsyncPager:
124
+ """A pager for iterating through ``list_sessions`` requests.
125
+
126
+ This class thinly wraps an initial
127
+ :class:`google.cloud.discoveryengine_v1beta.types.ListSessionsResponse` object, and
128
+ provides an ``__aiter__`` method to iterate through its
129
+ ``sessions`` field.
130
+
131
+ If there are more pages, the ``__aiter__`` method will make additional
132
+ ``ListSessions`` requests and continue to iterate
133
+ through the ``sessions`` field on the
134
+ corresponding responses.
135
+
136
+ All the usual :class:`google.cloud.discoveryengine_v1beta.types.ListSessionsResponse`
137
+ attributes are available on the pager. If multiple requests are made, only
138
+ the most recent response is retained, and thus used for attribute lookup.
139
+ """
140
+
141
+ def __init__(
142
+ self,
143
+ method: Callable[
144
+ ..., Awaitable[conversational_search_service.ListSessionsResponse]
145
+ ],
146
+ request: conversational_search_service.ListSessionsRequest,
147
+ response: conversational_search_service.ListSessionsResponse,
148
+ *,
149
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
150
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
151
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
152
+ ):
153
+ """Instantiates the pager.
154
+
155
+ Args:
156
+ method (Callable): The method that was originally called, and
157
+ which instantiated this pager.
158
+ request (google.cloud.discoveryengine_v1beta.types.ListSessionsRequest):
159
+ The initial request object.
160
+ response (google.cloud.discoveryengine_v1beta.types.ListSessionsResponse):
161
+ The initial response object.
162
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
163
+ if any, should be retried.
164
+ timeout (float): The timeout for this request.
165
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
166
+ sent along with the request as metadata. Normally, each value must be of type `str`,
167
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
168
+ be of type `bytes`.
169
+ """
170
+ self._method = method
171
+ self._request = conversational_search_service.ListSessionsRequest(request)
172
+ self._response = response
173
+ self._retry = retry
174
+ self._timeout = timeout
175
+ self._metadata = metadata
176
+
177
+ def __getattr__(self, name: str) -> Any:
178
+ return getattr(self._response, name)
179
+
180
+ @property
181
+ async def pages(
182
+ self,
183
+ ) -> AsyncIterator[conversational_search_service.ListSessionsResponse]:
184
+ yield self._response
185
+ while self._response.next_page_token:
186
+ self._request.page_token = self._response.next_page_token
187
+ self._response = await self._method(
188
+ self._request,
189
+ retry=self._retry,
190
+ timeout=self._timeout,
191
+ metadata=self._metadata,
192
+ )
193
+ yield self._response
194
+
195
+ def __aiter__(self) -> AsyncIterator[session.Session]:
196
+ async def async_generator():
197
+ async for page in self.pages:
198
+ for response in page.sessions:
199
+ yield response
200
+
201
+ return async_generator()
202
+
203
+ def __repr__(self) -> str:
204
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/transports/__init__.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from collections import OrderedDict
17
+ from typing import Dict, Type
18
+
19
+ from .base import SessionServiceTransport
20
+ from .grpc import SessionServiceGrpcTransport
21
+ from .grpc_asyncio import SessionServiceGrpcAsyncIOTransport
22
+ from .rest import SessionServiceRestInterceptor, SessionServiceRestTransport
23
+
24
+ # Compile a registry of transports.
25
+ _transport_registry = OrderedDict() # type: Dict[str, Type[SessionServiceTransport]]
26
+ _transport_registry["grpc"] = SessionServiceGrpcTransport
27
+ _transport_registry["grpc_asyncio"] = SessionServiceGrpcAsyncIOTransport
28
+ _transport_registry["rest"] = SessionServiceRestTransport
29
+
30
+ __all__ = (
31
+ "SessionServiceTransport",
32
+ "SessionServiceGrpcTransport",
33
+ "SessionServiceGrpcAsyncIOTransport",
34
+ "SessionServiceRestTransport",
35
+ "SessionServiceRestInterceptor",
36
+ )
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/transports/base.py ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import abc
17
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18
+
19
+ import google.api_core
20
+ from google.api_core import exceptions as core_exceptions
21
+ from google.api_core import gapic_v1
22
+ from google.api_core import retry as retries
23
+ import google.auth # type: ignore
24
+ from google.auth import credentials as ga_credentials # type: ignore
25
+ from google.cloud.location import locations_pb2 # type: ignore
26
+ from google.longrunning import operations_pb2 # type: ignore
27
+ from google.oauth2 import service_account # type: ignore
28
+ import google.protobuf
29
+ from google.protobuf import empty_pb2 # type: ignore
30
+
31
+ from google.cloud.discoveryengine_v1beta import gapic_version as package_version
32
+ from google.cloud.discoveryengine_v1beta.types import conversational_search_service
33
+ from google.cloud.discoveryengine_v1beta.types import session
34
+ from google.cloud.discoveryengine_v1beta.types import session as gcd_session
35
+
36
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
37
+ gapic_version=package_version.__version__
38
+ )
39
+
40
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
41
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
42
+
43
+
44
+ class SessionServiceTransport(abc.ABC):
45
+ """Abstract transport class for SessionService."""
46
+
47
+ AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",)
48
+
49
+ DEFAULT_HOST: str = "discoveryengine.googleapis.com"
50
+
51
+ def __init__(
52
+ self,
53
+ *,
54
+ host: str = DEFAULT_HOST,
55
+ credentials: Optional[ga_credentials.Credentials] = None,
56
+ credentials_file: Optional[str] = None,
57
+ scopes: Optional[Sequence[str]] = None,
58
+ quota_project_id: Optional[str] = None,
59
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
60
+ always_use_jwt_access: Optional[bool] = False,
61
+ api_audience: Optional[str] = None,
62
+ **kwargs,
63
+ ) -> None:
64
+ """Instantiate the transport.
65
+
66
+ Args:
67
+ host (Optional[str]):
68
+ The hostname to connect to (default: 'discoveryengine.googleapis.com').
69
+ credentials (Optional[google.auth.credentials.Credentials]): The
70
+ authorization credentials to attach to requests. These
71
+ credentials identify the application to the service; if none
72
+ are specified, the client will attempt to ascertain the
73
+ credentials from the environment.
74
+ credentials_file (Optional[str]): A file with credentials that can
75
+ be loaded with :func:`google.auth.load_credentials_from_file`.
76
+ This argument is mutually exclusive with credentials.
77
+ scopes (Optional[Sequence[str]]): A list of scopes.
78
+ quota_project_id (Optional[str]): An optional project to use for billing
79
+ and quota.
80
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
81
+ The client info used to send a user-agent string along with
82
+ API requests. If ``None``, then default info will be used.
83
+ Generally, you only need to set this if you're developing
84
+ your own client library.
85
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
86
+ be used for service account credentials.
87
+ """
88
+
89
+ scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
90
+
91
+ # Save the scopes.
92
+ self._scopes = scopes
93
+ if not hasattr(self, "_ignore_credentials"):
94
+ self._ignore_credentials: bool = False
95
+
96
+ # If no credentials are provided, then determine the appropriate
97
+ # defaults.
98
+ if credentials and credentials_file:
99
+ raise core_exceptions.DuplicateCredentialArgs(
100
+ "'credentials_file' and 'credentials' are mutually exclusive"
101
+ )
102
+
103
+ if credentials_file is not None:
104
+ credentials, _ = google.auth.load_credentials_from_file(
105
+ credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
106
+ )
107
+ elif credentials is None and not self._ignore_credentials:
108
+ credentials, _ = google.auth.default(
109
+ **scopes_kwargs, quota_project_id=quota_project_id
110
+ )
111
+ # Don't apply audience if the credentials file passed from user.
112
+ if hasattr(credentials, "with_gdch_audience"):
113
+ credentials = credentials.with_gdch_audience(
114
+ api_audience if api_audience else host
115
+ )
116
+
117
+ # If the credentials are service account credentials, then always try to use self signed JWT.
118
+ if (
119
+ always_use_jwt_access
120
+ and isinstance(credentials, service_account.Credentials)
121
+ and hasattr(service_account.Credentials, "with_always_use_jwt_access")
122
+ ):
123
+ credentials = credentials.with_always_use_jwt_access(True)
124
+
125
+ # Save the credentials.
126
+ self._credentials = credentials
127
+
128
+ # Save the hostname. Default to port 443 (HTTPS) if none is specified.
129
+ if ":" not in host:
130
+ host += ":443"
131
+ self._host = host
132
+
133
+ @property
134
+ def host(self):
135
+ return self._host
136
+
137
+ def _prep_wrapped_messages(self, client_info):
138
+ # Precompute the wrapped methods.
139
+ self._wrapped_methods = {
140
+ self.create_session: gapic_v1.method.wrap_method(
141
+ self.create_session,
142
+ default_timeout=None,
143
+ client_info=client_info,
144
+ ),
145
+ self.delete_session: gapic_v1.method.wrap_method(
146
+ self.delete_session,
147
+ default_timeout=None,
148
+ client_info=client_info,
149
+ ),
150
+ self.update_session: gapic_v1.method.wrap_method(
151
+ self.update_session,
152
+ default_timeout=None,
153
+ client_info=client_info,
154
+ ),
155
+ self.get_session: gapic_v1.method.wrap_method(
156
+ self.get_session,
157
+ default_timeout=None,
158
+ client_info=client_info,
159
+ ),
160
+ self.list_sessions: gapic_v1.method.wrap_method(
161
+ self.list_sessions,
162
+ default_timeout=None,
163
+ client_info=client_info,
164
+ ),
165
+ self.cancel_operation: gapic_v1.method.wrap_method(
166
+ self.cancel_operation,
167
+ default_timeout=None,
168
+ client_info=client_info,
169
+ ),
170
+ self.get_operation: gapic_v1.method.wrap_method(
171
+ self.get_operation,
172
+ default_timeout=None,
173
+ client_info=client_info,
174
+ ),
175
+ self.list_operations: gapic_v1.method.wrap_method(
176
+ self.list_operations,
177
+ default_timeout=None,
178
+ client_info=client_info,
179
+ ),
180
+ }
181
+
182
+ def close(self):
183
+ """Closes resources associated with the transport.
184
+
185
+ .. warning::
186
+ Only call this method if the transport is NOT shared
187
+ with other clients - this may cause errors in other clients!
188
+ """
189
+ raise NotImplementedError()
190
+
191
+ @property
192
+ def create_session(
193
+ self,
194
+ ) -> Callable[
195
+ [conversational_search_service.CreateSessionRequest],
196
+ Union[gcd_session.Session, Awaitable[gcd_session.Session]],
197
+ ]:
198
+ raise NotImplementedError()
199
+
200
+ @property
201
+ def delete_session(
202
+ self,
203
+ ) -> Callable[
204
+ [conversational_search_service.DeleteSessionRequest],
205
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
206
+ ]:
207
+ raise NotImplementedError()
208
+
209
+ @property
210
+ def update_session(
211
+ self,
212
+ ) -> Callable[
213
+ [conversational_search_service.UpdateSessionRequest],
214
+ Union[gcd_session.Session, Awaitable[gcd_session.Session]],
215
+ ]:
216
+ raise NotImplementedError()
217
+
218
+ @property
219
+ def get_session(
220
+ self,
221
+ ) -> Callable[
222
+ [conversational_search_service.GetSessionRequest],
223
+ Union[session.Session, Awaitable[session.Session]],
224
+ ]:
225
+ raise NotImplementedError()
226
+
227
+ @property
228
+ def list_sessions(
229
+ self,
230
+ ) -> Callable[
231
+ [conversational_search_service.ListSessionsRequest],
232
+ Union[
233
+ conversational_search_service.ListSessionsResponse,
234
+ Awaitable[conversational_search_service.ListSessionsResponse],
235
+ ],
236
+ ]:
237
+ raise NotImplementedError()
238
+
239
+ @property
240
+ def list_operations(
241
+ self,
242
+ ) -> Callable[
243
+ [operations_pb2.ListOperationsRequest],
244
+ Union[
245
+ operations_pb2.ListOperationsResponse,
246
+ Awaitable[operations_pb2.ListOperationsResponse],
247
+ ],
248
+ ]:
249
+ raise NotImplementedError()
250
+
251
+ @property
252
+ def get_operation(
253
+ self,
254
+ ) -> Callable[
255
+ [operations_pb2.GetOperationRequest],
256
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
257
+ ]:
258
+ raise NotImplementedError()
259
+
260
+ @property
261
+ def cancel_operation(
262
+ self,
263
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None,]:
264
+ raise NotImplementedError()
265
+
266
+ @property
267
+ def kind(self) -> str:
268
+ raise NotImplementedError()
269
+
270
+
271
+ __all__ = ("SessionServiceTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/transports/grpc.py ADDED
@@ -0,0 +1,539 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import json
17
+ import logging as std_logging
18
+ import pickle
19
+ from typing import Callable, Dict, Optional, Sequence, Tuple, Union
20
+ import warnings
21
+
22
+ from google.api_core import gapic_v1, grpc_helpers
23
+ import google.auth # type: ignore
24
+ from google.auth import credentials as ga_credentials # type: ignore
25
+ from google.auth.transport.grpc import SslCredentials # type: ignore
26
+ from google.cloud.location import locations_pb2 # type: ignore
27
+ from google.longrunning import operations_pb2 # type: ignore
28
+ from google.protobuf import empty_pb2 # type: ignore
29
+ from google.protobuf.json_format import MessageToJson
30
+ import google.protobuf.message
31
+ import grpc # type: ignore
32
+ import proto # type: ignore
33
+
34
+ from google.cloud.discoveryengine_v1beta.types import conversational_search_service
35
+ from google.cloud.discoveryengine_v1beta.types import session
36
+ from google.cloud.discoveryengine_v1beta.types import session as gcd_session
37
+
38
+ from .base import DEFAULT_CLIENT_INFO, SessionServiceTransport
39
+
40
+ try:
41
+ from google.api_core import client_logging # type: ignore
42
+
43
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
44
+ except ImportError: # pragma: NO COVER
45
+ CLIENT_LOGGING_SUPPORTED = False
46
+
47
+ _LOGGER = std_logging.getLogger(__name__)
48
+
49
+
50
+ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
51
+ def intercept_unary_unary(self, continuation, client_call_details, request):
52
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
53
+ std_logging.DEBUG
54
+ )
55
+ if logging_enabled: # pragma: NO COVER
56
+ request_metadata = client_call_details.metadata
57
+ if isinstance(request, proto.Message):
58
+ request_payload = type(request).to_json(request)
59
+ elif isinstance(request, google.protobuf.message.Message):
60
+ request_payload = MessageToJson(request)
61
+ else:
62
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
63
+
64
+ request_metadata = {
65
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
66
+ for key, value in request_metadata
67
+ }
68
+ grpc_request = {
69
+ "payload": request_payload,
70
+ "requestMethod": "grpc",
71
+ "metadata": dict(request_metadata),
72
+ }
73
+ _LOGGER.debug(
74
+ f"Sending request for {client_call_details.method}",
75
+ extra={
76
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
77
+ "rpcName": str(client_call_details.method),
78
+ "request": grpc_request,
79
+ "metadata": grpc_request["metadata"],
80
+ },
81
+ )
82
+ response = continuation(client_call_details, request)
83
+ if logging_enabled: # pragma: NO COVER
84
+ response_metadata = response.trailing_metadata()
85
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
86
+ metadata = (
87
+ dict([(k, str(v)) for k, v in response_metadata])
88
+ if response_metadata
89
+ else None
90
+ )
91
+ result = response.result()
92
+ if isinstance(result, proto.Message):
93
+ response_payload = type(result).to_json(result)
94
+ elif isinstance(result, google.protobuf.message.Message):
95
+ response_payload = MessageToJson(result)
96
+ else:
97
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
98
+ grpc_response = {
99
+ "payload": response_payload,
100
+ "metadata": metadata,
101
+ "status": "OK",
102
+ }
103
+ _LOGGER.debug(
104
+ f"Received response for {client_call_details.method}.",
105
+ extra={
106
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
107
+ "rpcName": client_call_details.method,
108
+ "response": grpc_response,
109
+ "metadata": grpc_response["metadata"],
110
+ },
111
+ )
112
+ return response
113
+
114
+
115
+ class SessionServiceGrpcTransport(SessionServiceTransport):
116
+ """gRPC backend transport for SessionService.
117
+
118
+ Service for managing Sessions and Session-related resources.
119
+
120
+ This class defines the same methods as the primary client, so the
121
+ primary client can load the underlying transport implementation
122
+ and call it.
123
+
124
+ It sends protocol buffers over the wire using gRPC (which is built on
125
+ top of HTTP/2); the ``grpcio`` package must be installed.
126
+ """
127
+
128
+ _stubs: Dict[str, Callable]
129
+
130
+ def __init__(
131
+ self,
132
+ *,
133
+ host: str = "discoveryengine.googleapis.com",
134
+ credentials: Optional[ga_credentials.Credentials] = None,
135
+ credentials_file: Optional[str] = None,
136
+ scopes: Optional[Sequence[str]] = None,
137
+ channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
138
+ api_mtls_endpoint: Optional[str] = None,
139
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
140
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
141
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
142
+ quota_project_id: Optional[str] = None,
143
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
144
+ always_use_jwt_access: Optional[bool] = False,
145
+ api_audience: Optional[str] = None,
146
+ ) -> None:
147
+ """Instantiate the transport.
148
+
149
+ Args:
150
+ host (Optional[str]):
151
+ The hostname to connect to (default: 'discoveryengine.googleapis.com').
152
+ credentials (Optional[google.auth.credentials.Credentials]): The
153
+ authorization credentials to attach to requests. These
154
+ credentials identify the application to the service; if none
155
+ are specified, the client will attempt to ascertain the
156
+ credentials from the environment.
157
+ This argument is ignored if a ``channel`` instance is provided.
158
+ credentials_file (Optional[str]): A file with credentials that can
159
+ be loaded with :func:`google.auth.load_credentials_from_file`.
160
+ This argument is ignored if a ``channel`` instance is provided.
161
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
162
+ ignored if a ``channel`` instance is provided.
163
+ channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
164
+ A ``Channel`` instance through which to make calls, or a Callable
165
+ that constructs and returns one. If set to None, ``self.create_channel``
166
+ is used to create the channel. If a Callable is given, it will be called
167
+ with the same arguments as used in ``self.create_channel``.
168
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
169
+ If provided, it overrides the ``host`` argument and tries to create
170
+ a mutual TLS channel with client SSL credentials from
171
+ ``client_cert_source`` or application default SSL credentials.
172
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
173
+ Deprecated. A callback to provide client SSL certificate bytes and
174
+ private key bytes, both in PEM format. It is ignored if
175
+ ``api_mtls_endpoint`` is None.
176
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
177
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
178
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
179
+ A callback to provide client certificate bytes and private key bytes,
180
+ both in PEM format. It is used to configure a mutual TLS channel. It is
181
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
182
+ quota_project_id (Optional[str]): An optional project to use for billing
183
+ and quota.
184
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
185
+ The client info used to send a user-agent string along with
186
+ API requests. If ``None``, then default info will be used.
187
+ Generally, you only need to set this if you're developing
188
+ your own client library.
189
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
190
+ be used for service account credentials.
191
+
192
+ Raises:
193
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
194
+ creation failed for any reason.
195
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
196
+ and ``credentials_file`` are passed.
197
+ """
198
+ self._grpc_channel = None
199
+ self._ssl_channel_credentials = ssl_channel_credentials
200
+ self._stubs: Dict[str, Callable] = {}
201
+
202
+ if api_mtls_endpoint:
203
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
204
+ if client_cert_source:
205
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
206
+
207
+ if isinstance(channel, grpc.Channel):
208
+ # Ignore credentials if a channel was passed.
209
+ credentials = None
210
+ self._ignore_credentials = True
211
+ # If a channel was explicitly provided, set it.
212
+ self._grpc_channel = channel
213
+ self._ssl_channel_credentials = None
214
+
215
+ else:
216
+ if api_mtls_endpoint:
217
+ host = api_mtls_endpoint
218
+
219
+ # Create SSL credentials with client_cert_source or application
220
+ # default SSL credentials.
221
+ if client_cert_source:
222
+ cert, key = client_cert_source()
223
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
224
+ certificate_chain=cert, private_key=key
225
+ )
226
+ else:
227
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
228
+
229
+ else:
230
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
231
+ cert, key = client_cert_source_for_mtls()
232
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
233
+ certificate_chain=cert, private_key=key
234
+ )
235
+
236
+ # The base transport sets the host, credentials and scopes
237
+ super().__init__(
238
+ host=host,
239
+ credentials=credentials,
240
+ credentials_file=credentials_file,
241
+ scopes=scopes,
242
+ quota_project_id=quota_project_id,
243
+ client_info=client_info,
244
+ always_use_jwt_access=always_use_jwt_access,
245
+ api_audience=api_audience,
246
+ )
247
+
248
+ if not self._grpc_channel:
249
+ # initialize with the provided callable or the default channel
250
+ channel_init = channel or type(self).create_channel
251
+ self._grpc_channel = channel_init(
252
+ self._host,
253
+ # use the credentials which are saved
254
+ credentials=self._credentials,
255
+ # Set ``credentials_file`` to ``None`` here as
256
+ # the credentials that we saved earlier should be used.
257
+ credentials_file=None,
258
+ scopes=self._scopes,
259
+ ssl_credentials=self._ssl_channel_credentials,
260
+ quota_project_id=quota_project_id,
261
+ options=[
262
+ ("grpc.max_send_message_length", -1),
263
+ ("grpc.max_receive_message_length", -1),
264
+ ],
265
+ )
266
+
267
+ self._interceptor = _LoggingClientInterceptor()
268
+ self._logged_channel = grpc.intercept_channel(
269
+ self._grpc_channel, self._interceptor
270
+ )
271
+
272
+ # Wrap messages. This must be done after self._logged_channel exists
273
+ self._prep_wrapped_messages(client_info)
274
+
275
+ @classmethod
276
+ def create_channel(
277
+ cls,
278
+ host: str = "discoveryengine.googleapis.com",
279
+ credentials: Optional[ga_credentials.Credentials] = None,
280
+ credentials_file: Optional[str] = None,
281
+ scopes: Optional[Sequence[str]] = None,
282
+ quota_project_id: Optional[str] = None,
283
+ **kwargs,
284
+ ) -> grpc.Channel:
285
+ """Create and return a gRPC channel object.
286
+ Args:
287
+ host (Optional[str]): The host for the channel to use.
288
+ credentials (Optional[~.Credentials]): The
289
+ authorization credentials to attach to requests. These
290
+ credentials identify this application to the service. If
291
+ none are specified, the client will attempt to ascertain
292
+ the credentials from the environment.
293
+ credentials_file (Optional[str]): A file with credentials that can
294
+ be loaded with :func:`google.auth.load_credentials_from_file`.
295
+ This argument is mutually exclusive with credentials.
296
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
297
+ service. These are only used when credentials are not specified and
298
+ are passed to :func:`google.auth.default`.
299
+ quota_project_id (Optional[str]): An optional project to use for billing
300
+ and quota.
301
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
302
+ channel creation.
303
+ Returns:
304
+ grpc.Channel: A gRPC channel object.
305
+
306
+ Raises:
307
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
308
+ and ``credentials_file`` are passed.
309
+ """
310
+
311
+ return grpc_helpers.create_channel(
312
+ host,
313
+ credentials=credentials,
314
+ credentials_file=credentials_file,
315
+ quota_project_id=quota_project_id,
316
+ default_scopes=cls.AUTH_SCOPES,
317
+ scopes=scopes,
318
+ default_host=cls.DEFAULT_HOST,
319
+ **kwargs,
320
+ )
321
+
322
+ @property
323
+ def grpc_channel(self) -> grpc.Channel:
324
+ """Return the channel designed to connect to this service."""
325
+ return self._grpc_channel
326
+
327
+ @property
328
+ def create_session(
329
+ self,
330
+ ) -> Callable[
331
+ [conversational_search_service.CreateSessionRequest], gcd_session.Session
332
+ ]:
333
+ r"""Return a callable for the create session method over gRPC.
334
+
335
+ Creates a Session.
336
+
337
+ If the [Session][google.cloud.discoveryengine.v1beta.Session] to
338
+ create already exists, an ALREADY_EXISTS error is returned.
339
+
340
+ Returns:
341
+ Callable[[~.CreateSessionRequest],
342
+ ~.Session]:
343
+ A function that, when called, will call the underlying RPC
344
+ on the server.
345
+ """
346
+ # Generate a "stub function" on-the-fly which will actually make
347
+ # the request.
348
+ # gRPC handles serialization and deserialization, so we just need
349
+ # to pass in the functions for each.
350
+ if "create_session" not in self._stubs:
351
+ self._stubs["create_session"] = self._logged_channel.unary_unary(
352
+ "/google.cloud.discoveryengine.v1beta.SessionService/CreateSession",
353
+ request_serializer=conversational_search_service.CreateSessionRequest.serialize,
354
+ response_deserializer=gcd_session.Session.deserialize,
355
+ )
356
+ return self._stubs["create_session"]
357
+
358
+ @property
359
+ def delete_session(
360
+ self,
361
+ ) -> Callable[
362
+ [conversational_search_service.DeleteSessionRequest], empty_pb2.Empty
363
+ ]:
364
+ r"""Return a callable for the delete session method over gRPC.
365
+
366
+ Deletes a Session.
367
+
368
+ If the [Session][google.cloud.discoveryengine.v1beta.Session] to
369
+ delete does not exist, a NOT_FOUND error is returned.
370
+
371
+ Returns:
372
+ Callable[[~.DeleteSessionRequest],
373
+ ~.Empty]:
374
+ A function that, when called, will call the underlying RPC
375
+ on the server.
376
+ """
377
+ # Generate a "stub function" on-the-fly which will actually make
378
+ # the request.
379
+ # gRPC handles serialization and deserialization, so we just need
380
+ # to pass in the functions for each.
381
+ if "delete_session" not in self._stubs:
382
+ self._stubs["delete_session"] = self._logged_channel.unary_unary(
383
+ "/google.cloud.discoveryengine.v1beta.SessionService/DeleteSession",
384
+ request_serializer=conversational_search_service.DeleteSessionRequest.serialize,
385
+ response_deserializer=empty_pb2.Empty.FromString,
386
+ )
387
+ return self._stubs["delete_session"]
388
+
389
+ @property
390
+ def update_session(
391
+ self,
392
+ ) -> Callable[
393
+ [conversational_search_service.UpdateSessionRequest], gcd_session.Session
394
+ ]:
395
+ r"""Return a callable for the update session method over gRPC.
396
+
397
+ Updates a Session.
398
+
399
+ [Session][google.cloud.discoveryengine.v1beta.Session] action
400
+ type cannot be changed. If the
401
+ [Session][google.cloud.discoveryengine.v1beta.Session] to update
402
+ does not exist, a NOT_FOUND error is returned.
403
+
404
+ Returns:
405
+ Callable[[~.UpdateSessionRequest],
406
+ ~.Session]:
407
+ A function that, when called, will call the underlying RPC
408
+ on the server.
409
+ """
410
+ # Generate a "stub function" on-the-fly which will actually make
411
+ # the request.
412
+ # gRPC handles serialization and deserialization, so we just need
413
+ # to pass in the functions for each.
414
+ if "update_session" not in self._stubs:
415
+ self._stubs["update_session"] = self._logged_channel.unary_unary(
416
+ "/google.cloud.discoveryengine.v1beta.SessionService/UpdateSession",
417
+ request_serializer=conversational_search_service.UpdateSessionRequest.serialize,
418
+ response_deserializer=gcd_session.Session.deserialize,
419
+ )
420
+ return self._stubs["update_session"]
421
+
422
+ @property
423
+ def get_session(
424
+ self,
425
+ ) -> Callable[[conversational_search_service.GetSessionRequest], session.Session]:
426
+ r"""Return a callable for the get session method over gRPC.
427
+
428
+ Gets a Session.
429
+
430
+ Returns:
431
+ Callable[[~.GetSessionRequest],
432
+ ~.Session]:
433
+ A function that, when called, will call the underlying RPC
434
+ on the server.
435
+ """
436
+ # Generate a "stub function" on-the-fly which will actually make
437
+ # the request.
438
+ # gRPC handles serialization and deserialization, so we just need
439
+ # to pass in the functions for each.
440
+ if "get_session" not in self._stubs:
441
+ self._stubs["get_session"] = self._logged_channel.unary_unary(
442
+ "/google.cloud.discoveryengine.v1beta.SessionService/GetSession",
443
+ request_serializer=conversational_search_service.GetSessionRequest.serialize,
444
+ response_deserializer=session.Session.deserialize,
445
+ )
446
+ return self._stubs["get_session"]
447
+
448
+ @property
449
+ def list_sessions(
450
+ self,
451
+ ) -> Callable[
452
+ [conversational_search_service.ListSessionsRequest],
453
+ conversational_search_service.ListSessionsResponse,
454
+ ]:
455
+ r"""Return a callable for the list sessions method over gRPC.
456
+
457
+ Lists all Sessions by their parent
458
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
459
+
460
+ Returns:
461
+ Callable[[~.ListSessionsRequest],
462
+ ~.ListSessionsResponse]:
463
+ A function that, when called, will call the underlying RPC
464
+ on the server.
465
+ """
466
+ # Generate a "stub function" on-the-fly which will actually make
467
+ # the request.
468
+ # gRPC handles serialization and deserialization, so we just need
469
+ # to pass in the functions for each.
470
+ if "list_sessions" not in self._stubs:
471
+ self._stubs["list_sessions"] = self._logged_channel.unary_unary(
472
+ "/google.cloud.discoveryengine.v1beta.SessionService/ListSessions",
473
+ request_serializer=conversational_search_service.ListSessionsRequest.serialize,
474
+ response_deserializer=conversational_search_service.ListSessionsResponse.deserialize,
475
+ )
476
+ return self._stubs["list_sessions"]
477
+
478
+ def close(self):
479
+ self._logged_channel.close()
480
+
481
+ @property
482
+ def cancel_operation(
483
+ self,
484
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
485
+ r"""Return a callable for the cancel_operation method over gRPC."""
486
+ # Generate a "stub function" on-the-fly which will actually make
487
+ # the request.
488
+ # gRPC handles serialization and deserialization, so we just need
489
+ # to pass in the functions for each.
490
+ if "cancel_operation" not in self._stubs:
491
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
492
+ "/google.longrunning.Operations/CancelOperation",
493
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
494
+ response_deserializer=None,
495
+ )
496
+ return self._stubs["cancel_operation"]
497
+
498
+ @property
499
+ def get_operation(
500
+ self,
501
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
502
+ r"""Return a callable for the get_operation method over gRPC."""
503
+ # Generate a "stub function" on-the-fly which will actually make
504
+ # the request.
505
+ # gRPC handles serialization and deserialization, so we just need
506
+ # to pass in the functions for each.
507
+ if "get_operation" not in self._stubs:
508
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
509
+ "/google.longrunning.Operations/GetOperation",
510
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
511
+ response_deserializer=operations_pb2.Operation.FromString,
512
+ )
513
+ return self._stubs["get_operation"]
514
+
515
+ @property
516
+ def list_operations(
517
+ self,
518
+ ) -> Callable[
519
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
520
+ ]:
521
+ r"""Return a callable for the list_operations method over gRPC."""
522
+ # Generate a "stub function" on-the-fly which will actually make
523
+ # the request.
524
+ # gRPC handles serialization and deserialization, so we just need
525
+ # to pass in the functions for each.
526
+ if "list_operations" not in self._stubs:
527
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
528
+ "/google.longrunning.Operations/ListOperations",
529
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
530
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
531
+ )
532
+ return self._stubs["list_operations"]
533
+
534
+ @property
535
+ def kind(self) -> str:
536
+ return "grpc"
537
+
538
+
539
+ __all__ = ("SessionServiceGrpcTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/transports/grpc_asyncio.py ADDED
@@ -0,0 +1,601 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import inspect
17
+ import json
18
+ import logging as std_logging
19
+ import pickle
20
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
21
+ import warnings
22
+
23
+ from google.api_core import exceptions as core_exceptions
24
+ from google.api_core import gapic_v1, grpc_helpers_async
25
+ from google.api_core import retry_async as retries
26
+ from google.auth import credentials as ga_credentials # type: ignore
27
+ from google.auth.transport.grpc import SslCredentials # type: ignore
28
+ from google.cloud.location import locations_pb2 # type: ignore
29
+ from google.longrunning import operations_pb2 # type: ignore
30
+ from google.protobuf import empty_pb2 # type: ignore
31
+ from google.protobuf.json_format import MessageToJson
32
+ import google.protobuf.message
33
+ import grpc # type: ignore
34
+ from grpc.experimental import aio # type: ignore
35
+ import proto # type: ignore
36
+
37
+ from google.cloud.discoveryengine_v1beta.types import conversational_search_service
38
+ from google.cloud.discoveryengine_v1beta.types import session
39
+ from google.cloud.discoveryengine_v1beta.types import session as gcd_session
40
+
41
+ from .base import DEFAULT_CLIENT_INFO, SessionServiceTransport
42
+ from .grpc import SessionServiceGrpcTransport
43
+
44
+ try:
45
+ from google.api_core import client_logging # type: ignore
46
+
47
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
48
+ except ImportError: # pragma: NO COVER
49
+ CLIENT_LOGGING_SUPPORTED = False
50
+
51
+ _LOGGER = std_logging.getLogger(__name__)
52
+
53
+
54
+ class _LoggingClientAIOInterceptor(
55
+ grpc.aio.UnaryUnaryClientInterceptor
56
+ ): # pragma: NO COVER
57
+ async def intercept_unary_unary(self, continuation, client_call_details, request):
58
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
59
+ std_logging.DEBUG
60
+ )
61
+ if logging_enabled: # pragma: NO COVER
62
+ request_metadata = client_call_details.metadata
63
+ if isinstance(request, proto.Message):
64
+ request_payload = type(request).to_json(request)
65
+ elif isinstance(request, google.protobuf.message.Message):
66
+ request_payload = MessageToJson(request)
67
+ else:
68
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
69
+
70
+ request_metadata = {
71
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
72
+ for key, value in request_metadata
73
+ }
74
+ grpc_request = {
75
+ "payload": request_payload,
76
+ "requestMethod": "grpc",
77
+ "metadata": dict(request_metadata),
78
+ }
79
+ _LOGGER.debug(
80
+ f"Sending request for {client_call_details.method}",
81
+ extra={
82
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
83
+ "rpcName": str(client_call_details.method),
84
+ "request": grpc_request,
85
+ "metadata": grpc_request["metadata"],
86
+ },
87
+ )
88
+ response = await continuation(client_call_details, request)
89
+ if logging_enabled: # pragma: NO COVER
90
+ response_metadata = await response.trailing_metadata()
91
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
92
+ metadata = (
93
+ dict([(k, str(v)) for k, v in response_metadata])
94
+ if response_metadata
95
+ else None
96
+ )
97
+ result = await response
98
+ if isinstance(result, proto.Message):
99
+ response_payload = type(result).to_json(result)
100
+ elif isinstance(result, google.protobuf.message.Message):
101
+ response_payload = MessageToJson(result)
102
+ else:
103
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
104
+ grpc_response = {
105
+ "payload": response_payload,
106
+ "metadata": metadata,
107
+ "status": "OK",
108
+ }
109
+ _LOGGER.debug(
110
+ f"Received response to rpc {client_call_details.method}.",
111
+ extra={
112
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
113
+ "rpcName": str(client_call_details.method),
114
+ "response": grpc_response,
115
+ "metadata": grpc_response["metadata"],
116
+ },
117
+ )
118
+ return response
119
+
120
+
121
+ class SessionServiceGrpcAsyncIOTransport(SessionServiceTransport):
122
+ """gRPC AsyncIO backend transport for SessionService.
123
+
124
+ Service for managing Sessions and Session-related resources.
125
+
126
+ This class defines the same methods as the primary client, so the
127
+ primary client can load the underlying transport implementation
128
+ and call it.
129
+
130
+ It sends protocol buffers over the wire using gRPC (which is built on
131
+ top of HTTP/2); the ``grpcio`` package must be installed.
132
+ """
133
+
134
+ _grpc_channel: aio.Channel
135
+ _stubs: Dict[str, Callable] = {}
136
+
137
+ @classmethod
138
+ def create_channel(
139
+ cls,
140
+ host: str = "discoveryengine.googleapis.com",
141
+ credentials: Optional[ga_credentials.Credentials] = None,
142
+ credentials_file: Optional[str] = None,
143
+ scopes: Optional[Sequence[str]] = None,
144
+ quota_project_id: Optional[str] = None,
145
+ **kwargs,
146
+ ) -> aio.Channel:
147
+ """Create and return a gRPC AsyncIO channel object.
148
+ Args:
149
+ host (Optional[str]): The host for the channel to use.
150
+ credentials (Optional[~.Credentials]): The
151
+ authorization credentials to attach to requests. These
152
+ credentials identify this application to the service. If
153
+ none are specified, the client will attempt to ascertain
154
+ the credentials from the environment.
155
+ credentials_file (Optional[str]): A file with credentials that can
156
+ be loaded with :func:`google.auth.load_credentials_from_file`.
157
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
158
+ service. These are only used when credentials are not specified and
159
+ are passed to :func:`google.auth.default`.
160
+ quota_project_id (Optional[str]): An optional project to use for billing
161
+ and quota.
162
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
163
+ channel creation.
164
+ Returns:
165
+ aio.Channel: A gRPC AsyncIO channel object.
166
+ """
167
+
168
+ return grpc_helpers_async.create_channel(
169
+ host,
170
+ credentials=credentials,
171
+ credentials_file=credentials_file,
172
+ quota_project_id=quota_project_id,
173
+ default_scopes=cls.AUTH_SCOPES,
174
+ scopes=scopes,
175
+ default_host=cls.DEFAULT_HOST,
176
+ **kwargs,
177
+ )
178
+
179
+ def __init__(
180
+ self,
181
+ *,
182
+ host: str = "discoveryengine.googleapis.com",
183
+ credentials: Optional[ga_credentials.Credentials] = None,
184
+ credentials_file: Optional[str] = None,
185
+ scopes: Optional[Sequence[str]] = None,
186
+ channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
187
+ api_mtls_endpoint: Optional[str] = None,
188
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
189
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
190
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
191
+ quota_project_id: Optional[str] = None,
192
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
193
+ always_use_jwt_access: Optional[bool] = False,
194
+ api_audience: Optional[str] = None,
195
+ ) -> None:
196
+ """Instantiate the transport.
197
+
198
+ Args:
199
+ host (Optional[str]):
200
+ The hostname to connect to (default: 'discoveryengine.googleapis.com').
201
+ credentials (Optional[google.auth.credentials.Credentials]): The
202
+ authorization credentials to attach to requests. These
203
+ credentials identify the application to the service; if none
204
+ are specified, the client will attempt to ascertain the
205
+ credentials from the environment.
206
+ This argument is ignored if a ``channel`` instance is provided.
207
+ credentials_file (Optional[str]): A file with credentials that can
208
+ be loaded with :func:`google.auth.load_credentials_from_file`.
209
+ This argument is ignored if a ``channel`` instance is provided.
210
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
211
+ service. These are only used when credentials are not specified and
212
+ are passed to :func:`google.auth.default`.
213
+ channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
214
+ A ``Channel`` instance through which to make calls, or a Callable
215
+ that constructs and returns one. If set to None, ``self.create_channel``
216
+ is used to create the channel. If a Callable is given, it will be called
217
+ with the same arguments as used in ``self.create_channel``.
218
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
219
+ If provided, it overrides the ``host`` argument and tries to create
220
+ a mutual TLS channel with client SSL credentials from
221
+ ``client_cert_source`` or application default SSL credentials.
222
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
223
+ Deprecated. A callback to provide client SSL certificate bytes and
224
+ private key bytes, both in PEM format. It is ignored if
225
+ ``api_mtls_endpoint`` is None.
226
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
227
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
228
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
229
+ A callback to provide client certificate bytes and private key bytes,
230
+ both in PEM format. It is used to configure a mutual TLS channel. It is
231
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
232
+ quota_project_id (Optional[str]): An optional project to use for billing
233
+ and quota.
234
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
235
+ The client info used to send a user-agent string along with
236
+ API requests. If ``None``, then default info will be used.
237
+ Generally, you only need to set this if you're developing
238
+ your own client library.
239
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
240
+ be used for service account credentials.
241
+
242
+ Raises:
243
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
244
+ creation failed for any reason.
245
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
246
+ and ``credentials_file`` are passed.
247
+ """
248
+ self._grpc_channel = None
249
+ self._ssl_channel_credentials = ssl_channel_credentials
250
+ self._stubs: Dict[str, Callable] = {}
251
+
252
+ if api_mtls_endpoint:
253
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
254
+ if client_cert_source:
255
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
256
+
257
+ if isinstance(channel, aio.Channel):
258
+ # Ignore credentials if a channel was passed.
259
+ credentials = None
260
+ self._ignore_credentials = True
261
+ # If a channel was explicitly provided, set it.
262
+ self._grpc_channel = channel
263
+ self._ssl_channel_credentials = None
264
+ else:
265
+ if api_mtls_endpoint:
266
+ host = api_mtls_endpoint
267
+
268
+ # Create SSL credentials with client_cert_source or application
269
+ # default SSL credentials.
270
+ if client_cert_source:
271
+ cert, key = client_cert_source()
272
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
273
+ certificate_chain=cert, private_key=key
274
+ )
275
+ else:
276
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
277
+
278
+ else:
279
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
280
+ cert, key = client_cert_source_for_mtls()
281
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
282
+ certificate_chain=cert, private_key=key
283
+ )
284
+
285
+ # The base transport sets the host, credentials and scopes
286
+ super().__init__(
287
+ host=host,
288
+ credentials=credentials,
289
+ credentials_file=credentials_file,
290
+ scopes=scopes,
291
+ quota_project_id=quota_project_id,
292
+ client_info=client_info,
293
+ always_use_jwt_access=always_use_jwt_access,
294
+ api_audience=api_audience,
295
+ )
296
+
297
+ if not self._grpc_channel:
298
+ # initialize with the provided callable or the default channel
299
+ channel_init = channel or type(self).create_channel
300
+ self._grpc_channel = channel_init(
301
+ self._host,
302
+ # use the credentials which are saved
303
+ credentials=self._credentials,
304
+ # Set ``credentials_file`` to ``None`` here as
305
+ # the credentials that we saved earlier should be used.
306
+ credentials_file=None,
307
+ scopes=self._scopes,
308
+ ssl_credentials=self._ssl_channel_credentials,
309
+ quota_project_id=quota_project_id,
310
+ options=[
311
+ ("grpc.max_send_message_length", -1),
312
+ ("grpc.max_receive_message_length", -1),
313
+ ],
314
+ )
315
+
316
+ self._interceptor = _LoggingClientAIOInterceptor()
317
+ self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
318
+ self._logged_channel = self._grpc_channel
319
+ self._wrap_with_kind = (
320
+ "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
321
+ )
322
+ # Wrap messages. This must be done after self._logged_channel exists
323
+ self._prep_wrapped_messages(client_info)
324
+
325
+ @property
326
+ def grpc_channel(self) -> aio.Channel:
327
+ """Create the channel designed to connect to this service.
328
+
329
+ This property caches on the instance; repeated calls return
330
+ the same channel.
331
+ """
332
+ # Return the channel from cache.
333
+ return self._grpc_channel
334
+
335
+ @property
336
+ def create_session(
337
+ self,
338
+ ) -> Callable[
339
+ [conversational_search_service.CreateSessionRequest],
340
+ Awaitable[gcd_session.Session],
341
+ ]:
342
+ r"""Return a callable for the create session method over gRPC.
343
+
344
+ Creates a Session.
345
+
346
+ If the [Session][google.cloud.discoveryengine.v1beta.Session] to
347
+ create already exists, an ALREADY_EXISTS error is returned.
348
+
349
+ Returns:
350
+ Callable[[~.CreateSessionRequest],
351
+ Awaitable[~.Session]]:
352
+ A function that, when called, will call the underlying RPC
353
+ on the server.
354
+ """
355
+ # Generate a "stub function" on-the-fly which will actually make
356
+ # the request.
357
+ # gRPC handles serialization and deserialization, so we just need
358
+ # to pass in the functions for each.
359
+ if "create_session" not in self._stubs:
360
+ self._stubs["create_session"] = self._logged_channel.unary_unary(
361
+ "/google.cloud.discoveryengine.v1beta.SessionService/CreateSession",
362
+ request_serializer=conversational_search_service.CreateSessionRequest.serialize,
363
+ response_deserializer=gcd_session.Session.deserialize,
364
+ )
365
+ return self._stubs["create_session"]
366
+
367
+ @property
368
+ def delete_session(
369
+ self,
370
+ ) -> Callable[
371
+ [conversational_search_service.DeleteSessionRequest], Awaitable[empty_pb2.Empty]
372
+ ]:
373
+ r"""Return a callable for the delete session method over gRPC.
374
+
375
+ Deletes a Session.
376
+
377
+ If the [Session][google.cloud.discoveryengine.v1beta.Session] to
378
+ delete does not exist, a NOT_FOUND error is returned.
379
+
380
+ Returns:
381
+ Callable[[~.DeleteSessionRequest],
382
+ Awaitable[~.Empty]]:
383
+ A function that, when called, will call the underlying RPC
384
+ on the server.
385
+ """
386
+ # Generate a "stub function" on-the-fly which will actually make
387
+ # the request.
388
+ # gRPC handles serialization and deserialization, so we just need
389
+ # to pass in the functions for each.
390
+ if "delete_session" not in self._stubs:
391
+ self._stubs["delete_session"] = self._logged_channel.unary_unary(
392
+ "/google.cloud.discoveryengine.v1beta.SessionService/DeleteSession",
393
+ request_serializer=conversational_search_service.DeleteSessionRequest.serialize,
394
+ response_deserializer=empty_pb2.Empty.FromString,
395
+ )
396
+ return self._stubs["delete_session"]
397
+
398
+ @property
399
+ def update_session(
400
+ self,
401
+ ) -> Callable[
402
+ [conversational_search_service.UpdateSessionRequest],
403
+ Awaitable[gcd_session.Session],
404
+ ]:
405
+ r"""Return a callable for the update session method over gRPC.
406
+
407
+ Updates a Session.
408
+
409
+ [Session][google.cloud.discoveryengine.v1beta.Session] action
410
+ type cannot be changed. If the
411
+ [Session][google.cloud.discoveryengine.v1beta.Session] to update
412
+ does not exist, a NOT_FOUND error is returned.
413
+
414
+ Returns:
415
+ Callable[[~.UpdateSessionRequest],
416
+ Awaitable[~.Session]]:
417
+ A function that, when called, will call the underlying RPC
418
+ on the server.
419
+ """
420
+ # Generate a "stub function" on-the-fly which will actually make
421
+ # the request.
422
+ # gRPC handles serialization and deserialization, so we just need
423
+ # to pass in the functions for each.
424
+ if "update_session" not in self._stubs:
425
+ self._stubs["update_session"] = self._logged_channel.unary_unary(
426
+ "/google.cloud.discoveryengine.v1beta.SessionService/UpdateSession",
427
+ request_serializer=conversational_search_service.UpdateSessionRequest.serialize,
428
+ response_deserializer=gcd_session.Session.deserialize,
429
+ )
430
+ return self._stubs["update_session"]
431
+
432
+ @property
433
+ def get_session(
434
+ self,
435
+ ) -> Callable[
436
+ [conversational_search_service.GetSessionRequest], Awaitable[session.Session]
437
+ ]:
438
+ r"""Return a callable for the get session method over gRPC.
439
+
440
+ Gets a Session.
441
+
442
+ Returns:
443
+ Callable[[~.GetSessionRequest],
444
+ Awaitable[~.Session]]:
445
+ A function that, when called, will call the underlying RPC
446
+ on the server.
447
+ """
448
+ # Generate a "stub function" on-the-fly which will actually make
449
+ # the request.
450
+ # gRPC handles serialization and deserialization, so we just need
451
+ # to pass in the functions for each.
452
+ if "get_session" not in self._stubs:
453
+ self._stubs["get_session"] = self._logged_channel.unary_unary(
454
+ "/google.cloud.discoveryengine.v1beta.SessionService/GetSession",
455
+ request_serializer=conversational_search_service.GetSessionRequest.serialize,
456
+ response_deserializer=session.Session.deserialize,
457
+ )
458
+ return self._stubs["get_session"]
459
+
460
+ @property
461
+ def list_sessions(
462
+ self,
463
+ ) -> Callable[
464
+ [conversational_search_service.ListSessionsRequest],
465
+ Awaitable[conversational_search_service.ListSessionsResponse],
466
+ ]:
467
+ r"""Return a callable for the list sessions method over gRPC.
468
+
469
+ Lists all Sessions by their parent
470
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
471
+
472
+ Returns:
473
+ Callable[[~.ListSessionsRequest],
474
+ Awaitable[~.ListSessionsResponse]]:
475
+ A function that, when called, will call the underlying RPC
476
+ on the server.
477
+ """
478
+ # Generate a "stub function" on-the-fly which will actually make
479
+ # the request.
480
+ # gRPC handles serialization and deserialization, so we just need
481
+ # to pass in the functions for each.
482
+ if "list_sessions" not in self._stubs:
483
+ self._stubs["list_sessions"] = self._logged_channel.unary_unary(
484
+ "/google.cloud.discoveryengine.v1beta.SessionService/ListSessions",
485
+ request_serializer=conversational_search_service.ListSessionsRequest.serialize,
486
+ response_deserializer=conversational_search_service.ListSessionsResponse.deserialize,
487
+ )
488
+ return self._stubs["list_sessions"]
489
+
490
+ def _prep_wrapped_messages(self, client_info):
491
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
492
+ self._wrapped_methods = {
493
+ self.create_session: self._wrap_method(
494
+ self.create_session,
495
+ default_timeout=None,
496
+ client_info=client_info,
497
+ ),
498
+ self.delete_session: self._wrap_method(
499
+ self.delete_session,
500
+ default_timeout=None,
501
+ client_info=client_info,
502
+ ),
503
+ self.update_session: self._wrap_method(
504
+ self.update_session,
505
+ default_timeout=None,
506
+ client_info=client_info,
507
+ ),
508
+ self.get_session: self._wrap_method(
509
+ self.get_session,
510
+ default_timeout=None,
511
+ client_info=client_info,
512
+ ),
513
+ self.list_sessions: self._wrap_method(
514
+ self.list_sessions,
515
+ default_timeout=None,
516
+ client_info=client_info,
517
+ ),
518
+ self.cancel_operation: self._wrap_method(
519
+ self.cancel_operation,
520
+ default_timeout=None,
521
+ client_info=client_info,
522
+ ),
523
+ self.get_operation: self._wrap_method(
524
+ self.get_operation,
525
+ default_timeout=None,
526
+ client_info=client_info,
527
+ ),
528
+ self.list_operations: self._wrap_method(
529
+ self.list_operations,
530
+ default_timeout=None,
531
+ client_info=client_info,
532
+ ),
533
+ }
534
+
535
+ def _wrap_method(self, func, *args, **kwargs):
536
+ if self._wrap_with_kind: # pragma: NO COVER
537
+ kwargs["kind"] = self.kind
538
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
539
+
540
+ def close(self):
541
+ return self._logged_channel.close()
542
+
543
+ @property
544
+ def kind(self) -> str:
545
+ return "grpc_asyncio"
546
+
547
+ @property
548
+ def cancel_operation(
549
+ self,
550
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
551
+ r"""Return a callable for the cancel_operation method over gRPC."""
552
+ # Generate a "stub function" on-the-fly which will actually make
553
+ # the request.
554
+ # gRPC handles serialization and deserialization, so we just need
555
+ # to pass in the functions for each.
556
+ if "cancel_operation" not in self._stubs:
557
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
558
+ "/google.longrunning.Operations/CancelOperation",
559
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
560
+ response_deserializer=None,
561
+ )
562
+ return self._stubs["cancel_operation"]
563
+
564
+ @property
565
+ def get_operation(
566
+ self,
567
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
568
+ r"""Return a callable for the get_operation method over gRPC."""
569
+ # Generate a "stub function" on-the-fly which will actually make
570
+ # the request.
571
+ # gRPC handles serialization and deserialization, so we just need
572
+ # to pass in the functions for each.
573
+ if "get_operation" not in self._stubs:
574
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
575
+ "/google.longrunning.Operations/GetOperation",
576
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
577
+ response_deserializer=operations_pb2.Operation.FromString,
578
+ )
579
+ return self._stubs["get_operation"]
580
+
581
+ @property
582
+ def list_operations(
583
+ self,
584
+ ) -> Callable[
585
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
586
+ ]:
587
+ r"""Return a callable for the list_operations method over gRPC."""
588
+ # Generate a "stub function" on-the-fly which will actually make
589
+ # the request.
590
+ # gRPC handles serialization and deserialization, so we just need
591
+ # to pass in the functions for each.
592
+ if "list_operations" not in self._stubs:
593
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
594
+ "/google.longrunning.Operations/ListOperations",
595
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
596
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
597
+ )
598
+ return self._stubs["list_operations"]
599
+
600
+
601
+ __all__ = ("SessionServiceGrpcAsyncIOTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/transports/rest.py ADDED
@@ -0,0 +1,1647 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import dataclasses
17
+ import json # type: ignore
18
+ import logging
19
+ from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
20
+ import warnings
21
+
22
+ from google.api_core import exceptions as core_exceptions
23
+ from google.api_core import gapic_v1, rest_helpers, rest_streaming
24
+ from google.api_core import retry as retries
25
+ from google.auth import credentials as ga_credentials # type: ignore
26
+ from google.auth.transport.requests import AuthorizedSession # type: ignore
27
+ from google.cloud.location import locations_pb2 # type: ignore
28
+ from google.longrunning import operations_pb2 # type: ignore
29
+ import google.protobuf
30
+ from google.protobuf import empty_pb2 # type: ignore
31
+ from google.protobuf import json_format
32
+ from requests import __version__ as requests_version
33
+
34
+ from google.cloud.discoveryengine_v1beta.types import conversational_search_service
35
+ from google.cloud.discoveryengine_v1beta.types import session
36
+ from google.cloud.discoveryengine_v1beta.types import session as gcd_session
37
+
38
+ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO
39
+ from .rest_base import _BaseSessionServiceRestTransport
40
+
41
+ try:
42
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
43
+ except AttributeError: # pragma: NO COVER
44
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
45
+
46
+ try:
47
+ from google.api_core import client_logging # type: ignore
48
+
49
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
50
+ except ImportError: # pragma: NO COVER
51
+ CLIENT_LOGGING_SUPPORTED = False
52
+
53
+ _LOGGER = logging.getLogger(__name__)
54
+
55
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
56
+ gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version,
57
+ grpc_version=None,
58
+ rest_version=f"requests@{requests_version}",
59
+ )
60
+
61
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
62
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
63
+
64
+
65
+ class SessionServiceRestInterceptor:
66
+ """Interceptor for SessionService.
67
+
68
+ Interceptors are used to manipulate requests, request metadata, and responses
69
+ in arbitrary ways.
70
+ Example use cases include:
71
+ * Logging
72
+ * Verifying requests according to service or custom semantics
73
+ * Stripping extraneous information from responses
74
+
75
+ These use cases and more can be enabled by injecting an
76
+ instance of a custom subclass when constructing the SessionServiceRestTransport.
77
+
78
+ .. code-block:: python
79
+ class MyCustomSessionServiceInterceptor(SessionServiceRestInterceptor):
80
+ def pre_create_session(self, request, metadata):
81
+ logging.log(f"Received request: {request}")
82
+ return request, metadata
83
+
84
+ def post_create_session(self, response):
85
+ logging.log(f"Received response: {response}")
86
+ return response
87
+
88
+ def pre_delete_session(self, request, metadata):
89
+ logging.log(f"Received request: {request}")
90
+ return request, metadata
91
+
92
+ def pre_get_session(self, request, metadata):
93
+ logging.log(f"Received request: {request}")
94
+ return request, metadata
95
+
96
+ def post_get_session(self, response):
97
+ logging.log(f"Received response: {response}")
98
+ return response
99
+
100
+ def pre_list_sessions(self, request, metadata):
101
+ logging.log(f"Received request: {request}")
102
+ return request, metadata
103
+
104
+ def post_list_sessions(self, response):
105
+ logging.log(f"Received response: {response}")
106
+ return response
107
+
108
+ def pre_update_session(self, request, metadata):
109
+ logging.log(f"Received request: {request}")
110
+ return request, metadata
111
+
112
+ def post_update_session(self, response):
113
+ logging.log(f"Received response: {response}")
114
+ return response
115
+
116
+ transport = SessionServiceRestTransport(interceptor=MyCustomSessionServiceInterceptor())
117
+ client = SessionServiceClient(transport=transport)
118
+
119
+
120
+ """
121
+
122
+ def pre_create_session(
123
+ self,
124
+ request: conversational_search_service.CreateSessionRequest,
125
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
126
+ ) -> Tuple[
127
+ conversational_search_service.CreateSessionRequest,
128
+ Sequence[Tuple[str, Union[str, bytes]]],
129
+ ]:
130
+ """Pre-rpc interceptor for create_session
131
+
132
+ Override in a subclass to manipulate the request or metadata
133
+ before they are sent to the SessionService server.
134
+ """
135
+ return request, metadata
136
+
137
+ def post_create_session(self, response: gcd_session.Session) -> gcd_session.Session:
138
+ """Post-rpc interceptor for create_session
139
+
140
+ DEPRECATED. Please use the `post_create_session_with_metadata`
141
+ interceptor instead.
142
+
143
+ Override in a subclass to read or manipulate the response
144
+ after it is returned by the SessionService server but before
145
+ it is returned to user code. This `post_create_session` interceptor runs
146
+ before the `post_create_session_with_metadata` interceptor.
147
+ """
148
+ return response
149
+
150
+ def post_create_session_with_metadata(
151
+ self,
152
+ response: gcd_session.Session,
153
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
154
+ ) -> Tuple[gcd_session.Session, Sequence[Tuple[str, Union[str, bytes]]]]:
155
+ """Post-rpc interceptor for create_session
156
+
157
+ Override in a subclass to read or manipulate the response or metadata after it
158
+ is returned by the SessionService server but before it is returned to user code.
159
+
160
+ We recommend only using this `post_create_session_with_metadata`
161
+ interceptor in new development instead of the `post_create_session` interceptor.
162
+ When both interceptors are used, this `post_create_session_with_metadata` interceptor runs after the
163
+ `post_create_session` interceptor. The (possibly modified) response returned by
164
+ `post_create_session` will be passed to
165
+ `post_create_session_with_metadata`.
166
+ """
167
+ return response, metadata
168
+
169
+ def pre_delete_session(
170
+ self,
171
+ request: conversational_search_service.DeleteSessionRequest,
172
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
173
+ ) -> Tuple[
174
+ conversational_search_service.DeleteSessionRequest,
175
+ Sequence[Tuple[str, Union[str, bytes]]],
176
+ ]:
177
+ """Pre-rpc interceptor for delete_session
178
+
179
+ Override in a subclass to manipulate the request or metadata
180
+ before they are sent to the SessionService server.
181
+ """
182
+ return request, metadata
183
+
184
+ def pre_get_session(
185
+ self,
186
+ request: conversational_search_service.GetSessionRequest,
187
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
188
+ ) -> Tuple[
189
+ conversational_search_service.GetSessionRequest,
190
+ Sequence[Tuple[str, Union[str, bytes]]],
191
+ ]:
192
+ """Pre-rpc interceptor for get_session
193
+
194
+ Override in a subclass to manipulate the request or metadata
195
+ before they are sent to the SessionService server.
196
+ """
197
+ return request, metadata
198
+
199
+ def post_get_session(self, response: session.Session) -> session.Session:
200
+ """Post-rpc interceptor for get_session
201
+
202
+ DEPRECATED. Please use the `post_get_session_with_metadata`
203
+ interceptor instead.
204
+
205
+ Override in a subclass to read or manipulate the response
206
+ after it is returned by the SessionService server but before
207
+ it is returned to user code. This `post_get_session` interceptor runs
208
+ before the `post_get_session_with_metadata` interceptor.
209
+ """
210
+ return response
211
+
212
+ def post_get_session_with_metadata(
213
+ self,
214
+ response: session.Session,
215
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
216
+ ) -> Tuple[session.Session, Sequence[Tuple[str, Union[str, bytes]]]]:
217
+ """Post-rpc interceptor for get_session
218
+
219
+ Override in a subclass to read or manipulate the response or metadata after it
220
+ is returned by the SessionService server but before it is returned to user code.
221
+
222
+ We recommend only using this `post_get_session_with_metadata`
223
+ interceptor in new development instead of the `post_get_session` interceptor.
224
+ When both interceptors are used, this `post_get_session_with_metadata` interceptor runs after the
225
+ `post_get_session` interceptor. The (possibly modified) response returned by
226
+ `post_get_session` will be passed to
227
+ `post_get_session_with_metadata`.
228
+ """
229
+ return response, metadata
230
+
231
+ def pre_list_sessions(
232
+ self,
233
+ request: conversational_search_service.ListSessionsRequest,
234
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
235
+ ) -> Tuple[
236
+ conversational_search_service.ListSessionsRequest,
237
+ Sequence[Tuple[str, Union[str, bytes]]],
238
+ ]:
239
+ """Pre-rpc interceptor for list_sessions
240
+
241
+ Override in a subclass to manipulate the request or metadata
242
+ before they are sent to the SessionService server.
243
+ """
244
+ return request, metadata
245
+
246
+ def post_list_sessions(
247
+ self, response: conversational_search_service.ListSessionsResponse
248
+ ) -> conversational_search_service.ListSessionsResponse:
249
+ """Post-rpc interceptor for list_sessions
250
+
251
+ DEPRECATED. Please use the `post_list_sessions_with_metadata`
252
+ interceptor instead.
253
+
254
+ Override in a subclass to read or manipulate the response
255
+ after it is returned by the SessionService server but before
256
+ it is returned to user code. This `post_list_sessions` interceptor runs
257
+ before the `post_list_sessions_with_metadata` interceptor.
258
+ """
259
+ return response
260
+
261
+ def post_list_sessions_with_metadata(
262
+ self,
263
+ response: conversational_search_service.ListSessionsResponse,
264
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
265
+ ) -> Tuple[
266
+ conversational_search_service.ListSessionsResponse,
267
+ Sequence[Tuple[str, Union[str, bytes]]],
268
+ ]:
269
+ """Post-rpc interceptor for list_sessions
270
+
271
+ Override in a subclass to read or manipulate the response or metadata after it
272
+ is returned by the SessionService server but before it is returned to user code.
273
+
274
+ We recommend only using this `post_list_sessions_with_metadata`
275
+ interceptor in new development instead of the `post_list_sessions` interceptor.
276
+ When both interceptors are used, this `post_list_sessions_with_metadata` interceptor runs after the
277
+ `post_list_sessions` interceptor. The (possibly modified) response returned by
278
+ `post_list_sessions` will be passed to
279
+ `post_list_sessions_with_metadata`.
280
+ """
281
+ return response, metadata
282
+
283
+ def pre_update_session(
284
+ self,
285
+ request: conversational_search_service.UpdateSessionRequest,
286
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
287
+ ) -> Tuple[
288
+ conversational_search_service.UpdateSessionRequest,
289
+ Sequence[Tuple[str, Union[str, bytes]]],
290
+ ]:
291
+ """Pre-rpc interceptor for update_session
292
+
293
+ Override in a subclass to manipulate the request or metadata
294
+ before they are sent to the SessionService server.
295
+ """
296
+ return request, metadata
297
+
298
+ def post_update_session(self, response: gcd_session.Session) -> gcd_session.Session:
299
+ """Post-rpc interceptor for update_session
300
+
301
+ DEPRECATED. Please use the `post_update_session_with_metadata`
302
+ interceptor instead.
303
+
304
+ Override in a subclass to read or manipulate the response
305
+ after it is returned by the SessionService server but before
306
+ it is returned to user code. This `post_update_session` interceptor runs
307
+ before the `post_update_session_with_metadata` interceptor.
308
+ """
309
+ return response
310
+
311
+ def post_update_session_with_metadata(
312
+ self,
313
+ response: gcd_session.Session,
314
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
315
+ ) -> Tuple[gcd_session.Session, Sequence[Tuple[str, Union[str, bytes]]]]:
316
+ """Post-rpc interceptor for update_session
317
+
318
+ Override in a subclass to read or manipulate the response or metadata after it
319
+ is returned by the SessionService server but before it is returned to user code.
320
+
321
+ We recommend only using this `post_update_session_with_metadata`
322
+ interceptor in new development instead of the `post_update_session` interceptor.
323
+ When both interceptors are used, this `post_update_session_with_metadata` interceptor runs after the
324
+ `post_update_session` interceptor. The (possibly modified) response returned by
325
+ `post_update_session` will be passed to
326
+ `post_update_session_with_metadata`.
327
+ """
328
+ return response, metadata
329
+
330
+ def pre_cancel_operation(
331
+ self,
332
+ request: operations_pb2.CancelOperationRequest,
333
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
334
+ ) -> Tuple[
335
+ operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
336
+ ]:
337
+ """Pre-rpc interceptor for cancel_operation
338
+
339
+ Override in a subclass to manipulate the request or metadata
340
+ before they are sent to the SessionService server.
341
+ """
342
+ return request, metadata
343
+
344
+ def post_cancel_operation(self, response: None) -> None:
345
+ """Post-rpc interceptor for cancel_operation
346
+
347
+ Override in a subclass to manipulate the response
348
+ after it is returned by the SessionService server but before
349
+ it is returned to user code.
350
+ """
351
+ return response
352
+
353
+ def pre_get_operation(
354
+ self,
355
+ request: operations_pb2.GetOperationRequest,
356
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
357
+ ) -> Tuple[
358
+ operations_pb2.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
359
+ ]:
360
+ """Pre-rpc interceptor for get_operation
361
+
362
+ Override in a subclass to manipulate the request or metadata
363
+ before they are sent to the SessionService server.
364
+ """
365
+ return request, metadata
366
+
367
+ def post_get_operation(
368
+ self, response: operations_pb2.Operation
369
+ ) -> operations_pb2.Operation:
370
+ """Post-rpc interceptor for get_operation
371
+
372
+ Override in a subclass to manipulate the response
373
+ after it is returned by the SessionService server but before
374
+ it is returned to user code.
375
+ """
376
+ return response
377
+
378
+ def pre_list_operations(
379
+ self,
380
+ request: operations_pb2.ListOperationsRequest,
381
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
382
+ ) -> Tuple[
383
+ operations_pb2.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]]
384
+ ]:
385
+ """Pre-rpc interceptor for list_operations
386
+
387
+ Override in a subclass to manipulate the request or metadata
388
+ before they are sent to the SessionService server.
389
+ """
390
+ return request, metadata
391
+
392
+ def post_list_operations(
393
+ self, response: operations_pb2.ListOperationsResponse
394
+ ) -> operations_pb2.ListOperationsResponse:
395
+ """Post-rpc interceptor for list_operations
396
+
397
+ Override in a subclass to manipulate the response
398
+ after it is returned by the SessionService server but before
399
+ it is returned to user code.
400
+ """
401
+ return response
402
+
403
+
404
+ @dataclasses.dataclass
405
+ class SessionServiceRestStub:
406
+ _session: AuthorizedSession
407
+ _host: str
408
+ _interceptor: SessionServiceRestInterceptor
409
+
410
+
411
+ class SessionServiceRestTransport(_BaseSessionServiceRestTransport):
412
+ """REST backend synchronous transport for SessionService.
413
+
414
+ Service for managing Sessions and Session-related resources.
415
+
416
+ This class defines the same methods as the primary client, so the
417
+ primary client can load the underlying transport implementation
418
+ and call it.
419
+
420
+ It sends JSON representations of protocol buffers over HTTP/1.1
421
+ """
422
+
423
+ def __init__(
424
+ self,
425
+ *,
426
+ host: str = "discoveryengine.googleapis.com",
427
+ credentials: Optional[ga_credentials.Credentials] = None,
428
+ credentials_file: Optional[str] = None,
429
+ scopes: Optional[Sequence[str]] = None,
430
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
431
+ quota_project_id: Optional[str] = None,
432
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
433
+ always_use_jwt_access: Optional[bool] = False,
434
+ url_scheme: str = "https",
435
+ interceptor: Optional[SessionServiceRestInterceptor] = None,
436
+ api_audience: Optional[str] = None,
437
+ ) -> None:
438
+ """Instantiate the transport.
439
+
440
+ Args:
441
+ host (Optional[str]):
442
+ The hostname to connect to (default: 'discoveryengine.googleapis.com').
443
+ credentials (Optional[google.auth.credentials.Credentials]): The
444
+ authorization credentials to attach to requests. These
445
+ credentials identify the application to the service; if none
446
+ are specified, the client will attempt to ascertain the
447
+ credentials from the environment.
448
+
449
+ credentials_file (Optional[str]): A file with credentials that can
450
+ be loaded with :func:`google.auth.load_credentials_from_file`.
451
+ This argument is ignored if ``channel`` is provided.
452
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
453
+ ignored if ``channel`` is provided.
454
+ client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client
455
+ certificate to configure mutual TLS HTTP channel. It is ignored
456
+ if ``channel`` is provided.
457
+ quota_project_id (Optional[str]): An optional project to use for billing
458
+ and quota.
459
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
460
+ The client info used to send a user-agent string along with
461
+ API requests. If ``None``, then default info will be used.
462
+ Generally, you only need to set this if you are developing
463
+ your own client library.
464
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
465
+ be used for service account credentials.
466
+ url_scheme: the protocol scheme for the API endpoint. Normally
467
+ "https", but for testing or local servers,
468
+ "http" can be specified.
469
+ """
470
+ # Run the base constructor
471
+ # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc.
472
+ # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the
473
+ # credentials object
474
+ super().__init__(
475
+ host=host,
476
+ credentials=credentials,
477
+ client_info=client_info,
478
+ always_use_jwt_access=always_use_jwt_access,
479
+ url_scheme=url_scheme,
480
+ api_audience=api_audience,
481
+ )
482
+ self._session = AuthorizedSession(
483
+ self._credentials, default_host=self.DEFAULT_HOST
484
+ )
485
+ if client_cert_source_for_mtls:
486
+ self._session.configure_mtls_channel(client_cert_source_for_mtls)
487
+ self._interceptor = interceptor or SessionServiceRestInterceptor()
488
+ self._prep_wrapped_messages(client_info)
489
+
490
+ class _CreateSession(
491
+ _BaseSessionServiceRestTransport._BaseCreateSession, SessionServiceRestStub
492
+ ):
493
+ def __hash__(self):
494
+ return hash("SessionServiceRestTransport.CreateSession")
495
+
496
+ @staticmethod
497
+ def _get_response(
498
+ host,
499
+ metadata,
500
+ query_params,
501
+ session,
502
+ timeout,
503
+ transcoded_request,
504
+ body=None,
505
+ ):
506
+ uri = transcoded_request["uri"]
507
+ method = transcoded_request["method"]
508
+ headers = dict(metadata)
509
+ headers["Content-Type"] = "application/json"
510
+ response = getattr(session, method)(
511
+ "{host}{uri}".format(host=host, uri=uri),
512
+ timeout=timeout,
513
+ headers=headers,
514
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
515
+ data=body,
516
+ )
517
+ return response
518
+
519
+ def __call__(
520
+ self,
521
+ request: conversational_search_service.CreateSessionRequest,
522
+ *,
523
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
524
+ timeout: Optional[float] = None,
525
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
526
+ ) -> gcd_session.Session:
527
+ r"""Call the create session method over HTTP.
528
+
529
+ Args:
530
+ request (~.conversational_search_service.CreateSessionRequest):
531
+ The request object. Request for CreateSession method.
532
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
533
+ should be retried.
534
+ timeout (float): The timeout for this request.
535
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
536
+ sent along with the request as metadata. Normally, each value must be of type `str`,
537
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
538
+ be of type `bytes`.
539
+
540
+ Returns:
541
+ ~.gcd_session.Session:
542
+ External session proto definition.
543
+ """
544
+
545
+ http_options = (
546
+ _BaseSessionServiceRestTransport._BaseCreateSession._get_http_options()
547
+ )
548
+
549
+ request, metadata = self._interceptor.pre_create_session(request, metadata)
550
+ transcoded_request = _BaseSessionServiceRestTransport._BaseCreateSession._get_transcoded_request(
551
+ http_options, request
552
+ )
553
+
554
+ body = _BaseSessionServiceRestTransport._BaseCreateSession._get_request_body_json(
555
+ transcoded_request
556
+ )
557
+
558
+ # Jsonify the query params
559
+ query_params = _BaseSessionServiceRestTransport._BaseCreateSession._get_query_params_json(
560
+ transcoded_request
561
+ )
562
+
563
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
564
+ logging.DEBUG
565
+ ): # pragma: NO COVER
566
+ request_url = "{host}{uri}".format(
567
+ host=self._host, uri=transcoded_request["uri"]
568
+ )
569
+ method = transcoded_request["method"]
570
+ try:
571
+ request_payload = type(request).to_json(request)
572
+ except:
573
+ request_payload = None
574
+ http_request = {
575
+ "payload": request_payload,
576
+ "requestMethod": method,
577
+ "requestUrl": request_url,
578
+ "headers": dict(metadata),
579
+ }
580
+ _LOGGER.debug(
581
+ f"Sending request for google.cloud.discoveryengine_v1beta.SessionServiceClient.CreateSession",
582
+ extra={
583
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
584
+ "rpcName": "CreateSession",
585
+ "httpRequest": http_request,
586
+ "metadata": http_request["headers"],
587
+ },
588
+ )
589
+
590
+ # Send the request
591
+ response = SessionServiceRestTransport._CreateSession._get_response(
592
+ self._host,
593
+ metadata,
594
+ query_params,
595
+ self._session,
596
+ timeout,
597
+ transcoded_request,
598
+ body,
599
+ )
600
+
601
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
602
+ # subclass.
603
+ if response.status_code >= 400:
604
+ raise core_exceptions.from_http_response(response)
605
+
606
+ # Return the response
607
+ resp = gcd_session.Session()
608
+ pb_resp = gcd_session.Session.pb(resp)
609
+
610
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
611
+
612
+ resp = self._interceptor.post_create_session(resp)
613
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
614
+ resp, _ = self._interceptor.post_create_session_with_metadata(
615
+ resp, response_metadata
616
+ )
617
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
618
+ logging.DEBUG
619
+ ): # pragma: NO COVER
620
+ try:
621
+ response_payload = gcd_session.Session.to_json(response)
622
+ except:
623
+ response_payload = None
624
+ http_response = {
625
+ "payload": response_payload,
626
+ "headers": dict(response.headers),
627
+ "status": response.status_code,
628
+ }
629
+ _LOGGER.debug(
630
+ "Received response for google.cloud.discoveryengine_v1beta.SessionServiceClient.create_session",
631
+ extra={
632
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
633
+ "rpcName": "CreateSession",
634
+ "metadata": http_response["headers"],
635
+ "httpResponse": http_response,
636
+ },
637
+ )
638
+ return resp
639
+
640
+ class _DeleteSession(
641
+ _BaseSessionServiceRestTransport._BaseDeleteSession, SessionServiceRestStub
642
+ ):
643
+ def __hash__(self):
644
+ return hash("SessionServiceRestTransport.DeleteSession")
645
+
646
+ @staticmethod
647
+ def _get_response(
648
+ host,
649
+ metadata,
650
+ query_params,
651
+ session,
652
+ timeout,
653
+ transcoded_request,
654
+ body=None,
655
+ ):
656
+ uri = transcoded_request["uri"]
657
+ method = transcoded_request["method"]
658
+ headers = dict(metadata)
659
+ headers["Content-Type"] = "application/json"
660
+ response = getattr(session, method)(
661
+ "{host}{uri}".format(host=host, uri=uri),
662
+ timeout=timeout,
663
+ headers=headers,
664
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
665
+ )
666
+ return response
667
+
668
+ def __call__(
669
+ self,
670
+ request: conversational_search_service.DeleteSessionRequest,
671
+ *,
672
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
673
+ timeout: Optional[float] = None,
674
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
675
+ ):
676
+ r"""Call the delete session method over HTTP.
677
+
678
+ Args:
679
+ request (~.conversational_search_service.DeleteSessionRequest):
680
+ The request object. Request for DeleteSession method.
681
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
682
+ should be retried.
683
+ timeout (float): The timeout for this request.
684
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
685
+ sent along with the request as metadata. Normally, each value must be of type `str`,
686
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
687
+ be of type `bytes`.
688
+ """
689
+
690
+ http_options = (
691
+ _BaseSessionServiceRestTransport._BaseDeleteSession._get_http_options()
692
+ )
693
+
694
+ request, metadata = self._interceptor.pre_delete_session(request, metadata)
695
+ transcoded_request = _BaseSessionServiceRestTransport._BaseDeleteSession._get_transcoded_request(
696
+ http_options, request
697
+ )
698
+
699
+ # Jsonify the query params
700
+ query_params = _BaseSessionServiceRestTransport._BaseDeleteSession._get_query_params_json(
701
+ transcoded_request
702
+ )
703
+
704
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
705
+ logging.DEBUG
706
+ ): # pragma: NO COVER
707
+ request_url = "{host}{uri}".format(
708
+ host=self._host, uri=transcoded_request["uri"]
709
+ )
710
+ method = transcoded_request["method"]
711
+ try:
712
+ request_payload = json_format.MessageToJson(request)
713
+ except:
714
+ request_payload = None
715
+ http_request = {
716
+ "payload": request_payload,
717
+ "requestMethod": method,
718
+ "requestUrl": request_url,
719
+ "headers": dict(metadata),
720
+ }
721
+ _LOGGER.debug(
722
+ f"Sending request for google.cloud.discoveryengine_v1beta.SessionServiceClient.DeleteSession",
723
+ extra={
724
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
725
+ "rpcName": "DeleteSession",
726
+ "httpRequest": http_request,
727
+ "metadata": http_request["headers"],
728
+ },
729
+ )
730
+
731
+ # Send the request
732
+ response = SessionServiceRestTransport._DeleteSession._get_response(
733
+ self._host,
734
+ metadata,
735
+ query_params,
736
+ self._session,
737
+ timeout,
738
+ transcoded_request,
739
+ )
740
+
741
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
742
+ # subclass.
743
+ if response.status_code >= 400:
744
+ raise core_exceptions.from_http_response(response)
745
+
746
+ class _GetSession(
747
+ _BaseSessionServiceRestTransport._BaseGetSession, SessionServiceRestStub
748
+ ):
749
+ def __hash__(self):
750
+ return hash("SessionServiceRestTransport.GetSession")
751
+
752
+ @staticmethod
753
+ def _get_response(
754
+ host,
755
+ metadata,
756
+ query_params,
757
+ session,
758
+ timeout,
759
+ transcoded_request,
760
+ body=None,
761
+ ):
762
+ uri = transcoded_request["uri"]
763
+ method = transcoded_request["method"]
764
+ headers = dict(metadata)
765
+ headers["Content-Type"] = "application/json"
766
+ response = getattr(session, method)(
767
+ "{host}{uri}".format(host=host, uri=uri),
768
+ timeout=timeout,
769
+ headers=headers,
770
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
771
+ )
772
+ return response
773
+
774
+ def __call__(
775
+ self,
776
+ request: conversational_search_service.GetSessionRequest,
777
+ *,
778
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
779
+ timeout: Optional[float] = None,
780
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
781
+ ) -> session.Session:
782
+ r"""Call the get session method over HTTP.
783
+
784
+ Args:
785
+ request (~.conversational_search_service.GetSessionRequest):
786
+ The request object. Request for GetSession method.
787
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
788
+ should be retried.
789
+ timeout (float): The timeout for this request.
790
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
791
+ sent along with the request as metadata. Normally, each value must be of type `str`,
792
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
793
+ be of type `bytes`.
794
+
795
+ Returns:
796
+ ~.session.Session:
797
+ External session proto definition.
798
+ """
799
+
800
+ http_options = (
801
+ _BaseSessionServiceRestTransport._BaseGetSession._get_http_options()
802
+ )
803
+
804
+ request, metadata = self._interceptor.pre_get_session(request, metadata)
805
+ transcoded_request = _BaseSessionServiceRestTransport._BaseGetSession._get_transcoded_request(
806
+ http_options, request
807
+ )
808
+
809
+ # Jsonify the query params
810
+ query_params = (
811
+ _BaseSessionServiceRestTransport._BaseGetSession._get_query_params_json(
812
+ transcoded_request
813
+ )
814
+ )
815
+
816
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
817
+ logging.DEBUG
818
+ ): # pragma: NO COVER
819
+ request_url = "{host}{uri}".format(
820
+ host=self._host, uri=transcoded_request["uri"]
821
+ )
822
+ method = transcoded_request["method"]
823
+ try:
824
+ request_payload = type(request).to_json(request)
825
+ except:
826
+ request_payload = None
827
+ http_request = {
828
+ "payload": request_payload,
829
+ "requestMethod": method,
830
+ "requestUrl": request_url,
831
+ "headers": dict(metadata),
832
+ }
833
+ _LOGGER.debug(
834
+ f"Sending request for google.cloud.discoveryengine_v1beta.SessionServiceClient.GetSession",
835
+ extra={
836
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
837
+ "rpcName": "GetSession",
838
+ "httpRequest": http_request,
839
+ "metadata": http_request["headers"],
840
+ },
841
+ )
842
+
843
+ # Send the request
844
+ response = SessionServiceRestTransport._GetSession._get_response(
845
+ self._host,
846
+ metadata,
847
+ query_params,
848
+ self._session,
849
+ timeout,
850
+ transcoded_request,
851
+ )
852
+
853
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
854
+ # subclass.
855
+ if response.status_code >= 400:
856
+ raise core_exceptions.from_http_response(response)
857
+
858
+ # Return the response
859
+ resp = session.Session()
860
+ pb_resp = session.Session.pb(resp)
861
+
862
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
863
+
864
+ resp = self._interceptor.post_get_session(resp)
865
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
866
+ resp, _ = self._interceptor.post_get_session_with_metadata(
867
+ resp, response_metadata
868
+ )
869
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
870
+ logging.DEBUG
871
+ ): # pragma: NO COVER
872
+ try:
873
+ response_payload = session.Session.to_json(response)
874
+ except:
875
+ response_payload = None
876
+ http_response = {
877
+ "payload": response_payload,
878
+ "headers": dict(response.headers),
879
+ "status": response.status_code,
880
+ }
881
+ _LOGGER.debug(
882
+ "Received response for google.cloud.discoveryengine_v1beta.SessionServiceClient.get_session",
883
+ extra={
884
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
885
+ "rpcName": "GetSession",
886
+ "metadata": http_response["headers"],
887
+ "httpResponse": http_response,
888
+ },
889
+ )
890
+ return resp
891
+
892
+ class _ListSessions(
893
+ _BaseSessionServiceRestTransport._BaseListSessions, SessionServiceRestStub
894
+ ):
895
+ def __hash__(self):
896
+ return hash("SessionServiceRestTransport.ListSessions")
897
+
898
+ @staticmethod
899
+ def _get_response(
900
+ host,
901
+ metadata,
902
+ query_params,
903
+ session,
904
+ timeout,
905
+ transcoded_request,
906
+ body=None,
907
+ ):
908
+ uri = transcoded_request["uri"]
909
+ method = transcoded_request["method"]
910
+ headers = dict(metadata)
911
+ headers["Content-Type"] = "application/json"
912
+ response = getattr(session, method)(
913
+ "{host}{uri}".format(host=host, uri=uri),
914
+ timeout=timeout,
915
+ headers=headers,
916
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
917
+ )
918
+ return response
919
+
920
+ def __call__(
921
+ self,
922
+ request: conversational_search_service.ListSessionsRequest,
923
+ *,
924
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
925
+ timeout: Optional[float] = None,
926
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
927
+ ) -> conversational_search_service.ListSessionsResponse:
928
+ r"""Call the list sessions method over HTTP.
929
+
930
+ Args:
931
+ request (~.conversational_search_service.ListSessionsRequest):
932
+ The request object. Request for ListSessions method.
933
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
934
+ should be retried.
935
+ timeout (float): The timeout for this request.
936
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
937
+ sent along with the request as metadata. Normally, each value must be of type `str`,
938
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
939
+ be of type `bytes`.
940
+
941
+ Returns:
942
+ ~.conversational_search_service.ListSessionsResponse:
943
+ Response for ListSessions method.
944
+ """
945
+
946
+ http_options = (
947
+ _BaseSessionServiceRestTransport._BaseListSessions._get_http_options()
948
+ )
949
+
950
+ request, metadata = self._interceptor.pre_list_sessions(request, metadata)
951
+ transcoded_request = _BaseSessionServiceRestTransport._BaseListSessions._get_transcoded_request(
952
+ http_options, request
953
+ )
954
+
955
+ # Jsonify the query params
956
+ query_params = _BaseSessionServiceRestTransport._BaseListSessions._get_query_params_json(
957
+ transcoded_request
958
+ )
959
+
960
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
961
+ logging.DEBUG
962
+ ): # pragma: NO COVER
963
+ request_url = "{host}{uri}".format(
964
+ host=self._host, uri=transcoded_request["uri"]
965
+ )
966
+ method = transcoded_request["method"]
967
+ try:
968
+ request_payload = type(request).to_json(request)
969
+ except:
970
+ request_payload = None
971
+ http_request = {
972
+ "payload": request_payload,
973
+ "requestMethod": method,
974
+ "requestUrl": request_url,
975
+ "headers": dict(metadata),
976
+ }
977
+ _LOGGER.debug(
978
+ f"Sending request for google.cloud.discoveryengine_v1beta.SessionServiceClient.ListSessions",
979
+ extra={
980
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
981
+ "rpcName": "ListSessions",
982
+ "httpRequest": http_request,
983
+ "metadata": http_request["headers"],
984
+ },
985
+ )
986
+
987
+ # Send the request
988
+ response = SessionServiceRestTransport._ListSessions._get_response(
989
+ self._host,
990
+ metadata,
991
+ query_params,
992
+ self._session,
993
+ timeout,
994
+ transcoded_request,
995
+ )
996
+
997
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
998
+ # subclass.
999
+ if response.status_code >= 400:
1000
+ raise core_exceptions.from_http_response(response)
1001
+
1002
+ # Return the response
1003
+ resp = conversational_search_service.ListSessionsResponse()
1004
+ pb_resp = conversational_search_service.ListSessionsResponse.pb(resp)
1005
+
1006
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
1007
+
1008
+ resp = self._interceptor.post_list_sessions(resp)
1009
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
1010
+ resp, _ = self._interceptor.post_list_sessions_with_metadata(
1011
+ resp, response_metadata
1012
+ )
1013
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1014
+ logging.DEBUG
1015
+ ): # pragma: NO COVER
1016
+ try:
1017
+ response_payload = (
1018
+ conversational_search_service.ListSessionsResponse.to_json(
1019
+ response
1020
+ )
1021
+ )
1022
+ except:
1023
+ response_payload = None
1024
+ http_response = {
1025
+ "payload": response_payload,
1026
+ "headers": dict(response.headers),
1027
+ "status": response.status_code,
1028
+ }
1029
+ _LOGGER.debug(
1030
+ "Received response for google.cloud.discoveryengine_v1beta.SessionServiceClient.list_sessions",
1031
+ extra={
1032
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
1033
+ "rpcName": "ListSessions",
1034
+ "metadata": http_response["headers"],
1035
+ "httpResponse": http_response,
1036
+ },
1037
+ )
1038
+ return resp
1039
+
1040
+ class _UpdateSession(
1041
+ _BaseSessionServiceRestTransport._BaseUpdateSession, SessionServiceRestStub
1042
+ ):
1043
+ def __hash__(self):
1044
+ return hash("SessionServiceRestTransport.UpdateSession")
1045
+
1046
+ @staticmethod
1047
+ def _get_response(
1048
+ host,
1049
+ metadata,
1050
+ query_params,
1051
+ session,
1052
+ timeout,
1053
+ transcoded_request,
1054
+ body=None,
1055
+ ):
1056
+ uri = transcoded_request["uri"]
1057
+ method = transcoded_request["method"]
1058
+ headers = dict(metadata)
1059
+ headers["Content-Type"] = "application/json"
1060
+ response = getattr(session, method)(
1061
+ "{host}{uri}".format(host=host, uri=uri),
1062
+ timeout=timeout,
1063
+ headers=headers,
1064
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1065
+ data=body,
1066
+ )
1067
+ return response
1068
+
1069
+ def __call__(
1070
+ self,
1071
+ request: conversational_search_service.UpdateSessionRequest,
1072
+ *,
1073
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1074
+ timeout: Optional[float] = None,
1075
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1076
+ ) -> gcd_session.Session:
1077
+ r"""Call the update session method over HTTP.
1078
+
1079
+ Args:
1080
+ request (~.conversational_search_service.UpdateSessionRequest):
1081
+ The request object. Request for UpdateSession method.
1082
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1083
+ should be retried.
1084
+ timeout (float): The timeout for this request.
1085
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1086
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1087
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1088
+ be of type `bytes`.
1089
+
1090
+ Returns:
1091
+ ~.gcd_session.Session:
1092
+ External session proto definition.
1093
+ """
1094
+
1095
+ http_options = (
1096
+ _BaseSessionServiceRestTransport._BaseUpdateSession._get_http_options()
1097
+ )
1098
+
1099
+ request, metadata = self._interceptor.pre_update_session(request, metadata)
1100
+ transcoded_request = _BaseSessionServiceRestTransport._BaseUpdateSession._get_transcoded_request(
1101
+ http_options, request
1102
+ )
1103
+
1104
+ body = _BaseSessionServiceRestTransport._BaseUpdateSession._get_request_body_json(
1105
+ transcoded_request
1106
+ )
1107
+
1108
+ # Jsonify the query params
1109
+ query_params = _BaseSessionServiceRestTransport._BaseUpdateSession._get_query_params_json(
1110
+ transcoded_request
1111
+ )
1112
+
1113
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1114
+ logging.DEBUG
1115
+ ): # pragma: NO COVER
1116
+ request_url = "{host}{uri}".format(
1117
+ host=self._host, uri=transcoded_request["uri"]
1118
+ )
1119
+ method = transcoded_request["method"]
1120
+ try:
1121
+ request_payload = type(request).to_json(request)
1122
+ except:
1123
+ request_payload = None
1124
+ http_request = {
1125
+ "payload": request_payload,
1126
+ "requestMethod": method,
1127
+ "requestUrl": request_url,
1128
+ "headers": dict(metadata),
1129
+ }
1130
+ _LOGGER.debug(
1131
+ f"Sending request for google.cloud.discoveryengine_v1beta.SessionServiceClient.UpdateSession",
1132
+ extra={
1133
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
1134
+ "rpcName": "UpdateSession",
1135
+ "httpRequest": http_request,
1136
+ "metadata": http_request["headers"],
1137
+ },
1138
+ )
1139
+
1140
+ # Send the request
1141
+ response = SessionServiceRestTransport._UpdateSession._get_response(
1142
+ self._host,
1143
+ metadata,
1144
+ query_params,
1145
+ self._session,
1146
+ timeout,
1147
+ transcoded_request,
1148
+ body,
1149
+ )
1150
+
1151
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1152
+ # subclass.
1153
+ if response.status_code >= 400:
1154
+ raise core_exceptions.from_http_response(response)
1155
+
1156
+ # Return the response
1157
+ resp = gcd_session.Session()
1158
+ pb_resp = gcd_session.Session.pb(resp)
1159
+
1160
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
1161
+
1162
+ resp = self._interceptor.post_update_session(resp)
1163
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
1164
+ resp, _ = self._interceptor.post_update_session_with_metadata(
1165
+ resp, response_metadata
1166
+ )
1167
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1168
+ logging.DEBUG
1169
+ ): # pragma: NO COVER
1170
+ try:
1171
+ response_payload = gcd_session.Session.to_json(response)
1172
+ except:
1173
+ response_payload = None
1174
+ http_response = {
1175
+ "payload": response_payload,
1176
+ "headers": dict(response.headers),
1177
+ "status": response.status_code,
1178
+ }
1179
+ _LOGGER.debug(
1180
+ "Received response for google.cloud.discoveryengine_v1beta.SessionServiceClient.update_session",
1181
+ extra={
1182
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
1183
+ "rpcName": "UpdateSession",
1184
+ "metadata": http_response["headers"],
1185
+ "httpResponse": http_response,
1186
+ },
1187
+ )
1188
+ return resp
1189
+
1190
+ @property
1191
+ def create_session(
1192
+ self,
1193
+ ) -> Callable[
1194
+ [conversational_search_service.CreateSessionRequest], gcd_session.Session
1195
+ ]:
1196
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
1197
+ # In C++ this would require a dynamic_cast
1198
+ return self._CreateSession(self._session, self._host, self._interceptor) # type: ignore
1199
+
1200
+ @property
1201
+ def delete_session(
1202
+ self,
1203
+ ) -> Callable[
1204
+ [conversational_search_service.DeleteSessionRequest], empty_pb2.Empty
1205
+ ]:
1206
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
1207
+ # In C++ this would require a dynamic_cast
1208
+ return self._DeleteSession(self._session, self._host, self._interceptor) # type: ignore
1209
+
1210
+ @property
1211
+ def get_session(
1212
+ self,
1213
+ ) -> Callable[[conversational_search_service.GetSessionRequest], session.Session]:
1214
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
1215
+ # In C++ this would require a dynamic_cast
1216
+ return self._GetSession(self._session, self._host, self._interceptor) # type: ignore
1217
+
1218
+ @property
1219
+ def list_sessions(
1220
+ self,
1221
+ ) -> Callable[
1222
+ [conversational_search_service.ListSessionsRequest],
1223
+ conversational_search_service.ListSessionsResponse,
1224
+ ]:
1225
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
1226
+ # In C++ this would require a dynamic_cast
1227
+ return self._ListSessions(self._session, self._host, self._interceptor) # type: ignore
1228
+
1229
+ @property
1230
+ def update_session(
1231
+ self,
1232
+ ) -> Callable[
1233
+ [conversational_search_service.UpdateSessionRequest], gcd_session.Session
1234
+ ]:
1235
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
1236
+ # In C++ this would require a dynamic_cast
1237
+ return self._UpdateSession(self._session, self._host, self._interceptor) # type: ignore
1238
+
1239
+ @property
1240
+ def cancel_operation(self):
1241
+ return self._CancelOperation(self._session, self._host, self._interceptor) # type: ignore
1242
+
1243
+ class _CancelOperation(
1244
+ _BaseSessionServiceRestTransport._BaseCancelOperation, SessionServiceRestStub
1245
+ ):
1246
+ def __hash__(self):
1247
+ return hash("SessionServiceRestTransport.CancelOperation")
1248
+
1249
+ @staticmethod
1250
+ def _get_response(
1251
+ host,
1252
+ metadata,
1253
+ query_params,
1254
+ session,
1255
+ timeout,
1256
+ transcoded_request,
1257
+ body=None,
1258
+ ):
1259
+ uri = transcoded_request["uri"]
1260
+ method = transcoded_request["method"]
1261
+ headers = dict(metadata)
1262
+ headers["Content-Type"] = "application/json"
1263
+ response = getattr(session, method)(
1264
+ "{host}{uri}".format(host=host, uri=uri),
1265
+ timeout=timeout,
1266
+ headers=headers,
1267
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1268
+ data=body,
1269
+ )
1270
+ return response
1271
+
1272
+ def __call__(
1273
+ self,
1274
+ request: operations_pb2.CancelOperationRequest,
1275
+ *,
1276
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1277
+ timeout: Optional[float] = None,
1278
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1279
+ ) -> None:
1280
+ r"""Call the cancel operation method over HTTP.
1281
+
1282
+ Args:
1283
+ request (operations_pb2.CancelOperationRequest):
1284
+ The request object for CancelOperation method.
1285
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1286
+ should be retried.
1287
+ timeout (float): The timeout for this request.
1288
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1289
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1290
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1291
+ be of type `bytes`.
1292
+ """
1293
+
1294
+ http_options = (
1295
+ _BaseSessionServiceRestTransport._BaseCancelOperation._get_http_options()
1296
+ )
1297
+
1298
+ request, metadata = self._interceptor.pre_cancel_operation(
1299
+ request, metadata
1300
+ )
1301
+ transcoded_request = _BaseSessionServiceRestTransport._BaseCancelOperation._get_transcoded_request(
1302
+ http_options, request
1303
+ )
1304
+
1305
+ body = _BaseSessionServiceRestTransport._BaseCancelOperation._get_request_body_json(
1306
+ transcoded_request
1307
+ )
1308
+
1309
+ # Jsonify the query params
1310
+ query_params = _BaseSessionServiceRestTransport._BaseCancelOperation._get_query_params_json(
1311
+ transcoded_request
1312
+ )
1313
+
1314
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1315
+ logging.DEBUG
1316
+ ): # pragma: NO COVER
1317
+ request_url = "{host}{uri}".format(
1318
+ host=self._host, uri=transcoded_request["uri"]
1319
+ )
1320
+ method = transcoded_request["method"]
1321
+ try:
1322
+ request_payload = json_format.MessageToJson(request)
1323
+ except:
1324
+ request_payload = None
1325
+ http_request = {
1326
+ "payload": request_payload,
1327
+ "requestMethod": method,
1328
+ "requestUrl": request_url,
1329
+ "headers": dict(metadata),
1330
+ }
1331
+ _LOGGER.debug(
1332
+ f"Sending request for google.cloud.discoveryengine_v1beta.SessionServiceClient.CancelOperation",
1333
+ extra={
1334
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
1335
+ "rpcName": "CancelOperation",
1336
+ "httpRequest": http_request,
1337
+ "metadata": http_request["headers"],
1338
+ },
1339
+ )
1340
+
1341
+ # Send the request
1342
+ response = SessionServiceRestTransport._CancelOperation._get_response(
1343
+ self._host,
1344
+ metadata,
1345
+ query_params,
1346
+ self._session,
1347
+ timeout,
1348
+ transcoded_request,
1349
+ body,
1350
+ )
1351
+
1352
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1353
+ # subclass.
1354
+ if response.status_code >= 400:
1355
+ raise core_exceptions.from_http_response(response)
1356
+
1357
+ return self._interceptor.post_cancel_operation(None)
1358
+
1359
+ @property
1360
+ def get_operation(self):
1361
+ return self._GetOperation(self._session, self._host, self._interceptor) # type: ignore
1362
+
1363
+ class _GetOperation(
1364
+ _BaseSessionServiceRestTransport._BaseGetOperation, SessionServiceRestStub
1365
+ ):
1366
+ def __hash__(self):
1367
+ return hash("SessionServiceRestTransport.GetOperation")
1368
+
1369
+ @staticmethod
1370
+ def _get_response(
1371
+ host,
1372
+ metadata,
1373
+ query_params,
1374
+ session,
1375
+ timeout,
1376
+ transcoded_request,
1377
+ body=None,
1378
+ ):
1379
+ uri = transcoded_request["uri"]
1380
+ method = transcoded_request["method"]
1381
+ headers = dict(metadata)
1382
+ headers["Content-Type"] = "application/json"
1383
+ response = getattr(session, method)(
1384
+ "{host}{uri}".format(host=host, uri=uri),
1385
+ timeout=timeout,
1386
+ headers=headers,
1387
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1388
+ )
1389
+ return response
1390
+
1391
+ def __call__(
1392
+ self,
1393
+ request: operations_pb2.GetOperationRequest,
1394
+ *,
1395
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1396
+ timeout: Optional[float] = None,
1397
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1398
+ ) -> operations_pb2.Operation:
1399
+ r"""Call the get operation method over HTTP.
1400
+
1401
+ Args:
1402
+ request (operations_pb2.GetOperationRequest):
1403
+ The request object for GetOperation method.
1404
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1405
+ should be retried.
1406
+ timeout (float): The timeout for this request.
1407
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1408
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1409
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1410
+ be of type `bytes`.
1411
+
1412
+ Returns:
1413
+ operations_pb2.Operation: Response from GetOperation method.
1414
+ """
1415
+
1416
+ http_options = (
1417
+ _BaseSessionServiceRestTransport._BaseGetOperation._get_http_options()
1418
+ )
1419
+
1420
+ request, metadata = self._interceptor.pre_get_operation(request, metadata)
1421
+ transcoded_request = _BaseSessionServiceRestTransport._BaseGetOperation._get_transcoded_request(
1422
+ http_options, request
1423
+ )
1424
+
1425
+ # Jsonify the query params
1426
+ query_params = _BaseSessionServiceRestTransport._BaseGetOperation._get_query_params_json(
1427
+ transcoded_request
1428
+ )
1429
+
1430
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1431
+ logging.DEBUG
1432
+ ): # pragma: NO COVER
1433
+ request_url = "{host}{uri}".format(
1434
+ host=self._host, uri=transcoded_request["uri"]
1435
+ )
1436
+ method = transcoded_request["method"]
1437
+ try:
1438
+ request_payload = json_format.MessageToJson(request)
1439
+ except:
1440
+ request_payload = None
1441
+ http_request = {
1442
+ "payload": request_payload,
1443
+ "requestMethod": method,
1444
+ "requestUrl": request_url,
1445
+ "headers": dict(metadata),
1446
+ }
1447
+ _LOGGER.debug(
1448
+ f"Sending request for google.cloud.discoveryengine_v1beta.SessionServiceClient.GetOperation",
1449
+ extra={
1450
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
1451
+ "rpcName": "GetOperation",
1452
+ "httpRequest": http_request,
1453
+ "metadata": http_request["headers"],
1454
+ },
1455
+ )
1456
+
1457
+ # Send the request
1458
+ response = SessionServiceRestTransport._GetOperation._get_response(
1459
+ self._host,
1460
+ metadata,
1461
+ query_params,
1462
+ self._session,
1463
+ timeout,
1464
+ transcoded_request,
1465
+ )
1466
+
1467
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1468
+ # subclass.
1469
+ if response.status_code >= 400:
1470
+ raise core_exceptions.from_http_response(response)
1471
+
1472
+ content = response.content.decode("utf-8")
1473
+ resp = operations_pb2.Operation()
1474
+ resp = json_format.Parse(content, resp)
1475
+ resp = self._interceptor.post_get_operation(resp)
1476
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1477
+ logging.DEBUG
1478
+ ): # pragma: NO COVER
1479
+ try:
1480
+ response_payload = json_format.MessageToJson(resp)
1481
+ except:
1482
+ response_payload = None
1483
+ http_response = {
1484
+ "payload": response_payload,
1485
+ "headers": dict(response.headers),
1486
+ "status": response.status_code,
1487
+ }
1488
+ _LOGGER.debug(
1489
+ "Received response for google.cloud.discoveryengine_v1beta.SessionServiceAsyncClient.GetOperation",
1490
+ extra={
1491
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
1492
+ "rpcName": "GetOperation",
1493
+ "httpResponse": http_response,
1494
+ "metadata": http_response["headers"],
1495
+ },
1496
+ )
1497
+ return resp
1498
+
1499
+ @property
1500
+ def list_operations(self):
1501
+ return self._ListOperations(self._session, self._host, self._interceptor) # type: ignore
1502
+
1503
+ class _ListOperations(
1504
+ _BaseSessionServiceRestTransport._BaseListOperations, SessionServiceRestStub
1505
+ ):
1506
+ def __hash__(self):
1507
+ return hash("SessionServiceRestTransport.ListOperations")
1508
+
1509
+ @staticmethod
1510
+ def _get_response(
1511
+ host,
1512
+ metadata,
1513
+ query_params,
1514
+ session,
1515
+ timeout,
1516
+ transcoded_request,
1517
+ body=None,
1518
+ ):
1519
+ uri = transcoded_request["uri"]
1520
+ method = transcoded_request["method"]
1521
+ headers = dict(metadata)
1522
+ headers["Content-Type"] = "application/json"
1523
+ response = getattr(session, method)(
1524
+ "{host}{uri}".format(host=host, uri=uri),
1525
+ timeout=timeout,
1526
+ headers=headers,
1527
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1528
+ )
1529
+ return response
1530
+
1531
+ def __call__(
1532
+ self,
1533
+ request: operations_pb2.ListOperationsRequest,
1534
+ *,
1535
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1536
+ timeout: Optional[float] = None,
1537
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1538
+ ) -> operations_pb2.ListOperationsResponse:
1539
+ r"""Call the list operations method over HTTP.
1540
+
1541
+ Args:
1542
+ request (operations_pb2.ListOperationsRequest):
1543
+ The request object for ListOperations method.
1544
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1545
+ should be retried.
1546
+ timeout (float): The timeout for this request.
1547
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1548
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1549
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1550
+ be of type `bytes`.
1551
+
1552
+ Returns:
1553
+ operations_pb2.ListOperationsResponse: Response from ListOperations method.
1554
+ """
1555
+
1556
+ http_options = (
1557
+ _BaseSessionServiceRestTransport._BaseListOperations._get_http_options()
1558
+ )
1559
+
1560
+ request, metadata = self._interceptor.pre_list_operations(request, metadata)
1561
+ transcoded_request = _BaseSessionServiceRestTransport._BaseListOperations._get_transcoded_request(
1562
+ http_options, request
1563
+ )
1564
+
1565
+ # Jsonify the query params
1566
+ query_params = _BaseSessionServiceRestTransport._BaseListOperations._get_query_params_json(
1567
+ transcoded_request
1568
+ )
1569
+
1570
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1571
+ logging.DEBUG
1572
+ ): # pragma: NO COVER
1573
+ request_url = "{host}{uri}".format(
1574
+ host=self._host, uri=transcoded_request["uri"]
1575
+ )
1576
+ method = transcoded_request["method"]
1577
+ try:
1578
+ request_payload = json_format.MessageToJson(request)
1579
+ except:
1580
+ request_payload = None
1581
+ http_request = {
1582
+ "payload": request_payload,
1583
+ "requestMethod": method,
1584
+ "requestUrl": request_url,
1585
+ "headers": dict(metadata),
1586
+ }
1587
+ _LOGGER.debug(
1588
+ f"Sending request for google.cloud.discoveryengine_v1beta.SessionServiceClient.ListOperations",
1589
+ extra={
1590
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
1591
+ "rpcName": "ListOperations",
1592
+ "httpRequest": http_request,
1593
+ "metadata": http_request["headers"],
1594
+ },
1595
+ )
1596
+
1597
+ # Send the request
1598
+ response = SessionServiceRestTransport._ListOperations._get_response(
1599
+ self._host,
1600
+ metadata,
1601
+ query_params,
1602
+ self._session,
1603
+ timeout,
1604
+ transcoded_request,
1605
+ )
1606
+
1607
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1608
+ # subclass.
1609
+ if response.status_code >= 400:
1610
+ raise core_exceptions.from_http_response(response)
1611
+
1612
+ content = response.content.decode("utf-8")
1613
+ resp = operations_pb2.ListOperationsResponse()
1614
+ resp = json_format.Parse(content, resp)
1615
+ resp = self._interceptor.post_list_operations(resp)
1616
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1617
+ logging.DEBUG
1618
+ ): # pragma: NO COVER
1619
+ try:
1620
+ response_payload = json_format.MessageToJson(resp)
1621
+ except:
1622
+ response_payload = None
1623
+ http_response = {
1624
+ "payload": response_payload,
1625
+ "headers": dict(response.headers),
1626
+ "status": response.status_code,
1627
+ }
1628
+ _LOGGER.debug(
1629
+ "Received response for google.cloud.discoveryengine_v1beta.SessionServiceAsyncClient.ListOperations",
1630
+ extra={
1631
+ "serviceName": "google.cloud.discoveryengine.v1beta.SessionService",
1632
+ "rpcName": "ListOperations",
1633
+ "httpResponse": http_response,
1634
+ "metadata": http_response["headers"],
1635
+ },
1636
+ )
1637
+ return resp
1638
+
1639
+ @property
1640
+ def kind(self) -> str:
1641
+ return "rest"
1642
+
1643
+ def close(self):
1644
+ self._session.close()
1645
+
1646
+
1647
+ __all__ = ("SessionServiceRestTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/session_service/transports/rest_base.py ADDED
@@ -0,0 +1,593 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import json # type: ignore
17
+ import re
18
+ from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
19
+
20
+ from google.api_core import gapic_v1, path_template
21
+ from google.cloud.location import locations_pb2 # type: ignore
22
+ from google.longrunning import operations_pb2 # type: ignore
23
+ from google.protobuf import empty_pb2 # type: ignore
24
+ from google.protobuf import json_format
25
+
26
+ from google.cloud.discoveryengine_v1beta.types import conversational_search_service
27
+ from google.cloud.discoveryengine_v1beta.types import session
28
+ from google.cloud.discoveryengine_v1beta.types import session as gcd_session
29
+
30
+ from .base import DEFAULT_CLIENT_INFO, SessionServiceTransport
31
+
32
+
33
+ class _BaseSessionServiceRestTransport(SessionServiceTransport):
34
+ """Base REST backend transport for SessionService.
35
+
36
+ Note: This class is not meant to be used directly. Use its sync and
37
+ async sub-classes instead.
38
+
39
+ This class defines the same methods as the primary client, so the
40
+ primary client can load the underlying transport implementation
41
+ and call it.
42
+
43
+ It sends JSON representations of protocol buffers over HTTP/1.1
44
+ """
45
+
46
+ def __init__(
47
+ self,
48
+ *,
49
+ host: str = "discoveryengine.googleapis.com",
50
+ credentials: Optional[Any] = None,
51
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
52
+ always_use_jwt_access: Optional[bool] = False,
53
+ url_scheme: str = "https",
54
+ api_audience: Optional[str] = None,
55
+ ) -> None:
56
+ """Instantiate the transport.
57
+ Args:
58
+ host (Optional[str]):
59
+ The hostname to connect to (default: 'discoveryengine.googleapis.com').
60
+ credentials (Optional[Any]): The
61
+ authorization credentials to attach to requests. These
62
+ credentials identify the application to the service; if none
63
+ are specified, the client will attempt to ascertain the
64
+ credentials from the environment.
65
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
66
+ The client info used to send a user-agent string along with
67
+ API requests. If ``None``, then default info will be used.
68
+ Generally, you only need to set this if you are developing
69
+ your own client library.
70
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
71
+ be used for service account credentials.
72
+ url_scheme: the protocol scheme for the API endpoint. Normally
73
+ "https", but for testing or local servers,
74
+ "http" can be specified.
75
+ """
76
+ # Run the base constructor
77
+ maybe_url_match = re.match("^(?P<scheme>http(?:s)?://)?(?P<host>.*)$", host)
78
+ if maybe_url_match is None:
79
+ raise ValueError(
80
+ f"Unexpected hostname structure: {host}"
81
+ ) # pragma: NO COVER
82
+
83
+ url_match_items = maybe_url_match.groupdict()
84
+
85
+ host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host
86
+
87
+ super().__init__(
88
+ host=host,
89
+ credentials=credentials,
90
+ client_info=client_info,
91
+ always_use_jwt_access=always_use_jwt_access,
92
+ api_audience=api_audience,
93
+ )
94
+
95
+ class _BaseCreateSession:
96
+ def __hash__(self): # pragma: NO COVER
97
+ return NotImplementedError("__hash__ must be implemented.")
98
+
99
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
100
+
101
+ @classmethod
102
+ def _get_unset_required_fields(cls, message_dict):
103
+ return {
104
+ k: v
105
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
106
+ if k not in message_dict
107
+ }
108
+
109
+ @staticmethod
110
+ def _get_http_options():
111
+ http_options: List[Dict[str, str]] = [
112
+ {
113
+ "method": "post",
114
+ "uri": "/v1beta/{parent=projects/*/locations/*/dataStores/*}/sessions",
115
+ "body": "session",
116
+ },
117
+ {
118
+ "method": "post",
119
+ "uri": "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/sessions",
120
+ "body": "session",
121
+ },
122
+ {
123
+ "method": "post",
124
+ "uri": "/v1beta/{parent=projects/*/locations/*/collections/*/engines/*}/sessions",
125
+ "body": "session",
126
+ },
127
+ ]
128
+ return http_options
129
+
130
+ @staticmethod
131
+ def _get_transcoded_request(http_options, request):
132
+ pb_request = conversational_search_service.CreateSessionRequest.pb(request)
133
+ transcoded_request = path_template.transcode(http_options, pb_request)
134
+ return transcoded_request
135
+
136
+ @staticmethod
137
+ def _get_request_body_json(transcoded_request):
138
+ # Jsonify the request body
139
+
140
+ body = json_format.MessageToJson(
141
+ transcoded_request["body"], use_integers_for_enums=True
142
+ )
143
+ return body
144
+
145
+ @staticmethod
146
+ def _get_query_params_json(transcoded_request):
147
+ query_params = json.loads(
148
+ json_format.MessageToJson(
149
+ transcoded_request["query_params"],
150
+ use_integers_for_enums=True,
151
+ )
152
+ )
153
+ query_params.update(
154
+ _BaseSessionServiceRestTransport._BaseCreateSession._get_unset_required_fields(
155
+ query_params
156
+ )
157
+ )
158
+
159
+ query_params["$alt"] = "json;enum-encoding=int"
160
+ return query_params
161
+
162
+ class _BaseDeleteSession:
163
+ def __hash__(self): # pragma: NO COVER
164
+ return NotImplementedError("__hash__ must be implemented.")
165
+
166
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
167
+
168
+ @classmethod
169
+ def _get_unset_required_fields(cls, message_dict):
170
+ return {
171
+ k: v
172
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
173
+ if k not in message_dict
174
+ }
175
+
176
+ @staticmethod
177
+ def _get_http_options():
178
+ http_options: List[Dict[str, str]] = [
179
+ {
180
+ "method": "delete",
181
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/sessions/*}",
182
+ },
183
+ {
184
+ "method": "delete",
185
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/sessions/*}",
186
+ },
187
+ {
188
+ "method": "delete",
189
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/engines/*/sessions/*}",
190
+ },
191
+ ]
192
+ return http_options
193
+
194
+ @staticmethod
195
+ def _get_transcoded_request(http_options, request):
196
+ pb_request = conversational_search_service.DeleteSessionRequest.pb(request)
197
+ transcoded_request = path_template.transcode(http_options, pb_request)
198
+ return transcoded_request
199
+
200
+ @staticmethod
201
+ def _get_query_params_json(transcoded_request):
202
+ query_params = json.loads(
203
+ json_format.MessageToJson(
204
+ transcoded_request["query_params"],
205
+ use_integers_for_enums=True,
206
+ )
207
+ )
208
+ query_params.update(
209
+ _BaseSessionServiceRestTransport._BaseDeleteSession._get_unset_required_fields(
210
+ query_params
211
+ )
212
+ )
213
+
214
+ query_params["$alt"] = "json;enum-encoding=int"
215
+ return query_params
216
+
217
+ class _BaseGetSession:
218
+ def __hash__(self): # pragma: NO COVER
219
+ return NotImplementedError("__hash__ must be implemented.")
220
+
221
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
222
+
223
+ @classmethod
224
+ def _get_unset_required_fields(cls, message_dict):
225
+ return {
226
+ k: v
227
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
228
+ if k not in message_dict
229
+ }
230
+
231
+ @staticmethod
232
+ def _get_http_options():
233
+ http_options: List[Dict[str, str]] = [
234
+ {
235
+ "method": "get",
236
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/sessions/*}",
237
+ },
238
+ {
239
+ "method": "get",
240
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/sessions/*}",
241
+ },
242
+ {
243
+ "method": "get",
244
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/engines/*/sessions/*}",
245
+ },
246
+ ]
247
+ return http_options
248
+
249
+ @staticmethod
250
+ def _get_transcoded_request(http_options, request):
251
+ pb_request = conversational_search_service.GetSessionRequest.pb(request)
252
+ transcoded_request = path_template.transcode(http_options, pb_request)
253
+ return transcoded_request
254
+
255
+ @staticmethod
256
+ def _get_query_params_json(transcoded_request):
257
+ query_params = json.loads(
258
+ json_format.MessageToJson(
259
+ transcoded_request["query_params"],
260
+ use_integers_for_enums=True,
261
+ )
262
+ )
263
+ query_params.update(
264
+ _BaseSessionServiceRestTransport._BaseGetSession._get_unset_required_fields(
265
+ query_params
266
+ )
267
+ )
268
+
269
+ query_params["$alt"] = "json;enum-encoding=int"
270
+ return query_params
271
+
272
+ class _BaseListSessions:
273
+ def __hash__(self): # pragma: NO COVER
274
+ return NotImplementedError("__hash__ must be implemented.")
275
+
276
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
277
+
278
+ @classmethod
279
+ def _get_unset_required_fields(cls, message_dict):
280
+ return {
281
+ k: v
282
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
283
+ if k not in message_dict
284
+ }
285
+
286
+ @staticmethod
287
+ def _get_http_options():
288
+ http_options: List[Dict[str, str]] = [
289
+ {
290
+ "method": "get",
291
+ "uri": "/v1beta/{parent=projects/*/locations/*/dataStores/*}/sessions",
292
+ },
293
+ {
294
+ "method": "get",
295
+ "uri": "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/sessions",
296
+ },
297
+ {
298
+ "method": "get",
299
+ "uri": "/v1beta/{parent=projects/*/locations/*/collections/*/engines/*}/sessions",
300
+ },
301
+ ]
302
+ return http_options
303
+
304
+ @staticmethod
305
+ def _get_transcoded_request(http_options, request):
306
+ pb_request = conversational_search_service.ListSessionsRequest.pb(request)
307
+ transcoded_request = path_template.transcode(http_options, pb_request)
308
+ return transcoded_request
309
+
310
+ @staticmethod
311
+ def _get_query_params_json(transcoded_request):
312
+ query_params = json.loads(
313
+ json_format.MessageToJson(
314
+ transcoded_request["query_params"],
315
+ use_integers_for_enums=True,
316
+ )
317
+ )
318
+ query_params.update(
319
+ _BaseSessionServiceRestTransport._BaseListSessions._get_unset_required_fields(
320
+ query_params
321
+ )
322
+ )
323
+
324
+ query_params["$alt"] = "json;enum-encoding=int"
325
+ return query_params
326
+
327
+ class _BaseUpdateSession:
328
+ def __hash__(self): # pragma: NO COVER
329
+ return NotImplementedError("__hash__ must be implemented.")
330
+
331
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
332
+
333
+ @classmethod
334
+ def _get_unset_required_fields(cls, message_dict):
335
+ return {
336
+ k: v
337
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
338
+ if k not in message_dict
339
+ }
340
+
341
+ @staticmethod
342
+ def _get_http_options():
343
+ http_options: List[Dict[str, str]] = [
344
+ {
345
+ "method": "patch",
346
+ "uri": "/v1beta/{session.name=projects/*/locations/*/dataStores/*/sessions/*}",
347
+ "body": "session",
348
+ },
349
+ {
350
+ "method": "patch",
351
+ "uri": "/v1beta/{session.name=projects/*/locations/*/collections/*/dataStores/*/sessions/*}",
352
+ "body": "session",
353
+ },
354
+ {
355
+ "method": "patch",
356
+ "uri": "/v1beta/{session.name=projects/*/locations/*/collections/*/engines/*/sessions/*}",
357
+ "body": "session",
358
+ },
359
+ ]
360
+ return http_options
361
+
362
+ @staticmethod
363
+ def _get_transcoded_request(http_options, request):
364
+ pb_request = conversational_search_service.UpdateSessionRequest.pb(request)
365
+ transcoded_request = path_template.transcode(http_options, pb_request)
366
+ return transcoded_request
367
+
368
+ @staticmethod
369
+ def _get_request_body_json(transcoded_request):
370
+ # Jsonify the request body
371
+
372
+ body = json_format.MessageToJson(
373
+ transcoded_request["body"], use_integers_for_enums=True
374
+ )
375
+ return body
376
+
377
+ @staticmethod
378
+ def _get_query_params_json(transcoded_request):
379
+ query_params = json.loads(
380
+ json_format.MessageToJson(
381
+ transcoded_request["query_params"],
382
+ use_integers_for_enums=True,
383
+ )
384
+ )
385
+ query_params.update(
386
+ _BaseSessionServiceRestTransport._BaseUpdateSession._get_unset_required_fields(
387
+ query_params
388
+ )
389
+ )
390
+
391
+ query_params["$alt"] = "json;enum-encoding=int"
392
+ return query_params
393
+
394
+ class _BaseCancelOperation:
395
+ def __hash__(self): # pragma: NO COVER
396
+ return NotImplementedError("__hash__ must be implemented.")
397
+
398
+ @staticmethod
399
+ def _get_http_options():
400
+ http_options: List[Dict[str, str]] = [
401
+ {
402
+ "method": "post",
403
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel",
404
+ "body": "*",
405
+ },
406
+ {
407
+ "method": "post",
408
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel",
409
+ "body": "*",
410
+ },
411
+ ]
412
+ return http_options
413
+
414
+ @staticmethod
415
+ def _get_transcoded_request(http_options, request):
416
+ request_kwargs = json_format.MessageToDict(request)
417
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
418
+ return transcoded_request
419
+
420
+ @staticmethod
421
+ def _get_request_body_json(transcoded_request):
422
+ body = json.dumps(transcoded_request["body"])
423
+ return body
424
+
425
+ @staticmethod
426
+ def _get_query_params_json(transcoded_request):
427
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
428
+ return query_params
429
+
430
+ class _BaseGetOperation:
431
+ def __hash__(self): # pragma: NO COVER
432
+ return NotImplementedError("__hash__ must be implemented.")
433
+
434
+ @staticmethod
435
+ def _get_http_options():
436
+ http_options: List[Dict[str, str]] = [
437
+ {
438
+ "method": "get",
439
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}",
440
+ },
441
+ {
442
+ "method": "get",
443
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}",
444
+ },
445
+ {
446
+ "method": "get",
447
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/models/*/operations/*}",
448
+ },
449
+ {
450
+ "method": "get",
451
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/operations/*}",
452
+ },
453
+ {
454
+ "method": "get",
455
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*/operations/*}",
456
+ },
457
+ {
458
+ "method": "get",
459
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/operations/*}",
460
+ },
461
+ {
462
+ "method": "get",
463
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/operations/*}",
464
+ },
465
+ {
466
+ "method": "get",
467
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/engines/*/operations/*}",
468
+ },
469
+ {
470
+ "method": "get",
471
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/operations/*}",
472
+ },
473
+ {
474
+ "method": "get",
475
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}",
476
+ },
477
+ {
478
+ "method": "get",
479
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/models/*/operations/*}",
480
+ },
481
+ {
482
+ "method": "get",
483
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/operations/*}",
484
+ },
485
+ {
486
+ "method": "get",
487
+ "uri": "/v1beta/{name=projects/*/locations/*/evaluations/*/operations/*}",
488
+ },
489
+ {
490
+ "method": "get",
491
+ "uri": "/v1beta/{name=projects/*/locations/*/operations/*}",
492
+ },
493
+ {
494
+ "method": "get",
495
+ "uri": "/v1beta/{name=projects/*/locations/*/sampleQuerySets/*/operations/*}",
496
+ },
497
+ {
498
+ "method": "get",
499
+ "uri": "/v1beta/{name=projects/*/operations/*}",
500
+ },
501
+ ]
502
+ return http_options
503
+
504
+ @staticmethod
505
+ def _get_transcoded_request(http_options, request):
506
+ request_kwargs = json_format.MessageToDict(request)
507
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
508
+ return transcoded_request
509
+
510
+ @staticmethod
511
+ def _get_query_params_json(transcoded_request):
512
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
513
+ return query_params
514
+
515
+ class _BaseListOperations:
516
+ def __hash__(self): # pragma: NO COVER
517
+ return NotImplementedError("__hash__ must be implemented.")
518
+
519
+ @staticmethod
520
+ def _get_http_options():
521
+ http_options: List[Dict[str, str]] = [
522
+ {
523
+ "method": "get",
524
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataConnector}/operations",
525
+ },
526
+ {
527
+ "method": "get",
528
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*}/operations",
529
+ },
530
+ {
531
+ "method": "get",
532
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/models/*}/operations",
533
+ },
534
+ {
535
+ "method": "get",
536
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*}/operations",
537
+ },
538
+ {
539
+ "method": "get",
540
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites}/operations",
541
+ },
542
+ {
543
+ "method": "get",
544
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/operations",
545
+ },
546
+ {
547
+ "method": "get",
548
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*}/operations",
549
+ },
550
+ {
551
+ "method": "get",
552
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/engines/*}/operations",
553
+ },
554
+ {
555
+ "method": "get",
556
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*}/operations",
557
+ },
558
+ {
559
+ "method": "get",
560
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*}/operations",
561
+ },
562
+ {
563
+ "method": "get",
564
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/models/*}/operations",
565
+ },
566
+ {
567
+ "method": "get",
568
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*}/operations",
569
+ },
570
+ {
571
+ "method": "get",
572
+ "uri": "/v1beta/{name=projects/*/locations/*}/operations",
573
+ },
574
+ {
575
+ "method": "get",
576
+ "uri": "/v1beta/{name=projects/*}/operations",
577
+ },
578
+ ]
579
+ return http_options
580
+
581
+ @staticmethod
582
+ def _get_transcoded_request(http_options, request):
583
+ request_kwargs = json_format.MessageToDict(request)
584
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
585
+ return transcoded_request
586
+
587
+ @staticmethod
588
+ def _get_query_params_json(transcoded_request):
589
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
590
+ return query_params
591
+
592
+
593
+ __all__ = ("_BaseSessionServiceRestTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/__init__.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from .async_client import SiteSearchEngineServiceAsyncClient
17
+ from .client import SiteSearchEngineServiceClient
18
+
19
+ __all__ = (
20
+ "SiteSearchEngineServiceClient",
21
+ "SiteSearchEngineServiceAsyncClient",
22
+ )
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/async_client.py ADDED
The diff for this file is too large to render. See raw diff
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/client.py ADDED
The diff for this file is too large to render. See raw diff
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/pagers.py ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from typing import (
17
+ Any,
18
+ AsyncIterator,
19
+ Awaitable,
20
+ Callable,
21
+ Iterator,
22
+ Optional,
23
+ Sequence,
24
+ Tuple,
25
+ Union,
26
+ )
27
+
28
+ from google.api_core import gapic_v1
29
+ from google.api_core import retry as retries
30
+ from google.api_core import retry_async as retries_async
31
+
32
+ try:
33
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
34
+ OptionalAsyncRetry = Union[
35
+ retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None
36
+ ]
37
+ except AttributeError: # pragma: NO COVER
38
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
39
+ OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore
40
+
41
+ from google.cloud.discoveryengine_v1beta.types import (
42
+ site_search_engine,
43
+ site_search_engine_service,
44
+ )
45
+
46
+
47
+ class ListTargetSitesPager:
48
+ """A pager for iterating through ``list_target_sites`` requests.
49
+
50
+ This class thinly wraps an initial
51
+ :class:`google.cloud.discoveryengine_v1beta.types.ListTargetSitesResponse` object, and
52
+ provides an ``__iter__`` method to iterate through its
53
+ ``target_sites`` field.
54
+
55
+ If there are more pages, the ``__iter__`` method will make additional
56
+ ``ListTargetSites`` requests and continue to iterate
57
+ through the ``target_sites`` field on the
58
+ corresponding responses.
59
+
60
+ All the usual :class:`google.cloud.discoveryengine_v1beta.types.ListTargetSitesResponse`
61
+ attributes are available on the pager. If multiple requests are made, only
62
+ the most recent response is retained, and thus used for attribute lookup.
63
+ """
64
+
65
+ def __init__(
66
+ self,
67
+ method: Callable[..., site_search_engine_service.ListTargetSitesResponse],
68
+ request: site_search_engine_service.ListTargetSitesRequest,
69
+ response: site_search_engine_service.ListTargetSitesResponse,
70
+ *,
71
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
72
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
73
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
74
+ ):
75
+ """Instantiate the pager.
76
+
77
+ Args:
78
+ method (Callable): The method that was originally called, and
79
+ which instantiated this pager.
80
+ request (google.cloud.discoveryengine_v1beta.types.ListTargetSitesRequest):
81
+ The initial request object.
82
+ response (google.cloud.discoveryengine_v1beta.types.ListTargetSitesResponse):
83
+ The initial response object.
84
+ retry (google.api_core.retry.Retry): Designation of what errors,
85
+ if any, should be retried.
86
+ timeout (float): The timeout for this request.
87
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
88
+ sent along with the request as metadata. Normally, each value must be of type `str`,
89
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
90
+ be of type `bytes`.
91
+ """
92
+ self._method = method
93
+ self._request = site_search_engine_service.ListTargetSitesRequest(request)
94
+ self._response = response
95
+ self._retry = retry
96
+ self._timeout = timeout
97
+ self._metadata = metadata
98
+
99
+ def __getattr__(self, name: str) -> Any:
100
+ return getattr(self._response, name)
101
+
102
+ @property
103
+ def pages(self) -> Iterator[site_search_engine_service.ListTargetSitesResponse]:
104
+ yield self._response
105
+ while self._response.next_page_token:
106
+ self._request.page_token = self._response.next_page_token
107
+ self._response = self._method(
108
+ self._request,
109
+ retry=self._retry,
110
+ timeout=self._timeout,
111
+ metadata=self._metadata,
112
+ )
113
+ yield self._response
114
+
115
+ def __iter__(self) -> Iterator[site_search_engine.TargetSite]:
116
+ for page in self.pages:
117
+ yield from page.target_sites
118
+
119
+ def __repr__(self) -> str:
120
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
121
+
122
+
123
+ class ListTargetSitesAsyncPager:
124
+ """A pager for iterating through ``list_target_sites`` requests.
125
+
126
+ This class thinly wraps an initial
127
+ :class:`google.cloud.discoveryengine_v1beta.types.ListTargetSitesResponse` object, and
128
+ provides an ``__aiter__`` method to iterate through its
129
+ ``target_sites`` field.
130
+
131
+ If there are more pages, the ``__aiter__`` method will make additional
132
+ ``ListTargetSites`` requests and continue to iterate
133
+ through the ``target_sites`` field on the
134
+ corresponding responses.
135
+
136
+ All the usual :class:`google.cloud.discoveryengine_v1beta.types.ListTargetSitesResponse`
137
+ attributes are available on the pager. If multiple requests are made, only
138
+ the most recent response is retained, and thus used for attribute lookup.
139
+ """
140
+
141
+ def __init__(
142
+ self,
143
+ method: Callable[
144
+ ..., Awaitable[site_search_engine_service.ListTargetSitesResponse]
145
+ ],
146
+ request: site_search_engine_service.ListTargetSitesRequest,
147
+ response: site_search_engine_service.ListTargetSitesResponse,
148
+ *,
149
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
150
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
151
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
152
+ ):
153
+ """Instantiates the pager.
154
+
155
+ Args:
156
+ method (Callable): The method that was originally called, and
157
+ which instantiated this pager.
158
+ request (google.cloud.discoveryengine_v1beta.types.ListTargetSitesRequest):
159
+ The initial request object.
160
+ response (google.cloud.discoveryengine_v1beta.types.ListTargetSitesResponse):
161
+ The initial response object.
162
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
163
+ if any, should be retried.
164
+ timeout (float): The timeout for this request.
165
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
166
+ sent along with the request as metadata. Normally, each value must be of type `str`,
167
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
168
+ be of type `bytes`.
169
+ """
170
+ self._method = method
171
+ self._request = site_search_engine_service.ListTargetSitesRequest(request)
172
+ self._response = response
173
+ self._retry = retry
174
+ self._timeout = timeout
175
+ self._metadata = metadata
176
+
177
+ def __getattr__(self, name: str) -> Any:
178
+ return getattr(self._response, name)
179
+
180
+ @property
181
+ async def pages(
182
+ self,
183
+ ) -> AsyncIterator[site_search_engine_service.ListTargetSitesResponse]:
184
+ yield self._response
185
+ while self._response.next_page_token:
186
+ self._request.page_token = self._response.next_page_token
187
+ self._response = await self._method(
188
+ self._request,
189
+ retry=self._retry,
190
+ timeout=self._timeout,
191
+ metadata=self._metadata,
192
+ )
193
+ yield self._response
194
+
195
+ def __aiter__(self) -> AsyncIterator[site_search_engine.TargetSite]:
196
+ async def async_generator():
197
+ async for page in self.pages:
198
+ for response in page.target_sites:
199
+ yield response
200
+
201
+ return async_generator()
202
+
203
+ def __repr__(self) -> str:
204
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
205
+
206
+
207
+ class FetchDomainVerificationStatusPager:
208
+ """A pager for iterating through ``fetch_domain_verification_status`` requests.
209
+
210
+ This class thinly wraps an initial
211
+ :class:`google.cloud.discoveryengine_v1beta.types.FetchDomainVerificationStatusResponse` object, and
212
+ provides an ``__iter__`` method to iterate through its
213
+ ``target_sites`` field.
214
+
215
+ If there are more pages, the ``__iter__`` method will make additional
216
+ ``FetchDomainVerificationStatus`` requests and continue to iterate
217
+ through the ``target_sites`` field on the
218
+ corresponding responses.
219
+
220
+ All the usual :class:`google.cloud.discoveryengine_v1beta.types.FetchDomainVerificationStatusResponse`
221
+ attributes are available on the pager. If multiple requests are made, only
222
+ the most recent response is retained, and thus used for attribute lookup.
223
+ """
224
+
225
+ def __init__(
226
+ self,
227
+ method: Callable[
228
+ ..., site_search_engine_service.FetchDomainVerificationStatusResponse
229
+ ],
230
+ request: site_search_engine_service.FetchDomainVerificationStatusRequest,
231
+ response: site_search_engine_service.FetchDomainVerificationStatusResponse,
232
+ *,
233
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
234
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
235
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
236
+ ):
237
+ """Instantiate the pager.
238
+
239
+ Args:
240
+ method (Callable): The method that was originally called, and
241
+ which instantiated this pager.
242
+ request (google.cloud.discoveryengine_v1beta.types.FetchDomainVerificationStatusRequest):
243
+ The initial request object.
244
+ response (google.cloud.discoveryengine_v1beta.types.FetchDomainVerificationStatusResponse):
245
+ The initial response object.
246
+ retry (google.api_core.retry.Retry): Designation of what errors,
247
+ if any, should be retried.
248
+ timeout (float): The timeout for this request.
249
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
250
+ sent along with the request as metadata. Normally, each value must be of type `str`,
251
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
252
+ be of type `bytes`.
253
+ """
254
+ self._method = method
255
+ self._request = site_search_engine_service.FetchDomainVerificationStatusRequest(
256
+ request
257
+ )
258
+ self._response = response
259
+ self._retry = retry
260
+ self._timeout = timeout
261
+ self._metadata = metadata
262
+
263
+ def __getattr__(self, name: str) -> Any:
264
+ return getattr(self._response, name)
265
+
266
+ @property
267
+ def pages(
268
+ self,
269
+ ) -> Iterator[site_search_engine_service.FetchDomainVerificationStatusResponse]:
270
+ yield self._response
271
+ while self._response.next_page_token:
272
+ self._request.page_token = self._response.next_page_token
273
+ self._response = self._method(
274
+ self._request,
275
+ retry=self._retry,
276
+ timeout=self._timeout,
277
+ metadata=self._metadata,
278
+ )
279
+ yield self._response
280
+
281
+ def __iter__(self) -> Iterator[site_search_engine.TargetSite]:
282
+ for page in self.pages:
283
+ yield from page.target_sites
284
+
285
+ def __repr__(self) -> str:
286
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
287
+
288
+
289
+ class FetchDomainVerificationStatusAsyncPager:
290
+ """A pager for iterating through ``fetch_domain_verification_status`` requests.
291
+
292
+ This class thinly wraps an initial
293
+ :class:`google.cloud.discoveryengine_v1beta.types.FetchDomainVerificationStatusResponse` object, and
294
+ provides an ``__aiter__`` method to iterate through its
295
+ ``target_sites`` field.
296
+
297
+ If there are more pages, the ``__aiter__`` method will make additional
298
+ ``FetchDomainVerificationStatus`` requests and continue to iterate
299
+ through the ``target_sites`` field on the
300
+ corresponding responses.
301
+
302
+ All the usual :class:`google.cloud.discoveryengine_v1beta.types.FetchDomainVerificationStatusResponse`
303
+ attributes are available on the pager. If multiple requests are made, only
304
+ the most recent response is retained, and thus used for attribute lookup.
305
+ """
306
+
307
+ def __init__(
308
+ self,
309
+ method: Callable[
310
+ ...,
311
+ Awaitable[site_search_engine_service.FetchDomainVerificationStatusResponse],
312
+ ],
313
+ request: site_search_engine_service.FetchDomainVerificationStatusRequest,
314
+ response: site_search_engine_service.FetchDomainVerificationStatusResponse,
315
+ *,
316
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
317
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
318
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
319
+ ):
320
+ """Instantiates the pager.
321
+
322
+ Args:
323
+ method (Callable): The method that was originally called, and
324
+ which instantiated this pager.
325
+ request (google.cloud.discoveryengine_v1beta.types.FetchDomainVerificationStatusRequest):
326
+ The initial request object.
327
+ response (google.cloud.discoveryengine_v1beta.types.FetchDomainVerificationStatusResponse):
328
+ The initial response object.
329
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
330
+ if any, should be retried.
331
+ timeout (float): The timeout for this request.
332
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
333
+ sent along with the request as metadata. Normally, each value must be of type `str`,
334
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
335
+ be of type `bytes`.
336
+ """
337
+ self._method = method
338
+ self._request = site_search_engine_service.FetchDomainVerificationStatusRequest(
339
+ request
340
+ )
341
+ self._response = response
342
+ self._retry = retry
343
+ self._timeout = timeout
344
+ self._metadata = metadata
345
+
346
+ def __getattr__(self, name: str) -> Any:
347
+ return getattr(self._response, name)
348
+
349
+ @property
350
+ async def pages(
351
+ self,
352
+ ) -> AsyncIterator[
353
+ site_search_engine_service.FetchDomainVerificationStatusResponse
354
+ ]:
355
+ yield self._response
356
+ while self._response.next_page_token:
357
+ self._request.page_token = self._response.next_page_token
358
+ self._response = await self._method(
359
+ self._request,
360
+ retry=self._retry,
361
+ timeout=self._timeout,
362
+ metadata=self._metadata,
363
+ )
364
+ yield self._response
365
+
366
+ def __aiter__(self) -> AsyncIterator[site_search_engine.TargetSite]:
367
+ async def async_generator():
368
+ async for page in self.pages:
369
+ for response in page.target_sites:
370
+ yield response
371
+
372
+ return async_generator()
373
+
374
+ def __repr__(self) -> str:
375
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/transports/__init__.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from collections import OrderedDict
17
+ from typing import Dict, Type
18
+
19
+ from .base import SiteSearchEngineServiceTransport
20
+ from .grpc import SiteSearchEngineServiceGrpcTransport
21
+ from .grpc_asyncio import SiteSearchEngineServiceGrpcAsyncIOTransport
22
+ from .rest import (
23
+ SiteSearchEngineServiceRestInterceptor,
24
+ SiteSearchEngineServiceRestTransport,
25
+ )
26
+
27
+ # Compile a registry of transports.
28
+ _transport_registry = (
29
+ OrderedDict()
30
+ ) # type: Dict[str, Type[SiteSearchEngineServiceTransport]]
31
+ _transport_registry["grpc"] = SiteSearchEngineServiceGrpcTransport
32
+ _transport_registry["grpc_asyncio"] = SiteSearchEngineServiceGrpcAsyncIOTransport
33
+ _transport_registry["rest"] = SiteSearchEngineServiceRestTransport
34
+
35
+ __all__ = (
36
+ "SiteSearchEngineServiceTransport",
37
+ "SiteSearchEngineServiceGrpcTransport",
38
+ "SiteSearchEngineServiceGrpcAsyncIOTransport",
39
+ "SiteSearchEngineServiceRestTransport",
40
+ "SiteSearchEngineServiceRestInterceptor",
41
+ )
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/transports/base.py ADDED
@@ -0,0 +1,425 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import abc
17
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18
+
19
+ import google.api_core
20
+ from google.api_core import exceptions as core_exceptions
21
+ from google.api_core import gapic_v1, operations_v1
22
+ from google.api_core import retry as retries
23
+ import google.auth # type: ignore
24
+ from google.auth import credentials as ga_credentials # type: ignore
25
+ from google.cloud.location import locations_pb2 # type: ignore
26
+ from google.longrunning import operations_pb2 # type: ignore
27
+ from google.oauth2 import service_account # type: ignore
28
+ import google.protobuf
29
+
30
+ from google.cloud.discoveryengine_v1beta import gapic_version as package_version
31
+ from google.cloud.discoveryengine_v1beta.types import (
32
+ site_search_engine,
33
+ site_search_engine_service,
34
+ )
35
+
36
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
37
+ gapic_version=package_version.__version__
38
+ )
39
+
40
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
41
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
42
+
43
+
44
+ class SiteSearchEngineServiceTransport(abc.ABC):
45
+ """Abstract transport class for SiteSearchEngineService."""
46
+
47
+ AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",)
48
+
49
+ DEFAULT_HOST: str = "discoveryengine.googleapis.com"
50
+
51
+ def __init__(
52
+ self,
53
+ *,
54
+ host: str = DEFAULT_HOST,
55
+ credentials: Optional[ga_credentials.Credentials] = None,
56
+ credentials_file: Optional[str] = None,
57
+ scopes: Optional[Sequence[str]] = None,
58
+ quota_project_id: Optional[str] = None,
59
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
60
+ always_use_jwt_access: Optional[bool] = False,
61
+ api_audience: Optional[str] = None,
62
+ **kwargs,
63
+ ) -> None:
64
+ """Instantiate the transport.
65
+
66
+ Args:
67
+ host (Optional[str]):
68
+ The hostname to connect to (default: 'discoveryengine.googleapis.com').
69
+ credentials (Optional[google.auth.credentials.Credentials]): The
70
+ authorization credentials to attach to requests. These
71
+ credentials identify the application to the service; if none
72
+ are specified, the client will attempt to ascertain the
73
+ credentials from the environment.
74
+ credentials_file (Optional[str]): A file with credentials that can
75
+ be loaded with :func:`google.auth.load_credentials_from_file`.
76
+ This argument is mutually exclusive with credentials.
77
+ scopes (Optional[Sequence[str]]): A list of scopes.
78
+ quota_project_id (Optional[str]): An optional project to use for billing
79
+ and quota.
80
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
81
+ The client info used to send a user-agent string along with
82
+ API requests. If ``None``, then default info will be used.
83
+ Generally, you only need to set this if you're developing
84
+ your own client library.
85
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
86
+ be used for service account credentials.
87
+ """
88
+
89
+ scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
90
+
91
+ # Save the scopes.
92
+ self._scopes = scopes
93
+ if not hasattr(self, "_ignore_credentials"):
94
+ self._ignore_credentials: bool = False
95
+
96
+ # If no credentials are provided, then determine the appropriate
97
+ # defaults.
98
+ if credentials and credentials_file:
99
+ raise core_exceptions.DuplicateCredentialArgs(
100
+ "'credentials_file' and 'credentials' are mutually exclusive"
101
+ )
102
+
103
+ if credentials_file is not None:
104
+ credentials, _ = google.auth.load_credentials_from_file(
105
+ credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
106
+ )
107
+ elif credentials is None and not self._ignore_credentials:
108
+ credentials, _ = google.auth.default(
109
+ **scopes_kwargs, quota_project_id=quota_project_id
110
+ )
111
+ # Don't apply audience if the credentials file passed from user.
112
+ if hasattr(credentials, "with_gdch_audience"):
113
+ credentials = credentials.with_gdch_audience(
114
+ api_audience if api_audience else host
115
+ )
116
+
117
+ # If the credentials are service account credentials, then always try to use self signed JWT.
118
+ if (
119
+ always_use_jwt_access
120
+ and isinstance(credentials, service_account.Credentials)
121
+ and hasattr(service_account.Credentials, "with_always_use_jwt_access")
122
+ ):
123
+ credentials = credentials.with_always_use_jwt_access(True)
124
+
125
+ # Save the credentials.
126
+ self._credentials = credentials
127
+
128
+ # Save the hostname. Default to port 443 (HTTPS) if none is specified.
129
+ if ":" not in host:
130
+ host += ":443"
131
+ self._host = host
132
+
133
+ @property
134
+ def host(self):
135
+ return self._host
136
+
137
+ def _prep_wrapped_messages(self, client_info):
138
+ # Precompute the wrapped methods.
139
+ self._wrapped_methods = {
140
+ self.get_site_search_engine: gapic_v1.method.wrap_method(
141
+ self.get_site_search_engine,
142
+ default_timeout=None,
143
+ client_info=client_info,
144
+ ),
145
+ self.create_target_site: gapic_v1.method.wrap_method(
146
+ self.create_target_site,
147
+ default_timeout=None,
148
+ client_info=client_info,
149
+ ),
150
+ self.batch_create_target_sites: gapic_v1.method.wrap_method(
151
+ self.batch_create_target_sites,
152
+ default_timeout=None,
153
+ client_info=client_info,
154
+ ),
155
+ self.get_target_site: gapic_v1.method.wrap_method(
156
+ self.get_target_site,
157
+ default_timeout=None,
158
+ client_info=client_info,
159
+ ),
160
+ self.update_target_site: gapic_v1.method.wrap_method(
161
+ self.update_target_site,
162
+ default_timeout=None,
163
+ client_info=client_info,
164
+ ),
165
+ self.delete_target_site: gapic_v1.method.wrap_method(
166
+ self.delete_target_site,
167
+ default_timeout=None,
168
+ client_info=client_info,
169
+ ),
170
+ self.list_target_sites: gapic_v1.method.wrap_method(
171
+ self.list_target_sites,
172
+ default_timeout=None,
173
+ client_info=client_info,
174
+ ),
175
+ self.create_sitemap: gapic_v1.method.wrap_method(
176
+ self.create_sitemap,
177
+ default_timeout=None,
178
+ client_info=client_info,
179
+ ),
180
+ self.delete_sitemap: gapic_v1.method.wrap_method(
181
+ self.delete_sitemap,
182
+ default_timeout=None,
183
+ client_info=client_info,
184
+ ),
185
+ self.fetch_sitemaps: gapic_v1.method.wrap_method(
186
+ self.fetch_sitemaps,
187
+ default_timeout=None,
188
+ client_info=client_info,
189
+ ),
190
+ self.enable_advanced_site_search: gapic_v1.method.wrap_method(
191
+ self.enable_advanced_site_search,
192
+ default_timeout=None,
193
+ client_info=client_info,
194
+ ),
195
+ self.disable_advanced_site_search: gapic_v1.method.wrap_method(
196
+ self.disable_advanced_site_search,
197
+ default_timeout=None,
198
+ client_info=client_info,
199
+ ),
200
+ self.recrawl_uris: gapic_v1.method.wrap_method(
201
+ self.recrawl_uris,
202
+ default_timeout=None,
203
+ client_info=client_info,
204
+ ),
205
+ self.batch_verify_target_sites: gapic_v1.method.wrap_method(
206
+ self.batch_verify_target_sites,
207
+ default_timeout=None,
208
+ client_info=client_info,
209
+ ),
210
+ self.fetch_domain_verification_status: gapic_v1.method.wrap_method(
211
+ self.fetch_domain_verification_status,
212
+ default_timeout=None,
213
+ client_info=client_info,
214
+ ),
215
+ self.cancel_operation: gapic_v1.method.wrap_method(
216
+ self.cancel_operation,
217
+ default_timeout=None,
218
+ client_info=client_info,
219
+ ),
220
+ self.get_operation: gapic_v1.method.wrap_method(
221
+ self.get_operation,
222
+ default_timeout=None,
223
+ client_info=client_info,
224
+ ),
225
+ self.list_operations: gapic_v1.method.wrap_method(
226
+ self.list_operations,
227
+ default_timeout=None,
228
+ client_info=client_info,
229
+ ),
230
+ }
231
+
232
+ def close(self):
233
+ """Closes resources associated with the transport.
234
+
235
+ .. warning::
236
+ Only call this method if the transport is NOT shared
237
+ with other clients - this may cause errors in other clients!
238
+ """
239
+ raise NotImplementedError()
240
+
241
+ @property
242
+ def operations_client(self):
243
+ """Return the client designed to process long-running operations."""
244
+ raise NotImplementedError()
245
+
246
+ @property
247
+ def get_site_search_engine(
248
+ self,
249
+ ) -> Callable[
250
+ [site_search_engine_service.GetSiteSearchEngineRequest],
251
+ Union[
252
+ site_search_engine.SiteSearchEngine,
253
+ Awaitable[site_search_engine.SiteSearchEngine],
254
+ ],
255
+ ]:
256
+ raise NotImplementedError()
257
+
258
+ @property
259
+ def create_target_site(
260
+ self,
261
+ ) -> Callable[
262
+ [site_search_engine_service.CreateTargetSiteRequest],
263
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
264
+ ]:
265
+ raise NotImplementedError()
266
+
267
+ @property
268
+ def batch_create_target_sites(
269
+ self,
270
+ ) -> Callable[
271
+ [site_search_engine_service.BatchCreateTargetSitesRequest],
272
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
273
+ ]:
274
+ raise NotImplementedError()
275
+
276
+ @property
277
+ def get_target_site(
278
+ self,
279
+ ) -> Callable[
280
+ [site_search_engine_service.GetTargetSiteRequest],
281
+ Union[site_search_engine.TargetSite, Awaitable[site_search_engine.TargetSite]],
282
+ ]:
283
+ raise NotImplementedError()
284
+
285
+ @property
286
+ def update_target_site(
287
+ self,
288
+ ) -> Callable[
289
+ [site_search_engine_service.UpdateTargetSiteRequest],
290
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
291
+ ]:
292
+ raise NotImplementedError()
293
+
294
+ @property
295
+ def delete_target_site(
296
+ self,
297
+ ) -> Callable[
298
+ [site_search_engine_service.DeleteTargetSiteRequest],
299
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
300
+ ]:
301
+ raise NotImplementedError()
302
+
303
+ @property
304
+ def list_target_sites(
305
+ self,
306
+ ) -> Callable[
307
+ [site_search_engine_service.ListTargetSitesRequest],
308
+ Union[
309
+ site_search_engine_service.ListTargetSitesResponse,
310
+ Awaitable[site_search_engine_service.ListTargetSitesResponse],
311
+ ],
312
+ ]:
313
+ raise NotImplementedError()
314
+
315
+ @property
316
+ def create_sitemap(
317
+ self,
318
+ ) -> Callable[
319
+ [site_search_engine_service.CreateSitemapRequest],
320
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
321
+ ]:
322
+ raise NotImplementedError()
323
+
324
+ @property
325
+ def delete_sitemap(
326
+ self,
327
+ ) -> Callable[
328
+ [site_search_engine_service.DeleteSitemapRequest],
329
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
330
+ ]:
331
+ raise NotImplementedError()
332
+
333
+ @property
334
+ def fetch_sitemaps(
335
+ self,
336
+ ) -> Callable[
337
+ [site_search_engine_service.FetchSitemapsRequest],
338
+ Union[
339
+ site_search_engine_service.FetchSitemapsResponse,
340
+ Awaitable[site_search_engine_service.FetchSitemapsResponse],
341
+ ],
342
+ ]:
343
+ raise NotImplementedError()
344
+
345
+ @property
346
+ def enable_advanced_site_search(
347
+ self,
348
+ ) -> Callable[
349
+ [site_search_engine_service.EnableAdvancedSiteSearchRequest],
350
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
351
+ ]:
352
+ raise NotImplementedError()
353
+
354
+ @property
355
+ def disable_advanced_site_search(
356
+ self,
357
+ ) -> Callable[
358
+ [site_search_engine_service.DisableAdvancedSiteSearchRequest],
359
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
360
+ ]:
361
+ raise NotImplementedError()
362
+
363
+ @property
364
+ def recrawl_uris(
365
+ self,
366
+ ) -> Callable[
367
+ [site_search_engine_service.RecrawlUrisRequest],
368
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
369
+ ]:
370
+ raise NotImplementedError()
371
+
372
+ @property
373
+ def batch_verify_target_sites(
374
+ self,
375
+ ) -> Callable[
376
+ [site_search_engine_service.BatchVerifyTargetSitesRequest],
377
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
378
+ ]:
379
+ raise NotImplementedError()
380
+
381
+ @property
382
+ def fetch_domain_verification_status(
383
+ self,
384
+ ) -> Callable[
385
+ [site_search_engine_service.FetchDomainVerificationStatusRequest],
386
+ Union[
387
+ site_search_engine_service.FetchDomainVerificationStatusResponse,
388
+ Awaitable[site_search_engine_service.FetchDomainVerificationStatusResponse],
389
+ ],
390
+ ]:
391
+ raise NotImplementedError()
392
+
393
+ @property
394
+ def list_operations(
395
+ self,
396
+ ) -> Callable[
397
+ [operations_pb2.ListOperationsRequest],
398
+ Union[
399
+ operations_pb2.ListOperationsResponse,
400
+ Awaitable[operations_pb2.ListOperationsResponse],
401
+ ],
402
+ ]:
403
+ raise NotImplementedError()
404
+
405
+ @property
406
+ def get_operation(
407
+ self,
408
+ ) -> Callable[
409
+ [operations_pb2.GetOperationRequest],
410
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
411
+ ]:
412
+ raise NotImplementedError()
413
+
414
+ @property
415
+ def cancel_operation(
416
+ self,
417
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None,]:
418
+ raise NotImplementedError()
419
+
420
+ @property
421
+ def kind(self) -> str:
422
+ raise NotImplementedError()
423
+
424
+
425
+ __all__ = ("SiteSearchEngineServiceTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/transports/grpc.py ADDED
@@ -0,0 +1,857 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import json
17
+ import logging as std_logging
18
+ import pickle
19
+ from typing import Callable, Dict, Optional, Sequence, Tuple, Union
20
+ import warnings
21
+
22
+ from google.api_core import gapic_v1, grpc_helpers, operations_v1
23
+ import google.auth # type: ignore
24
+ from google.auth import credentials as ga_credentials # type: ignore
25
+ from google.auth.transport.grpc import SslCredentials # type: ignore
26
+ from google.cloud.location import locations_pb2 # type: ignore
27
+ from google.longrunning import operations_pb2 # type: ignore
28
+ from google.protobuf.json_format import MessageToJson
29
+ import google.protobuf.message
30
+ import grpc # type: ignore
31
+ import proto # type: ignore
32
+
33
+ from google.cloud.discoveryengine_v1beta.types import (
34
+ site_search_engine,
35
+ site_search_engine_service,
36
+ )
37
+
38
+ from .base import DEFAULT_CLIENT_INFO, SiteSearchEngineServiceTransport
39
+
40
+ try:
41
+ from google.api_core import client_logging # type: ignore
42
+
43
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
44
+ except ImportError: # pragma: NO COVER
45
+ CLIENT_LOGGING_SUPPORTED = False
46
+
47
+ _LOGGER = std_logging.getLogger(__name__)
48
+
49
+
50
+ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
51
+ def intercept_unary_unary(self, continuation, client_call_details, request):
52
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
53
+ std_logging.DEBUG
54
+ )
55
+ if logging_enabled: # pragma: NO COVER
56
+ request_metadata = client_call_details.metadata
57
+ if isinstance(request, proto.Message):
58
+ request_payload = type(request).to_json(request)
59
+ elif isinstance(request, google.protobuf.message.Message):
60
+ request_payload = MessageToJson(request)
61
+ else:
62
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
63
+
64
+ request_metadata = {
65
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
66
+ for key, value in request_metadata
67
+ }
68
+ grpc_request = {
69
+ "payload": request_payload,
70
+ "requestMethod": "grpc",
71
+ "metadata": dict(request_metadata),
72
+ }
73
+ _LOGGER.debug(
74
+ f"Sending request for {client_call_details.method}",
75
+ extra={
76
+ "serviceName": "google.cloud.discoveryengine.v1beta.SiteSearchEngineService",
77
+ "rpcName": str(client_call_details.method),
78
+ "request": grpc_request,
79
+ "metadata": grpc_request["metadata"],
80
+ },
81
+ )
82
+ response = continuation(client_call_details, request)
83
+ if logging_enabled: # pragma: NO COVER
84
+ response_metadata = response.trailing_metadata()
85
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
86
+ metadata = (
87
+ dict([(k, str(v)) for k, v in response_metadata])
88
+ if response_metadata
89
+ else None
90
+ )
91
+ result = response.result()
92
+ if isinstance(result, proto.Message):
93
+ response_payload = type(result).to_json(result)
94
+ elif isinstance(result, google.protobuf.message.Message):
95
+ response_payload = MessageToJson(result)
96
+ else:
97
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
98
+ grpc_response = {
99
+ "payload": response_payload,
100
+ "metadata": metadata,
101
+ "status": "OK",
102
+ }
103
+ _LOGGER.debug(
104
+ f"Received response for {client_call_details.method}.",
105
+ extra={
106
+ "serviceName": "google.cloud.discoveryengine.v1beta.SiteSearchEngineService",
107
+ "rpcName": client_call_details.method,
108
+ "response": grpc_response,
109
+ "metadata": grpc_response["metadata"],
110
+ },
111
+ )
112
+ return response
113
+
114
+
115
+ class SiteSearchEngineServiceGrpcTransport(SiteSearchEngineServiceTransport):
116
+ """gRPC backend transport for SiteSearchEngineService.
117
+
118
+ Service for managing site search related resources.
119
+
120
+ This class defines the same methods as the primary client, so the
121
+ primary client can load the underlying transport implementation
122
+ and call it.
123
+
124
+ It sends protocol buffers over the wire using gRPC (which is built on
125
+ top of HTTP/2); the ``grpcio`` package must be installed.
126
+ """
127
+
128
+ _stubs: Dict[str, Callable]
129
+
130
+ def __init__(
131
+ self,
132
+ *,
133
+ host: str = "discoveryengine.googleapis.com",
134
+ credentials: Optional[ga_credentials.Credentials] = None,
135
+ credentials_file: Optional[str] = None,
136
+ scopes: Optional[Sequence[str]] = None,
137
+ channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
138
+ api_mtls_endpoint: Optional[str] = None,
139
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
140
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
141
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
142
+ quota_project_id: Optional[str] = None,
143
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
144
+ always_use_jwt_access: Optional[bool] = False,
145
+ api_audience: Optional[str] = None,
146
+ ) -> None:
147
+ """Instantiate the transport.
148
+
149
+ Args:
150
+ host (Optional[str]):
151
+ The hostname to connect to (default: 'discoveryengine.googleapis.com').
152
+ credentials (Optional[google.auth.credentials.Credentials]): The
153
+ authorization credentials to attach to requests. These
154
+ credentials identify the application to the service; if none
155
+ are specified, the client will attempt to ascertain the
156
+ credentials from the environment.
157
+ This argument is ignored if a ``channel`` instance is provided.
158
+ credentials_file (Optional[str]): A file with credentials that can
159
+ be loaded with :func:`google.auth.load_credentials_from_file`.
160
+ This argument is ignored if a ``channel`` instance is provided.
161
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
162
+ ignored if a ``channel`` instance is provided.
163
+ channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
164
+ A ``Channel`` instance through which to make calls, or a Callable
165
+ that constructs and returns one. If set to None, ``self.create_channel``
166
+ is used to create the channel. If a Callable is given, it will be called
167
+ with the same arguments as used in ``self.create_channel``.
168
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
169
+ If provided, it overrides the ``host`` argument and tries to create
170
+ a mutual TLS channel with client SSL credentials from
171
+ ``client_cert_source`` or application default SSL credentials.
172
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
173
+ Deprecated. A callback to provide client SSL certificate bytes and
174
+ private key bytes, both in PEM format. It is ignored if
175
+ ``api_mtls_endpoint`` is None.
176
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
177
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
178
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
179
+ A callback to provide client certificate bytes and private key bytes,
180
+ both in PEM format. It is used to configure a mutual TLS channel. It is
181
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
182
+ quota_project_id (Optional[str]): An optional project to use for billing
183
+ and quota.
184
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
185
+ The client info used to send a user-agent string along with
186
+ API requests. If ``None``, then default info will be used.
187
+ Generally, you only need to set this if you're developing
188
+ your own client library.
189
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
190
+ be used for service account credentials.
191
+
192
+ Raises:
193
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
194
+ creation failed for any reason.
195
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
196
+ and ``credentials_file`` are passed.
197
+ """
198
+ self._grpc_channel = None
199
+ self._ssl_channel_credentials = ssl_channel_credentials
200
+ self._stubs: Dict[str, Callable] = {}
201
+ self._operations_client: Optional[operations_v1.OperationsClient] = None
202
+
203
+ if api_mtls_endpoint:
204
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
205
+ if client_cert_source:
206
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
207
+
208
+ if isinstance(channel, grpc.Channel):
209
+ # Ignore credentials if a channel was passed.
210
+ credentials = None
211
+ self._ignore_credentials = True
212
+ # If a channel was explicitly provided, set it.
213
+ self._grpc_channel = channel
214
+ self._ssl_channel_credentials = None
215
+
216
+ else:
217
+ if api_mtls_endpoint:
218
+ host = api_mtls_endpoint
219
+
220
+ # Create SSL credentials with client_cert_source or application
221
+ # default SSL credentials.
222
+ if client_cert_source:
223
+ cert, key = client_cert_source()
224
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
225
+ certificate_chain=cert, private_key=key
226
+ )
227
+ else:
228
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
229
+
230
+ else:
231
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
232
+ cert, key = client_cert_source_for_mtls()
233
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
234
+ certificate_chain=cert, private_key=key
235
+ )
236
+
237
+ # The base transport sets the host, credentials and scopes
238
+ super().__init__(
239
+ host=host,
240
+ credentials=credentials,
241
+ credentials_file=credentials_file,
242
+ scopes=scopes,
243
+ quota_project_id=quota_project_id,
244
+ client_info=client_info,
245
+ always_use_jwt_access=always_use_jwt_access,
246
+ api_audience=api_audience,
247
+ )
248
+
249
+ if not self._grpc_channel:
250
+ # initialize with the provided callable or the default channel
251
+ channel_init = channel or type(self).create_channel
252
+ self._grpc_channel = channel_init(
253
+ self._host,
254
+ # use the credentials which are saved
255
+ credentials=self._credentials,
256
+ # Set ``credentials_file`` to ``None`` here as
257
+ # the credentials that we saved earlier should be used.
258
+ credentials_file=None,
259
+ scopes=self._scopes,
260
+ ssl_credentials=self._ssl_channel_credentials,
261
+ quota_project_id=quota_project_id,
262
+ options=[
263
+ ("grpc.max_send_message_length", -1),
264
+ ("grpc.max_receive_message_length", -1),
265
+ ],
266
+ )
267
+
268
+ self._interceptor = _LoggingClientInterceptor()
269
+ self._logged_channel = grpc.intercept_channel(
270
+ self._grpc_channel, self._interceptor
271
+ )
272
+
273
+ # Wrap messages. This must be done after self._logged_channel exists
274
+ self._prep_wrapped_messages(client_info)
275
+
276
+ @classmethod
277
+ def create_channel(
278
+ cls,
279
+ host: str = "discoveryengine.googleapis.com",
280
+ credentials: Optional[ga_credentials.Credentials] = None,
281
+ credentials_file: Optional[str] = None,
282
+ scopes: Optional[Sequence[str]] = None,
283
+ quota_project_id: Optional[str] = None,
284
+ **kwargs,
285
+ ) -> grpc.Channel:
286
+ """Create and return a gRPC channel object.
287
+ Args:
288
+ host (Optional[str]): The host for the channel to use.
289
+ credentials (Optional[~.Credentials]): The
290
+ authorization credentials to attach to requests. These
291
+ credentials identify this application to the service. If
292
+ none are specified, the client will attempt to ascertain
293
+ the credentials from the environment.
294
+ credentials_file (Optional[str]): A file with credentials that can
295
+ be loaded with :func:`google.auth.load_credentials_from_file`.
296
+ This argument is mutually exclusive with credentials.
297
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
298
+ service. These are only used when credentials are not specified and
299
+ are passed to :func:`google.auth.default`.
300
+ quota_project_id (Optional[str]): An optional project to use for billing
301
+ and quota.
302
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
303
+ channel creation.
304
+ Returns:
305
+ grpc.Channel: A gRPC channel object.
306
+
307
+ Raises:
308
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
309
+ and ``credentials_file`` are passed.
310
+ """
311
+
312
+ return grpc_helpers.create_channel(
313
+ host,
314
+ credentials=credentials,
315
+ credentials_file=credentials_file,
316
+ quota_project_id=quota_project_id,
317
+ default_scopes=cls.AUTH_SCOPES,
318
+ scopes=scopes,
319
+ default_host=cls.DEFAULT_HOST,
320
+ **kwargs,
321
+ )
322
+
323
+ @property
324
+ def grpc_channel(self) -> grpc.Channel:
325
+ """Return the channel designed to connect to this service."""
326
+ return self._grpc_channel
327
+
328
+ @property
329
+ def operations_client(self) -> operations_v1.OperationsClient:
330
+ """Create the client designed to process long-running operations.
331
+
332
+ This property caches on the instance; repeated calls return the same
333
+ client.
334
+ """
335
+ # Quick check: Only create a new client if we do not already have one.
336
+ if self._operations_client is None:
337
+ self._operations_client = operations_v1.OperationsClient(
338
+ self._logged_channel
339
+ )
340
+
341
+ # Return the client from cache.
342
+ return self._operations_client
343
+
344
+ @property
345
+ def get_site_search_engine(
346
+ self,
347
+ ) -> Callable[
348
+ [site_search_engine_service.GetSiteSearchEngineRequest],
349
+ site_search_engine.SiteSearchEngine,
350
+ ]:
351
+ r"""Return a callable for the get site search engine method over gRPC.
352
+
353
+ Gets the
354
+ [SiteSearchEngine][google.cloud.discoveryengine.v1beta.SiteSearchEngine].
355
+
356
+ Returns:
357
+ Callable[[~.GetSiteSearchEngineRequest],
358
+ ~.SiteSearchEngine]:
359
+ A function that, when called, will call the underlying RPC
360
+ on the server.
361
+ """
362
+ # Generate a "stub function" on-the-fly which will actually make
363
+ # the request.
364
+ # gRPC handles serialization and deserialization, so we just need
365
+ # to pass in the functions for each.
366
+ if "get_site_search_engine" not in self._stubs:
367
+ self._stubs["get_site_search_engine"] = self._logged_channel.unary_unary(
368
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/GetSiteSearchEngine",
369
+ request_serializer=site_search_engine_service.GetSiteSearchEngineRequest.serialize,
370
+ response_deserializer=site_search_engine.SiteSearchEngine.deserialize,
371
+ )
372
+ return self._stubs["get_site_search_engine"]
373
+
374
+ @property
375
+ def create_target_site(
376
+ self,
377
+ ) -> Callable[
378
+ [site_search_engine_service.CreateTargetSiteRequest], operations_pb2.Operation
379
+ ]:
380
+ r"""Return a callable for the create target site method over gRPC.
381
+
382
+ Creates a
383
+ [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite].
384
+
385
+ Returns:
386
+ Callable[[~.CreateTargetSiteRequest],
387
+ ~.Operation]:
388
+ A function that, when called, will call the underlying RPC
389
+ on the server.
390
+ """
391
+ # Generate a "stub function" on-the-fly which will actually make
392
+ # the request.
393
+ # gRPC handles serialization and deserialization, so we just need
394
+ # to pass in the functions for each.
395
+ if "create_target_site" not in self._stubs:
396
+ self._stubs["create_target_site"] = self._logged_channel.unary_unary(
397
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/CreateTargetSite",
398
+ request_serializer=site_search_engine_service.CreateTargetSiteRequest.serialize,
399
+ response_deserializer=operations_pb2.Operation.FromString,
400
+ )
401
+ return self._stubs["create_target_site"]
402
+
403
+ @property
404
+ def batch_create_target_sites(
405
+ self,
406
+ ) -> Callable[
407
+ [site_search_engine_service.BatchCreateTargetSitesRequest],
408
+ operations_pb2.Operation,
409
+ ]:
410
+ r"""Return a callable for the batch create target sites method over gRPC.
411
+
412
+ Creates
413
+ [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite] in
414
+ a batch.
415
+
416
+ Returns:
417
+ Callable[[~.BatchCreateTargetSitesRequest],
418
+ ~.Operation]:
419
+ A function that, when called, will call the underlying RPC
420
+ on the server.
421
+ """
422
+ # Generate a "stub function" on-the-fly which will actually make
423
+ # the request.
424
+ # gRPC handles serialization and deserialization, so we just need
425
+ # to pass in the functions for each.
426
+ if "batch_create_target_sites" not in self._stubs:
427
+ self._stubs["batch_create_target_sites"] = self._logged_channel.unary_unary(
428
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/BatchCreateTargetSites",
429
+ request_serializer=site_search_engine_service.BatchCreateTargetSitesRequest.serialize,
430
+ response_deserializer=operations_pb2.Operation.FromString,
431
+ )
432
+ return self._stubs["batch_create_target_sites"]
433
+
434
+ @property
435
+ def get_target_site(
436
+ self,
437
+ ) -> Callable[
438
+ [site_search_engine_service.GetTargetSiteRequest], site_search_engine.TargetSite
439
+ ]:
440
+ r"""Return a callable for the get target site method over gRPC.
441
+
442
+ Gets a
443
+ [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite].
444
+
445
+ Returns:
446
+ Callable[[~.GetTargetSiteRequest],
447
+ ~.TargetSite]:
448
+ A function that, when called, will call the underlying RPC
449
+ on the server.
450
+ """
451
+ # Generate a "stub function" on-the-fly which will actually make
452
+ # the request.
453
+ # gRPC handles serialization and deserialization, so we just need
454
+ # to pass in the functions for each.
455
+ if "get_target_site" not in self._stubs:
456
+ self._stubs["get_target_site"] = self._logged_channel.unary_unary(
457
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/GetTargetSite",
458
+ request_serializer=site_search_engine_service.GetTargetSiteRequest.serialize,
459
+ response_deserializer=site_search_engine.TargetSite.deserialize,
460
+ )
461
+ return self._stubs["get_target_site"]
462
+
463
+ @property
464
+ def update_target_site(
465
+ self,
466
+ ) -> Callable[
467
+ [site_search_engine_service.UpdateTargetSiteRequest], operations_pb2.Operation
468
+ ]:
469
+ r"""Return a callable for the update target site method over gRPC.
470
+
471
+ Updates a
472
+ [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite].
473
+
474
+ Returns:
475
+ Callable[[~.UpdateTargetSiteRequest],
476
+ ~.Operation]:
477
+ A function that, when called, will call the underlying RPC
478
+ on the server.
479
+ """
480
+ # Generate a "stub function" on-the-fly which will actually make
481
+ # the request.
482
+ # gRPC handles serialization and deserialization, so we just need
483
+ # to pass in the functions for each.
484
+ if "update_target_site" not in self._stubs:
485
+ self._stubs["update_target_site"] = self._logged_channel.unary_unary(
486
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/UpdateTargetSite",
487
+ request_serializer=site_search_engine_service.UpdateTargetSiteRequest.serialize,
488
+ response_deserializer=operations_pb2.Operation.FromString,
489
+ )
490
+ return self._stubs["update_target_site"]
491
+
492
+ @property
493
+ def delete_target_site(
494
+ self,
495
+ ) -> Callable[
496
+ [site_search_engine_service.DeleteTargetSiteRequest], operations_pb2.Operation
497
+ ]:
498
+ r"""Return a callable for the delete target site method over gRPC.
499
+
500
+ Deletes a
501
+ [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite].
502
+
503
+ Returns:
504
+ Callable[[~.DeleteTargetSiteRequest],
505
+ ~.Operation]:
506
+ A function that, when called, will call the underlying RPC
507
+ on the server.
508
+ """
509
+ # Generate a "stub function" on-the-fly which will actually make
510
+ # the request.
511
+ # gRPC handles serialization and deserialization, so we just need
512
+ # to pass in the functions for each.
513
+ if "delete_target_site" not in self._stubs:
514
+ self._stubs["delete_target_site"] = self._logged_channel.unary_unary(
515
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/DeleteTargetSite",
516
+ request_serializer=site_search_engine_service.DeleteTargetSiteRequest.serialize,
517
+ response_deserializer=operations_pb2.Operation.FromString,
518
+ )
519
+ return self._stubs["delete_target_site"]
520
+
521
+ @property
522
+ def list_target_sites(
523
+ self,
524
+ ) -> Callable[
525
+ [site_search_engine_service.ListTargetSitesRequest],
526
+ site_search_engine_service.ListTargetSitesResponse,
527
+ ]:
528
+ r"""Return a callable for the list target sites method over gRPC.
529
+
530
+ Gets a list of
531
+ [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite]s.
532
+
533
+ Returns:
534
+ Callable[[~.ListTargetSitesRequest],
535
+ ~.ListTargetSitesResponse]:
536
+ A function that, when called, will call the underlying RPC
537
+ on the server.
538
+ """
539
+ # Generate a "stub function" on-the-fly which will actually make
540
+ # the request.
541
+ # gRPC handles serialization and deserialization, so we just need
542
+ # to pass in the functions for each.
543
+ if "list_target_sites" not in self._stubs:
544
+ self._stubs["list_target_sites"] = self._logged_channel.unary_unary(
545
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/ListTargetSites",
546
+ request_serializer=site_search_engine_service.ListTargetSitesRequest.serialize,
547
+ response_deserializer=site_search_engine_service.ListTargetSitesResponse.deserialize,
548
+ )
549
+ return self._stubs["list_target_sites"]
550
+
551
+ @property
552
+ def create_sitemap(
553
+ self,
554
+ ) -> Callable[
555
+ [site_search_engine_service.CreateSitemapRequest], operations_pb2.Operation
556
+ ]:
557
+ r"""Return a callable for the create sitemap method over gRPC.
558
+
559
+ Creates a
560
+ [Sitemap][google.cloud.discoveryengine.v1beta.Sitemap].
561
+
562
+ Returns:
563
+ Callable[[~.CreateSitemapRequest],
564
+ ~.Operation]:
565
+ A function that, when called, will call the underlying RPC
566
+ on the server.
567
+ """
568
+ # Generate a "stub function" on-the-fly which will actually make
569
+ # the request.
570
+ # gRPC handles serialization and deserialization, so we just need
571
+ # to pass in the functions for each.
572
+ if "create_sitemap" not in self._stubs:
573
+ self._stubs["create_sitemap"] = self._logged_channel.unary_unary(
574
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/CreateSitemap",
575
+ request_serializer=site_search_engine_service.CreateSitemapRequest.serialize,
576
+ response_deserializer=operations_pb2.Operation.FromString,
577
+ )
578
+ return self._stubs["create_sitemap"]
579
+
580
+ @property
581
+ def delete_sitemap(
582
+ self,
583
+ ) -> Callable[
584
+ [site_search_engine_service.DeleteSitemapRequest], operations_pb2.Operation
585
+ ]:
586
+ r"""Return a callable for the delete sitemap method over gRPC.
587
+
588
+ Deletes a
589
+ [Sitemap][google.cloud.discoveryengine.v1beta.Sitemap].
590
+
591
+ Returns:
592
+ Callable[[~.DeleteSitemapRequest],
593
+ ~.Operation]:
594
+ A function that, when called, will call the underlying RPC
595
+ on the server.
596
+ """
597
+ # Generate a "stub function" on-the-fly which will actually make
598
+ # the request.
599
+ # gRPC handles serialization and deserialization, so we just need
600
+ # to pass in the functions for each.
601
+ if "delete_sitemap" not in self._stubs:
602
+ self._stubs["delete_sitemap"] = self._logged_channel.unary_unary(
603
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/DeleteSitemap",
604
+ request_serializer=site_search_engine_service.DeleteSitemapRequest.serialize,
605
+ response_deserializer=operations_pb2.Operation.FromString,
606
+ )
607
+ return self._stubs["delete_sitemap"]
608
+
609
+ @property
610
+ def fetch_sitemaps(
611
+ self,
612
+ ) -> Callable[
613
+ [site_search_engine_service.FetchSitemapsRequest],
614
+ site_search_engine_service.FetchSitemapsResponse,
615
+ ]:
616
+ r"""Return a callable for the fetch sitemaps method over gRPC.
617
+
618
+ Fetch [Sitemap][google.cloud.discoveryengine.v1beta.Sitemap]s in
619
+ a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
620
+
621
+ Returns:
622
+ Callable[[~.FetchSitemapsRequest],
623
+ ~.FetchSitemapsResponse]:
624
+ A function that, when called, will call the underlying RPC
625
+ on the server.
626
+ """
627
+ # Generate a "stub function" on-the-fly which will actually make
628
+ # the request.
629
+ # gRPC handles serialization and deserialization, so we just need
630
+ # to pass in the functions for each.
631
+ if "fetch_sitemaps" not in self._stubs:
632
+ self._stubs["fetch_sitemaps"] = self._logged_channel.unary_unary(
633
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/FetchSitemaps",
634
+ request_serializer=site_search_engine_service.FetchSitemapsRequest.serialize,
635
+ response_deserializer=site_search_engine_service.FetchSitemapsResponse.deserialize,
636
+ )
637
+ return self._stubs["fetch_sitemaps"]
638
+
639
+ @property
640
+ def enable_advanced_site_search(
641
+ self,
642
+ ) -> Callable[
643
+ [site_search_engine_service.EnableAdvancedSiteSearchRequest],
644
+ operations_pb2.Operation,
645
+ ]:
646
+ r"""Return a callable for the enable advanced site search method over gRPC.
647
+
648
+ Upgrade from basic site search to advanced site
649
+ search.
650
+
651
+ Returns:
652
+ Callable[[~.EnableAdvancedSiteSearchRequest],
653
+ ~.Operation]:
654
+ A function that, when called, will call the underlying RPC
655
+ on the server.
656
+ """
657
+ # Generate a "stub function" on-the-fly which will actually make
658
+ # the request.
659
+ # gRPC handles serialization and deserialization, so we just need
660
+ # to pass in the functions for each.
661
+ if "enable_advanced_site_search" not in self._stubs:
662
+ self._stubs[
663
+ "enable_advanced_site_search"
664
+ ] = self._logged_channel.unary_unary(
665
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/EnableAdvancedSiteSearch",
666
+ request_serializer=site_search_engine_service.EnableAdvancedSiteSearchRequest.serialize,
667
+ response_deserializer=operations_pb2.Operation.FromString,
668
+ )
669
+ return self._stubs["enable_advanced_site_search"]
670
+
671
+ @property
672
+ def disable_advanced_site_search(
673
+ self,
674
+ ) -> Callable[
675
+ [site_search_engine_service.DisableAdvancedSiteSearchRequest],
676
+ operations_pb2.Operation,
677
+ ]:
678
+ r"""Return a callable for the disable advanced site search method over gRPC.
679
+
680
+ Downgrade from advanced site search to basic site
681
+ search.
682
+
683
+ Returns:
684
+ Callable[[~.DisableAdvancedSiteSearchRequest],
685
+ ~.Operation]:
686
+ A function that, when called, will call the underlying RPC
687
+ on the server.
688
+ """
689
+ # Generate a "stub function" on-the-fly which will actually make
690
+ # the request.
691
+ # gRPC handles serialization and deserialization, so we just need
692
+ # to pass in the functions for each.
693
+ if "disable_advanced_site_search" not in self._stubs:
694
+ self._stubs[
695
+ "disable_advanced_site_search"
696
+ ] = self._logged_channel.unary_unary(
697
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/DisableAdvancedSiteSearch",
698
+ request_serializer=site_search_engine_service.DisableAdvancedSiteSearchRequest.serialize,
699
+ response_deserializer=operations_pb2.Operation.FromString,
700
+ )
701
+ return self._stubs["disable_advanced_site_search"]
702
+
703
+ @property
704
+ def recrawl_uris(
705
+ self,
706
+ ) -> Callable[
707
+ [site_search_engine_service.RecrawlUrisRequest], operations_pb2.Operation
708
+ ]:
709
+ r"""Return a callable for the recrawl uris method over gRPC.
710
+
711
+ Request on-demand recrawl for a list of URIs.
712
+
713
+ Returns:
714
+ Callable[[~.RecrawlUrisRequest],
715
+ ~.Operation]:
716
+ A function that, when called, will call the underlying RPC
717
+ on the server.
718
+ """
719
+ # Generate a "stub function" on-the-fly which will actually make
720
+ # the request.
721
+ # gRPC handles serialization and deserialization, so we just need
722
+ # to pass in the functions for each.
723
+ if "recrawl_uris" not in self._stubs:
724
+ self._stubs["recrawl_uris"] = self._logged_channel.unary_unary(
725
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/RecrawlUris",
726
+ request_serializer=site_search_engine_service.RecrawlUrisRequest.serialize,
727
+ response_deserializer=operations_pb2.Operation.FromString,
728
+ )
729
+ return self._stubs["recrawl_uris"]
730
+
731
+ @property
732
+ def batch_verify_target_sites(
733
+ self,
734
+ ) -> Callable[
735
+ [site_search_engine_service.BatchVerifyTargetSitesRequest],
736
+ operations_pb2.Operation,
737
+ ]:
738
+ r"""Return a callable for the batch verify target sites method over gRPC.
739
+
740
+ Verify target sites' ownership and validity.
741
+ This API sends all the target sites under site search
742
+ engine for verification.
743
+
744
+ Returns:
745
+ Callable[[~.BatchVerifyTargetSitesRequest],
746
+ ~.Operation]:
747
+ A function that, when called, will call the underlying RPC
748
+ on the server.
749
+ """
750
+ # Generate a "stub function" on-the-fly which will actually make
751
+ # the request.
752
+ # gRPC handles serialization and deserialization, so we just need
753
+ # to pass in the functions for each.
754
+ if "batch_verify_target_sites" not in self._stubs:
755
+ self._stubs["batch_verify_target_sites"] = self._logged_channel.unary_unary(
756
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/BatchVerifyTargetSites",
757
+ request_serializer=site_search_engine_service.BatchVerifyTargetSitesRequest.serialize,
758
+ response_deserializer=operations_pb2.Operation.FromString,
759
+ )
760
+ return self._stubs["batch_verify_target_sites"]
761
+
762
+ @property
763
+ def fetch_domain_verification_status(
764
+ self,
765
+ ) -> Callable[
766
+ [site_search_engine_service.FetchDomainVerificationStatusRequest],
767
+ site_search_engine_service.FetchDomainVerificationStatusResponse,
768
+ ]:
769
+ r"""Return a callable for the fetch domain verification
770
+ status method over gRPC.
771
+
772
+ Returns list of target sites with its domain verification
773
+ status. This method can only be called under data store with
774
+ BASIC_SITE_SEARCH state at the moment.
775
+
776
+ Returns:
777
+ Callable[[~.FetchDomainVerificationStatusRequest],
778
+ ~.FetchDomainVerificationStatusResponse]:
779
+ A function that, when called, will call the underlying RPC
780
+ on the server.
781
+ """
782
+ # Generate a "stub function" on-the-fly which will actually make
783
+ # the request.
784
+ # gRPC handles serialization and deserialization, so we just need
785
+ # to pass in the functions for each.
786
+ if "fetch_domain_verification_status" not in self._stubs:
787
+ self._stubs[
788
+ "fetch_domain_verification_status"
789
+ ] = self._logged_channel.unary_unary(
790
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/FetchDomainVerificationStatus",
791
+ request_serializer=site_search_engine_service.FetchDomainVerificationStatusRequest.serialize,
792
+ response_deserializer=site_search_engine_service.FetchDomainVerificationStatusResponse.deserialize,
793
+ )
794
+ return self._stubs["fetch_domain_verification_status"]
795
+
796
+ def close(self):
797
+ self._logged_channel.close()
798
+
799
+ @property
800
+ def cancel_operation(
801
+ self,
802
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
803
+ r"""Return a callable for the cancel_operation method over gRPC."""
804
+ # Generate a "stub function" on-the-fly which will actually make
805
+ # the request.
806
+ # gRPC handles serialization and deserialization, so we just need
807
+ # to pass in the functions for each.
808
+ if "cancel_operation" not in self._stubs:
809
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
810
+ "/google.longrunning.Operations/CancelOperation",
811
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
812
+ response_deserializer=None,
813
+ )
814
+ return self._stubs["cancel_operation"]
815
+
816
+ @property
817
+ def get_operation(
818
+ self,
819
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
820
+ r"""Return a callable for the get_operation method over gRPC."""
821
+ # Generate a "stub function" on-the-fly which will actually make
822
+ # the request.
823
+ # gRPC handles serialization and deserialization, so we just need
824
+ # to pass in the functions for each.
825
+ if "get_operation" not in self._stubs:
826
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
827
+ "/google.longrunning.Operations/GetOperation",
828
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
829
+ response_deserializer=operations_pb2.Operation.FromString,
830
+ )
831
+ return self._stubs["get_operation"]
832
+
833
+ @property
834
+ def list_operations(
835
+ self,
836
+ ) -> Callable[
837
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
838
+ ]:
839
+ r"""Return a callable for the list_operations method over gRPC."""
840
+ # Generate a "stub function" on-the-fly which will actually make
841
+ # the request.
842
+ # gRPC handles serialization and deserialization, so we just need
843
+ # to pass in the functions for each.
844
+ if "list_operations" not in self._stubs:
845
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
846
+ "/google.longrunning.Operations/ListOperations",
847
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
848
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
849
+ )
850
+ return self._stubs["list_operations"]
851
+
852
+ @property
853
+ def kind(self) -> str:
854
+ return "grpc"
855
+
856
+
857
+ __all__ = ("SiteSearchEngineServiceGrpcTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/transports/grpc_asyncio.py ADDED
@@ -0,0 +1,972 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import inspect
17
+ import json
18
+ import logging as std_logging
19
+ import pickle
20
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
21
+ import warnings
22
+
23
+ from google.api_core import exceptions as core_exceptions
24
+ from google.api_core import gapic_v1, grpc_helpers_async, operations_v1
25
+ from google.api_core import retry_async as retries
26
+ from google.auth import credentials as ga_credentials # type: ignore
27
+ from google.auth.transport.grpc import SslCredentials # type: ignore
28
+ from google.cloud.location import locations_pb2 # type: ignore
29
+ from google.longrunning import operations_pb2 # type: ignore
30
+ from google.protobuf.json_format import MessageToJson
31
+ import google.protobuf.message
32
+ import grpc # type: ignore
33
+ from grpc.experimental import aio # type: ignore
34
+ import proto # type: ignore
35
+
36
+ from google.cloud.discoveryengine_v1beta.types import (
37
+ site_search_engine,
38
+ site_search_engine_service,
39
+ )
40
+
41
+ from .base import DEFAULT_CLIENT_INFO, SiteSearchEngineServiceTransport
42
+ from .grpc import SiteSearchEngineServiceGrpcTransport
43
+
44
+ try:
45
+ from google.api_core import client_logging # type: ignore
46
+
47
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
48
+ except ImportError: # pragma: NO COVER
49
+ CLIENT_LOGGING_SUPPORTED = False
50
+
51
+ _LOGGER = std_logging.getLogger(__name__)
52
+
53
+
54
+ class _LoggingClientAIOInterceptor(
55
+ grpc.aio.UnaryUnaryClientInterceptor
56
+ ): # pragma: NO COVER
57
+ async def intercept_unary_unary(self, continuation, client_call_details, request):
58
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
59
+ std_logging.DEBUG
60
+ )
61
+ if logging_enabled: # pragma: NO COVER
62
+ request_metadata = client_call_details.metadata
63
+ if isinstance(request, proto.Message):
64
+ request_payload = type(request).to_json(request)
65
+ elif isinstance(request, google.protobuf.message.Message):
66
+ request_payload = MessageToJson(request)
67
+ else:
68
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
69
+
70
+ request_metadata = {
71
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
72
+ for key, value in request_metadata
73
+ }
74
+ grpc_request = {
75
+ "payload": request_payload,
76
+ "requestMethod": "grpc",
77
+ "metadata": dict(request_metadata),
78
+ }
79
+ _LOGGER.debug(
80
+ f"Sending request for {client_call_details.method}",
81
+ extra={
82
+ "serviceName": "google.cloud.discoveryengine.v1beta.SiteSearchEngineService",
83
+ "rpcName": str(client_call_details.method),
84
+ "request": grpc_request,
85
+ "metadata": grpc_request["metadata"],
86
+ },
87
+ )
88
+ response = await continuation(client_call_details, request)
89
+ if logging_enabled: # pragma: NO COVER
90
+ response_metadata = await response.trailing_metadata()
91
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
92
+ metadata = (
93
+ dict([(k, str(v)) for k, v in response_metadata])
94
+ if response_metadata
95
+ else None
96
+ )
97
+ result = await response
98
+ if isinstance(result, proto.Message):
99
+ response_payload = type(result).to_json(result)
100
+ elif isinstance(result, google.protobuf.message.Message):
101
+ response_payload = MessageToJson(result)
102
+ else:
103
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
104
+ grpc_response = {
105
+ "payload": response_payload,
106
+ "metadata": metadata,
107
+ "status": "OK",
108
+ }
109
+ _LOGGER.debug(
110
+ f"Received response to rpc {client_call_details.method}.",
111
+ extra={
112
+ "serviceName": "google.cloud.discoveryengine.v1beta.SiteSearchEngineService",
113
+ "rpcName": str(client_call_details.method),
114
+ "response": grpc_response,
115
+ "metadata": grpc_response["metadata"],
116
+ },
117
+ )
118
+ return response
119
+
120
+
121
+ class SiteSearchEngineServiceGrpcAsyncIOTransport(SiteSearchEngineServiceTransport):
122
+ """gRPC AsyncIO backend transport for SiteSearchEngineService.
123
+
124
+ Service for managing site search related resources.
125
+
126
+ This class defines the same methods as the primary client, so the
127
+ primary client can load the underlying transport implementation
128
+ and call it.
129
+
130
+ It sends protocol buffers over the wire using gRPC (which is built on
131
+ top of HTTP/2); the ``grpcio`` package must be installed.
132
+ """
133
+
134
+ _grpc_channel: aio.Channel
135
+ _stubs: Dict[str, Callable] = {}
136
+
137
+ @classmethod
138
+ def create_channel(
139
+ cls,
140
+ host: str = "discoveryengine.googleapis.com",
141
+ credentials: Optional[ga_credentials.Credentials] = None,
142
+ credentials_file: Optional[str] = None,
143
+ scopes: Optional[Sequence[str]] = None,
144
+ quota_project_id: Optional[str] = None,
145
+ **kwargs,
146
+ ) -> aio.Channel:
147
+ """Create and return a gRPC AsyncIO channel object.
148
+ Args:
149
+ host (Optional[str]): The host for the channel to use.
150
+ credentials (Optional[~.Credentials]): The
151
+ authorization credentials to attach to requests. These
152
+ credentials identify this application to the service. If
153
+ none are specified, the client will attempt to ascertain
154
+ the credentials from the environment.
155
+ credentials_file (Optional[str]): A file with credentials that can
156
+ be loaded with :func:`google.auth.load_credentials_from_file`.
157
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
158
+ service. These are only used when credentials are not specified and
159
+ are passed to :func:`google.auth.default`.
160
+ quota_project_id (Optional[str]): An optional project to use for billing
161
+ and quota.
162
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
163
+ channel creation.
164
+ Returns:
165
+ aio.Channel: A gRPC AsyncIO channel object.
166
+ """
167
+
168
+ return grpc_helpers_async.create_channel(
169
+ host,
170
+ credentials=credentials,
171
+ credentials_file=credentials_file,
172
+ quota_project_id=quota_project_id,
173
+ default_scopes=cls.AUTH_SCOPES,
174
+ scopes=scopes,
175
+ default_host=cls.DEFAULT_HOST,
176
+ **kwargs,
177
+ )
178
+
179
+ def __init__(
180
+ self,
181
+ *,
182
+ host: str = "discoveryengine.googleapis.com",
183
+ credentials: Optional[ga_credentials.Credentials] = None,
184
+ credentials_file: Optional[str] = None,
185
+ scopes: Optional[Sequence[str]] = None,
186
+ channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
187
+ api_mtls_endpoint: Optional[str] = None,
188
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
189
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
190
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
191
+ quota_project_id: Optional[str] = None,
192
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
193
+ always_use_jwt_access: Optional[bool] = False,
194
+ api_audience: Optional[str] = None,
195
+ ) -> None:
196
+ """Instantiate the transport.
197
+
198
+ Args:
199
+ host (Optional[str]):
200
+ The hostname to connect to (default: 'discoveryengine.googleapis.com').
201
+ credentials (Optional[google.auth.credentials.Credentials]): The
202
+ authorization credentials to attach to requests. These
203
+ credentials identify the application to the service; if none
204
+ are specified, the client will attempt to ascertain the
205
+ credentials from the environment.
206
+ This argument is ignored if a ``channel`` instance is provided.
207
+ credentials_file (Optional[str]): A file with credentials that can
208
+ be loaded with :func:`google.auth.load_credentials_from_file`.
209
+ This argument is ignored if a ``channel`` instance is provided.
210
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
211
+ service. These are only used when credentials are not specified and
212
+ are passed to :func:`google.auth.default`.
213
+ channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
214
+ A ``Channel`` instance through which to make calls, or a Callable
215
+ that constructs and returns one. If set to None, ``self.create_channel``
216
+ is used to create the channel. If a Callable is given, it will be called
217
+ with the same arguments as used in ``self.create_channel``.
218
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
219
+ If provided, it overrides the ``host`` argument and tries to create
220
+ a mutual TLS channel with client SSL credentials from
221
+ ``client_cert_source`` or application default SSL credentials.
222
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
223
+ Deprecated. A callback to provide client SSL certificate bytes and
224
+ private key bytes, both in PEM format. It is ignored if
225
+ ``api_mtls_endpoint`` is None.
226
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
227
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
228
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
229
+ A callback to provide client certificate bytes and private key bytes,
230
+ both in PEM format. It is used to configure a mutual TLS channel. It is
231
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
232
+ quota_project_id (Optional[str]): An optional project to use for billing
233
+ and quota.
234
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
235
+ The client info used to send a user-agent string along with
236
+ API requests. If ``None``, then default info will be used.
237
+ Generally, you only need to set this if you're developing
238
+ your own client library.
239
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
240
+ be used for service account credentials.
241
+
242
+ Raises:
243
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
244
+ creation failed for any reason.
245
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
246
+ and ``credentials_file`` are passed.
247
+ """
248
+ self._grpc_channel = None
249
+ self._ssl_channel_credentials = ssl_channel_credentials
250
+ self._stubs: Dict[str, Callable] = {}
251
+ self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None
252
+
253
+ if api_mtls_endpoint:
254
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
255
+ if client_cert_source:
256
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
257
+
258
+ if isinstance(channel, aio.Channel):
259
+ # Ignore credentials if a channel was passed.
260
+ credentials = None
261
+ self._ignore_credentials = True
262
+ # If a channel was explicitly provided, set it.
263
+ self._grpc_channel = channel
264
+ self._ssl_channel_credentials = None
265
+ else:
266
+ if api_mtls_endpoint:
267
+ host = api_mtls_endpoint
268
+
269
+ # Create SSL credentials with client_cert_source or application
270
+ # default SSL credentials.
271
+ if client_cert_source:
272
+ cert, key = client_cert_source()
273
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
274
+ certificate_chain=cert, private_key=key
275
+ )
276
+ else:
277
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
278
+
279
+ else:
280
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
281
+ cert, key = client_cert_source_for_mtls()
282
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
283
+ certificate_chain=cert, private_key=key
284
+ )
285
+
286
+ # The base transport sets the host, credentials and scopes
287
+ super().__init__(
288
+ host=host,
289
+ credentials=credentials,
290
+ credentials_file=credentials_file,
291
+ scopes=scopes,
292
+ quota_project_id=quota_project_id,
293
+ client_info=client_info,
294
+ always_use_jwt_access=always_use_jwt_access,
295
+ api_audience=api_audience,
296
+ )
297
+
298
+ if not self._grpc_channel:
299
+ # initialize with the provided callable or the default channel
300
+ channel_init = channel or type(self).create_channel
301
+ self._grpc_channel = channel_init(
302
+ self._host,
303
+ # use the credentials which are saved
304
+ credentials=self._credentials,
305
+ # Set ``credentials_file`` to ``None`` here as
306
+ # the credentials that we saved earlier should be used.
307
+ credentials_file=None,
308
+ scopes=self._scopes,
309
+ ssl_credentials=self._ssl_channel_credentials,
310
+ quota_project_id=quota_project_id,
311
+ options=[
312
+ ("grpc.max_send_message_length", -1),
313
+ ("grpc.max_receive_message_length", -1),
314
+ ],
315
+ )
316
+
317
+ self._interceptor = _LoggingClientAIOInterceptor()
318
+ self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
319
+ self._logged_channel = self._grpc_channel
320
+ self._wrap_with_kind = (
321
+ "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
322
+ )
323
+ # Wrap messages. This must be done after self._logged_channel exists
324
+ self._prep_wrapped_messages(client_info)
325
+
326
+ @property
327
+ def grpc_channel(self) -> aio.Channel:
328
+ """Create the channel designed to connect to this service.
329
+
330
+ This property caches on the instance; repeated calls return
331
+ the same channel.
332
+ """
333
+ # Return the channel from cache.
334
+ return self._grpc_channel
335
+
336
+ @property
337
+ def operations_client(self) -> operations_v1.OperationsAsyncClient:
338
+ """Create the client designed to process long-running operations.
339
+
340
+ This property caches on the instance; repeated calls return the same
341
+ client.
342
+ """
343
+ # Quick check: Only create a new client if we do not already have one.
344
+ if self._operations_client is None:
345
+ self._operations_client = operations_v1.OperationsAsyncClient(
346
+ self._logged_channel
347
+ )
348
+
349
+ # Return the client from cache.
350
+ return self._operations_client
351
+
352
+ @property
353
+ def get_site_search_engine(
354
+ self,
355
+ ) -> Callable[
356
+ [site_search_engine_service.GetSiteSearchEngineRequest],
357
+ Awaitable[site_search_engine.SiteSearchEngine],
358
+ ]:
359
+ r"""Return a callable for the get site search engine method over gRPC.
360
+
361
+ Gets the
362
+ [SiteSearchEngine][google.cloud.discoveryengine.v1beta.SiteSearchEngine].
363
+
364
+ Returns:
365
+ Callable[[~.GetSiteSearchEngineRequest],
366
+ Awaitable[~.SiteSearchEngine]]:
367
+ A function that, when called, will call the underlying RPC
368
+ on the server.
369
+ """
370
+ # Generate a "stub function" on-the-fly which will actually make
371
+ # the request.
372
+ # gRPC handles serialization and deserialization, so we just need
373
+ # to pass in the functions for each.
374
+ if "get_site_search_engine" not in self._stubs:
375
+ self._stubs["get_site_search_engine"] = self._logged_channel.unary_unary(
376
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/GetSiteSearchEngine",
377
+ request_serializer=site_search_engine_service.GetSiteSearchEngineRequest.serialize,
378
+ response_deserializer=site_search_engine.SiteSearchEngine.deserialize,
379
+ )
380
+ return self._stubs["get_site_search_engine"]
381
+
382
+ @property
383
+ def create_target_site(
384
+ self,
385
+ ) -> Callable[
386
+ [site_search_engine_service.CreateTargetSiteRequest],
387
+ Awaitable[operations_pb2.Operation],
388
+ ]:
389
+ r"""Return a callable for the create target site method over gRPC.
390
+
391
+ Creates a
392
+ [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite].
393
+
394
+ Returns:
395
+ Callable[[~.CreateTargetSiteRequest],
396
+ Awaitable[~.Operation]]:
397
+ A function that, when called, will call the underlying RPC
398
+ on the server.
399
+ """
400
+ # Generate a "stub function" on-the-fly which will actually make
401
+ # the request.
402
+ # gRPC handles serialization and deserialization, so we just need
403
+ # to pass in the functions for each.
404
+ if "create_target_site" not in self._stubs:
405
+ self._stubs["create_target_site"] = self._logged_channel.unary_unary(
406
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/CreateTargetSite",
407
+ request_serializer=site_search_engine_service.CreateTargetSiteRequest.serialize,
408
+ response_deserializer=operations_pb2.Operation.FromString,
409
+ )
410
+ return self._stubs["create_target_site"]
411
+
412
+ @property
413
+ def batch_create_target_sites(
414
+ self,
415
+ ) -> Callable[
416
+ [site_search_engine_service.BatchCreateTargetSitesRequest],
417
+ Awaitable[operations_pb2.Operation],
418
+ ]:
419
+ r"""Return a callable for the batch create target sites method over gRPC.
420
+
421
+ Creates
422
+ [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite] in
423
+ a batch.
424
+
425
+ Returns:
426
+ Callable[[~.BatchCreateTargetSitesRequest],
427
+ Awaitable[~.Operation]]:
428
+ A function that, when called, will call the underlying RPC
429
+ on the server.
430
+ """
431
+ # Generate a "stub function" on-the-fly which will actually make
432
+ # the request.
433
+ # gRPC handles serialization and deserialization, so we just need
434
+ # to pass in the functions for each.
435
+ if "batch_create_target_sites" not in self._stubs:
436
+ self._stubs["batch_create_target_sites"] = self._logged_channel.unary_unary(
437
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/BatchCreateTargetSites",
438
+ request_serializer=site_search_engine_service.BatchCreateTargetSitesRequest.serialize,
439
+ response_deserializer=operations_pb2.Operation.FromString,
440
+ )
441
+ return self._stubs["batch_create_target_sites"]
442
+
443
+ @property
444
+ def get_target_site(
445
+ self,
446
+ ) -> Callable[
447
+ [site_search_engine_service.GetTargetSiteRequest],
448
+ Awaitable[site_search_engine.TargetSite],
449
+ ]:
450
+ r"""Return a callable for the get target site method over gRPC.
451
+
452
+ Gets a
453
+ [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite].
454
+
455
+ Returns:
456
+ Callable[[~.GetTargetSiteRequest],
457
+ Awaitable[~.TargetSite]]:
458
+ A function that, when called, will call the underlying RPC
459
+ on the server.
460
+ """
461
+ # Generate a "stub function" on-the-fly which will actually make
462
+ # the request.
463
+ # gRPC handles serialization and deserialization, so we just need
464
+ # to pass in the functions for each.
465
+ if "get_target_site" not in self._stubs:
466
+ self._stubs["get_target_site"] = self._logged_channel.unary_unary(
467
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/GetTargetSite",
468
+ request_serializer=site_search_engine_service.GetTargetSiteRequest.serialize,
469
+ response_deserializer=site_search_engine.TargetSite.deserialize,
470
+ )
471
+ return self._stubs["get_target_site"]
472
+
473
+ @property
474
+ def update_target_site(
475
+ self,
476
+ ) -> Callable[
477
+ [site_search_engine_service.UpdateTargetSiteRequest],
478
+ Awaitable[operations_pb2.Operation],
479
+ ]:
480
+ r"""Return a callable for the update target site method over gRPC.
481
+
482
+ Updates a
483
+ [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite].
484
+
485
+ Returns:
486
+ Callable[[~.UpdateTargetSiteRequest],
487
+ Awaitable[~.Operation]]:
488
+ A function that, when called, will call the underlying RPC
489
+ on the server.
490
+ """
491
+ # Generate a "stub function" on-the-fly which will actually make
492
+ # the request.
493
+ # gRPC handles serialization and deserialization, so we just need
494
+ # to pass in the functions for each.
495
+ if "update_target_site" not in self._stubs:
496
+ self._stubs["update_target_site"] = self._logged_channel.unary_unary(
497
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/UpdateTargetSite",
498
+ request_serializer=site_search_engine_service.UpdateTargetSiteRequest.serialize,
499
+ response_deserializer=operations_pb2.Operation.FromString,
500
+ )
501
+ return self._stubs["update_target_site"]
502
+
503
+ @property
504
+ def delete_target_site(
505
+ self,
506
+ ) -> Callable[
507
+ [site_search_engine_service.DeleteTargetSiteRequest],
508
+ Awaitable[operations_pb2.Operation],
509
+ ]:
510
+ r"""Return a callable for the delete target site method over gRPC.
511
+
512
+ Deletes a
513
+ [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite].
514
+
515
+ Returns:
516
+ Callable[[~.DeleteTargetSiteRequest],
517
+ Awaitable[~.Operation]]:
518
+ A function that, when called, will call the underlying RPC
519
+ on the server.
520
+ """
521
+ # Generate a "stub function" on-the-fly which will actually make
522
+ # the request.
523
+ # gRPC handles serialization and deserialization, so we just need
524
+ # to pass in the functions for each.
525
+ if "delete_target_site" not in self._stubs:
526
+ self._stubs["delete_target_site"] = self._logged_channel.unary_unary(
527
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/DeleteTargetSite",
528
+ request_serializer=site_search_engine_service.DeleteTargetSiteRequest.serialize,
529
+ response_deserializer=operations_pb2.Operation.FromString,
530
+ )
531
+ return self._stubs["delete_target_site"]
532
+
533
+ @property
534
+ def list_target_sites(
535
+ self,
536
+ ) -> Callable[
537
+ [site_search_engine_service.ListTargetSitesRequest],
538
+ Awaitable[site_search_engine_service.ListTargetSitesResponse],
539
+ ]:
540
+ r"""Return a callable for the list target sites method over gRPC.
541
+
542
+ Gets a list of
543
+ [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite]s.
544
+
545
+ Returns:
546
+ Callable[[~.ListTargetSitesRequest],
547
+ Awaitable[~.ListTargetSitesResponse]]:
548
+ A function that, when called, will call the underlying RPC
549
+ on the server.
550
+ """
551
+ # Generate a "stub function" on-the-fly which will actually make
552
+ # the request.
553
+ # gRPC handles serialization and deserialization, so we just need
554
+ # to pass in the functions for each.
555
+ if "list_target_sites" not in self._stubs:
556
+ self._stubs["list_target_sites"] = self._logged_channel.unary_unary(
557
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/ListTargetSites",
558
+ request_serializer=site_search_engine_service.ListTargetSitesRequest.serialize,
559
+ response_deserializer=site_search_engine_service.ListTargetSitesResponse.deserialize,
560
+ )
561
+ return self._stubs["list_target_sites"]
562
+
563
+ @property
564
+ def create_sitemap(
565
+ self,
566
+ ) -> Callable[
567
+ [site_search_engine_service.CreateSitemapRequest],
568
+ Awaitable[operations_pb2.Operation],
569
+ ]:
570
+ r"""Return a callable for the create sitemap method over gRPC.
571
+
572
+ Creates a
573
+ [Sitemap][google.cloud.discoveryengine.v1beta.Sitemap].
574
+
575
+ Returns:
576
+ Callable[[~.CreateSitemapRequest],
577
+ Awaitable[~.Operation]]:
578
+ A function that, when called, will call the underlying RPC
579
+ on the server.
580
+ """
581
+ # Generate a "stub function" on-the-fly which will actually make
582
+ # the request.
583
+ # gRPC handles serialization and deserialization, so we just need
584
+ # to pass in the functions for each.
585
+ if "create_sitemap" not in self._stubs:
586
+ self._stubs["create_sitemap"] = self._logged_channel.unary_unary(
587
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/CreateSitemap",
588
+ request_serializer=site_search_engine_service.CreateSitemapRequest.serialize,
589
+ response_deserializer=operations_pb2.Operation.FromString,
590
+ )
591
+ return self._stubs["create_sitemap"]
592
+
593
+ @property
594
+ def delete_sitemap(
595
+ self,
596
+ ) -> Callable[
597
+ [site_search_engine_service.DeleteSitemapRequest],
598
+ Awaitable[operations_pb2.Operation],
599
+ ]:
600
+ r"""Return a callable for the delete sitemap method over gRPC.
601
+
602
+ Deletes a
603
+ [Sitemap][google.cloud.discoveryengine.v1beta.Sitemap].
604
+
605
+ Returns:
606
+ Callable[[~.DeleteSitemapRequest],
607
+ Awaitable[~.Operation]]:
608
+ A function that, when called, will call the underlying RPC
609
+ on the server.
610
+ """
611
+ # Generate a "stub function" on-the-fly which will actually make
612
+ # the request.
613
+ # gRPC handles serialization and deserialization, so we just need
614
+ # to pass in the functions for each.
615
+ if "delete_sitemap" not in self._stubs:
616
+ self._stubs["delete_sitemap"] = self._logged_channel.unary_unary(
617
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/DeleteSitemap",
618
+ request_serializer=site_search_engine_service.DeleteSitemapRequest.serialize,
619
+ response_deserializer=operations_pb2.Operation.FromString,
620
+ )
621
+ return self._stubs["delete_sitemap"]
622
+
623
+ @property
624
+ def fetch_sitemaps(
625
+ self,
626
+ ) -> Callable[
627
+ [site_search_engine_service.FetchSitemapsRequest],
628
+ Awaitable[site_search_engine_service.FetchSitemapsResponse],
629
+ ]:
630
+ r"""Return a callable for the fetch sitemaps method over gRPC.
631
+
632
+ Fetch [Sitemap][google.cloud.discoveryengine.v1beta.Sitemap]s in
633
+ a [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
634
+
635
+ Returns:
636
+ Callable[[~.FetchSitemapsRequest],
637
+ Awaitable[~.FetchSitemapsResponse]]:
638
+ A function that, when called, will call the underlying RPC
639
+ on the server.
640
+ """
641
+ # Generate a "stub function" on-the-fly which will actually make
642
+ # the request.
643
+ # gRPC handles serialization and deserialization, so we just need
644
+ # to pass in the functions for each.
645
+ if "fetch_sitemaps" not in self._stubs:
646
+ self._stubs["fetch_sitemaps"] = self._logged_channel.unary_unary(
647
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/FetchSitemaps",
648
+ request_serializer=site_search_engine_service.FetchSitemapsRequest.serialize,
649
+ response_deserializer=site_search_engine_service.FetchSitemapsResponse.deserialize,
650
+ )
651
+ return self._stubs["fetch_sitemaps"]
652
+
653
+ @property
654
+ def enable_advanced_site_search(
655
+ self,
656
+ ) -> Callable[
657
+ [site_search_engine_service.EnableAdvancedSiteSearchRequest],
658
+ Awaitable[operations_pb2.Operation],
659
+ ]:
660
+ r"""Return a callable for the enable advanced site search method over gRPC.
661
+
662
+ Upgrade from basic site search to advanced site
663
+ search.
664
+
665
+ Returns:
666
+ Callable[[~.EnableAdvancedSiteSearchRequest],
667
+ Awaitable[~.Operation]]:
668
+ A function that, when called, will call the underlying RPC
669
+ on the server.
670
+ """
671
+ # Generate a "stub function" on-the-fly which will actually make
672
+ # the request.
673
+ # gRPC handles serialization and deserialization, so we just need
674
+ # to pass in the functions for each.
675
+ if "enable_advanced_site_search" not in self._stubs:
676
+ self._stubs[
677
+ "enable_advanced_site_search"
678
+ ] = self._logged_channel.unary_unary(
679
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/EnableAdvancedSiteSearch",
680
+ request_serializer=site_search_engine_service.EnableAdvancedSiteSearchRequest.serialize,
681
+ response_deserializer=operations_pb2.Operation.FromString,
682
+ )
683
+ return self._stubs["enable_advanced_site_search"]
684
+
685
+ @property
686
+ def disable_advanced_site_search(
687
+ self,
688
+ ) -> Callable[
689
+ [site_search_engine_service.DisableAdvancedSiteSearchRequest],
690
+ Awaitable[operations_pb2.Operation],
691
+ ]:
692
+ r"""Return a callable for the disable advanced site search method over gRPC.
693
+
694
+ Downgrade from advanced site search to basic site
695
+ search.
696
+
697
+ Returns:
698
+ Callable[[~.DisableAdvancedSiteSearchRequest],
699
+ Awaitable[~.Operation]]:
700
+ A function that, when called, will call the underlying RPC
701
+ on the server.
702
+ """
703
+ # Generate a "stub function" on-the-fly which will actually make
704
+ # the request.
705
+ # gRPC handles serialization and deserialization, so we just need
706
+ # to pass in the functions for each.
707
+ if "disable_advanced_site_search" not in self._stubs:
708
+ self._stubs[
709
+ "disable_advanced_site_search"
710
+ ] = self._logged_channel.unary_unary(
711
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/DisableAdvancedSiteSearch",
712
+ request_serializer=site_search_engine_service.DisableAdvancedSiteSearchRequest.serialize,
713
+ response_deserializer=operations_pb2.Operation.FromString,
714
+ )
715
+ return self._stubs["disable_advanced_site_search"]
716
+
717
+ @property
718
+ def recrawl_uris(
719
+ self,
720
+ ) -> Callable[
721
+ [site_search_engine_service.RecrawlUrisRequest],
722
+ Awaitable[operations_pb2.Operation],
723
+ ]:
724
+ r"""Return a callable for the recrawl uris method over gRPC.
725
+
726
+ Request on-demand recrawl for a list of URIs.
727
+
728
+ Returns:
729
+ Callable[[~.RecrawlUrisRequest],
730
+ Awaitable[~.Operation]]:
731
+ A function that, when called, will call the underlying RPC
732
+ on the server.
733
+ """
734
+ # Generate a "stub function" on-the-fly which will actually make
735
+ # the request.
736
+ # gRPC handles serialization and deserialization, so we just need
737
+ # to pass in the functions for each.
738
+ if "recrawl_uris" not in self._stubs:
739
+ self._stubs["recrawl_uris"] = self._logged_channel.unary_unary(
740
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/RecrawlUris",
741
+ request_serializer=site_search_engine_service.RecrawlUrisRequest.serialize,
742
+ response_deserializer=operations_pb2.Operation.FromString,
743
+ )
744
+ return self._stubs["recrawl_uris"]
745
+
746
+ @property
747
+ def batch_verify_target_sites(
748
+ self,
749
+ ) -> Callable[
750
+ [site_search_engine_service.BatchVerifyTargetSitesRequest],
751
+ Awaitable[operations_pb2.Operation],
752
+ ]:
753
+ r"""Return a callable for the batch verify target sites method over gRPC.
754
+
755
+ Verify target sites' ownership and validity.
756
+ This API sends all the target sites under site search
757
+ engine for verification.
758
+
759
+ Returns:
760
+ Callable[[~.BatchVerifyTargetSitesRequest],
761
+ Awaitable[~.Operation]]:
762
+ A function that, when called, will call the underlying RPC
763
+ on the server.
764
+ """
765
+ # Generate a "stub function" on-the-fly which will actually make
766
+ # the request.
767
+ # gRPC handles serialization and deserialization, so we just need
768
+ # to pass in the functions for each.
769
+ if "batch_verify_target_sites" not in self._stubs:
770
+ self._stubs["batch_verify_target_sites"] = self._logged_channel.unary_unary(
771
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/BatchVerifyTargetSites",
772
+ request_serializer=site_search_engine_service.BatchVerifyTargetSitesRequest.serialize,
773
+ response_deserializer=operations_pb2.Operation.FromString,
774
+ )
775
+ return self._stubs["batch_verify_target_sites"]
776
+
777
+ @property
778
+ def fetch_domain_verification_status(
779
+ self,
780
+ ) -> Callable[
781
+ [site_search_engine_service.FetchDomainVerificationStatusRequest],
782
+ Awaitable[site_search_engine_service.FetchDomainVerificationStatusResponse],
783
+ ]:
784
+ r"""Return a callable for the fetch domain verification
785
+ status method over gRPC.
786
+
787
+ Returns list of target sites with its domain verification
788
+ status. This method can only be called under data store with
789
+ BASIC_SITE_SEARCH state at the moment.
790
+
791
+ Returns:
792
+ Callable[[~.FetchDomainVerificationStatusRequest],
793
+ Awaitable[~.FetchDomainVerificationStatusResponse]]:
794
+ A function that, when called, will call the underlying RPC
795
+ on the server.
796
+ """
797
+ # Generate a "stub function" on-the-fly which will actually make
798
+ # the request.
799
+ # gRPC handles serialization and deserialization, so we just need
800
+ # to pass in the functions for each.
801
+ if "fetch_domain_verification_status" not in self._stubs:
802
+ self._stubs[
803
+ "fetch_domain_verification_status"
804
+ ] = self._logged_channel.unary_unary(
805
+ "/google.cloud.discoveryengine.v1beta.SiteSearchEngineService/FetchDomainVerificationStatus",
806
+ request_serializer=site_search_engine_service.FetchDomainVerificationStatusRequest.serialize,
807
+ response_deserializer=site_search_engine_service.FetchDomainVerificationStatusResponse.deserialize,
808
+ )
809
+ return self._stubs["fetch_domain_verification_status"]
810
+
811
+ def _prep_wrapped_messages(self, client_info):
812
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
813
+ self._wrapped_methods = {
814
+ self.get_site_search_engine: self._wrap_method(
815
+ self.get_site_search_engine,
816
+ default_timeout=None,
817
+ client_info=client_info,
818
+ ),
819
+ self.create_target_site: self._wrap_method(
820
+ self.create_target_site,
821
+ default_timeout=None,
822
+ client_info=client_info,
823
+ ),
824
+ self.batch_create_target_sites: self._wrap_method(
825
+ self.batch_create_target_sites,
826
+ default_timeout=None,
827
+ client_info=client_info,
828
+ ),
829
+ self.get_target_site: self._wrap_method(
830
+ self.get_target_site,
831
+ default_timeout=None,
832
+ client_info=client_info,
833
+ ),
834
+ self.update_target_site: self._wrap_method(
835
+ self.update_target_site,
836
+ default_timeout=None,
837
+ client_info=client_info,
838
+ ),
839
+ self.delete_target_site: self._wrap_method(
840
+ self.delete_target_site,
841
+ default_timeout=None,
842
+ client_info=client_info,
843
+ ),
844
+ self.list_target_sites: self._wrap_method(
845
+ self.list_target_sites,
846
+ default_timeout=None,
847
+ client_info=client_info,
848
+ ),
849
+ self.create_sitemap: self._wrap_method(
850
+ self.create_sitemap,
851
+ default_timeout=None,
852
+ client_info=client_info,
853
+ ),
854
+ self.delete_sitemap: self._wrap_method(
855
+ self.delete_sitemap,
856
+ default_timeout=None,
857
+ client_info=client_info,
858
+ ),
859
+ self.fetch_sitemaps: self._wrap_method(
860
+ self.fetch_sitemaps,
861
+ default_timeout=None,
862
+ client_info=client_info,
863
+ ),
864
+ self.enable_advanced_site_search: self._wrap_method(
865
+ self.enable_advanced_site_search,
866
+ default_timeout=None,
867
+ client_info=client_info,
868
+ ),
869
+ self.disable_advanced_site_search: self._wrap_method(
870
+ self.disable_advanced_site_search,
871
+ default_timeout=None,
872
+ client_info=client_info,
873
+ ),
874
+ self.recrawl_uris: self._wrap_method(
875
+ self.recrawl_uris,
876
+ default_timeout=None,
877
+ client_info=client_info,
878
+ ),
879
+ self.batch_verify_target_sites: self._wrap_method(
880
+ self.batch_verify_target_sites,
881
+ default_timeout=None,
882
+ client_info=client_info,
883
+ ),
884
+ self.fetch_domain_verification_status: self._wrap_method(
885
+ self.fetch_domain_verification_status,
886
+ default_timeout=None,
887
+ client_info=client_info,
888
+ ),
889
+ self.cancel_operation: self._wrap_method(
890
+ self.cancel_operation,
891
+ default_timeout=None,
892
+ client_info=client_info,
893
+ ),
894
+ self.get_operation: self._wrap_method(
895
+ self.get_operation,
896
+ default_timeout=None,
897
+ client_info=client_info,
898
+ ),
899
+ self.list_operations: self._wrap_method(
900
+ self.list_operations,
901
+ default_timeout=None,
902
+ client_info=client_info,
903
+ ),
904
+ }
905
+
906
+ def _wrap_method(self, func, *args, **kwargs):
907
+ if self._wrap_with_kind: # pragma: NO COVER
908
+ kwargs["kind"] = self.kind
909
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
910
+
911
+ def close(self):
912
+ return self._logged_channel.close()
913
+
914
+ @property
915
+ def kind(self) -> str:
916
+ return "grpc_asyncio"
917
+
918
+ @property
919
+ def cancel_operation(
920
+ self,
921
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
922
+ r"""Return a callable for the cancel_operation method over gRPC."""
923
+ # Generate a "stub function" on-the-fly which will actually make
924
+ # the request.
925
+ # gRPC handles serialization and deserialization, so we just need
926
+ # to pass in the functions for each.
927
+ if "cancel_operation" not in self._stubs:
928
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
929
+ "/google.longrunning.Operations/CancelOperation",
930
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
931
+ response_deserializer=None,
932
+ )
933
+ return self._stubs["cancel_operation"]
934
+
935
+ @property
936
+ def get_operation(
937
+ self,
938
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
939
+ r"""Return a callable for the get_operation method over gRPC."""
940
+ # Generate a "stub function" on-the-fly which will actually make
941
+ # the request.
942
+ # gRPC handles serialization and deserialization, so we just need
943
+ # to pass in the functions for each.
944
+ if "get_operation" not in self._stubs:
945
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
946
+ "/google.longrunning.Operations/GetOperation",
947
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
948
+ response_deserializer=operations_pb2.Operation.FromString,
949
+ )
950
+ return self._stubs["get_operation"]
951
+
952
+ @property
953
+ def list_operations(
954
+ self,
955
+ ) -> Callable[
956
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
957
+ ]:
958
+ r"""Return a callable for the list_operations method over gRPC."""
959
+ # Generate a "stub function" on-the-fly which will actually make
960
+ # the request.
961
+ # gRPC handles serialization and deserialization, so we just need
962
+ # to pass in the functions for each.
963
+ if "list_operations" not in self._stubs:
964
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
965
+ "/google.longrunning.Operations/ListOperations",
966
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
967
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
968
+ )
969
+ return self._stubs["list_operations"]
970
+
971
+
972
+ __all__ = ("SiteSearchEngineServiceGrpcAsyncIOTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/transports/rest.py ADDED
The diff for this file is too large to render. See raw diff
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/site_search_engine_service/transports/rest_base.py ADDED
@@ -0,0 +1,1148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import json # type: ignore
17
+ import re
18
+ from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
19
+
20
+ from google.api_core import gapic_v1, path_template
21
+ from google.cloud.location import locations_pb2 # type: ignore
22
+ from google.longrunning import operations_pb2 # type: ignore
23
+ from google.protobuf import json_format
24
+
25
+ from google.cloud.discoveryengine_v1beta.types import (
26
+ site_search_engine,
27
+ site_search_engine_service,
28
+ )
29
+
30
+ from .base import DEFAULT_CLIENT_INFO, SiteSearchEngineServiceTransport
31
+
32
+
33
+ class _BaseSiteSearchEngineServiceRestTransport(SiteSearchEngineServiceTransport):
34
+ """Base REST backend transport for SiteSearchEngineService.
35
+
36
+ Note: This class is not meant to be used directly. Use its sync and
37
+ async sub-classes instead.
38
+
39
+ This class defines the same methods as the primary client, so the
40
+ primary client can load the underlying transport implementation
41
+ and call it.
42
+
43
+ It sends JSON representations of protocol buffers over HTTP/1.1
44
+ """
45
+
46
+ def __init__(
47
+ self,
48
+ *,
49
+ host: str = "discoveryengine.googleapis.com",
50
+ credentials: Optional[Any] = None,
51
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
52
+ always_use_jwt_access: Optional[bool] = False,
53
+ url_scheme: str = "https",
54
+ api_audience: Optional[str] = None,
55
+ ) -> None:
56
+ """Instantiate the transport.
57
+ Args:
58
+ host (Optional[str]):
59
+ The hostname to connect to (default: 'discoveryengine.googleapis.com').
60
+ credentials (Optional[Any]): The
61
+ authorization credentials to attach to requests. These
62
+ credentials identify the application to the service; if none
63
+ are specified, the client will attempt to ascertain the
64
+ credentials from the environment.
65
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
66
+ The client info used to send a user-agent string along with
67
+ API requests. If ``None``, then default info will be used.
68
+ Generally, you only need to set this if you are developing
69
+ your own client library.
70
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
71
+ be used for service account credentials.
72
+ url_scheme: the protocol scheme for the API endpoint. Normally
73
+ "https", but for testing or local servers,
74
+ "http" can be specified.
75
+ """
76
+ # Run the base constructor
77
+ maybe_url_match = re.match("^(?P<scheme>http(?:s)?://)?(?P<host>.*)$", host)
78
+ if maybe_url_match is None:
79
+ raise ValueError(
80
+ f"Unexpected hostname structure: {host}"
81
+ ) # pragma: NO COVER
82
+
83
+ url_match_items = maybe_url_match.groupdict()
84
+
85
+ host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host
86
+
87
+ super().__init__(
88
+ host=host,
89
+ credentials=credentials,
90
+ client_info=client_info,
91
+ always_use_jwt_access=always_use_jwt_access,
92
+ api_audience=api_audience,
93
+ )
94
+
95
+ class _BaseBatchCreateTargetSites:
96
+ def __hash__(self): # pragma: NO COVER
97
+ return NotImplementedError("__hash__ must be implemented.")
98
+
99
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
100
+
101
+ @classmethod
102
+ def _get_unset_required_fields(cls, message_dict):
103
+ return {
104
+ k: v
105
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
106
+ if k not in message_dict
107
+ }
108
+
109
+ @staticmethod
110
+ def _get_http_options():
111
+ http_options: List[Dict[str, str]] = [
112
+ {
113
+ "method": "post",
114
+ "uri": "/v1beta/{parent=projects/*/locations/*/dataStores/*/siteSearchEngine}/targetSites:batchCreate",
115
+ "body": "*",
116
+ },
117
+ {
118
+ "method": "post",
119
+ "uri": "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/targetSites:batchCreate",
120
+ "body": "*",
121
+ },
122
+ ]
123
+ return http_options
124
+
125
+ @staticmethod
126
+ def _get_transcoded_request(http_options, request):
127
+ pb_request = site_search_engine_service.BatchCreateTargetSitesRequest.pb(
128
+ request
129
+ )
130
+ transcoded_request = path_template.transcode(http_options, pb_request)
131
+ return transcoded_request
132
+
133
+ @staticmethod
134
+ def _get_request_body_json(transcoded_request):
135
+ # Jsonify the request body
136
+
137
+ body = json_format.MessageToJson(
138
+ transcoded_request["body"], use_integers_for_enums=True
139
+ )
140
+ return body
141
+
142
+ @staticmethod
143
+ def _get_query_params_json(transcoded_request):
144
+ query_params = json.loads(
145
+ json_format.MessageToJson(
146
+ transcoded_request["query_params"],
147
+ use_integers_for_enums=True,
148
+ )
149
+ )
150
+ query_params.update(
151
+ _BaseSiteSearchEngineServiceRestTransport._BaseBatchCreateTargetSites._get_unset_required_fields(
152
+ query_params
153
+ )
154
+ )
155
+
156
+ query_params["$alt"] = "json;enum-encoding=int"
157
+ return query_params
158
+
159
+ class _BaseBatchVerifyTargetSites:
160
+ def __hash__(self): # pragma: NO COVER
161
+ return NotImplementedError("__hash__ must be implemented.")
162
+
163
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
164
+
165
+ @classmethod
166
+ def _get_unset_required_fields(cls, message_dict):
167
+ return {
168
+ k: v
169
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
170
+ if k not in message_dict
171
+ }
172
+
173
+ @staticmethod
174
+ def _get_http_options():
175
+ http_options: List[Dict[str, str]] = [
176
+ {
177
+ "method": "post",
178
+ "uri": "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:batchVerifyTargetSites",
179
+ "body": "*",
180
+ },
181
+ ]
182
+ return http_options
183
+
184
+ @staticmethod
185
+ def _get_transcoded_request(http_options, request):
186
+ pb_request = site_search_engine_service.BatchVerifyTargetSitesRequest.pb(
187
+ request
188
+ )
189
+ transcoded_request = path_template.transcode(http_options, pb_request)
190
+ return transcoded_request
191
+
192
+ @staticmethod
193
+ def _get_request_body_json(transcoded_request):
194
+ # Jsonify the request body
195
+
196
+ body = json_format.MessageToJson(
197
+ transcoded_request["body"], use_integers_for_enums=True
198
+ )
199
+ return body
200
+
201
+ @staticmethod
202
+ def _get_query_params_json(transcoded_request):
203
+ query_params = json.loads(
204
+ json_format.MessageToJson(
205
+ transcoded_request["query_params"],
206
+ use_integers_for_enums=True,
207
+ )
208
+ )
209
+ query_params.update(
210
+ _BaseSiteSearchEngineServiceRestTransport._BaseBatchVerifyTargetSites._get_unset_required_fields(
211
+ query_params
212
+ )
213
+ )
214
+
215
+ query_params["$alt"] = "json;enum-encoding=int"
216
+ return query_params
217
+
218
+ class _BaseCreateSitemap:
219
+ def __hash__(self): # pragma: NO COVER
220
+ return NotImplementedError("__hash__ must be implemented.")
221
+
222
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
223
+
224
+ @classmethod
225
+ def _get_unset_required_fields(cls, message_dict):
226
+ return {
227
+ k: v
228
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
229
+ if k not in message_dict
230
+ }
231
+
232
+ @staticmethod
233
+ def _get_http_options():
234
+ http_options: List[Dict[str, str]] = [
235
+ {
236
+ "method": "post",
237
+ "uri": "/v1beta/{parent=projects/*/locations/*/dataStores/*/siteSearchEngine}/sitemaps",
238
+ "body": "sitemap",
239
+ },
240
+ {
241
+ "method": "post",
242
+ "uri": "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/sitemaps",
243
+ "body": "sitemap",
244
+ },
245
+ ]
246
+ return http_options
247
+
248
+ @staticmethod
249
+ def _get_transcoded_request(http_options, request):
250
+ pb_request = site_search_engine_service.CreateSitemapRequest.pb(request)
251
+ transcoded_request = path_template.transcode(http_options, pb_request)
252
+ return transcoded_request
253
+
254
+ @staticmethod
255
+ def _get_request_body_json(transcoded_request):
256
+ # Jsonify the request body
257
+
258
+ body = json_format.MessageToJson(
259
+ transcoded_request["body"], use_integers_for_enums=True
260
+ )
261
+ return body
262
+
263
+ @staticmethod
264
+ def _get_query_params_json(transcoded_request):
265
+ query_params = json.loads(
266
+ json_format.MessageToJson(
267
+ transcoded_request["query_params"],
268
+ use_integers_for_enums=True,
269
+ )
270
+ )
271
+ query_params.update(
272
+ _BaseSiteSearchEngineServiceRestTransport._BaseCreateSitemap._get_unset_required_fields(
273
+ query_params
274
+ )
275
+ )
276
+
277
+ query_params["$alt"] = "json;enum-encoding=int"
278
+ return query_params
279
+
280
+ class _BaseCreateTargetSite:
281
+ def __hash__(self): # pragma: NO COVER
282
+ return NotImplementedError("__hash__ must be implemented.")
283
+
284
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
285
+
286
+ @classmethod
287
+ def _get_unset_required_fields(cls, message_dict):
288
+ return {
289
+ k: v
290
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
291
+ if k not in message_dict
292
+ }
293
+
294
+ @staticmethod
295
+ def _get_http_options():
296
+ http_options: List[Dict[str, str]] = [
297
+ {
298
+ "method": "post",
299
+ "uri": "/v1beta/{parent=projects/*/locations/*/dataStores/*/siteSearchEngine}/targetSites",
300
+ "body": "target_site",
301
+ },
302
+ {
303
+ "method": "post",
304
+ "uri": "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/targetSites",
305
+ "body": "target_site",
306
+ },
307
+ ]
308
+ return http_options
309
+
310
+ @staticmethod
311
+ def _get_transcoded_request(http_options, request):
312
+ pb_request = site_search_engine_service.CreateTargetSiteRequest.pb(request)
313
+ transcoded_request = path_template.transcode(http_options, pb_request)
314
+ return transcoded_request
315
+
316
+ @staticmethod
317
+ def _get_request_body_json(transcoded_request):
318
+ # Jsonify the request body
319
+
320
+ body = json_format.MessageToJson(
321
+ transcoded_request["body"], use_integers_for_enums=True
322
+ )
323
+ return body
324
+
325
+ @staticmethod
326
+ def _get_query_params_json(transcoded_request):
327
+ query_params = json.loads(
328
+ json_format.MessageToJson(
329
+ transcoded_request["query_params"],
330
+ use_integers_for_enums=True,
331
+ )
332
+ )
333
+ query_params.update(
334
+ _BaseSiteSearchEngineServiceRestTransport._BaseCreateTargetSite._get_unset_required_fields(
335
+ query_params
336
+ )
337
+ )
338
+
339
+ query_params["$alt"] = "json;enum-encoding=int"
340
+ return query_params
341
+
342
+ class _BaseDeleteSitemap:
343
+ def __hash__(self): # pragma: NO COVER
344
+ return NotImplementedError("__hash__ must be implemented.")
345
+
346
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
347
+
348
+ @classmethod
349
+ def _get_unset_required_fields(cls, message_dict):
350
+ return {
351
+ k: v
352
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
353
+ if k not in message_dict
354
+ }
355
+
356
+ @staticmethod
357
+ def _get_http_options():
358
+ http_options: List[Dict[str, str]] = [
359
+ {
360
+ "method": "delete",
361
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/siteSearchEngine/sitemaps/*}",
362
+ },
363
+ {
364
+ "method": "delete",
365
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/sitemaps/*}",
366
+ },
367
+ ]
368
+ return http_options
369
+
370
+ @staticmethod
371
+ def _get_transcoded_request(http_options, request):
372
+ pb_request = site_search_engine_service.DeleteSitemapRequest.pb(request)
373
+ transcoded_request = path_template.transcode(http_options, pb_request)
374
+ return transcoded_request
375
+
376
+ @staticmethod
377
+ def _get_query_params_json(transcoded_request):
378
+ query_params = json.loads(
379
+ json_format.MessageToJson(
380
+ transcoded_request["query_params"],
381
+ use_integers_for_enums=True,
382
+ )
383
+ )
384
+ query_params.update(
385
+ _BaseSiteSearchEngineServiceRestTransport._BaseDeleteSitemap._get_unset_required_fields(
386
+ query_params
387
+ )
388
+ )
389
+
390
+ query_params["$alt"] = "json;enum-encoding=int"
391
+ return query_params
392
+
393
+ class _BaseDeleteTargetSite:
394
+ def __hash__(self): # pragma: NO COVER
395
+ return NotImplementedError("__hash__ must be implemented.")
396
+
397
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
398
+
399
+ @classmethod
400
+ def _get_unset_required_fields(cls, message_dict):
401
+ return {
402
+ k: v
403
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
404
+ if k not in message_dict
405
+ }
406
+
407
+ @staticmethod
408
+ def _get_http_options():
409
+ http_options: List[Dict[str, str]] = [
410
+ {
411
+ "method": "delete",
412
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/siteSearchEngine/targetSites/*}",
413
+ },
414
+ {
415
+ "method": "delete",
416
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/*}",
417
+ },
418
+ ]
419
+ return http_options
420
+
421
+ @staticmethod
422
+ def _get_transcoded_request(http_options, request):
423
+ pb_request = site_search_engine_service.DeleteTargetSiteRequest.pb(request)
424
+ transcoded_request = path_template.transcode(http_options, pb_request)
425
+ return transcoded_request
426
+
427
+ @staticmethod
428
+ def _get_query_params_json(transcoded_request):
429
+ query_params = json.loads(
430
+ json_format.MessageToJson(
431
+ transcoded_request["query_params"],
432
+ use_integers_for_enums=True,
433
+ )
434
+ )
435
+ query_params.update(
436
+ _BaseSiteSearchEngineServiceRestTransport._BaseDeleteTargetSite._get_unset_required_fields(
437
+ query_params
438
+ )
439
+ )
440
+
441
+ query_params["$alt"] = "json;enum-encoding=int"
442
+ return query_params
443
+
444
+ class _BaseDisableAdvancedSiteSearch:
445
+ def __hash__(self): # pragma: NO COVER
446
+ return NotImplementedError("__hash__ must be implemented.")
447
+
448
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
449
+
450
+ @classmethod
451
+ def _get_unset_required_fields(cls, message_dict):
452
+ return {
453
+ k: v
454
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
455
+ if k not in message_dict
456
+ }
457
+
458
+ @staticmethod
459
+ def _get_http_options():
460
+ http_options: List[Dict[str, str]] = [
461
+ {
462
+ "method": "post",
463
+ "uri": "/v1beta/{site_search_engine=projects/*/locations/*/dataStores/*/siteSearchEngine}:disableAdvancedSiteSearch",
464
+ "body": "*",
465
+ },
466
+ {
467
+ "method": "post",
468
+ "uri": "/v1beta/{site_search_engine=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:disableAdvancedSiteSearch",
469
+ "body": "*",
470
+ },
471
+ ]
472
+ return http_options
473
+
474
+ @staticmethod
475
+ def _get_transcoded_request(http_options, request):
476
+ pb_request = site_search_engine_service.DisableAdvancedSiteSearchRequest.pb(
477
+ request
478
+ )
479
+ transcoded_request = path_template.transcode(http_options, pb_request)
480
+ return transcoded_request
481
+
482
+ @staticmethod
483
+ def _get_request_body_json(transcoded_request):
484
+ # Jsonify the request body
485
+
486
+ body = json_format.MessageToJson(
487
+ transcoded_request["body"], use_integers_for_enums=True
488
+ )
489
+ return body
490
+
491
+ @staticmethod
492
+ def _get_query_params_json(transcoded_request):
493
+ query_params = json.loads(
494
+ json_format.MessageToJson(
495
+ transcoded_request["query_params"],
496
+ use_integers_for_enums=True,
497
+ )
498
+ )
499
+ query_params.update(
500
+ _BaseSiteSearchEngineServiceRestTransport._BaseDisableAdvancedSiteSearch._get_unset_required_fields(
501
+ query_params
502
+ )
503
+ )
504
+
505
+ query_params["$alt"] = "json;enum-encoding=int"
506
+ return query_params
507
+
508
+ class _BaseEnableAdvancedSiteSearch:
509
+ def __hash__(self): # pragma: NO COVER
510
+ return NotImplementedError("__hash__ must be implemented.")
511
+
512
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
513
+
514
+ @classmethod
515
+ def _get_unset_required_fields(cls, message_dict):
516
+ return {
517
+ k: v
518
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
519
+ if k not in message_dict
520
+ }
521
+
522
+ @staticmethod
523
+ def _get_http_options():
524
+ http_options: List[Dict[str, str]] = [
525
+ {
526
+ "method": "post",
527
+ "uri": "/v1beta/{site_search_engine=projects/*/locations/*/dataStores/*/siteSearchEngine}:enableAdvancedSiteSearch",
528
+ "body": "*",
529
+ },
530
+ {
531
+ "method": "post",
532
+ "uri": "/v1beta/{site_search_engine=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:enableAdvancedSiteSearch",
533
+ "body": "*",
534
+ },
535
+ ]
536
+ return http_options
537
+
538
+ @staticmethod
539
+ def _get_transcoded_request(http_options, request):
540
+ pb_request = site_search_engine_service.EnableAdvancedSiteSearchRequest.pb(
541
+ request
542
+ )
543
+ transcoded_request = path_template.transcode(http_options, pb_request)
544
+ return transcoded_request
545
+
546
+ @staticmethod
547
+ def _get_request_body_json(transcoded_request):
548
+ # Jsonify the request body
549
+
550
+ body = json_format.MessageToJson(
551
+ transcoded_request["body"], use_integers_for_enums=True
552
+ )
553
+ return body
554
+
555
+ @staticmethod
556
+ def _get_query_params_json(transcoded_request):
557
+ query_params = json.loads(
558
+ json_format.MessageToJson(
559
+ transcoded_request["query_params"],
560
+ use_integers_for_enums=True,
561
+ )
562
+ )
563
+ query_params.update(
564
+ _BaseSiteSearchEngineServiceRestTransport._BaseEnableAdvancedSiteSearch._get_unset_required_fields(
565
+ query_params
566
+ )
567
+ )
568
+
569
+ query_params["$alt"] = "json;enum-encoding=int"
570
+ return query_params
571
+
572
+ class _BaseFetchDomainVerificationStatus:
573
+ def __hash__(self): # pragma: NO COVER
574
+ return NotImplementedError("__hash__ must be implemented.")
575
+
576
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
577
+
578
+ @classmethod
579
+ def _get_unset_required_fields(cls, message_dict):
580
+ return {
581
+ k: v
582
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
583
+ if k not in message_dict
584
+ }
585
+
586
+ @staticmethod
587
+ def _get_http_options():
588
+ http_options: List[Dict[str, str]] = [
589
+ {
590
+ "method": "get",
591
+ "uri": "/v1beta/{site_search_engine=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:fetchDomainVerificationStatus",
592
+ },
593
+ ]
594
+ return http_options
595
+
596
+ @staticmethod
597
+ def _get_transcoded_request(http_options, request):
598
+ pb_request = (
599
+ site_search_engine_service.FetchDomainVerificationStatusRequest.pb(
600
+ request
601
+ )
602
+ )
603
+ transcoded_request = path_template.transcode(http_options, pb_request)
604
+ return transcoded_request
605
+
606
+ @staticmethod
607
+ def _get_query_params_json(transcoded_request):
608
+ query_params = json.loads(
609
+ json_format.MessageToJson(
610
+ transcoded_request["query_params"],
611
+ use_integers_for_enums=True,
612
+ )
613
+ )
614
+ query_params.update(
615
+ _BaseSiteSearchEngineServiceRestTransport._BaseFetchDomainVerificationStatus._get_unset_required_fields(
616
+ query_params
617
+ )
618
+ )
619
+
620
+ query_params["$alt"] = "json;enum-encoding=int"
621
+ return query_params
622
+
623
+ class _BaseFetchSitemaps:
624
+ def __hash__(self): # pragma: NO COVER
625
+ return NotImplementedError("__hash__ must be implemented.")
626
+
627
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
628
+
629
+ @classmethod
630
+ def _get_unset_required_fields(cls, message_dict):
631
+ return {
632
+ k: v
633
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
634
+ if k not in message_dict
635
+ }
636
+
637
+ @staticmethod
638
+ def _get_http_options():
639
+ http_options: List[Dict[str, str]] = [
640
+ {
641
+ "method": "get",
642
+ "uri": "/v1beta/{parent=projects/*/locations/*/dataStores/*/siteSearchEngine}/sitemaps:fetch",
643
+ },
644
+ ]
645
+ return http_options
646
+
647
+ @staticmethod
648
+ def _get_transcoded_request(http_options, request):
649
+ pb_request = site_search_engine_service.FetchSitemapsRequest.pb(request)
650
+ transcoded_request = path_template.transcode(http_options, pb_request)
651
+ return transcoded_request
652
+
653
+ @staticmethod
654
+ def _get_query_params_json(transcoded_request):
655
+ query_params = json.loads(
656
+ json_format.MessageToJson(
657
+ transcoded_request["query_params"],
658
+ use_integers_for_enums=True,
659
+ )
660
+ )
661
+ query_params.update(
662
+ _BaseSiteSearchEngineServiceRestTransport._BaseFetchSitemaps._get_unset_required_fields(
663
+ query_params
664
+ )
665
+ )
666
+
667
+ query_params["$alt"] = "json;enum-encoding=int"
668
+ return query_params
669
+
670
+ class _BaseGetSiteSearchEngine:
671
+ def __hash__(self): # pragma: NO COVER
672
+ return NotImplementedError("__hash__ must be implemented.")
673
+
674
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
675
+
676
+ @classmethod
677
+ def _get_unset_required_fields(cls, message_dict):
678
+ return {
679
+ k: v
680
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
681
+ if k not in message_dict
682
+ }
683
+
684
+ @staticmethod
685
+ def _get_http_options():
686
+ http_options: List[Dict[str, str]] = [
687
+ {
688
+ "method": "get",
689
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/siteSearchEngine}",
690
+ },
691
+ {
692
+ "method": "get",
693
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}",
694
+ },
695
+ ]
696
+ return http_options
697
+
698
+ @staticmethod
699
+ def _get_transcoded_request(http_options, request):
700
+ pb_request = site_search_engine_service.GetSiteSearchEngineRequest.pb(
701
+ request
702
+ )
703
+ transcoded_request = path_template.transcode(http_options, pb_request)
704
+ return transcoded_request
705
+
706
+ @staticmethod
707
+ def _get_query_params_json(transcoded_request):
708
+ query_params = json.loads(
709
+ json_format.MessageToJson(
710
+ transcoded_request["query_params"],
711
+ use_integers_for_enums=True,
712
+ )
713
+ )
714
+ query_params.update(
715
+ _BaseSiteSearchEngineServiceRestTransport._BaseGetSiteSearchEngine._get_unset_required_fields(
716
+ query_params
717
+ )
718
+ )
719
+
720
+ query_params["$alt"] = "json;enum-encoding=int"
721
+ return query_params
722
+
723
+ class _BaseGetTargetSite:
724
+ def __hash__(self): # pragma: NO COVER
725
+ return NotImplementedError("__hash__ must be implemented.")
726
+
727
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
728
+
729
+ @classmethod
730
+ def _get_unset_required_fields(cls, message_dict):
731
+ return {
732
+ k: v
733
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
734
+ if k not in message_dict
735
+ }
736
+
737
+ @staticmethod
738
+ def _get_http_options():
739
+ http_options: List[Dict[str, str]] = [
740
+ {
741
+ "method": "get",
742
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/siteSearchEngine/targetSites/*}",
743
+ },
744
+ {
745
+ "method": "get",
746
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/*}",
747
+ },
748
+ ]
749
+ return http_options
750
+
751
+ @staticmethod
752
+ def _get_transcoded_request(http_options, request):
753
+ pb_request = site_search_engine_service.GetTargetSiteRequest.pb(request)
754
+ transcoded_request = path_template.transcode(http_options, pb_request)
755
+ return transcoded_request
756
+
757
+ @staticmethod
758
+ def _get_query_params_json(transcoded_request):
759
+ query_params = json.loads(
760
+ json_format.MessageToJson(
761
+ transcoded_request["query_params"],
762
+ use_integers_for_enums=True,
763
+ )
764
+ )
765
+ query_params.update(
766
+ _BaseSiteSearchEngineServiceRestTransport._BaseGetTargetSite._get_unset_required_fields(
767
+ query_params
768
+ )
769
+ )
770
+
771
+ query_params["$alt"] = "json;enum-encoding=int"
772
+ return query_params
773
+
774
+ class _BaseListTargetSites:
775
+ def __hash__(self): # pragma: NO COVER
776
+ return NotImplementedError("__hash__ must be implemented.")
777
+
778
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
779
+
780
+ @classmethod
781
+ def _get_unset_required_fields(cls, message_dict):
782
+ return {
783
+ k: v
784
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
785
+ if k not in message_dict
786
+ }
787
+
788
+ @staticmethod
789
+ def _get_http_options():
790
+ http_options: List[Dict[str, str]] = [
791
+ {
792
+ "method": "get",
793
+ "uri": "/v1beta/{parent=projects/*/locations/*/dataStores/*/siteSearchEngine}/targetSites",
794
+ },
795
+ {
796
+ "method": "get",
797
+ "uri": "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/targetSites",
798
+ },
799
+ ]
800
+ return http_options
801
+
802
+ @staticmethod
803
+ def _get_transcoded_request(http_options, request):
804
+ pb_request = site_search_engine_service.ListTargetSitesRequest.pb(request)
805
+ transcoded_request = path_template.transcode(http_options, pb_request)
806
+ return transcoded_request
807
+
808
+ @staticmethod
809
+ def _get_query_params_json(transcoded_request):
810
+ query_params = json.loads(
811
+ json_format.MessageToJson(
812
+ transcoded_request["query_params"],
813
+ use_integers_for_enums=True,
814
+ )
815
+ )
816
+ query_params.update(
817
+ _BaseSiteSearchEngineServiceRestTransport._BaseListTargetSites._get_unset_required_fields(
818
+ query_params
819
+ )
820
+ )
821
+
822
+ query_params["$alt"] = "json;enum-encoding=int"
823
+ return query_params
824
+
825
+ class _BaseRecrawlUris:
826
+ def __hash__(self): # pragma: NO COVER
827
+ return NotImplementedError("__hash__ must be implemented.")
828
+
829
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
830
+
831
+ @classmethod
832
+ def _get_unset_required_fields(cls, message_dict):
833
+ return {
834
+ k: v
835
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
836
+ if k not in message_dict
837
+ }
838
+
839
+ @staticmethod
840
+ def _get_http_options():
841
+ http_options: List[Dict[str, str]] = [
842
+ {
843
+ "method": "post",
844
+ "uri": "/v1beta/{site_search_engine=projects/*/locations/*/dataStores/*/siteSearchEngine}:recrawlUris",
845
+ "body": "*",
846
+ },
847
+ {
848
+ "method": "post",
849
+ "uri": "/v1beta/{site_search_engine=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:recrawlUris",
850
+ "body": "*",
851
+ },
852
+ ]
853
+ return http_options
854
+
855
+ @staticmethod
856
+ def _get_transcoded_request(http_options, request):
857
+ pb_request = site_search_engine_service.RecrawlUrisRequest.pb(request)
858
+ transcoded_request = path_template.transcode(http_options, pb_request)
859
+ return transcoded_request
860
+
861
+ @staticmethod
862
+ def _get_request_body_json(transcoded_request):
863
+ # Jsonify the request body
864
+
865
+ body = json_format.MessageToJson(
866
+ transcoded_request["body"], use_integers_for_enums=True
867
+ )
868
+ return body
869
+
870
+ @staticmethod
871
+ def _get_query_params_json(transcoded_request):
872
+ query_params = json.loads(
873
+ json_format.MessageToJson(
874
+ transcoded_request["query_params"],
875
+ use_integers_for_enums=True,
876
+ )
877
+ )
878
+ query_params.update(
879
+ _BaseSiteSearchEngineServiceRestTransport._BaseRecrawlUris._get_unset_required_fields(
880
+ query_params
881
+ )
882
+ )
883
+
884
+ query_params["$alt"] = "json;enum-encoding=int"
885
+ return query_params
886
+
887
+ class _BaseUpdateTargetSite:
888
+ def __hash__(self): # pragma: NO COVER
889
+ return NotImplementedError("__hash__ must be implemented.")
890
+
891
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
892
+
893
+ @classmethod
894
+ def _get_unset_required_fields(cls, message_dict):
895
+ return {
896
+ k: v
897
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
898
+ if k not in message_dict
899
+ }
900
+
901
+ @staticmethod
902
+ def _get_http_options():
903
+ http_options: List[Dict[str, str]] = [
904
+ {
905
+ "method": "patch",
906
+ "uri": "/v1beta/{target_site.name=projects/*/locations/*/dataStores/*/siteSearchEngine/targetSites/*}",
907
+ "body": "target_site",
908
+ },
909
+ {
910
+ "method": "patch",
911
+ "uri": "/v1beta/{target_site.name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/*}",
912
+ "body": "target_site",
913
+ },
914
+ ]
915
+ return http_options
916
+
917
+ @staticmethod
918
+ def _get_transcoded_request(http_options, request):
919
+ pb_request = site_search_engine_service.UpdateTargetSiteRequest.pb(request)
920
+ transcoded_request = path_template.transcode(http_options, pb_request)
921
+ return transcoded_request
922
+
923
+ @staticmethod
924
+ def _get_request_body_json(transcoded_request):
925
+ # Jsonify the request body
926
+
927
+ body = json_format.MessageToJson(
928
+ transcoded_request["body"], use_integers_for_enums=True
929
+ )
930
+ return body
931
+
932
+ @staticmethod
933
+ def _get_query_params_json(transcoded_request):
934
+ query_params = json.loads(
935
+ json_format.MessageToJson(
936
+ transcoded_request["query_params"],
937
+ use_integers_for_enums=True,
938
+ )
939
+ )
940
+ query_params.update(
941
+ _BaseSiteSearchEngineServiceRestTransport._BaseUpdateTargetSite._get_unset_required_fields(
942
+ query_params
943
+ )
944
+ )
945
+
946
+ query_params["$alt"] = "json;enum-encoding=int"
947
+ return query_params
948
+
949
+ class _BaseCancelOperation:
950
+ def __hash__(self): # pragma: NO COVER
951
+ return NotImplementedError("__hash__ must be implemented.")
952
+
953
+ @staticmethod
954
+ def _get_http_options():
955
+ http_options: List[Dict[str, str]] = [
956
+ {
957
+ "method": "post",
958
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel",
959
+ "body": "*",
960
+ },
961
+ {
962
+ "method": "post",
963
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel",
964
+ "body": "*",
965
+ },
966
+ ]
967
+ return http_options
968
+
969
+ @staticmethod
970
+ def _get_transcoded_request(http_options, request):
971
+ request_kwargs = json_format.MessageToDict(request)
972
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
973
+ return transcoded_request
974
+
975
+ @staticmethod
976
+ def _get_request_body_json(transcoded_request):
977
+ body = json.dumps(transcoded_request["body"])
978
+ return body
979
+
980
+ @staticmethod
981
+ def _get_query_params_json(transcoded_request):
982
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
983
+ return query_params
984
+
985
+ class _BaseGetOperation:
986
+ def __hash__(self): # pragma: NO COVER
987
+ return NotImplementedError("__hash__ must be implemented.")
988
+
989
+ @staticmethod
990
+ def _get_http_options():
991
+ http_options: List[Dict[str, str]] = [
992
+ {
993
+ "method": "get",
994
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}",
995
+ },
996
+ {
997
+ "method": "get",
998
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}",
999
+ },
1000
+ {
1001
+ "method": "get",
1002
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/models/*/operations/*}",
1003
+ },
1004
+ {
1005
+ "method": "get",
1006
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/operations/*}",
1007
+ },
1008
+ {
1009
+ "method": "get",
1010
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*/operations/*}",
1011
+ },
1012
+ {
1013
+ "method": "get",
1014
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/operations/*}",
1015
+ },
1016
+ {
1017
+ "method": "get",
1018
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/operations/*}",
1019
+ },
1020
+ {
1021
+ "method": "get",
1022
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/engines/*/operations/*}",
1023
+ },
1024
+ {
1025
+ "method": "get",
1026
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/operations/*}",
1027
+ },
1028
+ {
1029
+ "method": "get",
1030
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}",
1031
+ },
1032
+ {
1033
+ "method": "get",
1034
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/models/*/operations/*}",
1035
+ },
1036
+ {
1037
+ "method": "get",
1038
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/operations/*}",
1039
+ },
1040
+ {
1041
+ "method": "get",
1042
+ "uri": "/v1beta/{name=projects/*/locations/*/evaluations/*/operations/*}",
1043
+ },
1044
+ {
1045
+ "method": "get",
1046
+ "uri": "/v1beta/{name=projects/*/locations/*/operations/*}",
1047
+ },
1048
+ {
1049
+ "method": "get",
1050
+ "uri": "/v1beta/{name=projects/*/locations/*/sampleQuerySets/*/operations/*}",
1051
+ },
1052
+ {
1053
+ "method": "get",
1054
+ "uri": "/v1beta/{name=projects/*/operations/*}",
1055
+ },
1056
+ ]
1057
+ return http_options
1058
+
1059
+ @staticmethod
1060
+ def _get_transcoded_request(http_options, request):
1061
+ request_kwargs = json_format.MessageToDict(request)
1062
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
1063
+ return transcoded_request
1064
+
1065
+ @staticmethod
1066
+ def _get_query_params_json(transcoded_request):
1067
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
1068
+ return query_params
1069
+
1070
+ class _BaseListOperations:
1071
+ def __hash__(self): # pragma: NO COVER
1072
+ return NotImplementedError("__hash__ must be implemented.")
1073
+
1074
+ @staticmethod
1075
+ def _get_http_options():
1076
+ http_options: List[Dict[str, str]] = [
1077
+ {
1078
+ "method": "get",
1079
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataConnector}/operations",
1080
+ },
1081
+ {
1082
+ "method": "get",
1083
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*}/operations",
1084
+ },
1085
+ {
1086
+ "method": "get",
1087
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/models/*}/operations",
1088
+ },
1089
+ {
1090
+ "method": "get",
1091
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*}/operations",
1092
+ },
1093
+ {
1094
+ "method": "get",
1095
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites}/operations",
1096
+ },
1097
+ {
1098
+ "method": "get",
1099
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/operations",
1100
+ },
1101
+ {
1102
+ "method": "get",
1103
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*}/operations",
1104
+ },
1105
+ {
1106
+ "method": "get",
1107
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/engines/*}/operations",
1108
+ },
1109
+ {
1110
+ "method": "get",
1111
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*}/operations",
1112
+ },
1113
+ {
1114
+ "method": "get",
1115
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*}/operations",
1116
+ },
1117
+ {
1118
+ "method": "get",
1119
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/models/*}/operations",
1120
+ },
1121
+ {
1122
+ "method": "get",
1123
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*}/operations",
1124
+ },
1125
+ {
1126
+ "method": "get",
1127
+ "uri": "/v1beta/{name=projects/*/locations/*}/operations",
1128
+ },
1129
+ {
1130
+ "method": "get",
1131
+ "uri": "/v1beta/{name=projects/*}/operations",
1132
+ },
1133
+ ]
1134
+ return http_options
1135
+
1136
+ @staticmethod
1137
+ def _get_transcoded_request(http_options, request):
1138
+ request_kwargs = json_format.MessageToDict(request)
1139
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
1140
+ return transcoded_request
1141
+
1142
+ @staticmethod
1143
+ def _get_query_params_json(transcoded_request):
1144
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
1145
+ return query_params
1146
+
1147
+
1148
+ __all__ = ("_BaseSiteSearchEngineServiceRestTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/__init__.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from .async_client import UserEventServiceAsyncClient
17
+ from .client import UserEventServiceClient
18
+
19
+ __all__ = (
20
+ "UserEventServiceClient",
21
+ "UserEventServiceAsyncClient",
22
+ )
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/async_client.py ADDED
@@ -0,0 +1,939 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from collections import OrderedDict
17
+ import logging as std_logging
18
+ import re
19
+ from typing import (
20
+ Callable,
21
+ Dict,
22
+ Mapping,
23
+ MutableMapping,
24
+ MutableSequence,
25
+ Optional,
26
+ Sequence,
27
+ Tuple,
28
+ Type,
29
+ Union,
30
+ )
31
+
32
+ from google.api_core import exceptions as core_exceptions
33
+ from google.api_core import gapic_v1
34
+ from google.api_core import retry_async as retries
35
+ from google.api_core.client_options import ClientOptions
36
+ from google.auth import credentials as ga_credentials # type: ignore
37
+ from google.oauth2 import service_account # type: ignore
38
+ import google.protobuf
39
+
40
+ from google.cloud.discoveryengine_v1beta import gapic_version as package_version
41
+
42
+ try:
43
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
44
+ except AttributeError: # pragma: NO COVER
45
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
46
+
47
+ from google.api import httpbody_pb2 # type: ignore
48
+ from google.api_core import operation # type: ignore
49
+ from google.api_core import operation_async # type: ignore
50
+ from google.cloud.location import locations_pb2 # type: ignore
51
+ from google.longrunning import operations_pb2 # type: ignore
52
+ from google.protobuf import any_pb2 # type: ignore
53
+ from google.protobuf import timestamp_pb2 # type: ignore
54
+
55
+ from google.cloud.discoveryengine_v1beta.types import (
56
+ common,
57
+ import_config,
58
+ purge_config,
59
+ user_event,
60
+ user_event_service,
61
+ )
62
+
63
+ from .client import UserEventServiceClient
64
+ from .transports.base import DEFAULT_CLIENT_INFO, UserEventServiceTransport
65
+ from .transports.grpc_asyncio import UserEventServiceGrpcAsyncIOTransport
66
+
67
+ try:
68
+ from google.api_core import client_logging # type: ignore
69
+
70
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
71
+ except ImportError: # pragma: NO COVER
72
+ CLIENT_LOGGING_SUPPORTED = False
73
+
74
+ _LOGGER = std_logging.getLogger(__name__)
75
+
76
+
77
+ class UserEventServiceAsyncClient:
78
+ """Service for ingesting end user actions on a website to
79
+ Discovery Engine API.
80
+ """
81
+
82
+ _client: UserEventServiceClient
83
+
84
+ # Copy defaults from the synchronous client for use here.
85
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
86
+ DEFAULT_ENDPOINT = UserEventServiceClient.DEFAULT_ENDPOINT
87
+ DEFAULT_MTLS_ENDPOINT = UserEventServiceClient.DEFAULT_MTLS_ENDPOINT
88
+ _DEFAULT_ENDPOINT_TEMPLATE = UserEventServiceClient._DEFAULT_ENDPOINT_TEMPLATE
89
+ _DEFAULT_UNIVERSE = UserEventServiceClient._DEFAULT_UNIVERSE
90
+
91
+ data_store_path = staticmethod(UserEventServiceClient.data_store_path)
92
+ parse_data_store_path = staticmethod(UserEventServiceClient.parse_data_store_path)
93
+ document_path = staticmethod(UserEventServiceClient.document_path)
94
+ parse_document_path = staticmethod(UserEventServiceClient.parse_document_path)
95
+ engine_path = staticmethod(UserEventServiceClient.engine_path)
96
+ parse_engine_path = staticmethod(UserEventServiceClient.parse_engine_path)
97
+ common_billing_account_path = staticmethod(
98
+ UserEventServiceClient.common_billing_account_path
99
+ )
100
+ parse_common_billing_account_path = staticmethod(
101
+ UserEventServiceClient.parse_common_billing_account_path
102
+ )
103
+ common_folder_path = staticmethod(UserEventServiceClient.common_folder_path)
104
+ parse_common_folder_path = staticmethod(
105
+ UserEventServiceClient.parse_common_folder_path
106
+ )
107
+ common_organization_path = staticmethod(
108
+ UserEventServiceClient.common_organization_path
109
+ )
110
+ parse_common_organization_path = staticmethod(
111
+ UserEventServiceClient.parse_common_organization_path
112
+ )
113
+ common_project_path = staticmethod(UserEventServiceClient.common_project_path)
114
+ parse_common_project_path = staticmethod(
115
+ UserEventServiceClient.parse_common_project_path
116
+ )
117
+ common_location_path = staticmethod(UserEventServiceClient.common_location_path)
118
+ parse_common_location_path = staticmethod(
119
+ UserEventServiceClient.parse_common_location_path
120
+ )
121
+
122
+ @classmethod
123
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
124
+ """Creates an instance of this client using the provided credentials
125
+ info.
126
+
127
+ Args:
128
+ info (dict): The service account private key info.
129
+ args: Additional arguments to pass to the constructor.
130
+ kwargs: Additional arguments to pass to the constructor.
131
+
132
+ Returns:
133
+ UserEventServiceAsyncClient: The constructed client.
134
+ """
135
+ return UserEventServiceClient.from_service_account_info.__func__(UserEventServiceAsyncClient, info, *args, **kwargs) # type: ignore
136
+
137
+ @classmethod
138
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
139
+ """Creates an instance of this client using the provided credentials
140
+ file.
141
+
142
+ Args:
143
+ filename (str): The path to the service account private key json
144
+ file.
145
+ args: Additional arguments to pass to the constructor.
146
+ kwargs: Additional arguments to pass to the constructor.
147
+
148
+ Returns:
149
+ UserEventServiceAsyncClient: The constructed client.
150
+ """
151
+ return UserEventServiceClient.from_service_account_file.__func__(UserEventServiceAsyncClient, filename, *args, **kwargs) # type: ignore
152
+
153
+ from_service_account_json = from_service_account_file
154
+
155
+ @classmethod
156
+ def get_mtls_endpoint_and_cert_source(
157
+ cls, client_options: Optional[ClientOptions] = None
158
+ ):
159
+ """Return the API endpoint and client cert source for mutual TLS.
160
+
161
+ The client cert source is determined in the following order:
162
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
163
+ client cert source is None.
164
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
165
+ default client cert source exists, use the default one; otherwise the client cert
166
+ source is None.
167
+
168
+ The API endpoint is determined in the following order:
169
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
170
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
171
+ default mTLS endpoint; if the environment variable is "never", use the default API
172
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
173
+ use the default API endpoint.
174
+
175
+ More details can be found at https://google.aip.dev/auth/4114.
176
+
177
+ Args:
178
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
179
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
180
+ in this method.
181
+
182
+ Returns:
183
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
184
+ client cert source to use.
185
+
186
+ Raises:
187
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
188
+ """
189
+ return UserEventServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
190
+
191
+ @property
192
+ def transport(self) -> UserEventServiceTransport:
193
+ """Returns the transport used by the client instance.
194
+
195
+ Returns:
196
+ UserEventServiceTransport: The transport used by the client instance.
197
+ """
198
+ return self._client.transport
199
+
200
+ @property
201
+ def api_endpoint(self):
202
+ """Return the API endpoint used by the client instance.
203
+
204
+ Returns:
205
+ str: The API endpoint used by the client instance.
206
+ """
207
+ return self._client._api_endpoint
208
+
209
+ @property
210
+ def universe_domain(self) -> str:
211
+ """Return the universe domain used by the client instance.
212
+
213
+ Returns:
214
+ str: The universe domain used
215
+ by the client instance.
216
+ """
217
+ return self._client._universe_domain
218
+
219
+ get_transport_class = UserEventServiceClient.get_transport_class
220
+
221
+ def __init__(
222
+ self,
223
+ *,
224
+ credentials: Optional[ga_credentials.Credentials] = None,
225
+ transport: Optional[
226
+ Union[
227
+ str, UserEventServiceTransport, Callable[..., UserEventServiceTransport]
228
+ ]
229
+ ] = "grpc_asyncio",
230
+ client_options: Optional[ClientOptions] = None,
231
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
232
+ ) -> None:
233
+ """Instantiates the user event service async client.
234
+
235
+ Args:
236
+ credentials (Optional[google.auth.credentials.Credentials]): The
237
+ authorization credentials to attach to requests. These
238
+ credentials identify the application to the service; if none
239
+ are specified, the client will attempt to ascertain the
240
+ credentials from the environment.
241
+ transport (Optional[Union[str,UserEventServiceTransport,Callable[..., UserEventServiceTransport]]]):
242
+ The transport to use, or a Callable that constructs and returns a new transport to use.
243
+ If a Callable is given, it will be called with the same set of initialization
244
+ arguments as used in the UserEventServiceTransport constructor.
245
+ If set to None, a transport is chosen automatically.
246
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
247
+ Custom options for the client.
248
+
249
+ 1. The ``api_endpoint`` property can be used to override the
250
+ default endpoint provided by the client when ``transport`` is
251
+ not explicitly provided. Only if this property is not set and
252
+ ``transport`` was not explicitly provided, the endpoint is
253
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
254
+ variable, which have one of the following values:
255
+ "always" (always use the default mTLS endpoint), "never" (always
256
+ use the default regular endpoint) and "auto" (auto-switch to the
257
+ default mTLS endpoint if client certificate is present; this is
258
+ the default value).
259
+
260
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
261
+ is "true", then the ``client_cert_source`` property can be used
262
+ to provide a client certificate for mTLS transport. If
263
+ not provided, the default SSL client certificate will be used if
264
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
265
+ set, no client certificate will be used.
266
+
267
+ 3. The ``universe_domain`` property can be used to override the
268
+ default "googleapis.com" universe. Note that ``api_endpoint``
269
+ property still takes precedence; and ``universe_domain`` is
270
+ currently not supported for mTLS.
271
+
272
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
273
+ The client info used to send a user-agent string along with
274
+ API requests. If ``None``, then default info will be used.
275
+ Generally, you only need to set this if you're developing
276
+ your own client library.
277
+
278
+ Raises:
279
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
280
+ creation failed for any reason.
281
+ """
282
+ self._client = UserEventServiceClient(
283
+ credentials=credentials,
284
+ transport=transport,
285
+ client_options=client_options,
286
+ client_info=client_info,
287
+ )
288
+
289
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
290
+ std_logging.DEBUG
291
+ ): # pragma: NO COVER
292
+ _LOGGER.debug(
293
+ "Created client `google.cloud.discoveryengine_v1beta.UserEventServiceAsyncClient`.",
294
+ extra={
295
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
296
+ "universeDomain": getattr(
297
+ self._client._transport._credentials, "universe_domain", ""
298
+ ),
299
+ "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
300
+ "credentialsInfo": getattr(
301
+ self.transport._credentials, "get_cred_info", lambda: None
302
+ )(),
303
+ }
304
+ if hasattr(self._client._transport, "_credentials")
305
+ else {
306
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
307
+ "credentialsType": None,
308
+ },
309
+ )
310
+
311
+ async def write_user_event(
312
+ self,
313
+ request: Optional[Union[user_event_service.WriteUserEventRequest, dict]] = None,
314
+ *,
315
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
316
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
317
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
318
+ ) -> user_event.UserEvent:
319
+ r"""Writes a single user event.
320
+
321
+ .. code-block:: python
322
+
323
+ # This snippet has been automatically generated and should be regarded as a
324
+ # code template only.
325
+ # It will require modifications to work:
326
+ # - It may require correct/in-range values for request initialization.
327
+ # - It may require specifying regional endpoints when creating the service
328
+ # client as shown in:
329
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
330
+ from google.cloud import discoveryengine_v1beta
331
+
332
+ async def sample_write_user_event():
333
+ # Create a client
334
+ client = discoveryengine_v1beta.UserEventServiceAsyncClient()
335
+
336
+ # Initialize request argument(s)
337
+ request = discoveryengine_v1beta.WriteUserEventRequest(
338
+ parent="parent_value",
339
+ )
340
+
341
+ # Make the request
342
+ response = await client.write_user_event(request=request)
343
+
344
+ # Handle the response
345
+ print(response)
346
+
347
+ Args:
348
+ request (Optional[Union[google.cloud.discoveryengine_v1beta.types.WriteUserEventRequest, dict]]):
349
+ The request object. Request message for WriteUserEvent
350
+ method.
351
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
352
+ should be retried.
353
+ timeout (float): The timeout for this request.
354
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
355
+ sent along with the request as metadata. Normally, each value must be of type `str`,
356
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
357
+ be of type `bytes`.
358
+
359
+ Returns:
360
+ google.cloud.discoveryengine_v1beta.types.UserEvent:
361
+ UserEvent captures all metadata
362
+ information Discovery Engine API needs
363
+ to know about how end users interact
364
+ with your website.
365
+
366
+ """
367
+ # Create or coerce a protobuf request object.
368
+ # - Use the request object if provided (there's no risk of modifying the input as
369
+ # there are no flattened fields), or create one.
370
+ if not isinstance(request, user_event_service.WriteUserEventRequest):
371
+ request = user_event_service.WriteUserEventRequest(request)
372
+
373
+ # Wrap the RPC method; this adds retry and timeout information,
374
+ # and friendly error handling.
375
+ rpc = self._client._transport._wrapped_methods[
376
+ self._client._transport.write_user_event
377
+ ]
378
+
379
+ # Certain fields should be provided within the metadata header;
380
+ # add these here.
381
+ metadata = tuple(metadata) + (
382
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
383
+ )
384
+
385
+ # Validate the universe domain.
386
+ self._client._validate_universe_domain()
387
+
388
+ # Send the request.
389
+ response = await rpc(
390
+ request,
391
+ retry=retry,
392
+ timeout=timeout,
393
+ metadata=metadata,
394
+ )
395
+
396
+ # Done; return the response.
397
+ return response
398
+
399
+ async def collect_user_event(
400
+ self,
401
+ request: Optional[
402
+ Union[user_event_service.CollectUserEventRequest, dict]
403
+ ] = None,
404
+ *,
405
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
406
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
407
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
408
+ ) -> httpbody_pb2.HttpBody:
409
+ r"""Writes a single user event from the browser. This
410
+ uses a GET request to due to browser restriction of
411
+ POST-ing to a third-party domain.
412
+
413
+ This method is used only by the Discovery Engine API
414
+ JavaScript pixel and Google Tag Manager. Users should
415
+ not call this method directly.
416
+
417
+ .. code-block:: python
418
+
419
+ # This snippet has been automatically generated and should be regarded as a
420
+ # code template only.
421
+ # It will require modifications to work:
422
+ # - It may require correct/in-range values for request initialization.
423
+ # - It may require specifying regional endpoints when creating the service
424
+ # client as shown in:
425
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
426
+ from google.cloud import discoveryengine_v1beta
427
+
428
+ async def sample_collect_user_event():
429
+ # Create a client
430
+ client = discoveryengine_v1beta.UserEventServiceAsyncClient()
431
+
432
+ # Initialize request argument(s)
433
+ request = discoveryengine_v1beta.CollectUserEventRequest(
434
+ parent="parent_value",
435
+ user_event="user_event_value",
436
+ )
437
+
438
+ # Make the request
439
+ response = await client.collect_user_event(request=request)
440
+
441
+ # Handle the response
442
+ print(response)
443
+
444
+ Args:
445
+ request (Optional[Union[google.cloud.discoveryengine_v1beta.types.CollectUserEventRequest, dict]]):
446
+ The request object. Request message for CollectUserEvent
447
+ method.
448
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
449
+ should be retried.
450
+ timeout (float): The timeout for this request.
451
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
452
+ sent along with the request as metadata. Normally, each value must be of type `str`,
453
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
454
+ be of type `bytes`.
455
+
456
+ Returns:
457
+ google.api.httpbody_pb2.HttpBody:
458
+ Message that represents an arbitrary HTTP body. It should only be used for
459
+ payload formats that can't be represented as JSON,
460
+ such as raw binary or an HTML page.
461
+
462
+ This message can be used both in streaming and
463
+ non-streaming API methods in the request as well as
464
+ the response.
465
+
466
+ It can be used as a top-level request field, which is
467
+ convenient if one wants to extract parameters from
468
+ either the URL or HTTP template into the request
469
+ fields and also want access to the raw HTTP body.
470
+
471
+ Example:
472
+
473
+ message GetResourceRequest {
474
+ // A unique request id. string request_id = 1;
475
+
476
+ // The raw HTTP body is bound to this field.
477
+ google.api.HttpBody http_body = 2;
478
+
479
+ }
480
+
481
+ service ResourceService {
482
+ rpc GetResource(GetResourceRequest)
483
+ returns (google.api.HttpBody);
484
+
485
+ rpc UpdateResource(google.api.HttpBody)
486
+ returns (google.protobuf.Empty);
487
+
488
+ }
489
+
490
+ Example with streaming methods:
491
+
492
+ service CaldavService {
493
+ rpc GetCalendar(stream google.api.HttpBody)
494
+ returns (stream google.api.HttpBody);
495
+
496
+ rpc UpdateCalendar(stream google.api.HttpBody)
497
+ returns (stream google.api.HttpBody);
498
+
499
+ }
500
+
501
+ Use of this type only changes how the request and
502
+ response bodies are handled, all other features will
503
+ continue to work unchanged.
504
+
505
+ """
506
+ # Create or coerce a protobuf request object.
507
+ # - Use the request object if provided (there's no risk of modifying the input as
508
+ # there are no flattened fields), or create one.
509
+ if not isinstance(request, user_event_service.CollectUserEventRequest):
510
+ request = user_event_service.CollectUserEventRequest(request)
511
+
512
+ # Wrap the RPC method; this adds retry and timeout information,
513
+ # and friendly error handling.
514
+ rpc = self._client._transport._wrapped_methods[
515
+ self._client._transport.collect_user_event
516
+ ]
517
+
518
+ # Certain fields should be provided within the metadata header;
519
+ # add these here.
520
+ metadata = tuple(metadata) + (
521
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
522
+ )
523
+
524
+ # Validate the universe domain.
525
+ self._client._validate_universe_domain()
526
+
527
+ # Send the request.
528
+ response = await rpc(
529
+ request,
530
+ retry=retry,
531
+ timeout=timeout,
532
+ metadata=metadata,
533
+ )
534
+
535
+ # Done; return the response.
536
+ return response
537
+
538
+ async def purge_user_events(
539
+ self,
540
+ request: Optional[Union[purge_config.PurgeUserEventsRequest, dict]] = None,
541
+ *,
542
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
543
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
544
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
545
+ ) -> operation_async.AsyncOperation:
546
+ r"""Deletes permanently all user events specified by the
547
+ filter provided. Depending on the number of events
548
+ specified by the filter, this operation could take hours
549
+ or days to complete. To test a filter, use the list
550
+ command first.
551
+
552
+ .. code-block:: python
553
+
554
+ # This snippet has been automatically generated and should be regarded as a
555
+ # code template only.
556
+ # It will require modifications to work:
557
+ # - It may require correct/in-range values for request initialization.
558
+ # - It may require specifying regional endpoints when creating the service
559
+ # client as shown in:
560
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
561
+ from google.cloud import discoveryengine_v1beta
562
+
563
+ async def sample_purge_user_events():
564
+ # Create a client
565
+ client = discoveryengine_v1beta.UserEventServiceAsyncClient()
566
+
567
+ # Initialize request argument(s)
568
+ request = discoveryengine_v1beta.PurgeUserEventsRequest(
569
+ parent="parent_value",
570
+ filter="filter_value",
571
+ )
572
+
573
+ # Make the request
574
+ operation = client.purge_user_events(request=request)
575
+
576
+ print("Waiting for operation to complete...")
577
+
578
+ response = (await operation).result()
579
+
580
+ # Handle the response
581
+ print(response)
582
+
583
+ Args:
584
+ request (Optional[Union[google.cloud.discoveryengine_v1beta.types.PurgeUserEventsRequest, dict]]):
585
+ The request object. Request message for PurgeUserEvents
586
+ method.
587
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
588
+ should be retried.
589
+ timeout (float): The timeout for this request.
590
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
591
+ sent along with the request as metadata. Normally, each value must be of type `str`,
592
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
593
+ be of type `bytes`.
594
+
595
+ Returns:
596
+ google.api_core.operation_async.AsyncOperation:
597
+ An object representing a long-running operation.
598
+
599
+ The result type for the operation will be :class:`google.cloud.discoveryengine_v1beta.types.PurgeUserEventsResponse` Response of the PurgeUserEventsRequest. If the long running operation is
600
+ successfully done, then this message is returned by
601
+ the google.longrunning.Operations.response field.
602
+
603
+ """
604
+ # Create or coerce a protobuf request object.
605
+ # - Use the request object if provided (there's no risk of modifying the input as
606
+ # there are no flattened fields), or create one.
607
+ if not isinstance(request, purge_config.PurgeUserEventsRequest):
608
+ request = purge_config.PurgeUserEventsRequest(request)
609
+
610
+ # Wrap the RPC method; this adds retry and timeout information,
611
+ # and friendly error handling.
612
+ rpc = self._client._transport._wrapped_methods[
613
+ self._client._transport.purge_user_events
614
+ ]
615
+
616
+ # Certain fields should be provided within the metadata header;
617
+ # add these here.
618
+ metadata = tuple(metadata) + (
619
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
620
+ )
621
+
622
+ # Validate the universe domain.
623
+ self._client._validate_universe_domain()
624
+
625
+ # Send the request.
626
+ response = await rpc(
627
+ request,
628
+ retry=retry,
629
+ timeout=timeout,
630
+ metadata=metadata,
631
+ )
632
+
633
+ # Wrap the response in an operation future.
634
+ response = operation_async.from_gapic(
635
+ response,
636
+ self._client._transport.operations_client,
637
+ purge_config.PurgeUserEventsResponse,
638
+ metadata_type=purge_config.PurgeUserEventsMetadata,
639
+ )
640
+
641
+ # Done; return the response.
642
+ return response
643
+
644
+ async def import_user_events(
645
+ self,
646
+ request: Optional[Union[import_config.ImportUserEventsRequest, dict]] = None,
647
+ *,
648
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
649
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
650
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
651
+ ) -> operation_async.AsyncOperation:
652
+ r"""Bulk import of user events. Request processing might
653
+ be synchronous. Events that already exist are skipped.
654
+ Use this method for backfilling historical user events.
655
+
656
+ Operation.response is of type ImportResponse. Note that
657
+ it is possible for a subset of the items to be
658
+ successfully inserted. Operation.metadata is of type
659
+ ImportMetadata.
660
+
661
+ .. code-block:: python
662
+
663
+ # This snippet has been automatically generated and should be regarded as a
664
+ # code template only.
665
+ # It will require modifications to work:
666
+ # - It may require correct/in-range values for request initialization.
667
+ # - It may require specifying regional endpoints when creating the service
668
+ # client as shown in:
669
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
670
+ from google.cloud import discoveryengine_v1beta
671
+
672
+ async def sample_import_user_events():
673
+ # Create a client
674
+ client = discoveryengine_v1beta.UserEventServiceAsyncClient()
675
+
676
+ # Initialize request argument(s)
677
+ inline_source = discoveryengine_v1beta.InlineSource()
678
+ inline_source.user_events.event_type = "event_type_value"
679
+ inline_source.user_events.user_pseudo_id = "user_pseudo_id_value"
680
+
681
+ request = discoveryengine_v1beta.ImportUserEventsRequest(
682
+ inline_source=inline_source,
683
+ parent="parent_value",
684
+ )
685
+
686
+ # Make the request
687
+ operation = client.import_user_events(request=request)
688
+
689
+ print("Waiting for operation to complete...")
690
+
691
+ response = (await operation).result()
692
+
693
+ # Handle the response
694
+ print(response)
695
+
696
+ Args:
697
+ request (Optional[Union[google.cloud.discoveryengine_v1beta.types.ImportUserEventsRequest, dict]]):
698
+ The request object. Request message for the
699
+ ImportUserEvents request.
700
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
701
+ should be retried.
702
+ timeout (float): The timeout for this request.
703
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
704
+ sent along with the request as metadata. Normally, each value must be of type `str`,
705
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
706
+ be of type `bytes`.
707
+
708
+ Returns:
709
+ google.api_core.operation_async.AsyncOperation:
710
+ An object representing a long-running operation.
711
+
712
+ The result type for the operation will be :class:`google.cloud.discoveryengine_v1beta.types.ImportUserEventsResponse` Response of the ImportUserEventsRequest. If the long running
713
+ operation was successful, then this message is
714
+ returned by the
715
+ google.longrunning.Operations.response field if the
716
+ operation was successful.
717
+
718
+ """
719
+ # Create or coerce a protobuf request object.
720
+ # - Use the request object if provided (there's no risk of modifying the input as
721
+ # there are no flattened fields), or create one.
722
+ if not isinstance(request, import_config.ImportUserEventsRequest):
723
+ request = import_config.ImportUserEventsRequest(request)
724
+
725
+ # Wrap the RPC method; this adds retry and timeout information,
726
+ # and friendly error handling.
727
+ rpc = self._client._transport._wrapped_methods[
728
+ self._client._transport.import_user_events
729
+ ]
730
+
731
+ # Certain fields should be provided within the metadata header;
732
+ # add these here.
733
+ metadata = tuple(metadata) + (
734
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
735
+ )
736
+
737
+ # Validate the universe domain.
738
+ self._client._validate_universe_domain()
739
+
740
+ # Send the request.
741
+ response = await rpc(
742
+ request,
743
+ retry=retry,
744
+ timeout=timeout,
745
+ metadata=metadata,
746
+ )
747
+
748
+ # Wrap the response in an operation future.
749
+ response = operation_async.from_gapic(
750
+ response,
751
+ self._client._transport.operations_client,
752
+ import_config.ImportUserEventsResponse,
753
+ metadata_type=import_config.ImportUserEventsMetadata,
754
+ )
755
+
756
+ # Done; return the response.
757
+ return response
758
+
759
+ async def list_operations(
760
+ self,
761
+ request: Optional[operations_pb2.ListOperationsRequest] = None,
762
+ *,
763
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
764
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
765
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
766
+ ) -> operations_pb2.ListOperationsResponse:
767
+ r"""Lists operations that match the specified filter in the request.
768
+
769
+ Args:
770
+ request (:class:`~.operations_pb2.ListOperationsRequest`):
771
+ The request object. Request message for
772
+ `ListOperations` method.
773
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
774
+ if any, should be retried.
775
+ timeout (float): The timeout for this request.
776
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
777
+ sent along with the request as metadata. Normally, each value must be of type `str`,
778
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
779
+ be of type `bytes`.
780
+ Returns:
781
+ ~.operations_pb2.ListOperationsResponse:
782
+ Response message for ``ListOperations`` method.
783
+ """
784
+ # Create or coerce a protobuf request object.
785
+ # The request isn't a proto-plus wrapped type,
786
+ # so it must be constructed via keyword expansion.
787
+ if isinstance(request, dict):
788
+ request = operations_pb2.ListOperationsRequest(**request)
789
+
790
+ # Wrap the RPC method; this adds retry and timeout information,
791
+ # and friendly error handling.
792
+ rpc = self.transport._wrapped_methods[self._client._transport.list_operations]
793
+
794
+ # Certain fields should be provided within the metadata header;
795
+ # add these here.
796
+ metadata = tuple(metadata) + (
797
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
798
+ )
799
+
800
+ # Validate the universe domain.
801
+ self._client._validate_universe_domain()
802
+
803
+ # Send the request.
804
+ response = await rpc(
805
+ request,
806
+ retry=retry,
807
+ timeout=timeout,
808
+ metadata=metadata,
809
+ )
810
+
811
+ # Done; return the response.
812
+ return response
813
+
814
+ async def get_operation(
815
+ self,
816
+ request: Optional[operations_pb2.GetOperationRequest] = None,
817
+ *,
818
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
819
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
820
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
821
+ ) -> operations_pb2.Operation:
822
+ r"""Gets the latest state of a long-running operation.
823
+
824
+ Args:
825
+ request (:class:`~.operations_pb2.GetOperationRequest`):
826
+ The request object. Request message for
827
+ `GetOperation` method.
828
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
829
+ if any, should be retried.
830
+ timeout (float): The timeout for this request.
831
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
832
+ sent along with the request as metadata. Normally, each value must be of type `str`,
833
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
834
+ be of type `bytes`.
835
+ Returns:
836
+ ~.operations_pb2.Operation:
837
+ An ``Operation`` object.
838
+ """
839
+ # Create or coerce a protobuf request object.
840
+ # The request isn't a proto-plus wrapped type,
841
+ # so it must be constructed via keyword expansion.
842
+ if isinstance(request, dict):
843
+ request = operations_pb2.GetOperationRequest(**request)
844
+
845
+ # Wrap the RPC method; this adds retry and timeout information,
846
+ # and friendly error handling.
847
+ rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
848
+
849
+ # Certain fields should be provided within the metadata header;
850
+ # add these here.
851
+ metadata = tuple(metadata) + (
852
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
853
+ )
854
+
855
+ # Validate the universe domain.
856
+ self._client._validate_universe_domain()
857
+
858
+ # Send the request.
859
+ response = await rpc(
860
+ request,
861
+ retry=retry,
862
+ timeout=timeout,
863
+ metadata=metadata,
864
+ )
865
+
866
+ # Done; return the response.
867
+ return response
868
+
869
+ async def cancel_operation(
870
+ self,
871
+ request: Optional[operations_pb2.CancelOperationRequest] = None,
872
+ *,
873
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
874
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
875
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
876
+ ) -> None:
877
+ r"""Starts asynchronous cancellation on a long-running operation.
878
+
879
+ The server makes a best effort to cancel the operation, but success
880
+ is not guaranteed. If the server doesn't support this method, it returns
881
+ `google.rpc.Code.UNIMPLEMENTED`.
882
+
883
+ Args:
884
+ request (:class:`~.operations_pb2.CancelOperationRequest`):
885
+ The request object. Request message for
886
+ `CancelOperation` method.
887
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
888
+ if any, should be retried.
889
+ timeout (float): The timeout for this request.
890
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
891
+ sent along with the request as metadata. Normally, each value must be of type `str`,
892
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
893
+ be of type `bytes`.
894
+ Returns:
895
+ None
896
+ """
897
+ # Create or coerce a protobuf request object.
898
+ # The request isn't a proto-plus wrapped type,
899
+ # so it must be constructed via keyword expansion.
900
+ if isinstance(request, dict):
901
+ request = operations_pb2.CancelOperationRequest(**request)
902
+
903
+ # Wrap the RPC method; this adds retry and timeout information,
904
+ # and friendly error handling.
905
+ rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation]
906
+
907
+ # Certain fields should be provided within the metadata header;
908
+ # add these here.
909
+ metadata = tuple(metadata) + (
910
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
911
+ )
912
+
913
+ # Validate the universe domain.
914
+ self._client._validate_universe_domain()
915
+
916
+ # Send the request.
917
+ await rpc(
918
+ request,
919
+ retry=retry,
920
+ timeout=timeout,
921
+ metadata=metadata,
922
+ )
923
+
924
+ async def __aenter__(self) -> "UserEventServiceAsyncClient":
925
+ return self
926
+
927
+ async def __aexit__(self, exc_type, exc, tb):
928
+ await self.transport.close()
929
+
930
+
931
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
932
+ gapic_version=package_version.__version__
933
+ )
934
+
935
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
936
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
937
+
938
+
939
+ __all__ = ("UserEventServiceAsyncClient",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/client.py ADDED
@@ -0,0 +1,1415 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from collections import OrderedDict
17
+ from http import HTTPStatus
18
+ import json
19
+ import logging as std_logging
20
+ import os
21
+ import re
22
+ from typing import (
23
+ Callable,
24
+ Dict,
25
+ Mapping,
26
+ MutableMapping,
27
+ MutableSequence,
28
+ Optional,
29
+ Sequence,
30
+ Tuple,
31
+ Type,
32
+ Union,
33
+ cast,
34
+ )
35
+ import warnings
36
+
37
+ from google.api_core import client_options as client_options_lib
38
+ from google.api_core import exceptions as core_exceptions
39
+ from google.api_core import gapic_v1
40
+ from google.api_core import retry as retries
41
+ from google.auth import credentials as ga_credentials # type: ignore
42
+ from google.auth.exceptions import MutualTLSChannelError # type: ignore
43
+ from google.auth.transport import mtls # type: ignore
44
+ from google.auth.transport.grpc import SslCredentials # type: ignore
45
+ from google.oauth2 import service_account # type: ignore
46
+ import google.protobuf
47
+
48
+ from google.cloud.discoveryengine_v1beta import gapic_version as package_version
49
+
50
+ try:
51
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
52
+ except AttributeError: # pragma: NO COVER
53
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
54
+
55
+ try:
56
+ from google.api_core import client_logging # type: ignore
57
+
58
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
59
+ except ImportError: # pragma: NO COVER
60
+ CLIENT_LOGGING_SUPPORTED = False
61
+
62
+ _LOGGER = std_logging.getLogger(__name__)
63
+
64
+ from google.api import httpbody_pb2 # type: ignore
65
+ from google.api_core import operation # type: ignore
66
+ from google.api_core import operation_async # type: ignore
67
+ from google.cloud.location import locations_pb2 # type: ignore
68
+ from google.longrunning import operations_pb2 # type: ignore
69
+ from google.protobuf import any_pb2 # type: ignore
70
+ from google.protobuf import timestamp_pb2 # type: ignore
71
+
72
+ from google.cloud.discoveryengine_v1beta.types import (
73
+ common,
74
+ import_config,
75
+ purge_config,
76
+ user_event,
77
+ user_event_service,
78
+ )
79
+
80
+ from .transports.base import DEFAULT_CLIENT_INFO, UserEventServiceTransport
81
+ from .transports.grpc import UserEventServiceGrpcTransport
82
+ from .transports.grpc_asyncio import UserEventServiceGrpcAsyncIOTransport
83
+ from .transports.rest import UserEventServiceRestTransport
84
+
85
+
86
+ class UserEventServiceClientMeta(type):
87
+ """Metaclass for the UserEventService client.
88
+
89
+ This provides class-level methods for building and retrieving
90
+ support objects (e.g. transport) without polluting the client instance
91
+ objects.
92
+ """
93
+
94
+ _transport_registry = (
95
+ OrderedDict()
96
+ ) # type: Dict[str, Type[UserEventServiceTransport]]
97
+ _transport_registry["grpc"] = UserEventServiceGrpcTransport
98
+ _transport_registry["grpc_asyncio"] = UserEventServiceGrpcAsyncIOTransport
99
+ _transport_registry["rest"] = UserEventServiceRestTransport
100
+
101
+ def get_transport_class(
102
+ cls,
103
+ label: Optional[str] = None,
104
+ ) -> Type[UserEventServiceTransport]:
105
+ """Returns an appropriate transport class.
106
+
107
+ Args:
108
+ label: The name of the desired transport. If none is
109
+ provided, then the first transport in the registry is used.
110
+
111
+ Returns:
112
+ The transport class to use.
113
+ """
114
+ # If a specific transport is requested, return that one.
115
+ if label:
116
+ return cls._transport_registry[label]
117
+
118
+ # No transport is requested; return the default (that is, the first one
119
+ # in the dictionary).
120
+ return next(iter(cls._transport_registry.values()))
121
+
122
+
123
+ class UserEventServiceClient(metaclass=UserEventServiceClientMeta):
124
+ """Service for ingesting end user actions on a website to
125
+ Discovery Engine API.
126
+ """
127
+
128
+ @staticmethod
129
+ def _get_default_mtls_endpoint(api_endpoint):
130
+ """Converts api endpoint to mTLS endpoint.
131
+
132
+ Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
133
+ "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
134
+ Args:
135
+ api_endpoint (Optional[str]): the api endpoint to convert.
136
+ Returns:
137
+ str: converted mTLS api endpoint.
138
+ """
139
+ if not api_endpoint:
140
+ return api_endpoint
141
+
142
+ mtls_endpoint_re = re.compile(
143
+ r"(?P<name>[^.]+)(?P<mtls>\.mtls)?(?P<sandbox>\.sandbox)?(?P<googledomain>\.googleapis\.com)?"
144
+ )
145
+
146
+ m = mtls_endpoint_re.match(api_endpoint)
147
+ name, mtls, sandbox, googledomain = m.groups()
148
+ if mtls or not googledomain:
149
+ return api_endpoint
150
+
151
+ if sandbox:
152
+ return api_endpoint.replace(
153
+ "sandbox.googleapis.com", "mtls.sandbox.googleapis.com"
154
+ )
155
+
156
+ return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")
157
+
158
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
159
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
160
+ DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore
161
+ DEFAULT_ENDPOINT
162
+ )
163
+
164
+ _DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.{UNIVERSE_DOMAIN}"
165
+ _DEFAULT_UNIVERSE = "googleapis.com"
166
+
167
+ @classmethod
168
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
169
+ """Creates an instance of this client using the provided credentials
170
+ info.
171
+
172
+ Args:
173
+ info (dict): The service account private key info.
174
+ args: Additional arguments to pass to the constructor.
175
+ kwargs: Additional arguments to pass to the constructor.
176
+
177
+ Returns:
178
+ UserEventServiceClient: The constructed client.
179
+ """
180
+ credentials = service_account.Credentials.from_service_account_info(info)
181
+ kwargs["credentials"] = credentials
182
+ return cls(*args, **kwargs)
183
+
184
+ @classmethod
185
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
186
+ """Creates an instance of this client using the provided credentials
187
+ file.
188
+
189
+ Args:
190
+ filename (str): The path to the service account private key json
191
+ file.
192
+ args: Additional arguments to pass to the constructor.
193
+ kwargs: Additional arguments to pass to the constructor.
194
+
195
+ Returns:
196
+ UserEventServiceClient: The constructed client.
197
+ """
198
+ credentials = service_account.Credentials.from_service_account_file(filename)
199
+ kwargs["credentials"] = credentials
200
+ return cls(*args, **kwargs)
201
+
202
+ from_service_account_json = from_service_account_file
203
+
204
+ @property
205
+ def transport(self) -> UserEventServiceTransport:
206
+ """Returns the transport used by the client instance.
207
+
208
+ Returns:
209
+ UserEventServiceTransport: The transport used by the client
210
+ instance.
211
+ """
212
+ return self._transport
213
+
214
+ @staticmethod
215
+ def data_store_path(
216
+ project: str,
217
+ location: str,
218
+ data_store: str,
219
+ ) -> str:
220
+ """Returns a fully-qualified data_store string."""
221
+ return "projects/{project}/locations/{location}/dataStores/{data_store}".format(
222
+ project=project,
223
+ location=location,
224
+ data_store=data_store,
225
+ )
226
+
227
+ @staticmethod
228
+ def parse_data_store_path(path: str) -> Dict[str, str]:
229
+ """Parses a data_store path into its component segments."""
230
+ m = re.match(
231
+ r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/dataStores/(?P<data_store>.+?)$",
232
+ path,
233
+ )
234
+ return m.groupdict() if m else {}
235
+
236
+ @staticmethod
237
+ def document_path(
238
+ project: str,
239
+ location: str,
240
+ data_store: str,
241
+ branch: str,
242
+ document: str,
243
+ ) -> str:
244
+ """Returns a fully-qualified document string."""
245
+ return "projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}".format(
246
+ project=project,
247
+ location=location,
248
+ data_store=data_store,
249
+ branch=branch,
250
+ document=document,
251
+ )
252
+
253
+ @staticmethod
254
+ def parse_document_path(path: str) -> Dict[str, str]:
255
+ """Parses a document path into its component segments."""
256
+ m = re.match(
257
+ r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/dataStores/(?P<data_store>.+?)/branches/(?P<branch>.+?)/documents/(?P<document>.+?)$",
258
+ path,
259
+ )
260
+ return m.groupdict() if m else {}
261
+
262
+ @staticmethod
263
+ def engine_path(
264
+ project: str,
265
+ location: str,
266
+ collection: str,
267
+ engine: str,
268
+ ) -> str:
269
+ """Returns a fully-qualified engine string."""
270
+ return "projects/{project}/locations/{location}/collections/{collection}/engines/{engine}".format(
271
+ project=project,
272
+ location=location,
273
+ collection=collection,
274
+ engine=engine,
275
+ )
276
+
277
+ @staticmethod
278
+ def parse_engine_path(path: str) -> Dict[str, str]:
279
+ """Parses a engine path into its component segments."""
280
+ m = re.match(
281
+ r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/collections/(?P<collection>.+?)/engines/(?P<engine>.+?)$",
282
+ path,
283
+ )
284
+ return m.groupdict() if m else {}
285
+
286
+ @staticmethod
287
+ def common_billing_account_path(
288
+ billing_account: str,
289
+ ) -> str:
290
+ """Returns a fully-qualified billing_account string."""
291
+ return "billingAccounts/{billing_account}".format(
292
+ billing_account=billing_account,
293
+ )
294
+
295
+ @staticmethod
296
+ def parse_common_billing_account_path(path: str) -> Dict[str, str]:
297
+ """Parse a billing_account path into its component segments."""
298
+ m = re.match(r"^billingAccounts/(?P<billing_account>.+?)$", path)
299
+ return m.groupdict() if m else {}
300
+
301
+ @staticmethod
302
+ def common_folder_path(
303
+ folder: str,
304
+ ) -> str:
305
+ """Returns a fully-qualified folder string."""
306
+ return "folders/{folder}".format(
307
+ folder=folder,
308
+ )
309
+
310
+ @staticmethod
311
+ def parse_common_folder_path(path: str) -> Dict[str, str]:
312
+ """Parse a folder path into its component segments."""
313
+ m = re.match(r"^folders/(?P<folder>.+?)$", path)
314
+ return m.groupdict() if m else {}
315
+
316
+ @staticmethod
317
+ def common_organization_path(
318
+ organization: str,
319
+ ) -> str:
320
+ """Returns a fully-qualified organization string."""
321
+ return "organizations/{organization}".format(
322
+ organization=organization,
323
+ )
324
+
325
+ @staticmethod
326
+ def parse_common_organization_path(path: str) -> Dict[str, str]:
327
+ """Parse a organization path into its component segments."""
328
+ m = re.match(r"^organizations/(?P<organization>.+?)$", path)
329
+ return m.groupdict() if m else {}
330
+
331
+ @staticmethod
332
+ def common_project_path(
333
+ project: str,
334
+ ) -> str:
335
+ """Returns a fully-qualified project string."""
336
+ return "projects/{project}".format(
337
+ project=project,
338
+ )
339
+
340
+ @staticmethod
341
+ def parse_common_project_path(path: str) -> Dict[str, str]:
342
+ """Parse a project path into its component segments."""
343
+ m = re.match(r"^projects/(?P<project>.+?)$", path)
344
+ return m.groupdict() if m else {}
345
+
346
+ @staticmethod
347
+ def common_location_path(
348
+ project: str,
349
+ location: str,
350
+ ) -> str:
351
+ """Returns a fully-qualified location string."""
352
+ return "projects/{project}/locations/{location}".format(
353
+ project=project,
354
+ location=location,
355
+ )
356
+
357
+ @staticmethod
358
+ def parse_common_location_path(path: str) -> Dict[str, str]:
359
+ """Parse a location path into its component segments."""
360
+ m = re.match(r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)$", path)
361
+ return m.groupdict() if m else {}
362
+
363
+ @classmethod
364
+ def get_mtls_endpoint_and_cert_source(
365
+ cls, client_options: Optional[client_options_lib.ClientOptions] = None
366
+ ):
367
+ """Deprecated. Return the API endpoint and client cert source for mutual TLS.
368
+
369
+ The client cert source is determined in the following order:
370
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
371
+ client cert source is None.
372
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
373
+ default client cert source exists, use the default one; otherwise the client cert
374
+ source is None.
375
+
376
+ The API endpoint is determined in the following order:
377
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
378
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
379
+ default mTLS endpoint; if the environment variable is "never", use the default API
380
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
381
+ use the default API endpoint.
382
+
383
+ More details can be found at https://google.aip.dev/auth/4114.
384
+
385
+ Args:
386
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
387
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
388
+ in this method.
389
+
390
+ Returns:
391
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
392
+ client cert source to use.
393
+
394
+ Raises:
395
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
396
+ """
397
+
398
+ warnings.warn(
399
+ "get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.",
400
+ DeprecationWarning,
401
+ )
402
+ if client_options is None:
403
+ client_options = client_options_lib.ClientOptions()
404
+ use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")
405
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
406
+ if use_client_cert not in ("true", "false"):
407
+ raise ValueError(
408
+ "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
409
+ )
410
+ if use_mtls_endpoint not in ("auto", "never", "always"):
411
+ raise MutualTLSChannelError(
412
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
413
+ )
414
+
415
+ # Figure out the client cert source to use.
416
+ client_cert_source = None
417
+ if use_client_cert == "true":
418
+ if client_options.client_cert_source:
419
+ client_cert_source = client_options.client_cert_source
420
+ elif mtls.has_default_client_cert_source():
421
+ client_cert_source = mtls.default_client_cert_source()
422
+
423
+ # Figure out which api endpoint to use.
424
+ if client_options.api_endpoint is not None:
425
+ api_endpoint = client_options.api_endpoint
426
+ elif use_mtls_endpoint == "always" or (
427
+ use_mtls_endpoint == "auto" and client_cert_source
428
+ ):
429
+ api_endpoint = cls.DEFAULT_MTLS_ENDPOINT
430
+ else:
431
+ api_endpoint = cls.DEFAULT_ENDPOINT
432
+
433
+ return api_endpoint, client_cert_source
434
+
435
+ @staticmethod
436
+ def _read_environment_variables():
437
+ """Returns the environment variables used by the client.
438
+
439
+ Returns:
440
+ Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE,
441
+ GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables.
442
+
443
+ Raises:
444
+ ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not
445
+ any of ["true", "false"].
446
+ google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
447
+ is not any of ["auto", "never", "always"].
448
+ """
449
+ use_client_cert = os.getenv(
450
+ "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
451
+ ).lower()
452
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
453
+ universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
454
+ if use_client_cert not in ("true", "false"):
455
+ raise ValueError(
456
+ "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
457
+ )
458
+ if use_mtls_endpoint not in ("auto", "never", "always"):
459
+ raise MutualTLSChannelError(
460
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
461
+ )
462
+ return use_client_cert == "true", use_mtls_endpoint, universe_domain_env
463
+
464
+ @staticmethod
465
+ def _get_client_cert_source(provided_cert_source, use_cert_flag):
466
+ """Return the client cert source to be used by the client.
467
+
468
+ Args:
469
+ provided_cert_source (bytes): The client certificate source provided.
470
+ use_cert_flag (bool): A flag indicating whether to use the client certificate.
471
+
472
+ Returns:
473
+ bytes or None: The client cert source to be used by the client.
474
+ """
475
+ client_cert_source = None
476
+ if use_cert_flag:
477
+ if provided_cert_source:
478
+ client_cert_source = provided_cert_source
479
+ elif mtls.has_default_client_cert_source():
480
+ client_cert_source = mtls.default_client_cert_source()
481
+ return client_cert_source
482
+
483
+ @staticmethod
484
+ def _get_api_endpoint(
485
+ api_override, client_cert_source, universe_domain, use_mtls_endpoint
486
+ ):
487
+ """Return the API endpoint used by the client.
488
+
489
+ Args:
490
+ api_override (str): The API endpoint override. If specified, this is always
491
+ the return value of this function and the other arguments are not used.
492
+ client_cert_source (bytes): The client certificate source used by the client.
493
+ universe_domain (str): The universe domain used by the client.
494
+ use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters.
495
+ Possible values are "always", "auto", or "never".
496
+
497
+ Returns:
498
+ str: The API endpoint to be used by the client.
499
+ """
500
+ if api_override is not None:
501
+ api_endpoint = api_override
502
+ elif use_mtls_endpoint == "always" or (
503
+ use_mtls_endpoint == "auto" and client_cert_source
504
+ ):
505
+ _default_universe = UserEventServiceClient._DEFAULT_UNIVERSE
506
+ if universe_domain != _default_universe:
507
+ raise MutualTLSChannelError(
508
+ f"mTLS is not supported in any universe other than {_default_universe}."
509
+ )
510
+ api_endpoint = UserEventServiceClient.DEFAULT_MTLS_ENDPOINT
511
+ else:
512
+ api_endpoint = UserEventServiceClient._DEFAULT_ENDPOINT_TEMPLATE.format(
513
+ UNIVERSE_DOMAIN=universe_domain
514
+ )
515
+ return api_endpoint
516
+
517
+ @staticmethod
518
+ def _get_universe_domain(
519
+ client_universe_domain: Optional[str], universe_domain_env: Optional[str]
520
+ ) -> str:
521
+ """Return the universe domain used by the client.
522
+
523
+ Args:
524
+ client_universe_domain (Optional[str]): The universe domain configured via the client options.
525
+ universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable.
526
+
527
+ Returns:
528
+ str: The universe domain to be used by the client.
529
+
530
+ Raises:
531
+ ValueError: If the universe domain is an empty string.
532
+ """
533
+ universe_domain = UserEventServiceClient._DEFAULT_UNIVERSE
534
+ if client_universe_domain is not None:
535
+ universe_domain = client_universe_domain
536
+ elif universe_domain_env is not None:
537
+ universe_domain = universe_domain_env
538
+ if len(universe_domain.strip()) == 0:
539
+ raise ValueError("Universe Domain cannot be an empty string.")
540
+ return universe_domain
541
+
542
+ def _validate_universe_domain(self):
543
+ """Validates client's and credentials' universe domains are consistent.
544
+
545
+ Returns:
546
+ bool: True iff the configured universe domain is valid.
547
+
548
+ Raises:
549
+ ValueError: If the configured universe domain is not valid.
550
+ """
551
+
552
+ # NOTE (b/349488459): universe validation is disabled until further notice.
553
+ return True
554
+
555
+ def _add_cred_info_for_auth_errors(
556
+ self, error: core_exceptions.GoogleAPICallError
557
+ ) -> None:
558
+ """Adds credential info string to error details for 401/403/404 errors.
559
+
560
+ Args:
561
+ error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
562
+ """
563
+ if error.code not in [
564
+ HTTPStatus.UNAUTHORIZED,
565
+ HTTPStatus.FORBIDDEN,
566
+ HTTPStatus.NOT_FOUND,
567
+ ]:
568
+ return
569
+
570
+ cred = self._transport._credentials
571
+
572
+ # get_cred_info is only available in google-auth>=2.35.0
573
+ if not hasattr(cred, "get_cred_info"):
574
+ return
575
+
576
+ # ignore the type check since pypy test fails when get_cred_info
577
+ # is not available
578
+ cred_info = cred.get_cred_info() # type: ignore
579
+ if cred_info and hasattr(error._details, "append"):
580
+ error._details.append(json.dumps(cred_info))
581
+
582
+ @property
583
+ def api_endpoint(self):
584
+ """Return the API endpoint used by the client instance.
585
+
586
+ Returns:
587
+ str: The API endpoint used by the client instance.
588
+ """
589
+ return self._api_endpoint
590
+
591
+ @property
592
+ def universe_domain(self) -> str:
593
+ """Return the universe domain used by the client instance.
594
+
595
+ Returns:
596
+ str: The universe domain used by the client instance.
597
+ """
598
+ return self._universe_domain
599
+
600
+ def __init__(
601
+ self,
602
+ *,
603
+ credentials: Optional[ga_credentials.Credentials] = None,
604
+ transport: Optional[
605
+ Union[
606
+ str, UserEventServiceTransport, Callable[..., UserEventServiceTransport]
607
+ ]
608
+ ] = None,
609
+ client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
610
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
611
+ ) -> None:
612
+ """Instantiates the user event service client.
613
+
614
+ Args:
615
+ credentials (Optional[google.auth.credentials.Credentials]): The
616
+ authorization credentials to attach to requests. These
617
+ credentials identify the application to the service; if none
618
+ are specified, the client will attempt to ascertain the
619
+ credentials from the environment.
620
+ transport (Optional[Union[str,UserEventServiceTransport,Callable[..., UserEventServiceTransport]]]):
621
+ The transport to use, or a Callable that constructs and returns a new transport.
622
+ If a Callable is given, it will be called with the same set of initialization
623
+ arguments as used in the UserEventServiceTransport constructor.
624
+ If set to None, a transport is chosen automatically.
625
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
626
+ Custom options for the client.
627
+
628
+ 1. The ``api_endpoint`` property can be used to override the
629
+ default endpoint provided by the client when ``transport`` is
630
+ not explicitly provided. Only if this property is not set and
631
+ ``transport`` was not explicitly provided, the endpoint is
632
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
633
+ variable, which have one of the following values:
634
+ "always" (always use the default mTLS endpoint), "never" (always
635
+ use the default regular endpoint) and "auto" (auto-switch to the
636
+ default mTLS endpoint if client certificate is present; this is
637
+ the default value).
638
+
639
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
640
+ is "true", then the ``client_cert_source`` property can be used
641
+ to provide a client certificate for mTLS transport. If
642
+ not provided, the default SSL client certificate will be used if
643
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
644
+ set, no client certificate will be used.
645
+
646
+ 3. The ``universe_domain`` property can be used to override the
647
+ default "googleapis.com" universe. Note that the ``api_endpoint``
648
+ property still takes precedence; and ``universe_domain`` is
649
+ currently not supported for mTLS.
650
+
651
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
652
+ The client info used to send a user-agent string along with
653
+ API requests. If ``None``, then default info will be used.
654
+ Generally, you only need to set this if you're developing
655
+ your own client library.
656
+
657
+ Raises:
658
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
659
+ creation failed for any reason.
660
+ """
661
+ self._client_options = client_options
662
+ if isinstance(self._client_options, dict):
663
+ self._client_options = client_options_lib.from_dict(self._client_options)
664
+ if self._client_options is None:
665
+ self._client_options = client_options_lib.ClientOptions()
666
+ self._client_options = cast(
667
+ client_options_lib.ClientOptions, self._client_options
668
+ )
669
+
670
+ universe_domain_opt = getattr(self._client_options, "universe_domain", None)
671
+
672
+ (
673
+ self._use_client_cert,
674
+ self._use_mtls_endpoint,
675
+ self._universe_domain_env,
676
+ ) = UserEventServiceClient._read_environment_variables()
677
+ self._client_cert_source = UserEventServiceClient._get_client_cert_source(
678
+ self._client_options.client_cert_source, self._use_client_cert
679
+ )
680
+ self._universe_domain = UserEventServiceClient._get_universe_domain(
681
+ universe_domain_opt, self._universe_domain_env
682
+ )
683
+ self._api_endpoint = None # updated below, depending on `transport`
684
+
685
+ # Initialize the universe domain validation.
686
+ self._is_universe_domain_valid = False
687
+
688
+ if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER
689
+ # Setup logging.
690
+ client_logging.initialize_logging()
691
+
692
+ api_key_value = getattr(self._client_options, "api_key", None)
693
+ if api_key_value and credentials:
694
+ raise ValueError(
695
+ "client_options.api_key and credentials are mutually exclusive"
696
+ )
697
+
698
+ # Save or instantiate the transport.
699
+ # Ordinarily, we provide the transport, but allowing a custom transport
700
+ # instance provides an extensibility point for unusual situations.
701
+ transport_provided = isinstance(transport, UserEventServiceTransport)
702
+ if transport_provided:
703
+ # transport is a UserEventServiceTransport instance.
704
+ if credentials or self._client_options.credentials_file or api_key_value:
705
+ raise ValueError(
706
+ "When providing a transport instance, "
707
+ "provide its credentials directly."
708
+ )
709
+ if self._client_options.scopes:
710
+ raise ValueError(
711
+ "When providing a transport instance, provide its scopes "
712
+ "directly."
713
+ )
714
+ self._transport = cast(UserEventServiceTransport, transport)
715
+ self._api_endpoint = self._transport.host
716
+
717
+ self._api_endpoint = (
718
+ self._api_endpoint
719
+ or UserEventServiceClient._get_api_endpoint(
720
+ self._client_options.api_endpoint,
721
+ self._client_cert_source,
722
+ self._universe_domain,
723
+ self._use_mtls_endpoint,
724
+ )
725
+ )
726
+
727
+ if not transport_provided:
728
+ import google.auth._default # type: ignore
729
+
730
+ if api_key_value and hasattr(
731
+ google.auth._default, "get_api_key_credentials"
732
+ ):
733
+ credentials = google.auth._default.get_api_key_credentials(
734
+ api_key_value
735
+ )
736
+
737
+ transport_init: Union[
738
+ Type[UserEventServiceTransport],
739
+ Callable[..., UserEventServiceTransport],
740
+ ] = (
741
+ UserEventServiceClient.get_transport_class(transport)
742
+ if isinstance(transport, str) or transport is None
743
+ else cast(Callable[..., UserEventServiceTransport], transport)
744
+ )
745
+ # initialize with the provided callable or the passed in class
746
+ self._transport = transport_init(
747
+ credentials=credentials,
748
+ credentials_file=self._client_options.credentials_file,
749
+ host=self._api_endpoint,
750
+ scopes=self._client_options.scopes,
751
+ client_cert_source_for_mtls=self._client_cert_source,
752
+ quota_project_id=self._client_options.quota_project_id,
753
+ client_info=client_info,
754
+ always_use_jwt_access=True,
755
+ api_audience=self._client_options.api_audience,
756
+ )
757
+
758
+ if "async" not in str(self._transport):
759
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
760
+ std_logging.DEBUG
761
+ ): # pragma: NO COVER
762
+ _LOGGER.debug(
763
+ "Created client `google.cloud.discoveryengine_v1beta.UserEventServiceClient`.",
764
+ extra={
765
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
766
+ "universeDomain": getattr(
767
+ self._transport._credentials, "universe_domain", ""
768
+ ),
769
+ "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}",
770
+ "credentialsInfo": getattr(
771
+ self.transport._credentials, "get_cred_info", lambda: None
772
+ )(),
773
+ }
774
+ if hasattr(self._transport, "_credentials")
775
+ else {
776
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
777
+ "credentialsType": None,
778
+ },
779
+ )
780
+
781
+ def write_user_event(
782
+ self,
783
+ request: Optional[Union[user_event_service.WriteUserEventRequest, dict]] = None,
784
+ *,
785
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
786
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
787
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
788
+ ) -> user_event.UserEvent:
789
+ r"""Writes a single user event.
790
+
791
+ .. code-block:: python
792
+
793
+ # This snippet has been automatically generated and should be regarded as a
794
+ # code template only.
795
+ # It will require modifications to work:
796
+ # - It may require correct/in-range values for request initialization.
797
+ # - It may require specifying regional endpoints when creating the service
798
+ # client as shown in:
799
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
800
+ from google.cloud import discoveryengine_v1beta
801
+
802
+ def sample_write_user_event():
803
+ # Create a client
804
+ client = discoveryengine_v1beta.UserEventServiceClient()
805
+
806
+ # Initialize request argument(s)
807
+ request = discoveryengine_v1beta.WriteUserEventRequest(
808
+ parent="parent_value",
809
+ )
810
+
811
+ # Make the request
812
+ response = client.write_user_event(request=request)
813
+
814
+ # Handle the response
815
+ print(response)
816
+
817
+ Args:
818
+ request (Union[google.cloud.discoveryengine_v1beta.types.WriteUserEventRequest, dict]):
819
+ The request object. Request message for WriteUserEvent
820
+ method.
821
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
822
+ should be retried.
823
+ timeout (float): The timeout for this request.
824
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
825
+ sent along with the request as metadata. Normally, each value must be of type `str`,
826
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
827
+ be of type `bytes`.
828
+
829
+ Returns:
830
+ google.cloud.discoveryengine_v1beta.types.UserEvent:
831
+ UserEvent captures all metadata
832
+ information Discovery Engine API needs
833
+ to know about how end users interact
834
+ with your website.
835
+
836
+ """
837
+ # Create or coerce a protobuf request object.
838
+ # - Use the request object if provided (there's no risk of modifying the input as
839
+ # there are no flattened fields), or create one.
840
+ if not isinstance(request, user_event_service.WriteUserEventRequest):
841
+ request = user_event_service.WriteUserEventRequest(request)
842
+
843
+ # Wrap the RPC method; this adds retry and timeout information,
844
+ # and friendly error handling.
845
+ rpc = self._transport._wrapped_methods[self._transport.write_user_event]
846
+
847
+ # Certain fields should be provided within the metadata header;
848
+ # add these here.
849
+ metadata = tuple(metadata) + (
850
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
851
+ )
852
+
853
+ # Validate the universe domain.
854
+ self._validate_universe_domain()
855
+
856
+ # Send the request.
857
+ response = rpc(
858
+ request,
859
+ retry=retry,
860
+ timeout=timeout,
861
+ metadata=metadata,
862
+ )
863
+
864
+ # Done; return the response.
865
+ return response
866
+
867
+ def collect_user_event(
868
+ self,
869
+ request: Optional[
870
+ Union[user_event_service.CollectUserEventRequest, dict]
871
+ ] = None,
872
+ *,
873
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
874
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
875
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
876
+ ) -> httpbody_pb2.HttpBody:
877
+ r"""Writes a single user event from the browser. This
878
+ uses a GET request to due to browser restriction of
879
+ POST-ing to a third-party domain.
880
+
881
+ This method is used only by the Discovery Engine API
882
+ JavaScript pixel and Google Tag Manager. Users should
883
+ not call this method directly.
884
+
885
+ .. code-block:: python
886
+
887
+ # This snippet has been automatically generated and should be regarded as a
888
+ # code template only.
889
+ # It will require modifications to work:
890
+ # - It may require correct/in-range values for request initialization.
891
+ # - It may require specifying regional endpoints when creating the service
892
+ # client as shown in:
893
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
894
+ from google.cloud import discoveryengine_v1beta
895
+
896
+ def sample_collect_user_event():
897
+ # Create a client
898
+ client = discoveryengine_v1beta.UserEventServiceClient()
899
+
900
+ # Initialize request argument(s)
901
+ request = discoveryengine_v1beta.CollectUserEventRequest(
902
+ parent="parent_value",
903
+ user_event="user_event_value",
904
+ )
905
+
906
+ # Make the request
907
+ response = client.collect_user_event(request=request)
908
+
909
+ # Handle the response
910
+ print(response)
911
+
912
+ Args:
913
+ request (Union[google.cloud.discoveryengine_v1beta.types.CollectUserEventRequest, dict]):
914
+ The request object. Request message for CollectUserEvent
915
+ method.
916
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
917
+ should be retried.
918
+ timeout (float): The timeout for this request.
919
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
920
+ sent along with the request as metadata. Normally, each value must be of type `str`,
921
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
922
+ be of type `bytes`.
923
+
924
+ Returns:
925
+ google.api.httpbody_pb2.HttpBody:
926
+ Message that represents an arbitrary HTTP body. It should only be used for
927
+ payload formats that can't be represented as JSON,
928
+ such as raw binary or an HTML page.
929
+
930
+ This message can be used both in streaming and
931
+ non-streaming API methods in the request as well as
932
+ the response.
933
+
934
+ It can be used as a top-level request field, which is
935
+ convenient if one wants to extract parameters from
936
+ either the URL or HTTP template into the request
937
+ fields and also want access to the raw HTTP body.
938
+
939
+ Example:
940
+
941
+ message GetResourceRequest {
942
+ // A unique request id. string request_id = 1;
943
+
944
+ // The raw HTTP body is bound to this field.
945
+ google.api.HttpBody http_body = 2;
946
+
947
+ }
948
+
949
+ service ResourceService {
950
+ rpc GetResource(GetResourceRequest)
951
+ returns (google.api.HttpBody);
952
+
953
+ rpc UpdateResource(google.api.HttpBody)
954
+ returns (google.protobuf.Empty);
955
+
956
+ }
957
+
958
+ Example with streaming methods:
959
+
960
+ service CaldavService {
961
+ rpc GetCalendar(stream google.api.HttpBody)
962
+ returns (stream google.api.HttpBody);
963
+
964
+ rpc UpdateCalendar(stream google.api.HttpBody)
965
+ returns (stream google.api.HttpBody);
966
+
967
+ }
968
+
969
+ Use of this type only changes how the request and
970
+ response bodies are handled, all other features will
971
+ continue to work unchanged.
972
+
973
+ """
974
+ # Create or coerce a protobuf request object.
975
+ # - Use the request object if provided (there's no risk of modifying the input as
976
+ # there are no flattened fields), or create one.
977
+ if not isinstance(request, user_event_service.CollectUserEventRequest):
978
+ request = user_event_service.CollectUserEventRequest(request)
979
+
980
+ # Wrap the RPC method; this adds retry and timeout information,
981
+ # and friendly error handling.
982
+ rpc = self._transport._wrapped_methods[self._transport.collect_user_event]
983
+
984
+ # Certain fields should be provided within the metadata header;
985
+ # add these here.
986
+ metadata = tuple(metadata) + (
987
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
988
+ )
989
+
990
+ # Validate the universe domain.
991
+ self._validate_universe_domain()
992
+
993
+ # Send the request.
994
+ response = rpc(
995
+ request,
996
+ retry=retry,
997
+ timeout=timeout,
998
+ metadata=metadata,
999
+ )
1000
+
1001
+ # Done; return the response.
1002
+ return response
1003
+
1004
+ def purge_user_events(
1005
+ self,
1006
+ request: Optional[Union[purge_config.PurgeUserEventsRequest, dict]] = None,
1007
+ *,
1008
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1009
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1010
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1011
+ ) -> operation.Operation:
1012
+ r"""Deletes permanently all user events specified by the
1013
+ filter provided. Depending on the number of events
1014
+ specified by the filter, this operation could take hours
1015
+ or days to complete. To test a filter, use the list
1016
+ command first.
1017
+
1018
+ .. code-block:: python
1019
+
1020
+ # This snippet has been automatically generated and should be regarded as a
1021
+ # code template only.
1022
+ # It will require modifications to work:
1023
+ # - It may require correct/in-range values for request initialization.
1024
+ # - It may require specifying regional endpoints when creating the service
1025
+ # client as shown in:
1026
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1027
+ from google.cloud import discoveryengine_v1beta
1028
+
1029
+ def sample_purge_user_events():
1030
+ # Create a client
1031
+ client = discoveryengine_v1beta.UserEventServiceClient()
1032
+
1033
+ # Initialize request argument(s)
1034
+ request = discoveryengine_v1beta.PurgeUserEventsRequest(
1035
+ parent="parent_value",
1036
+ filter="filter_value",
1037
+ )
1038
+
1039
+ # Make the request
1040
+ operation = client.purge_user_events(request=request)
1041
+
1042
+ print("Waiting for operation to complete...")
1043
+
1044
+ response = operation.result()
1045
+
1046
+ # Handle the response
1047
+ print(response)
1048
+
1049
+ Args:
1050
+ request (Union[google.cloud.discoveryengine_v1beta.types.PurgeUserEventsRequest, dict]):
1051
+ The request object. Request message for PurgeUserEvents
1052
+ method.
1053
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1054
+ should be retried.
1055
+ timeout (float): The timeout for this request.
1056
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1057
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1058
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1059
+ be of type `bytes`.
1060
+
1061
+ Returns:
1062
+ google.api_core.operation.Operation:
1063
+ An object representing a long-running operation.
1064
+
1065
+ The result type for the operation will be :class:`google.cloud.discoveryengine_v1beta.types.PurgeUserEventsResponse` Response of the PurgeUserEventsRequest. If the long running operation is
1066
+ successfully done, then this message is returned by
1067
+ the google.longrunning.Operations.response field.
1068
+
1069
+ """
1070
+ # Create or coerce a protobuf request object.
1071
+ # - Use the request object if provided (there's no risk of modifying the input as
1072
+ # there are no flattened fields), or create one.
1073
+ if not isinstance(request, purge_config.PurgeUserEventsRequest):
1074
+ request = purge_config.PurgeUserEventsRequest(request)
1075
+
1076
+ # Wrap the RPC method; this adds retry and timeout information,
1077
+ # and friendly error handling.
1078
+ rpc = self._transport._wrapped_methods[self._transport.purge_user_events]
1079
+
1080
+ # Certain fields should be provided within the metadata header;
1081
+ # add these here.
1082
+ metadata = tuple(metadata) + (
1083
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1084
+ )
1085
+
1086
+ # Validate the universe domain.
1087
+ self._validate_universe_domain()
1088
+
1089
+ # Send the request.
1090
+ response = rpc(
1091
+ request,
1092
+ retry=retry,
1093
+ timeout=timeout,
1094
+ metadata=metadata,
1095
+ )
1096
+
1097
+ # Wrap the response in an operation future.
1098
+ response = operation.from_gapic(
1099
+ response,
1100
+ self._transport.operations_client,
1101
+ purge_config.PurgeUserEventsResponse,
1102
+ metadata_type=purge_config.PurgeUserEventsMetadata,
1103
+ )
1104
+
1105
+ # Done; return the response.
1106
+ return response
1107
+
1108
+ def import_user_events(
1109
+ self,
1110
+ request: Optional[Union[import_config.ImportUserEventsRequest, dict]] = None,
1111
+ *,
1112
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1113
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1114
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1115
+ ) -> operation.Operation:
1116
+ r"""Bulk import of user events. Request processing might
1117
+ be synchronous. Events that already exist are skipped.
1118
+ Use this method for backfilling historical user events.
1119
+
1120
+ Operation.response is of type ImportResponse. Note that
1121
+ it is possible for a subset of the items to be
1122
+ successfully inserted. Operation.metadata is of type
1123
+ ImportMetadata.
1124
+
1125
+ .. code-block:: python
1126
+
1127
+ # This snippet has been automatically generated and should be regarded as a
1128
+ # code template only.
1129
+ # It will require modifications to work:
1130
+ # - It may require correct/in-range values for request initialization.
1131
+ # - It may require specifying regional endpoints when creating the service
1132
+ # client as shown in:
1133
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1134
+ from google.cloud import discoveryengine_v1beta
1135
+
1136
+ def sample_import_user_events():
1137
+ # Create a client
1138
+ client = discoveryengine_v1beta.UserEventServiceClient()
1139
+
1140
+ # Initialize request argument(s)
1141
+ inline_source = discoveryengine_v1beta.InlineSource()
1142
+ inline_source.user_events.event_type = "event_type_value"
1143
+ inline_source.user_events.user_pseudo_id = "user_pseudo_id_value"
1144
+
1145
+ request = discoveryengine_v1beta.ImportUserEventsRequest(
1146
+ inline_source=inline_source,
1147
+ parent="parent_value",
1148
+ )
1149
+
1150
+ # Make the request
1151
+ operation = client.import_user_events(request=request)
1152
+
1153
+ print("Waiting for operation to complete...")
1154
+
1155
+ response = operation.result()
1156
+
1157
+ # Handle the response
1158
+ print(response)
1159
+
1160
+ Args:
1161
+ request (Union[google.cloud.discoveryengine_v1beta.types.ImportUserEventsRequest, dict]):
1162
+ The request object. Request message for the
1163
+ ImportUserEvents request.
1164
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1165
+ should be retried.
1166
+ timeout (float): The timeout for this request.
1167
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1168
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1169
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1170
+ be of type `bytes`.
1171
+
1172
+ Returns:
1173
+ google.api_core.operation.Operation:
1174
+ An object representing a long-running operation.
1175
+
1176
+ The result type for the operation will be :class:`google.cloud.discoveryengine_v1beta.types.ImportUserEventsResponse` Response of the ImportUserEventsRequest. If the long running
1177
+ operation was successful, then this message is
1178
+ returned by the
1179
+ google.longrunning.Operations.response field if the
1180
+ operation was successful.
1181
+
1182
+ """
1183
+ # Create or coerce a protobuf request object.
1184
+ # - Use the request object if provided (there's no risk of modifying the input as
1185
+ # there are no flattened fields), or create one.
1186
+ if not isinstance(request, import_config.ImportUserEventsRequest):
1187
+ request = import_config.ImportUserEventsRequest(request)
1188
+
1189
+ # Wrap the RPC method; this adds retry and timeout information,
1190
+ # and friendly error handling.
1191
+ rpc = self._transport._wrapped_methods[self._transport.import_user_events]
1192
+
1193
+ # Certain fields should be provided within the metadata header;
1194
+ # add these here.
1195
+ metadata = tuple(metadata) + (
1196
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1197
+ )
1198
+
1199
+ # Validate the universe domain.
1200
+ self._validate_universe_domain()
1201
+
1202
+ # Send the request.
1203
+ response = rpc(
1204
+ request,
1205
+ retry=retry,
1206
+ timeout=timeout,
1207
+ metadata=metadata,
1208
+ )
1209
+
1210
+ # Wrap the response in an operation future.
1211
+ response = operation.from_gapic(
1212
+ response,
1213
+ self._transport.operations_client,
1214
+ import_config.ImportUserEventsResponse,
1215
+ metadata_type=import_config.ImportUserEventsMetadata,
1216
+ )
1217
+
1218
+ # Done; return the response.
1219
+ return response
1220
+
1221
+ def __enter__(self) -> "UserEventServiceClient":
1222
+ return self
1223
+
1224
+ def __exit__(self, type, value, traceback):
1225
+ """Releases underlying transport's resources.
1226
+
1227
+ .. warning::
1228
+ ONLY use as a context manager if the transport is NOT shared
1229
+ with other clients! Exiting the with block will CLOSE the transport
1230
+ and may cause errors in other clients!
1231
+ """
1232
+ self.transport.close()
1233
+
1234
+ def list_operations(
1235
+ self,
1236
+ request: Optional[operations_pb2.ListOperationsRequest] = None,
1237
+ *,
1238
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1239
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1240
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1241
+ ) -> operations_pb2.ListOperationsResponse:
1242
+ r"""Lists operations that match the specified filter in the request.
1243
+
1244
+ Args:
1245
+ request (:class:`~.operations_pb2.ListOperationsRequest`):
1246
+ The request object. Request message for
1247
+ `ListOperations` method.
1248
+ retry (google.api_core.retry.Retry): Designation of what errors,
1249
+ if any, should be retried.
1250
+ timeout (float): The timeout for this request.
1251
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1252
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1253
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1254
+ be of type `bytes`.
1255
+ Returns:
1256
+ ~.operations_pb2.ListOperationsResponse:
1257
+ Response message for ``ListOperations`` method.
1258
+ """
1259
+ # Create or coerce a protobuf request object.
1260
+ # The request isn't a proto-plus wrapped type,
1261
+ # so it must be constructed via keyword expansion.
1262
+ if isinstance(request, dict):
1263
+ request = operations_pb2.ListOperationsRequest(**request)
1264
+
1265
+ # Wrap the RPC method; this adds retry and timeout information,
1266
+ # and friendly error handling.
1267
+ rpc = self._transport._wrapped_methods[self._transport.list_operations]
1268
+
1269
+ # Certain fields should be provided within the metadata header;
1270
+ # add these here.
1271
+ metadata = tuple(metadata) + (
1272
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1273
+ )
1274
+
1275
+ # Validate the universe domain.
1276
+ self._validate_universe_domain()
1277
+
1278
+ try:
1279
+ # Send the request.
1280
+ response = rpc(
1281
+ request,
1282
+ retry=retry,
1283
+ timeout=timeout,
1284
+ metadata=metadata,
1285
+ )
1286
+
1287
+ # Done; return the response.
1288
+ return response
1289
+ except core_exceptions.GoogleAPICallError as e:
1290
+ self._add_cred_info_for_auth_errors(e)
1291
+ raise e
1292
+
1293
+ def get_operation(
1294
+ self,
1295
+ request: Optional[operations_pb2.GetOperationRequest] = None,
1296
+ *,
1297
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1298
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1299
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1300
+ ) -> operations_pb2.Operation:
1301
+ r"""Gets the latest state of a long-running operation.
1302
+
1303
+ Args:
1304
+ request (:class:`~.operations_pb2.GetOperationRequest`):
1305
+ The request object. Request message for
1306
+ `GetOperation` method.
1307
+ retry (google.api_core.retry.Retry): Designation of what errors,
1308
+ if any, should be retried.
1309
+ timeout (float): The timeout for this request.
1310
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1311
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1312
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1313
+ be of type `bytes`.
1314
+ Returns:
1315
+ ~.operations_pb2.Operation:
1316
+ An ``Operation`` object.
1317
+ """
1318
+ # Create or coerce a protobuf request object.
1319
+ # The request isn't a proto-plus wrapped type,
1320
+ # so it must be constructed via keyword expansion.
1321
+ if isinstance(request, dict):
1322
+ request = operations_pb2.GetOperationRequest(**request)
1323
+
1324
+ # Wrap the RPC method; this adds retry and timeout information,
1325
+ # and friendly error handling.
1326
+ rpc = self._transport._wrapped_methods[self._transport.get_operation]
1327
+
1328
+ # Certain fields should be provided within the metadata header;
1329
+ # add these here.
1330
+ metadata = tuple(metadata) + (
1331
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1332
+ )
1333
+
1334
+ # Validate the universe domain.
1335
+ self._validate_universe_domain()
1336
+
1337
+ try:
1338
+ # Send the request.
1339
+ response = rpc(
1340
+ request,
1341
+ retry=retry,
1342
+ timeout=timeout,
1343
+ metadata=metadata,
1344
+ )
1345
+
1346
+ # Done; return the response.
1347
+ return response
1348
+ except core_exceptions.GoogleAPICallError as e:
1349
+ self._add_cred_info_for_auth_errors(e)
1350
+ raise e
1351
+
1352
+ def cancel_operation(
1353
+ self,
1354
+ request: Optional[operations_pb2.CancelOperationRequest] = None,
1355
+ *,
1356
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1357
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1358
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1359
+ ) -> None:
1360
+ r"""Starts asynchronous cancellation on a long-running operation.
1361
+
1362
+ The server makes a best effort to cancel the operation, but success
1363
+ is not guaranteed. If the server doesn't support this method, it returns
1364
+ `google.rpc.Code.UNIMPLEMENTED`.
1365
+
1366
+ Args:
1367
+ request (:class:`~.operations_pb2.CancelOperationRequest`):
1368
+ The request object. Request message for
1369
+ `CancelOperation` method.
1370
+ retry (google.api_core.retry.Retry): Designation of what errors,
1371
+ if any, should be retried.
1372
+ timeout (float): The timeout for this request.
1373
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1374
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1375
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1376
+ be of type `bytes`.
1377
+ Returns:
1378
+ None
1379
+ """
1380
+ # Create or coerce a protobuf request object.
1381
+ # The request isn't a proto-plus wrapped type,
1382
+ # so it must be constructed via keyword expansion.
1383
+ if isinstance(request, dict):
1384
+ request = operations_pb2.CancelOperationRequest(**request)
1385
+
1386
+ # Wrap the RPC method; this adds retry and timeout information,
1387
+ # and friendly error handling.
1388
+ rpc = self._transport._wrapped_methods[self._transport.cancel_operation]
1389
+
1390
+ # Certain fields should be provided within the metadata header;
1391
+ # add these here.
1392
+ metadata = tuple(metadata) + (
1393
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1394
+ )
1395
+
1396
+ # Validate the universe domain.
1397
+ self._validate_universe_domain()
1398
+
1399
+ # Send the request.
1400
+ rpc(
1401
+ request,
1402
+ retry=retry,
1403
+ timeout=timeout,
1404
+ metadata=metadata,
1405
+ )
1406
+
1407
+
1408
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1409
+ gapic_version=package_version.__version__
1410
+ )
1411
+
1412
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1413
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1414
+
1415
+ __all__ = ("UserEventServiceClient",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/transports/__init__.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from collections import OrderedDict
17
+ from typing import Dict, Type
18
+
19
+ from .base import UserEventServiceTransport
20
+ from .grpc import UserEventServiceGrpcTransport
21
+ from .grpc_asyncio import UserEventServiceGrpcAsyncIOTransport
22
+ from .rest import UserEventServiceRestInterceptor, UserEventServiceRestTransport
23
+
24
+ # Compile a registry of transports.
25
+ _transport_registry = OrderedDict() # type: Dict[str, Type[UserEventServiceTransport]]
26
+ _transport_registry["grpc"] = UserEventServiceGrpcTransport
27
+ _transport_registry["grpc_asyncio"] = UserEventServiceGrpcAsyncIOTransport
28
+ _transport_registry["rest"] = UserEventServiceRestTransport
29
+
30
+ __all__ = (
31
+ "UserEventServiceTransport",
32
+ "UserEventServiceGrpcTransport",
33
+ "UserEventServiceGrpcAsyncIOTransport",
34
+ "UserEventServiceRestTransport",
35
+ "UserEventServiceRestInterceptor",
36
+ )
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/transports/base.py ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import abc
17
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18
+
19
+ from google.api import httpbody_pb2 # type: ignore
20
+ import google.api_core
21
+ from google.api_core import exceptions as core_exceptions
22
+ from google.api_core import gapic_v1, operations_v1
23
+ from google.api_core import retry as retries
24
+ import google.auth # type: ignore
25
+ from google.auth import credentials as ga_credentials # type: ignore
26
+ from google.cloud.location import locations_pb2 # type: ignore
27
+ from google.longrunning import operations_pb2 # type: ignore
28
+ from google.oauth2 import service_account # type: ignore
29
+ import google.protobuf
30
+
31
+ from google.cloud.discoveryengine_v1beta import gapic_version as package_version
32
+ from google.cloud.discoveryengine_v1beta.types import (
33
+ import_config,
34
+ purge_config,
35
+ user_event,
36
+ user_event_service,
37
+ )
38
+
39
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
40
+ gapic_version=package_version.__version__
41
+ )
42
+
43
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
44
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
45
+
46
+
47
+ class UserEventServiceTransport(abc.ABC):
48
+ """Abstract transport class for UserEventService."""
49
+
50
+ AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",)
51
+
52
+ DEFAULT_HOST: str = "discoveryengine.googleapis.com"
53
+
54
+ def __init__(
55
+ self,
56
+ *,
57
+ host: str = DEFAULT_HOST,
58
+ credentials: Optional[ga_credentials.Credentials] = None,
59
+ credentials_file: Optional[str] = None,
60
+ scopes: Optional[Sequence[str]] = None,
61
+ quota_project_id: Optional[str] = None,
62
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
63
+ always_use_jwt_access: Optional[bool] = False,
64
+ api_audience: Optional[str] = None,
65
+ **kwargs,
66
+ ) -> None:
67
+ """Instantiate the transport.
68
+
69
+ Args:
70
+ host (Optional[str]):
71
+ The hostname to connect to (default: 'discoveryengine.googleapis.com').
72
+ credentials (Optional[google.auth.credentials.Credentials]): The
73
+ authorization credentials to attach to requests. These
74
+ credentials identify the application to the service; if none
75
+ are specified, the client will attempt to ascertain the
76
+ credentials from the environment.
77
+ credentials_file (Optional[str]): A file with credentials that can
78
+ be loaded with :func:`google.auth.load_credentials_from_file`.
79
+ This argument is mutually exclusive with credentials.
80
+ scopes (Optional[Sequence[str]]): A list of scopes.
81
+ quota_project_id (Optional[str]): An optional project to use for billing
82
+ and quota.
83
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
84
+ The client info used to send a user-agent string along with
85
+ API requests. If ``None``, then default info will be used.
86
+ Generally, you only need to set this if you're developing
87
+ your own client library.
88
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
89
+ be used for service account credentials.
90
+ """
91
+
92
+ scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
93
+
94
+ # Save the scopes.
95
+ self._scopes = scopes
96
+ if not hasattr(self, "_ignore_credentials"):
97
+ self._ignore_credentials: bool = False
98
+
99
+ # If no credentials are provided, then determine the appropriate
100
+ # defaults.
101
+ if credentials and credentials_file:
102
+ raise core_exceptions.DuplicateCredentialArgs(
103
+ "'credentials_file' and 'credentials' are mutually exclusive"
104
+ )
105
+
106
+ if credentials_file is not None:
107
+ credentials, _ = google.auth.load_credentials_from_file(
108
+ credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
109
+ )
110
+ elif credentials is None and not self._ignore_credentials:
111
+ credentials, _ = google.auth.default(
112
+ **scopes_kwargs, quota_project_id=quota_project_id
113
+ )
114
+ # Don't apply audience if the credentials file passed from user.
115
+ if hasattr(credentials, "with_gdch_audience"):
116
+ credentials = credentials.with_gdch_audience(
117
+ api_audience if api_audience else host
118
+ )
119
+
120
+ # If the credentials are service account credentials, then always try to use self signed JWT.
121
+ if (
122
+ always_use_jwt_access
123
+ and isinstance(credentials, service_account.Credentials)
124
+ and hasattr(service_account.Credentials, "with_always_use_jwt_access")
125
+ ):
126
+ credentials = credentials.with_always_use_jwt_access(True)
127
+
128
+ # Save the credentials.
129
+ self._credentials = credentials
130
+
131
+ # Save the hostname. Default to port 443 (HTTPS) if none is specified.
132
+ if ":" not in host:
133
+ host += ":443"
134
+ self._host = host
135
+
136
+ @property
137
+ def host(self):
138
+ return self._host
139
+
140
+ def _prep_wrapped_messages(self, client_info):
141
+ # Precompute the wrapped methods.
142
+ self._wrapped_methods = {
143
+ self.write_user_event: gapic_v1.method.wrap_method(
144
+ self.write_user_event,
145
+ default_timeout=None,
146
+ client_info=client_info,
147
+ ),
148
+ self.collect_user_event: gapic_v1.method.wrap_method(
149
+ self.collect_user_event,
150
+ default_timeout=None,
151
+ client_info=client_info,
152
+ ),
153
+ self.purge_user_events: gapic_v1.method.wrap_method(
154
+ self.purge_user_events,
155
+ default_timeout=None,
156
+ client_info=client_info,
157
+ ),
158
+ self.import_user_events: gapic_v1.method.wrap_method(
159
+ self.import_user_events,
160
+ default_retry=retries.Retry(
161
+ initial=1.0,
162
+ maximum=30.0,
163
+ multiplier=1.3,
164
+ predicate=retries.if_exception_type(
165
+ core_exceptions.ServiceUnavailable,
166
+ ),
167
+ deadline=300.0,
168
+ ),
169
+ default_timeout=300.0,
170
+ client_info=client_info,
171
+ ),
172
+ self.cancel_operation: gapic_v1.method.wrap_method(
173
+ self.cancel_operation,
174
+ default_timeout=None,
175
+ client_info=client_info,
176
+ ),
177
+ self.get_operation: gapic_v1.method.wrap_method(
178
+ self.get_operation,
179
+ default_timeout=None,
180
+ client_info=client_info,
181
+ ),
182
+ self.list_operations: gapic_v1.method.wrap_method(
183
+ self.list_operations,
184
+ default_timeout=None,
185
+ client_info=client_info,
186
+ ),
187
+ }
188
+
189
+ def close(self):
190
+ """Closes resources associated with the transport.
191
+
192
+ .. warning::
193
+ Only call this method if the transport is NOT shared
194
+ with other clients - this may cause errors in other clients!
195
+ """
196
+ raise NotImplementedError()
197
+
198
+ @property
199
+ def operations_client(self):
200
+ """Return the client designed to process long-running operations."""
201
+ raise NotImplementedError()
202
+
203
+ @property
204
+ def write_user_event(
205
+ self,
206
+ ) -> Callable[
207
+ [user_event_service.WriteUserEventRequest],
208
+ Union[user_event.UserEvent, Awaitable[user_event.UserEvent]],
209
+ ]:
210
+ raise NotImplementedError()
211
+
212
+ @property
213
+ def collect_user_event(
214
+ self,
215
+ ) -> Callable[
216
+ [user_event_service.CollectUserEventRequest],
217
+ Union[httpbody_pb2.HttpBody, Awaitable[httpbody_pb2.HttpBody]],
218
+ ]:
219
+ raise NotImplementedError()
220
+
221
+ @property
222
+ def purge_user_events(
223
+ self,
224
+ ) -> Callable[
225
+ [purge_config.PurgeUserEventsRequest],
226
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
227
+ ]:
228
+ raise NotImplementedError()
229
+
230
+ @property
231
+ def import_user_events(
232
+ self,
233
+ ) -> Callable[
234
+ [import_config.ImportUserEventsRequest],
235
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
236
+ ]:
237
+ raise NotImplementedError()
238
+
239
+ @property
240
+ def list_operations(
241
+ self,
242
+ ) -> Callable[
243
+ [operations_pb2.ListOperationsRequest],
244
+ Union[
245
+ operations_pb2.ListOperationsResponse,
246
+ Awaitable[operations_pb2.ListOperationsResponse],
247
+ ],
248
+ ]:
249
+ raise NotImplementedError()
250
+
251
+ @property
252
+ def get_operation(
253
+ self,
254
+ ) -> Callable[
255
+ [operations_pb2.GetOperationRequest],
256
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
257
+ ]:
258
+ raise NotImplementedError()
259
+
260
+ @property
261
+ def cancel_operation(
262
+ self,
263
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None,]:
264
+ raise NotImplementedError()
265
+
266
+ @property
267
+ def kind(self) -> str:
268
+ raise NotImplementedError()
269
+
270
+
271
+ __all__ = ("UserEventServiceTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/transports/grpc.py ADDED
@@ -0,0 +1,530 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import json
17
+ import logging as std_logging
18
+ import pickle
19
+ from typing import Callable, Dict, Optional, Sequence, Tuple, Union
20
+ import warnings
21
+
22
+ from google.api import httpbody_pb2 # type: ignore
23
+ from google.api_core import gapic_v1, grpc_helpers, operations_v1
24
+ import google.auth # type: ignore
25
+ from google.auth import credentials as ga_credentials # type: ignore
26
+ from google.auth.transport.grpc import SslCredentials # type: ignore
27
+ from google.cloud.location import locations_pb2 # type: ignore
28
+ from google.longrunning import operations_pb2 # type: ignore
29
+ from google.protobuf.json_format import MessageToJson
30
+ import google.protobuf.message
31
+ import grpc # type: ignore
32
+ import proto # type: ignore
33
+
34
+ from google.cloud.discoveryengine_v1beta.types import (
35
+ import_config,
36
+ purge_config,
37
+ user_event,
38
+ user_event_service,
39
+ )
40
+
41
+ from .base import DEFAULT_CLIENT_INFO, UserEventServiceTransport
42
+
43
+ try:
44
+ from google.api_core import client_logging # type: ignore
45
+
46
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
47
+ except ImportError: # pragma: NO COVER
48
+ CLIENT_LOGGING_SUPPORTED = False
49
+
50
+ _LOGGER = std_logging.getLogger(__name__)
51
+
52
+
53
+ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
54
+ def intercept_unary_unary(self, continuation, client_call_details, request):
55
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
56
+ std_logging.DEBUG
57
+ )
58
+ if logging_enabled: # pragma: NO COVER
59
+ request_metadata = client_call_details.metadata
60
+ if isinstance(request, proto.Message):
61
+ request_payload = type(request).to_json(request)
62
+ elif isinstance(request, google.protobuf.message.Message):
63
+ request_payload = MessageToJson(request)
64
+ else:
65
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
66
+
67
+ request_metadata = {
68
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
69
+ for key, value in request_metadata
70
+ }
71
+ grpc_request = {
72
+ "payload": request_payload,
73
+ "requestMethod": "grpc",
74
+ "metadata": dict(request_metadata),
75
+ }
76
+ _LOGGER.debug(
77
+ f"Sending request for {client_call_details.method}",
78
+ extra={
79
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
80
+ "rpcName": str(client_call_details.method),
81
+ "request": grpc_request,
82
+ "metadata": grpc_request["metadata"],
83
+ },
84
+ )
85
+ response = continuation(client_call_details, request)
86
+ if logging_enabled: # pragma: NO COVER
87
+ response_metadata = response.trailing_metadata()
88
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
89
+ metadata = (
90
+ dict([(k, str(v)) for k, v in response_metadata])
91
+ if response_metadata
92
+ else None
93
+ )
94
+ result = response.result()
95
+ if isinstance(result, proto.Message):
96
+ response_payload = type(result).to_json(result)
97
+ elif isinstance(result, google.protobuf.message.Message):
98
+ response_payload = MessageToJson(result)
99
+ else:
100
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
101
+ grpc_response = {
102
+ "payload": response_payload,
103
+ "metadata": metadata,
104
+ "status": "OK",
105
+ }
106
+ _LOGGER.debug(
107
+ f"Received response for {client_call_details.method}.",
108
+ extra={
109
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
110
+ "rpcName": client_call_details.method,
111
+ "response": grpc_response,
112
+ "metadata": grpc_response["metadata"],
113
+ },
114
+ )
115
+ return response
116
+
117
+
118
+ class UserEventServiceGrpcTransport(UserEventServiceTransport):
119
+ """gRPC backend transport for UserEventService.
120
+
121
+ Service for ingesting end user actions on a website to
122
+ Discovery Engine API.
123
+
124
+ This class defines the same methods as the primary client, so the
125
+ primary client can load the underlying transport implementation
126
+ and call it.
127
+
128
+ It sends protocol buffers over the wire using gRPC (which is built on
129
+ top of HTTP/2); the ``grpcio`` package must be installed.
130
+ """
131
+
132
+ _stubs: Dict[str, Callable]
133
+
134
+ def __init__(
135
+ self,
136
+ *,
137
+ host: str = "discoveryengine.googleapis.com",
138
+ credentials: Optional[ga_credentials.Credentials] = None,
139
+ credentials_file: Optional[str] = None,
140
+ scopes: Optional[Sequence[str]] = None,
141
+ channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
142
+ api_mtls_endpoint: Optional[str] = None,
143
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
144
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
145
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
146
+ quota_project_id: Optional[str] = None,
147
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
148
+ always_use_jwt_access: Optional[bool] = False,
149
+ api_audience: Optional[str] = None,
150
+ ) -> None:
151
+ """Instantiate the transport.
152
+
153
+ Args:
154
+ host (Optional[str]):
155
+ The hostname to connect to (default: 'discoveryengine.googleapis.com').
156
+ credentials (Optional[google.auth.credentials.Credentials]): The
157
+ authorization credentials to attach to requests. These
158
+ credentials identify the application to the service; if none
159
+ are specified, the client will attempt to ascertain the
160
+ credentials from the environment.
161
+ This argument is ignored if a ``channel`` instance is provided.
162
+ credentials_file (Optional[str]): A file with credentials that can
163
+ be loaded with :func:`google.auth.load_credentials_from_file`.
164
+ This argument is ignored if a ``channel`` instance is provided.
165
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
166
+ ignored if a ``channel`` instance is provided.
167
+ channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
168
+ A ``Channel`` instance through which to make calls, or a Callable
169
+ that constructs and returns one. If set to None, ``self.create_channel``
170
+ is used to create the channel. If a Callable is given, it will be called
171
+ with the same arguments as used in ``self.create_channel``.
172
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
173
+ If provided, it overrides the ``host`` argument and tries to create
174
+ a mutual TLS channel with client SSL credentials from
175
+ ``client_cert_source`` or application default SSL credentials.
176
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
177
+ Deprecated. A callback to provide client SSL certificate bytes and
178
+ private key bytes, both in PEM format. It is ignored if
179
+ ``api_mtls_endpoint`` is None.
180
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
181
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
182
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
183
+ A callback to provide client certificate bytes and private key bytes,
184
+ both in PEM format. It is used to configure a mutual TLS channel. It is
185
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
186
+ quota_project_id (Optional[str]): An optional project to use for billing
187
+ and quota.
188
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
189
+ The client info used to send a user-agent string along with
190
+ API requests. If ``None``, then default info will be used.
191
+ Generally, you only need to set this if you're developing
192
+ your own client library.
193
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
194
+ be used for service account credentials.
195
+
196
+ Raises:
197
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
198
+ creation failed for any reason.
199
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
200
+ and ``credentials_file`` are passed.
201
+ """
202
+ self._grpc_channel = None
203
+ self._ssl_channel_credentials = ssl_channel_credentials
204
+ self._stubs: Dict[str, Callable] = {}
205
+ self._operations_client: Optional[operations_v1.OperationsClient] = None
206
+
207
+ if api_mtls_endpoint:
208
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
209
+ if client_cert_source:
210
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
211
+
212
+ if isinstance(channel, grpc.Channel):
213
+ # Ignore credentials if a channel was passed.
214
+ credentials = None
215
+ self._ignore_credentials = True
216
+ # If a channel was explicitly provided, set it.
217
+ self._grpc_channel = channel
218
+ self._ssl_channel_credentials = None
219
+
220
+ else:
221
+ if api_mtls_endpoint:
222
+ host = api_mtls_endpoint
223
+
224
+ # Create SSL credentials with client_cert_source or application
225
+ # default SSL credentials.
226
+ if client_cert_source:
227
+ cert, key = client_cert_source()
228
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
229
+ certificate_chain=cert, private_key=key
230
+ )
231
+ else:
232
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
233
+
234
+ else:
235
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
236
+ cert, key = client_cert_source_for_mtls()
237
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
238
+ certificate_chain=cert, private_key=key
239
+ )
240
+
241
+ # The base transport sets the host, credentials and scopes
242
+ super().__init__(
243
+ host=host,
244
+ credentials=credentials,
245
+ credentials_file=credentials_file,
246
+ scopes=scopes,
247
+ quota_project_id=quota_project_id,
248
+ client_info=client_info,
249
+ always_use_jwt_access=always_use_jwt_access,
250
+ api_audience=api_audience,
251
+ )
252
+
253
+ if not self._grpc_channel:
254
+ # initialize with the provided callable or the default channel
255
+ channel_init = channel or type(self).create_channel
256
+ self._grpc_channel = channel_init(
257
+ self._host,
258
+ # use the credentials which are saved
259
+ credentials=self._credentials,
260
+ # Set ``credentials_file`` to ``None`` here as
261
+ # the credentials that we saved earlier should be used.
262
+ credentials_file=None,
263
+ scopes=self._scopes,
264
+ ssl_credentials=self._ssl_channel_credentials,
265
+ quota_project_id=quota_project_id,
266
+ options=[
267
+ ("grpc.max_send_message_length", -1),
268
+ ("grpc.max_receive_message_length", -1),
269
+ ],
270
+ )
271
+
272
+ self._interceptor = _LoggingClientInterceptor()
273
+ self._logged_channel = grpc.intercept_channel(
274
+ self._grpc_channel, self._interceptor
275
+ )
276
+
277
+ # Wrap messages. This must be done after self._logged_channel exists
278
+ self._prep_wrapped_messages(client_info)
279
+
280
+ @classmethod
281
+ def create_channel(
282
+ cls,
283
+ host: str = "discoveryengine.googleapis.com",
284
+ credentials: Optional[ga_credentials.Credentials] = None,
285
+ credentials_file: Optional[str] = None,
286
+ scopes: Optional[Sequence[str]] = None,
287
+ quota_project_id: Optional[str] = None,
288
+ **kwargs,
289
+ ) -> grpc.Channel:
290
+ """Create and return a gRPC channel object.
291
+ Args:
292
+ host (Optional[str]): The host for the channel to use.
293
+ credentials (Optional[~.Credentials]): The
294
+ authorization credentials to attach to requests. These
295
+ credentials identify this application to the service. If
296
+ none are specified, the client will attempt to ascertain
297
+ the credentials from the environment.
298
+ credentials_file (Optional[str]): A file with credentials that can
299
+ be loaded with :func:`google.auth.load_credentials_from_file`.
300
+ This argument is mutually exclusive with credentials.
301
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
302
+ service. These are only used when credentials are not specified and
303
+ are passed to :func:`google.auth.default`.
304
+ quota_project_id (Optional[str]): An optional project to use for billing
305
+ and quota.
306
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
307
+ channel creation.
308
+ Returns:
309
+ grpc.Channel: A gRPC channel object.
310
+
311
+ Raises:
312
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
313
+ and ``credentials_file`` are passed.
314
+ """
315
+
316
+ return grpc_helpers.create_channel(
317
+ host,
318
+ credentials=credentials,
319
+ credentials_file=credentials_file,
320
+ quota_project_id=quota_project_id,
321
+ default_scopes=cls.AUTH_SCOPES,
322
+ scopes=scopes,
323
+ default_host=cls.DEFAULT_HOST,
324
+ **kwargs,
325
+ )
326
+
327
+ @property
328
+ def grpc_channel(self) -> grpc.Channel:
329
+ """Return the channel designed to connect to this service."""
330
+ return self._grpc_channel
331
+
332
+ @property
333
+ def operations_client(self) -> operations_v1.OperationsClient:
334
+ """Create the client designed to process long-running operations.
335
+
336
+ This property caches on the instance; repeated calls return the same
337
+ client.
338
+ """
339
+ # Quick check: Only create a new client if we do not already have one.
340
+ if self._operations_client is None:
341
+ self._operations_client = operations_v1.OperationsClient(
342
+ self._logged_channel
343
+ )
344
+
345
+ # Return the client from cache.
346
+ return self._operations_client
347
+
348
+ @property
349
+ def write_user_event(
350
+ self,
351
+ ) -> Callable[[user_event_service.WriteUserEventRequest], user_event.UserEvent]:
352
+ r"""Return a callable for the write user event method over gRPC.
353
+
354
+ Writes a single user event.
355
+
356
+ Returns:
357
+ Callable[[~.WriteUserEventRequest],
358
+ ~.UserEvent]:
359
+ A function that, when called, will call the underlying RPC
360
+ on the server.
361
+ """
362
+ # Generate a "stub function" on-the-fly which will actually make
363
+ # the request.
364
+ # gRPC handles serialization and deserialization, so we just need
365
+ # to pass in the functions for each.
366
+ if "write_user_event" not in self._stubs:
367
+ self._stubs["write_user_event"] = self._logged_channel.unary_unary(
368
+ "/google.cloud.discoveryengine.v1beta.UserEventService/WriteUserEvent",
369
+ request_serializer=user_event_service.WriteUserEventRequest.serialize,
370
+ response_deserializer=user_event.UserEvent.deserialize,
371
+ )
372
+ return self._stubs["write_user_event"]
373
+
374
+ @property
375
+ def collect_user_event(
376
+ self,
377
+ ) -> Callable[[user_event_service.CollectUserEventRequest], httpbody_pb2.HttpBody]:
378
+ r"""Return a callable for the collect user event method over gRPC.
379
+
380
+ Writes a single user event from the browser. This
381
+ uses a GET request to due to browser restriction of
382
+ POST-ing to a third-party domain.
383
+
384
+ This method is used only by the Discovery Engine API
385
+ JavaScript pixel and Google Tag Manager. Users should
386
+ not call this method directly.
387
+
388
+ Returns:
389
+ Callable[[~.CollectUserEventRequest],
390
+ ~.HttpBody]:
391
+ A function that, when called, will call the underlying RPC
392
+ on the server.
393
+ """
394
+ # Generate a "stub function" on-the-fly which will actually make
395
+ # the request.
396
+ # gRPC handles serialization and deserialization, so we just need
397
+ # to pass in the functions for each.
398
+ if "collect_user_event" not in self._stubs:
399
+ self._stubs["collect_user_event"] = self._logged_channel.unary_unary(
400
+ "/google.cloud.discoveryengine.v1beta.UserEventService/CollectUserEvent",
401
+ request_serializer=user_event_service.CollectUserEventRequest.serialize,
402
+ response_deserializer=httpbody_pb2.HttpBody.FromString,
403
+ )
404
+ return self._stubs["collect_user_event"]
405
+
406
+ @property
407
+ def purge_user_events(
408
+ self,
409
+ ) -> Callable[[purge_config.PurgeUserEventsRequest], operations_pb2.Operation]:
410
+ r"""Return a callable for the purge user events method over gRPC.
411
+
412
+ Deletes permanently all user events specified by the
413
+ filter provided. Depending on the number of events
414
+ specified by the filter, this operation could take hours
415
+ or days to complete. To test a filter, use the list
416
+ command first.
417
+
418
+ Returns:
419
+ Callable[[~.PurgeUserEventsRequest],
420
+ ~.Operation]:
421
+ A function that, when called, will call the underlying RPC
422
+ on the server.
423
+ """
424
+ # Generate a "stub function" on-the-fly which will actually make
425
+ # the request.
426
+ # gRPC handles serialization and deserialization, so we just need
427
+ # to pass in the functions for each.
428
+ if "purge_user_events" not in self._stubs:
429
+ self._stubs["purge_user_events"] = self._logged_channel.unary_unary(
430
+ "/google.cloud.discoveryengine.v1beta.UserEventService/PurgeUserEvents",
431
+ request_serializer=purge_config.PurgeUserEventsRequest.serialize,
432
+ response_deserializer=operations_pb2.Operation.FromString,
433
+ )
434
+ return self._stubs["purge_user_events"]
435
+
436
+ @property
437
+ def import_user_events(
438
+ self,
439
+ ) -> Callable[[import_config.ImportUserEventsRequest], operations_pb2.Operation]:
440
+ r"""Return a callable for the import user events method over gRPC.
441
+
442
+ Bulk import of user events. Request processing might
443
+ be synchronous. Events that already exist are skipped.
444
+ Use this method for backfilling historical user events.
445
+
446
+ Operation.response is of type ImportResponse. Note that
447
+ it is possible for a subset of the items to be
448
+ successfully inserted. Operation.metadata is of type
449
+ ImportMetadata.
450
+
451
+ Returns:
452
+ Callable[[~.ImportUserEventsRequest],
453
+ ~.Operation]:
454
+ A function that, when called, will call the underlying RPC
455
+ on the server.
456
+ """
457
+ # Generate a "stub function" on-the-fly which will actually make
458
+ # the request.
459
+ # gRPC handles serialization and deserialization, so we just need
460
+ # to pass in the functions for each.
461
+ if "import_user_events" not in self._stubs:
462
+ self._stubs["import_user_events"] = self._logged_channel.unary_unary(
463
+ "/google.cloud.discoveryengine.v1beta.UserEventService/ImportUserEvents",
464
+ request_serializer=import_config.ImportUserEventsRequest.serialize,
465
+ response_deserializer=operations_pb2.Operation.FromString,
466
+ )
467
+ return self._stubs["import_user_events"]
468
+
469
+ def close(self):
470
+ self._logged_channel.close()
471
+
472
+ @property
473
+ def cancel_operation(
474
+ self,
475
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
476
+ r"""Return a callable for the cancel_operation method over gRPC."""
477
+ # Generate a "stub function" on-the-fly which will actually make
478
+ # the request.
479
+ # gRPC handles serialization and deserialization, so we just need
480
+ # to pass in the functions for each.
481
+ if "cancel_operation" not in self._stubs:
482
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
483
+ "/google.longrunning.Operations/CancelOperation",
484
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
485
+ response_deserializer=None,
486
+ )
487
+ return self._stubs["cancel_operation"]
488
+
489
+ @property
490
+ def get_operation(
491
+ self,
492
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
493
+ r"""Return a callable for the get_operation method over gRPC."""
494
+ # Generate a "stub function" on-the-fly which will actually make
495
+ # the request.
496
+ # gRPC handles serialization and deserialization, so we just need
497
+ # to pass in the functions for each.
498
+ if "get_operation" not in self._stubs:
499
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
500
+ "/google.longrunning.Operations/GetOperation",
501
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
502
+ response_deserializer=operations_pb2.Operation.FromString,
503
+ )
504
+ return self._stubs["get_operation"]
505
+
506
+ @property
507
+ def list_operations(
508
+ self,
509
+ ) -> Callable[
510
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
511
+ ]:
512
+ r"""Return a callable for the list_operations method over gRPC."""
513
+ # Generate a "stub function" on-the-fly which will actually make
514
+ # the request.
515
+ # gRPC handles serialization and deserialization, so we just need
516
+ # to pass in the functions for each.
517
+ if "list_operations" not in self._stubs:
518
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
519
+ "/google.longrunning.Operations/ListOperations",
520
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
521
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
522
+ )
523
+ return self._stubs["list_operations"]
524
+
525
+ @property
526
+ def kind(self) -> str:
527
+ return "grpc"
528
+
529
+
530
+ __all__ = ("UserEventServiceGrpcTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/transports/grpc_asyncio.py ADDED
@@ -0,0 +1,600 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import inspect
17
+ import json
18
+ import logging as std_logging
19
+ import pickle
20
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
21
+ import warnings
22
+
23
+ from google.api import httpbody_pb2 # type: ignore
24
+ from google.api_core import exceptions as core_exceptions
25
+ from google.api_core import gapic_v1, grpc_helpers_async, operations_v1
26
+ from google.api_core import retry_async as retries
27
+ from google.auth import credentials as ga_credentials # type: ignore
28
+ from google.auth.transport.grpc import SslCredentials # type: ignore
29
+ from google.cloud.location import locations_pb2 # type: ignore
30
+ from google.longrunning import operations_pb2 # type: ignore
31
+ from google.protobuf.json_format import MessageToJson
32
+ import google.protobuf.message
33
+ import grpc # type: ignore
34
+ from grpc.experimental import aio # type: ignore
35
+ import proto # type: ignore
36
+
37
+ from google.cloud.discoveryengine_v1beta.types import (
38
+ import_config,
39
+ purge_config,
40
+ user_event,
41
+ user_event_service,
42
+ )
43
+
44
+ from .base import DEFAULT_CLIENT_INFO, UserEventServiceTransport
45
+ from .grpc import UserEventServiceGrpcTransport
46
+
47
+ try:
48
+ from google.api_core import client_logging # type: ignore
49
+
50
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
51
+ except ImportError: # pragma: NO COVER
52
+ CLIENT_LOGGING_SUPPORTED = False
53
+
54
+ _LOGGER = std_logging.getLogger(__name__)
55
+
56
+
57
+ class _LoggingClientAIOInterceptor(
58
+ grpc.aio.UnaryUnaryClientInterceptor
59
+ ): # pragma: NO COVER
60
+ async def intercept_unary_unary(self, continuation, client_call_details, request):
61
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
62
+ std_logging.DEBUG
63
+ )
64
+ if logging_enabled: # pragma: NO COVER
65
+ request_metadata = client_call_details.metadata
66
+ if isinstance(request, proto.Message):
67
+ request_payload = type(request).to_json(request)
68
+ elif isinstance(request, google.protobuf.message.Message):
69
+ request_payload = MessageToJson(request)
70
+ else:
71
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
72
+
73
+ request_metadata = {
74
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
75
+ for key, value in request_metadata
76
+ }
77
+ grpc_request = {
78
+ "payload": request_payload,
79
+ "requestMethod": "grpc",
80
+ "metadata": dict(request_metadata),
81
+ }
82
+ _LOGGER.debug(
83
+ f"Sending request for {client_call_details.method}",
84
+ extra={
85
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
86
+ "rpcName": str(client_call_details.method),
87
+ "request": grpc_request,
88
+ "metadata": grpc_request["metadata"],
89
+ },
90
+ )
91
+ response = await continuation(client_call_details, request)
92
+ if logging_enabled: # pragma: NO COVER
93
+ response_metadata = await response.trailing_metadata()
94
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
95
+ metadata = (
96
+ dict([(k, str(v)) for k, v in response_metadata])
97
+ if response_metadata
98
+ else None
99
+ )
100
+ result = await response
101
+ if isinstance(result, proto.Message):
102
+ response_payload = type(result).to_json(result)
103
+ elif isinstance(result, google.protobuf.message.Message):
104
+ response_payload = MessageToJson(result)
105
+ else:
106
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
107
+ grpc_response = {
108
+ "payload": response_payload,
109
+ "metadata": metadata,
110
+ "status": "OK",
111
+ }
112
+ _LOGGER.debug(
113
+ f"Received response to rpc {client_call_details.method}.",
114
+ extra={
115
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
116
+ "rpcName": str(client_call_details.method),
117
+ "response": grpc_response,
118
+ "metadata": grpc_response["metadata"],
119
+ },
120
+ )
121
+ return response
122
+
123
+
124
+ class UserEventServiceGrpcAsyncIOTransport(UserEventServiceTransport):
125
+ """gRPC AsyncIO backend transport for UserEventService.
126
+
127
+ Service for ingesting end user actions on a website to
128
+ Discovery Engine API.
129
+
130
+ This class defines the same methods as the primary client, so the
131
+ primary client can load the underlying transport implementation
132
+ and call it.
133
+
134
+ It sends protocol buffers over the wire using gRPC (which is built on
135
+ top of HTTP/2); the ``grpcio`` package must be installed.
136
+ """
137
+
138
+ _grpc_channel: aio.Channel
139
+ _stubs: Dict[str, Callable] = {}
140
+
141
+ @classmethod
142
+ def create_channel(
143
+ cls,
144
+ host: str = "discoveryengine.googleapis.com",
145
+ credentials: Optional[ga_credentials.Credentials] = None,
146
+ credentials_file: Optional[str] = None,
147
+ scopes: Optional[Sequence[str]] = None,
148
+ quota_project_id: Optional[str] = None,
149
+ **kwargs,
150
+ ) -> aio.Channel:
151
+ """Create and return a gRPC AsyncIO channel object.
152
+ Args:
153
+ host (Optional[str]): The host for the channel to use.
154
+ credentials (Optional[~.Credentials]): The
155
+ authorization credentials to attach to requests. These
156
+ credentials identify this application to the service. If
157
+ none are specified, the client will attempt to ascertain
158
+ the credentials from the environment.
159
+ credentials_file (Optional[str]): A file with credentials that can
160
+ be loaded with :func:`google.auth.load_credentials_from_file`.
161
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
162
+ service. These are only used when credentials are not specified and
163
+ are passed to :func:`google.auth.default`.
164
+ quota_project_id (Optional[str]): An optional project to use for billing
165
+ and quota.
166
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
167
+ channel creation.
168
+ Returns:
169
+ aio.Channel: A gRPC AsyncIO channel object.
170
+ """
171
+
172
+ return grpc_helpers_async.create_channel(
173
+ host,
174
+ credentials=credentials,
175
+ credentials_file=credentials_file,
176
+ quota_project_id=quota_project_id,
177
+ default_scopes=cls.AUTH_SCOPES,
178
+ scopes=scopes,
179
+ default_host=cls.DEFAULT_HOST,
180
+ **kwargs,
181
+ )
182
+
183
+ def __init__(
184
+ self,
185
+ *,
186
+ host: str = "discoveryengine.googleapis.com",
187
+ credentials: Optional[ga_credentials.Credentials] = None,
188
+ credentials_file: Optional[str] = None,
189
+ scopes: Optional[Sequence[str]] = None,
190
+ channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
191
+ api_mtls_endpoint: Optional[str] = None,
192
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
193
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
194
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
195
+ quota_project_id: Optional[str] = None,
196
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
197
+ always_use_jwt_access: Optional[bool] = False,
198
+ api_audience: Optional[str] = None,
199
+ ) -> None:
200
+ """Instantiate the transport.
201
+
202
+ Args:
203
+ host (Optional[str]):
204
+ The hostname to connect to (default: 'discoveryengine.googleapis.com').
205
+ credentials (Optional[google.auth.credentials.Credentials]): The
206
+ authorization credentials to attach to requests. These
207
+ credentials identify the application to the service; if none
208
+ are specified, the client will attempt to ascertain the
209
+ credentials from the environment.
210
+ This argument is ignored if a ``channel`` instance is provided.
211
+ credentials_file (Optional[str]): A file with credentials that can
212
+ be loaded with :func:`google.auth.load_credentials_from_file`.
213
+ This argument is ignored if a ``channel`` instance is provided.
214
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
215
+ service. These are only used when credentials are not specified and
216
+ are passed to :func:`google.auth.default`.
217
+ channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
218
+ A ``Channel`` instance through which to make calls, or a Callable
219
+ that constructs and returns one. If set to None, ``self.create_channel``
220
+ is used to create the channel. If a Callable is given, it will be called
221
+ with the same arguments as used in ``self.create_channel``.
222
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
223
+ If provided, it overrides the ``host`` argument and tries to create
224
+ a mutual TLS channel with client SSL credentials from
225
+ ``client_cert_source`` or application default SSL credentials.
226
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
227
+ Deprecated. A callback to provide client SSL certificate bytes and
228
+ private key bytes, both in PEM format. It is ignored if
229
+ ``api_mtls_endpoint`` is None.
230
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
231
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
232
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
233
+ A callback to provide client certificate bytes and private key bytes,
234
+ both in PEM format. It is used to configure a mutual TLS channel. It is
235
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
236
+ quota_project_id (Optional[str]): An optional project to use for billing
237
+ and quota.
238
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
239
+ The client info used to send a user-agent string along with
240
+ API requests. If ``None``, then default info will be used.
241
+ Generally, you only need to set this if you're developing
242
+ your own client library.
243
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
244
+ be used for service account credentials.
245
+
246
+ Raises:
247
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
248
+ creation failed for any reason.
249
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
250
+ and ``credentials_file`` are passed.
251
+ """
252
+ self._grpc_channel = None
253
+ self._ssl_channel_credentials = ssl_channel_credentials
254
+ self._stubs: Dict[str, Callable] = {}
255
+ self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None
256
+
257
+ if api_mtls_endpoint:
258
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
259
+ if client_cert_source:
260
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
261
+
262
+ if isinstance(channel, aio.Channel):
263
+ # Ignore credentials if a channel was passed.
264
+ credentials = None
265
+ self._ignore_credentials = True
266
+ # If a channel was explicitly provided, set it.
267
+ self._grpc_channel = channel
268
+ self._ssl_channel_credentials = None
269
+ else:
270
+ if api_mtls_endpoint:
271
+ host = api_mtls_endpoint
272
+
273
+ # Create SSL credentials with client_cert_source or application
274
+ # default SSL credentials.
275
+ if client_cert_source:
276
+ cert, key = client_cert_source()
277
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
278
+ certificate_chain=cert, private_key=key
279
+ )
280
+ else:
281
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
282
+
283
+ else:
284
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
285
+ cert, key = client_cert_source_for_mtls()
286
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
287
+ certificate_chain=cert, private_key=key
288
+ )
289
+
290
+ # The base transport sets the host, credentials and scopes
291
+ super().__init__(
292
+ host=host,
293
+ credentials=credentials,
294
+ credentials_file=credentials_file,
295
+ scopes=scopes,
296
+ quota_project_id=quota_project_id,
297
+ client_info=client_info,
298
+ always_use_jwt_access=always_use_jwt_access,
299
+ api_audience=api_audience,
300
+ )
301
+
302
+ if not self._grpc_channel:
303
+ # initialize with the provided callable or the default channel
304
+ channel_init = channel or type(self).create_channel
305
+ self._grpc_channel = channel_init(
306
+ self._host,
307
+ # use the credentials which are saved
308
+ credentials=self._credentials,
309
+ # Set ``credentials_file`` to ``None`` here as
310
+ # the credentials that we saved earlier should be used.
311
+ credentials_file=None,
312
+ scopes=self._scopes,
313
+ ssl_credentials=self._ssl_channel_credentials,
314
+ quota_project_id=quota_project_id,
315
+ options=[
316
+ ("grpc.max_send_message_length", -1),
317
+ ("grpc.max_receive_message_length", -1),
318
+ ],
319
+ )
320
+
321
+ self._interceptor = _LoggingClientAIOInterceptor()
322
+ self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
323
+ self._logged_channel = self._grpc_channel
324
+ self._wrap_with_kind = (
325
+ "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
326
+ )
327
+ # Wrap messages. This must be done after self._logged_channel exists
328
+ self._prep_wrapped_messages(client_info)
329
+
330
+ @property
331
+ def grpc_channel(self) -> aio.Channel:
332
+ """Create the channel designed to connect to this service.
333
+
334
+ This property caches on the instance; repeated calls return
335
+ the same channel.
336
+ """
337
+ # Return the channel from cache.
338
+ return self._grpc_channel
339
+
340
+ @property
341
+ def operations_client(self) -> operations_v1.OperationsAsyncClient:
342
+ """Create the client designed to process long-running operations.
343
+
344
+ This property caches on the instance; repeated calls return the same
345
+ client.
346
+ """
347
+ # Quick check: Only create a new client if we do not already have one.
348
+ if self._operations_client is None:
349
+ self._operations_client = operations_v1.OperationsAsyncClient(
350
+ self._logged_channel
351
+ )
352
+
353
+ # Return the client from cache.
354
+ return self._operations_client
355
+
356
+ @property
357
+ def write_user_event(
358
+ self,
359
+ ) -> Callable[
360
+ [user_event_service.WriteUserEventRequest], Awaitable[user_event.UserEvent]
361
+ ]:
362
+ r"""Return a callable for the write user event method over gRPC.
363
+
364
+ Writes a single user event.
365
+
366
+ Returns:
367
+ Callable[[~.WriteUserEventRequest],
368
+ Awaitable[~.UserEvent]]:
369
+ A function that, when called, will call the underlying RPC
370
+ on the server.
371
+ """
372
+ # Generate a "stub function" on-the-fly which will actually make
373
+ # the request.
374
+ # gRPC handles serialization and deserialization, so we just need
375
+ # to pass in the functions for each.
376
+ if "write_user_event" not in self._stubs:
377
+ self._stubs["write_user_event"] = self._logged_channel.unary_unary(
378
+ "/google.cloud.discoveryengine.v1beta.UserEventService/WriteUserEvent",
379
+ request_serializer=user_event_service.WriteUserEventRequest.serialize,
380
+ response_deserializer=user_event.UserEvent.deserialize,
381
+ )
382
+ return self._stubs["write_user_event"]
383
+
384
+ @property
385
+ def collect_user_event(
386
+ self,
387
+ ) -> Callable[
388
+ [user_event_service.CollectUserEventRequest], Awaitable[httpbody_pb2.HttpBody]
389
+ ]:
390
+ r"""Return a callable for the collect user event method over gRPC.
391
+
392
+ Writes a single user event from the browser. This
393
+ uses a GET request to due to browser restriction of
394
+ POST-ing to a third-party domain.
395
+
396
+ This method is used only by the Discovery Engine API
397
+ JavaScript pixel and Google Tag Manager. Users should
398
+ not call this method directly.
399
+
400
+ Returns:
401
+ Callable[[~.CollectUserEventRequest],
402
+ Awaitable[~.HttpBody]]:
403
+ A function that, when called, will call the underlying RPC
404
+ on the server.
405
+ """
406
+ # Generate a "stub function" on-the-fly which will actually make
407
+ # the request.
408
+ # gRPC handles serialization and deserialization, so we just need
409
+ # to pass in the functions for each.
410
+ if "collect_user_event" not in self._stubs:
411
+ self._stubs["collect_user_event"] = self._logged_channel.unary_unary(
412
+ "/google.cloud.discoveryengine.v1beta.UserEventService/CollectUserEvent",
413
+ request_serializer=user_event_service.CollectUserEventRequest.serialize,
414
+ response_deserializer=httpbody_pb2.HttpBody.FromString,
415
+ )
416
+ return self._stubs["collect_user_event"]
417
+
418
+ @property
419
+ def purge_user_events(
420
+ self,
421
+ ) -> Callable[
422
+ [purge_config.PurgeUserEventsRequest], Awaitable[operations_pb2.Operation]
423
+ ]:
424
+ r"""Return a callable for the purge user events method over gRPC.
425
+
426
+ Deletes permanently all user events specified by the
427
+ filter provided. Depending on the number of events
428
+ specified by the filter, this operation could take hours
429
+ or days to complete. To test a filter, use the list
430
+ command first.
431
+
432
+ Returns:
433
+ Callable[[~.PurgeUserEventsRequest],
434
+ Awaitable[~.Operation]]:
435
+ A function that, when called, will call the underlying RPC
436
+ on the server.
437
+ """
438
+ # Generate a "stub function" on-the-fly which will actually make
439
+ # the request.
440
+ # gRPC handles serialization and deserialization, so we just need
441
+ # to pass in the functions for each.
442
+ if "purge_user_events" not in self._stubs:
443
+ self._stubs["purge_user_events"] = self._logged_channel.unary_unary(
444
+ "/google.cloud.discoveryengine.v1beta.UserEventService/PurgeUserEvents",
445
+ request_serializer=purge_config.PurgeUserEventsRequest.serialize,
446
+ response_deserializer=operations_pb2.Operation.FromString,
447
+ )
448
+ return self._stubs["purge_user_events"]
449
+
450
+ @property
451
+ def import_user_events(
452
+ self,
453
+ ) -> Callable[
454
+ [import_config.ImportUserEventsRequest], Awaitable[operations_pb2.Operation]
455
+ ]:
456
+ r"""Return a callable for the import user events method over gRPC.
457
+
458
+ Bulk import of user events. Request processing might
459
+ be synchronous. Events that already exist are skipped.
460
+ Use this method for backfilling historical user events.
461
+
462
+ Operation.response is of type ImportResponse. Note that
463
+ it is possible for a subset of the items to be
464
+ successfully inserted. Operation.metadata is of type
465
+ ImportMetadata.
466
+
467
+ Returns:
468
+ Callable[[~.ImportUserEventsRequest],
469
+ Awaitable[~.Operation]]:
470
+ A function that, when called, will call the underlying RPC
471
+ on the server.
472
+ """
473
+ # Generate a "stub function" on-the-fly which will actually make
474
+ # the request.
475
+ # gRPC handles serialization and deserialization, so we just need
476
+ # to pass in the functions for each.
477
+ if "import_user_events" not in self._stubs:
478
+ self._stubs["import_user_events"] = self._logged_channel.unary_unary(
479
+ "/google.cloud.discoveryengine.v1beta.UserEventService/ImportUserEvents",
480
+ request_serializer=import_config.ImportUserEventsRequest.serialize,
481
+ response_deserializer=operations_pb2.Operation.FromString,
482
+ )
483
+ return self._stubs["import_user_events"]
484
+
485
+ def _prep_wrapped_messages(self, client_info):
486
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
487
+ self._wrapped_methods = {
488
+ self.write_user_event: self._wrap_method(
489
+ self.write_user_event,
490
+ default_timeout=None,
491
+ client_info=client_info,
492
+ ),
493
+ self.collect_user_event: self._wrap_method(
494
+ self.collect_user_event,
495
+ default_timeout=None,
496
+ client_info=client_info,
497
+ ),
498
+ self.purge_user_events: self._wrap_method(
499
+ self.purge_user_events,
500
+ default_timeout=None,
501
+ client_info=client_info,
502
+ ),
503
+ self.import_user_events: self._wrap_method(
504
+ self.import_user_events,
505
+ default_retry=retries.AsyncRetry(
506
+ initial=1.0,
507
+ maximum=30.0,
508
+ multiplier=1.3,
509
+ predicate=retries.if_exception_type(
510
+ core_exceptions.ServiceUnavailable,
511
+ ),
512
+ deadline=300.0,
513
+ ),
514
+ default_timeout=300.0,
515
+ client_info=client_info,
516
+ ),
517
+ self.cancel_operation: self._wrap_method(
518
+ self.cancel_operation,
519
+ default_timeout=None,
520
+ client_info=client_info,
521
+ ),
522
+ self.get_operation: self._wrap_method(
523
+ self.get_operation,
524
+ default_timeout=None,
525
+ client_info=client_info,
526
+ ),
527
+ self.list_operations: self._wrap_method(
528
+ self.list_operations,
529
+ default_timeout=None,
530
+ client_info=client_info,
531
+ ),
532
+ }
533
+
534
+ def _wrap_method(self, func, *args, **kwargs):
535
+ if self._wrap_with_kind: # pragma: NO COVER
536
+ kwargs["kind"] = self.kind
537
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
538
+
539
+ def close(self):
540
+ return self._logged_channel.close()
541
+
542
+ @property
543
+ def kind(self) -> str:
544
+ return "grpc_asyncio"
545
+
546
+ @property
547
+ def cancel_operation(
548
+ self,
549
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
550
+ r"""Return a callable for the cancel_operation method over gRPC."""
551
+ # Generate a "stub function" on-the-fly which will actually make
552
+ # the request.
553
+ # gRPC handles serialization and deserialization, so we just need
554
+ # to pass in the functions for each.
555
+ if "cancel_operation" not in self._stubs:
556
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
557
+ "/google.longrunning.Operations/CancelOperation",
558
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
559
+ response_deserializer=None,
560
+ )
561
+ return self._stubs["cancel_operation"]
562
+
563
+ @property
564
+ def get_operation(
565
+ self,
566
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
567
+ r"""Return a callable for the get_operation method over gRPC."""
568
+ # Generate a "stub function" on-the-fly which will actually make
569
+ # the request.
570
+ # gRPC handles serialization and deserialization, so we just need
571
+ # to pass in the functions for each.
572
+ if "get_operation" not in self._stubs:
573
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
574
+ "/google.longrunning.Operations/GetOperation",
575
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
576
+ response_deserializer=operations_pb2.Operation.FromString,
577
+ )
578
+ return self._stubs["get_operation"]
579
+
580
+ @property
581
+ def list_operations(
582
+ self,
583
+ ) -> Callable[
584
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
585
+ ]:
586
+ r"""Return a callable for the list_operations method over gRPC."""
587
+ # Generate a "stub function" on-the-fly which will actually make
588
+ # the request.
589
+ # gRPC handles serialization and deserialization, so we just need
590
+ # to pass in the functions for each.
591
+ if "list_operations" not in self._stubs:
592
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
593
+ "/google.longrunning.Operations/ListOperations",
594
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
595
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
596
+ )
597
+ return self._stubs["list_operations"]
598
+
599
+
600
+ __all__ = ("UserEventServiceGrpcAsyncIOTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/transports/rest.py ADDED
@@ -0,0 +1,1746 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import dataclasses
17
+ import json # type: ignore
18
+ import logging
19
+ from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
20
+ import warnings
21
+
22
+ from google.api import httpbody_pb2 # type: ignore
23
+ from google.api_core import gapic_v1, operations_v1, rest_helpers, rest_streaming
24
+ from google.api_core import exceptions as core_exceptions
25
+ from google.api_core import retry as retries
26
+ from google.auth import credentials as ga_credentials # type: ignore
27
+ from google.auth.transport.requests import AuthorizedSession # type: ignore
28
+ from google.cloud.location import locations_pb2 # type: ignore
29
+ from google.longrunning import operations_pb2 # type: ignore
30
+ import google.protobuf
31
+ from google.protobuf import json_format
32
+ from requests import __version__ as requests_version
33
+
34
+ from google.cloud.discoveryengine_v1beta.types import (
35
+ import_config,
36
+ purge_config,
37
+ user_event,
38
+ user_event_service,
39
+ )
40
+
41
+ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO
42
+ from .rest_base import _BaseUserEventServiceRestTransport
43
+
44
+ try:
45
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
46
+ except AttributeError: # pragma: NO COVER
47
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
48
+
49
+ try:
50
+ from google.api_core import client_logging # type: ignore
51
+
52
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
53
+ except ImportError: # pragma: NO COVER
54
+ CLIENT_LOGGING_SUPPORTED = False
55
+
56
+ _LOGGER = logging.getLogger(__name__)
57
+
58
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
59
+ gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version,
60
+ grpc_version=None,
61
+ rest_version=f"requests@{requests_version}",
62
+ )
63
+
64
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
65
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
66
+
67
+
68
+ class UserEventServiceRestInterceptor:
69
+ """Interceptor for UserEventService.
70
+
71
+ Interceptors are used to manipulate requests, request metadata, and responses
72
+ in arbitrary ways.
73
+ Example use cases include:
74
+ * Logging
75
+ * Verifying requests according to service or custom semantics
76
+ * Stripping extraneous information from responses
77
+
78
+ These use cases and more can be enabled by injecting an
79
+ instance of a custom subclass when constructing the UserEventServiceRestTransport.
80
+
81
+ .. code-block:: python
82
+ class MyCustomUserEventServiceInterceptor(UserEventServiceRestInterceptor):
83
+ def pre_collect_user_event(self, request, metadata):
84
+ logging.log(f"Received request: {request}")
85
+ return request, metadata
86
+
87
+ def post_collect_user_event(self, response):
88
+ logging.log(f"Received response: {response}")
89
+ return response
90
+
91
+ def pre_import_user_events(self, request, metadata):
92
+ logging.log(f"Received request: {request}")
93
+ return request, metadata
94
+
95
+ def post_import_user_events(self, response):
96
+ logging.log(f"Received response: {response}")
97
+ return response
98
+
99
+ def pre_purge_user_events(self, request, metadata):
100
+ logging.log(f"Received request: {request}")
101
+ return request, metadata
102
+
103
+ def post_purge_user_events(self, response):
104
+ logging.log(f"Received response: {response}")
105
+ return response
106
+
107
+ def pre_write_user_event(self, request, metadata):
108
+ logging.log(f"Received request: {request}")
109
+ return request, metadata
110
+
111
+ def post_write_user_event(self, response):
112
+ logging.log(f"Received response: {response}")
113
+ return response
114
+
115
+ transport = UserEventServiceRestTransport(interceptor=MyCustomUserEventServiceInterceptor())
116
+ client = UserEventServiceClient(transport=transport)
117
+
118
+
119
+ """
120
+
121
+ def pre_collect_user_event(
122
+ self,
123
+ request: user_event_service.CollectUserEventRequest,
124
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
125
+ ) -> Tuple[
126
+ user_event_service.CollectUserEventRequest,
127
+ Sequence[Tuple[str, Union[str, bytes]]],
128
+ ]:
129
+ """Pre-rpc interceptor for collect_user_event
130
+
131
+ Override in a subclass to manipulate the request or metadata
132
+ before they are sent to the UserEventService server.
133
+ """
134
+ return request, metadata
135
+
136
+ def post_collect_user_event(
137
+ self, response: httpbody_pb2.HttpBody
138
+ ) -> httpbody_pb2.HttpBody:
139
+ """Post-rpc interceptor for collect_user_event
140
+
141
+ DEPRECATED. Please use the `post_collect_user_event_with_metadata`
142
+ interceptor instead.
143
+
144
+ Override in a subclass to read or manipulate the response
145
+ after it is returned by the UserEventService server but before
146
+ it is returned to user code. This `post_collect_user_event` interceptor runs
147
+ before the `post_collect_user_event_with_metadata` interceptor.
148
+ """
149
+ return response
150
+
151
+ def post_collect_user_event_with_metadata(
152
+ self,
153
+ response: httpbody_pb2.HttpBody,
154
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
155
+ ) -> Tuple[httpbody_pb2.HttpBody, Sequence[Tuple[str, Union[str, bytes]]]]:
156
+ """Post-rpc interceptor for collect_user_event
157
+
158
+ Override in a subclass to read or manipulate the response or metadata after it
159
+ is returned by the UserEventService server but before it is returned to user code.
160
+
161
+ We recommend only using this `post_collect_user_event_with_metadata`
162
+ interceptor in new development instead of the `post_collect_user_event` interceptor.
163
+ When both interceptors are used, this `post_collect_user_event_with_metadata` interceptor runs after the
164
+ `post_collect_user_event` interceptor. The (possibly modified) response returned by
165
+ `post_collect_user_event` will be passed to
166
+ `post_collect_user_event_with_metadata`.
167
+ """
168
+ return response, metadata
169
+
170
+ def pre_import_user_events(
171
+ self,
172
+ request: import_config.ImportUserEventsRequest,
173
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
174
+ ) -> Tuple[
175
+ import_config.ImportUserEventsRequest, Sequence[Tuple[str, Union[str, bytes]]]
176
+ ]:
177
+ """Pre-rpc interceptor for import_user_events
178
+
179
+ Override in a subclass to manipulate the request or metadata
180
+ before they are sent to the UserEventService server.
181
+ """
182
+ return request, metadata
183
+
184
+ def post_import_user_events(
185
+ self, response: operations_pb2.Operation
186
+ ) -> operations_pb2.Operation:
187
+ """Post-rpc interceptor for import_user_events
188
+
189
+ DEPRECATED. Please use the `post_import_user_events_with_metadata`
190
+ interceptor instead.
191
+
192
+ Override in a subclass to read or manipulate the response
193
+ after it is returned by the UserEventService server but before
194
+ it is returned to user code. This `post_import_user_events` interceptor runs
195
+ before the `post_import_user_events_with_metadata` interceptor.
196
+ """
197
+ return response
198
+
199
+ def post_import_user_events_with_metadata(
200
+ self,
201
+ response: operations_pb2.Operation,
202
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
203
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
204
+ """Post-rpc interceptor for import_user_events
205
+
206
+ Override in a subclass to read or manipulate the response or metadata after it
207
+ is returned by the UserEventService server but before it is returned to user code.
208
+
209
+ We recommend only using this `post_import_user_events_with_metadata`
210
+ interceptor in new development instead of the `post_import_user_events` interceptor.
211
+ When both interceptors are used, this `post_import_user_events_with_metadata` interceptor runs after the
212
+ `post_import_user_events` interceptor. The (possibly modified) response returned by
213
+ `post_import_user_events` will be passed to
214
+ `post_import_user_events_with_metadata`.
215
+ """
216
+ return response, metadata
217
+
218
+ def pre_purge_user_events(
219
+ self,
220
+ request: purge_config.PurgeUserEventsRequest,
221
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
222
+ ) -> Tuple[
223
+ purge_config.PurgeUserEventsRequest, Sequence[Tuple[str, Union[str, bytes]]]
224
+ ]:
225
+ """Pre-rpc interceptor for purge_user_events
226
+
227
+ Override in a subclass to manipulate the request or metadata
228
+ before they are sent to the UserEventService server.
229
+ """
230
+ return request, metadata
231
+
232
+ def post_purge_user_events(
233
+ self, response: operations_pb2.Operation
234
+ ) -> operations_pb2.Operation:
235
+ """Post-rpc interceptor for purge_user_events
236
+
237
+ DEPRECATED. Please use the `post_purge_user_events_with_metadata`
238
+ interceptor instead.
239
+
240
+ Override in a subclass to read or manipulate the response
241
+ after it is returned by the UserEventService server but before
242
+ it is returned to user code. This `post_purge_user_events` interceptor runs
243
+ before the `post_purge_user_events_with_metadata` interceptor.
244
+ """
245
+ return response
246
+
247
+ def post_purge_user_events_with_metadata(
248
+ self,
249
+ response: operations_pb2.Operation,
250
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
251
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
252
+ """Post-rpc interceptor for purge_user_events
253
+
254
+ Override in a subclass to read or manipulate the response or metadata after it
255
+ is returned by the UserEventService server but before it is returned to user code.
256
+
257
+ We recommend only using this `post_purge_user_events_with_metadata`
258
+ interceptor in new development instead of the `post_purge_user_events` interceptor.
259
+ When both interceptors are used, this `post_purge_user_events_with_metadata` interceptor runs after the
260
+ `post_purge_user_events` interceptor. The (possibly modified) response returned by
261
+ `post_purge_user_events` will be passed to
262
+ `post_purge_user_events_with_metadata`.
263
+ """
264
+ return response, metadata
265
+
266
+ def pre_write_user_event(
267
+ self,
268
+ request: user_event_service.WriteUserEventRequest,
269
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
270
+ ) -> Tuple[
271
+ user_event_service.WriteUserEventRequest,
272
+ Sequence[Tuple[str, Union[str, bytes]]],
273
+ ]:
274
+ """Pre-rpc interceptor for write_user_event
275
+
276
+ Override in a subclass to manipulate the request or metadata
277
+ before they are sent to the UserEventService server.
278
+ """
279
+ return request, metadata
280
+
281
+ def post_write_user_event(
282
+ self, response: user_event.UserEvent
283
+ ) -> user_event.UserEvent:
284
+ """Post-rpc interceptor for write_user_event
285
+
286
+ DEPRECATED. Please use the `post_write_user_event_with_metadata`
287
+ interceptor instead.
288
+
289
+ Override in a subclass to read or manipulate the response
290
+ after it is returned by the UserEventService server but before
291
+ it is returned to user code. This `post_write_user_event` interceptor runs
292
+ before the `post_write_user_event_with_metadata` interceptor.
293
+ """
294
+ return response
295
+
296
+ def post_write_user_event_with_metadata(
297
+ self,
298
+ response: user_event.UserEvent,
299
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
300
+ ) -> Tuple[user_event.UserEvent, Sequence[Tuple[str, Union[str, bytes]]]]:
301
+ """Post-rpc interceptor for write_user_event
302
+
303
+ Override in a subclass to read or manipulate the response or metadata after it
304
+ is returned by the UserEventService server but before it is returned to user code.
305
+
306
+ We recommend only using this `post_write_user_event_with_metadata`
307
+ interceptor in new development instead of the `post_write_user_event` interceptor.
308
+ When both interceptors are used, this `post_write_user_event_with_metadata` interceptor runs after the
309
+ `post_write_user_event` interceptor. The (possibly modified) response returned by
310
+ `post_write_user_event` will be passed to
311
+ `post_write_user_event_with_metadata`.
312
+ """
313
+ return response, metadata
314
+
315
+ def pre_cancel_operation(
316
+ self,
317
+ request: operations_pb2.CancelOperationRequest,
318
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
319
+ ) -> Tuple[
320
+ operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
321
+ ]:
322
+ """Pre-rpc interceptor for cancel_operation
323
+
324
+ Override in a subclass to manipulate the request or metadata
325
+ before they are sent to the UserEventService server.
326
+ """
327
+ return request, metadata
328
+
329
+ def post_cancel_operation(self, response: None) -> None:
330
+ """Post-rpc interceptor for cancel_operation
331
+
332
+ Override in a subclass to manipulate the response
333
+ after it is returned by the UserEventService server but before
334
+ it is returned to user code.
335
+ """
336
+ return response
337
+
338
+ def pre_get_operation(
339
+ self,
340
+ request: operations_pb2.GetOperationRequest,
341
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
342
+ ) -> Tuple[
343
+ operations_pb2.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
344
+ ]:
345
+ """Pre-rpc interceptor for get_operation
346
+
347
+ Override in a subclass to manipulate the request or metadata
348
+ before they are sent to the UserEventService server.
349
+ """
350
+ return request, metadata
351
+
352
+ def post_get_operation(
353
+ self, response: operations_pb2.Operation
354
+ ) -> operations_pb2.Operation:
355
+ """Post-rpc interceptor for get_operation
356
+
357
+ Override in a subclass to manipulate the response
358
+ after it is returned by the UserEventService server but before
359
+ it is returned to user code.
360
+ """
361
+ return response
362
+
363
+ def pre_list_operations(
364
+ self,
365
+ request: operations_pb2.ListOperationsRequest,
366
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
367
+ ) -> Tuple[
368
+ operations_pb2.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]]
369
+ ]:
370
+ """Pre-rpc interceptor for list_operations
371
+
372
+ Override in a subclass to manipulate the request or metadata
373
+ before they are sent to the UserEventService server.
374
+ """
375
+ return request, metadata
376
+
377
+ def post_list_operations(
378
+ self, response: operations_pb2.ListOperationsResponse
379
+ ) -> operations_pb2.ListOperationsResponse:
380
+ """Post-rpc interceptor for list_operations
381
+
382
+ Override in a subclass to manipulate the response
383
+ after it is returned by the UserEventService server but before
384
+ it is returned to user code.
385
+ """
386
+ return response
387
+
388
+
389
+ @dataclasses.dataclass
390
+ class UserEventServiceRestStub:
391
+ _session: AuthorizedSession
392
+ _host: str
393
+ _interceptor: UserEventServiceRestInterceptor
394
+
395
+
396
+ class UserEventServiceRestTransport(_BaseUserEventServiceRestTransport):
397
+ """REST backend synchronous transport for UserEventService.
398
+
399
+ Service for ingesting end user actions on a website to
400
+ Discovery Engine API.
401
+
402
+ This class defines the same methods as the primary client, so the
403
+ primary client can load the underlying transport implementation
404
+ and call it.
405
+
406
+ It sends JSON representations of protocol buffers over HTTP/1.1
407
+ """
408
+
409
+ def __init__(
410
+ self,
411
+ *,
412
+ host: str = "discoveryengine.googleapis.com",
413
+ credentials: Optional[ga_credentials.Credentials] = None,
414
+ credentials_file: Optional[str] = None,
415
+ scopes: Optional[Sequence[str]] = None,
416
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
417
+ quota_project_id: Optional[str] = None,
418
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
419
+ always_use_jwt_access: Optional[bool] = False,
420
+ url_scheme: str = "https",
421
+ interceptor: Optional[UserEventServiceRestInterceptor] = None,
422
+ api_audience: Optional[str] = None,
423
+ ) -> None:
424
+ """Instantiate the transport.
425
+
426
+ Args:
427
+ host (Optional[str]):
428
+ The hostname to connect to (default: 'discoveryengine.googleapis.com').
429
+ credentials (Optional[google.auth.credentials.Credentials]): The
430
+ authorization credentials to attach to requests. These
431
+ credentials identify the application to the service; if none
432
+ are specified, the client will attempt to ascertain the
433
+ credentials from the environment.
434
+
435
+ credentials_file (Optional[str]): A file with credentials that can
436
+ be loaded with :func:`google.auth.load_credentials_from_file`.
437
+ This argument is ignored if ``channel`` is provided.
438
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
439
+ ignored if ``channel`` is provided.
440
+ client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client
441
+ certificate to configure mutual TLS HTTP channel. It is ignored
442
+ if ``channel`` is provided.
443
+ quota_project_id (Optional[str]): An optional project to use for billing
444
+ and quota.
445
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
446
+ The client info used to send a user-agent string along with
447
+ API requests. If ``None``, then default info will be used.
448
+ Generally, you only need to set this if you are developing
449
+ your own client library.
450
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
451
+ be used for service account credentials.
452
+ url_scheme: the protocol scheme for the API endpoint. Normally
453
+ "https", but for testing or local servers,
454
+ "http" can be specified.
455
+ """
456
+ # Run the base constructor
457
+ # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc.
458
+ # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the
459
+ # credentials object
460
+ super().__init__(
461
+ host=host,
462
+ credentials=credentials,
463
+ client_info=client_info,
464
+ always_use_jwt_access=always_use_jwt_access,
465
+ url_scheme=url_scheme,
466
+ api_audience=api_audience,
467
+ )
468
+ self._session = AuthorizedSession(
469
+ self._credentials, default_host=self.DEFAULT_HOST
470
+ )
471
+ self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None
472
+ if client_cert_source_for_mtls:
473
+ self._session.configure_mtls_channel(client_cert_source_for_mtls)
474
+ self._interceptor = interceptor or UserEventServiceRestInterceptor()
475
+ self._prep_wrapped_messages(client_info)
476
+
477
+ @property
478
+ def operations_client(self) -> operations_v1.AbstractOperationsClient:
479
+ """Create the client designed to process long-running operations.
480
+
481
+ This property caches on the instance; repeated calls return the same
482
+ client.
483
+ """
484
+ # Only create a new client if we do not already have one.
485
+ if self._operations_client is None:
486
+ http_options: Dict[str, List[Dict[str, str]]] = {
487
+ "google.longrunning.Operations.CancelOperation": [
488
+ {
489
+ "method": "post",
490
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel",
491
+ "body": "*",
492
+ },
493
+ {
494
+ "method": "post",
495
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel",
496
+ "body": "*",
497
+ },
498
+ ],
499
+ "google.longrunning.Operations.GetOperation": [
500
+ {
501
+ "method": "get",
502
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}",
503
+ },
504
+ {
505
+ "method": "get",
506
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}",
507
+ },
508
+ {
509
+ "method": "get",
510
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/models/*/operations/*}",
511
+ },
512
+ {
513
+ "method": "get",
514
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/operations/*}",
515
+ },
516
+ {
517
+ "method": "get",
518
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*/operations/*}",
519
+ },
520
+ {
521
+ "method": "get",
522
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/operations/*}",
523
+ },
524
+ {
525
+ "method": "get",
526
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/operations/*}",
527
+ },
528
+ {
529
+ "method": "get",
530
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/engines/*/operations/*}",
531
+ },
532
+ {
533
+ "method": "get",
534
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/operations/*}",
535
+ },
536
+ {
537
+ "method": "get",
538
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}",
539
+ },
540
+ {
541
+ "method": "get",
542
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/models/*/operations/*}",
543
+ },
544
+ {
545
+ "method": "get",
546
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/operations/*}",
547
+ },
548
+ {
549
+ "method": "get",
550
+ "uri": "/v1beta/{name=projects/*/locations/*/evaluations/*/operations/*}",
551
+ },
552
+ {
553
+ "method": "get",
554
+ "uri": "/v1beta/{name=projects/*/locations/*/operations/*}",
555
+ },
556
+ {
557
+ "method": "get",
558
+ "uri": "/v1beta/{name=projects/*/locations/*/sampleQuerySets/*/operations/*}",
559
+ },
560
+ {
561
+ "method": "get",
562
+ "uri": "/v1beta/{name=projects/*/operations/*}",
563
+ },
564
+ ],
565
+ "google.longrunning.Operations.ListOperations": [
566
+ {
567
+ "method": "get",
568
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataConnector}/operations",
569
+ },
570
+ {
571
+ "method": "get",
572
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*}/operations",
573
+ },
574
+ {
575
+ "method": "get",
576
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/models/*}/operations",
577
+ },
578
+ {
579
+ "method": "get",
580
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*}/operations",
581
+ },
582
+ {
583
+ "method": "get",
584
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites}/operations",
585
+ },
586
+ {
587
+ "method": "get",
588
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/operations",
589
+ },
590
+ {
591
+ "method": "get",
592
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*}/operations",
593
+ },
594
+ {
595
+ "method": "get",
596
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/engines/*}/operations",
597
+ },
598
+ {
599
+ "method": "get",
600
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*}/operations",
601
+ },
602
+ {
603
+ "method": "get",
604
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*}/operations",
605
+ },
606
+ {
607
+ "method": "get",
608
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/models/*}/operations",
609
+ },
610
+ {
611
+ "method": "get",
612
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*}/operations",
613
+ },
614
+ {
615
+ "method": "get",
616
+ "uri": "/v1beta/{name=projects/*/locations/*}/operations",
617
+ },
618
+ {
619
+ "method": "get",
620
+ "uri": "/v1beta/{name=projects/*}/operations",
621
+ },
622
+ ],
623
+ }
624
+
625
+ rest_transport = operations_v1.OperationsRestTransport(
626
+ host=self._host,
627
+ # use the credentials which are saved
628
+ credentials=self._credentials,
629
+ scopes=self._scopes,
630
+ http_options=http_options,
631
+ path_prefix="v1beta",
632
+ )
633
+
634
+ self._operations_client = operations_v1.AbstractOperationsClient(
635
+ transport=rest_transport
636
+ )
637
+
638
+ # Return the client from cache.
639
+ return self._operations_client
640
+
641
+ class _CollectUserEvent(
642
+ _BaseUserEventServiceRestTransport._BaseCollectUserEvent,
643
+ UserEventServiceRestStub,
644
+ ):
645
+ def __hash__(self):
646
+ return hash("UserEventServiceRestTransport.CollectUserEvent")
647
+
648
+ @staticmethod
649
+ def _get_response(
650
+ host,
651
+ metadata,
652
+ query_params,
653
+ session,
654
+ timeout,
655
+ transcoded_request,
656
+ body=None,
657
+ ):
658
+ uri = transcoded_request["uri"]
659
+ method = transcoded_request["method"]
660
+ headers = dict(metadata)
661
+ headers["Content-Type"] = "application/json"
662
+ response = getattr(session, method)(
663
+ "{host}{uri}".format(host=host, uri=uri),
664
+ timeout=timeout,
665
+ headers=headers,
666
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
667
+ )
668
+ return response
669
+
670
+ def __call__(
671
+ self,
672
+ request: user_event_service.CollectUserEventRequest,
673
+ *,
674
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
675
+ timeout: Optional[float] = None,
676
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
677
+ ) -> httpbody_pb2.HttpBody:
678
+ r"""Call the collect user event method over HTTP.
679
+
680
+ Args:
681
+ request (~.user_event_service.CollectUserEventRequest):
682
+ The request object. Request message for CollectUserEvent
683
+ method.
684
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
685
+ should be retried.
686
+ timeout (float): The timeout for this request.
687
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
688
+ sent along with the request as metadata. Normally, each value must be of type `str`,
689
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
690
+ be of type `bytes`.
691
+
692
+ Returns:
693
+ ~.httpbody_pb2.HttpBody:
694
+ Message that represents an arbitrary HTTP body. It
695
+ should only be used for payload formats that can't be
696
+ represented as JSON, such as raw binary or an HTML page.
697
+
698
+ This message can be used both in streaming and
699
+ non-streaming API methods in the request as well as the
700
+ response.
701
+
702
+ It can be used as a top-level request field, which is
703
+ convenient if one wants to extract parameters from
704
+ either the URL or HTTP template into the request fields
705
+ and also want access to the raw HTTP body.
706
+
707
+ Example:
708
+
709
+ ::
710
+
711
+ message GetResourceRequest {
712
+ // A unique request id.
713
+ string request_id = 1;
714
+
715
+ // The raw HTTP body is bound to this field.
716
+ google.api.HttpBody http_body = 2;
717
+
718
+ }
719
+
720
+ service ResourceService {
721
+ rpc GetResource(GetResourceRequest)
722
+ returns (google.api.HttpBody);
723
+ rpc UpdateResource(google.api.HttpBody)
724
+ returns (google.protobuf.Empty);
725
+
726
+ }
727
+
728
+ Example with streaming methods:
729
+
730
+ ::
731
+
732
+ service CaldavService {
733
+ rpc GetCalendar(stream google.api.HttpBody)
734
+ returns (stream google.api.HttpBody);
735
+ rpc UpdateCalendar(stream google.api.HttpBody)
736
+ returns (stream google.api.HttpBody);
737
+
738
+ }
739
+
740
+ Use of this type only changes how the request and
741
+ response bodies are handled, all other features will
742
+ continue to work unchanged.
743
+
744
+ """
745
+
746
+ http_options = (
747
+ _BaseUserEventServiceRestTransport._BaseCollectUserEvent._get_http_options()
748
+ )
749
+
750
+ request, metadata = self._interceptor.pre_collect_user_event(
751
+ request, metadata
752
+ )
753
+ transcoded_request = _BaseUserEventServiceRestTransport._BaseCollectUserEvent._get_transcoded_request(
754
+ http_options, request
755
+ )
756
+
757
+ # Jsonify the query params
758
+ query_params = _BaseUserEventServiceRestTransport._BaseCollectUserEvent._get_query_params_json(
759
+ transcoded_request
760
+ )
761
+
762
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
763
+ logging.DEBUG
764
+ ): # pragma: NO COVER
765
+ request_url = "{host}{uri}".format(
766
+ host=self._host, uri=transcoded_request["uri"]
767
+ )
768
+ method = transcoded_request["method"]
769
+ try:
770
+ request_payload = json_format.MessageToJson(request)
771
+ except:
772
+ request_payload = None
773
+ http_request = {
774
+ "payload": request_payload,
775
+ "requestMethod": method,
776
+ "requestUrl": request_url,
777
+ "headers": dict(metadata),
778
+ }
779
+ _LOGGER.debug(
780
+ f"Sending request for google.cloud.discoveryengine_v1beta.UserEventServiceClient.CollectUserEvent",
781
+ extra={
782
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
783
+ "rpcName": "CollectUserEvent",
784
+ "httpRequest": http_request,
785
+ "metadata": http_request["headers"],
786
+ },
787
+ )
788
+
789
+ # Send the request
790
+ response = UserEventServiceRestTransport._CollectUserEvent._get_response(
791
+ self._host,
792
+ metadata,
793
+ query_params,
794
+ self._session,
795
+ timeout,
796
+ transcoded_request,
797
+ )
798
+
799
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
800
+ # subclass.
801
+ if response.status_code >= 400:
802
+ raise core_exceptions.from_http_response(response)
803
+
804
+ # Return the response
805
+ resp = httpbody_pb2.HttpBody()
806
+ pb_resp = resp
807
+
808
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
809
+
810
+ resp = self._interceptor.post_collect_user_event(resp)
811
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
812
+ resp, _ = self._interceptor.post_collect_user_event_with_metadata(
813
+ resp, response_metadata
814
+ )
815
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
816
+ logging.DEBUG
817
+ ): # pragma: NO COVER
818
+ try:
819
+ response_payload = json_format.MessageToJson(resp)
820
+ except:
821
+ response_payload = None
822
+ http_response = {
823
+ "payload": response_payload,
824
+ "headers": dict(response.headers),
825
+ "status": response.status_code,
826
+ }
827
+ _LOGGER.debug(
828
+ "Received response for google.cloud.discoveryengine_v1beta.UserEventServiceClient.collect_user_event",
829
+ extra={
830
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
831
+ "rpcName": "CollectUserEvent",
832
+ "metadata": http_response["headers"],
833
+ "httpResponse": http_response,
834
+ },
835
+ )
836
+ return resp
837
+
838
+ class _ImportUserEvents(
839
+ _BaseUserEventServiceRestTransport._BaseImportUserEvents,
840
+ UserEventServiceRestStub,
841
+ ):
842
+ def __hash__(self):
843
+ return hash("UserEventServiceRestTransport.ImportUserEvents")
844
+
845
+ @staticmethod
846
+ def _get_response(
847
+ host,
848
+ metadata,
849
+ query_params,
850
+ session,
851
+ timeout,
852
+ transcoded_request,
853
+ body=None,
854
+ ):
855
+ uri = transcoded_request["uri"]
856
+ method = transcoded_request["method"]
857
+ headers = dict(metadata)
858
+ headers["Content-Type"] = "application/json"
859
+ response = getattr(session, method)(
860
+ "{host}{uri}".format(host=host, uri=uri),
861
+ timeout=timeout,
862
+ headers=headers,
863
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
864
+ data=body,
865
+ )
866
+ return response
867
+
868
+ def __call__(
869
+ self,
870
+ request: import_config.ImportUserEventsRequest,
871
+ *,
872
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
873
+ timeout: Optional[float] = None,
874
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
875
+ ) -> operations_pb2.Operation:
876
+ r"""Call the import user events method over HTTP.
877
+
878
+ Args:
879
+ request (~.import_config.ImportUserEventsRequest):
880
+ The request object. Request message for the
881
+ ImportUserEvents request.
882
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
883
+ should be retried.
884
+ timeout (float): The timeout for this request.
885
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
886
+ sent along with the request as metadata. Normally, each value must be of type `str`,
887
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
888
+ be of type `bytes`.
889
+
890
+ Returns:
891
+ ~.operations_pb2.Operation:
892
+ This resource represents a
893
+ long-running operation that is the
894
+ result of a network API call.
895
+
896
+ """
897
+
898
+ http_options = (
899
+ _BaseUserEventServiceRestTransport._BaseImportUserEvents._get_http_options()
900
+ )
901
+
902
+ request, metadata = self._interceptor.pre_import_user_events(
903
+ request, metadata
904
+ )
905
+ transcoded_request = _BaseUserEventServiceRestTransport._BaseImportUserEvents._get_transcoded_request(
906
+ http_options, request
907
+ )
908
+
909
+ body = _BaseUserEventServiceRestTransport._BaseImportUserEvents._get_request_body_json(
910
+ transcoded_request
911
+ )
912
+
913
+ # Jsonify the query params
914
+ query_params = _BaseUserEventServiceRestTransport._BaseImportUserEvents._get_query_params_json(
915
+ transcoded_request
916
+ )
917
+
918
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
919
+ logging.DEBUG
920
+ ): # pragma: NO COVER
921
+ request_url = "{host}{uri}".format(
922
+ host=self._host, uri=transcoded_request["uri"]
923
+ )
924
+ method = transcoded_request["method"]
925
+ try:
926
+ request_payload = json_format.MessageToJson(request)
927
+ except:
928
+ request_payload = None
929
+ http_request = {
930
+ "payload": request_payload,
931
+ "requestMethod": method,
932
+ "requestUrl": request_url,
933
+ "headers": dict(metadata),
934
+ }
935
+ _LOGGER.debug(
936
+ f"Sending request for google.cloud.discoveryengine_v1beta.UserEventServiceClient.ImportUserEvents",
937
+ extra={
938
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
939
+ "rpcName": "ImportUserEvents",
940
+ "httpRequest": http_request,
941
+ "metadata": http_request["headers"],
942
+ },
943
+ )
944
+
945
+ # Send the request
946
+ response = UserEventServiceRestTransport._ImportUserEvents._get_response(
947
+ self._host,
948
+ metadata,
949
+ query_params,
950
+ self._session,
951
+ timeout,
952
+ transcoded_request,
953
+ body,
954
+ )
955
+
956
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
957
+ # subclass.
958
+ if response.status_code >= 400:
959
+ raise core_exceptions.from_http_response(response)
960
+
961
+ # Return the response
962
+ resp = operations_pb2.Operation()
963
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
964
+
965
+ resp = self._interceptor.post_import_user_events(resp)
966
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
967
+ resp, _ = self._interceptor.post_import_user_events_with_metadata(
968
+ resp, response_metadata
969
+ )
970
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
971
+ logging.DEBUG
972
+ ): # pragma: NO COVER
973
+ try:
974
+ response_payload = json_format.MessageToJson(resp)
975
+ except:
976
+ response_payload = None
977
+ http_response = {
978
+ "payload": response_payload,
979
+ "headers": dict(response.headers),
980
+ "status": response.status_code,
981
+ }
982
+ _LOGGER.debug(
983
+ "Received response for google.cloud.discoveryengine_v1beta.UserEventServiceClient.import_user_events",
984
+ extra={
985
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
986
+ "rpcName": "ImportUserEvents",
987
+ "metadata": http_response["headers"],
988
+ "httpResponse": http_response,
989
+ },
990
+ )
991
+ return resp
992
+
993
+ class _PurgeUserEvents(
994
+ _BaseUserEventServiceRestTransport._BasePurgeUserEvents,
995
+ UserEventServiceRestStub,
996
+ ):
997
+ def __hash__(self):
998
+ return hash("UserEventServiceRestTransport.PurgeUserEvents")
999
+
1000
+ @staticmethod
1001
+ def _get_response(
1002
+ host,
1003
+ metadata,
1004
+ query_params,
1005
+ session,
1006
+ timeout,
1007
+ transcoded_request,
1008
+ body=None,
1009
+ ):
1010
+ uri = transcoded_request["uri"]
1011
+ method = transcoded_request["method"]
1012
+ headers = dict(metadata)
1013
+ headers["Content-Type"] = "application/json"
1014
+ response = getattr(session, method)(
1015
+ "{host}{uri}".format(host=host, uri=uri),
1016
+ timeout=timeout,
1017
+ headers=headers,
1018
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1019
+ data=body,
1020
+ )
1021
+ return response
1022
+
1023
+ def __call__(
1024
+ self,
1025
+ request: purge_config.PurgeUserEventsRequest,
1026
+ *,
1027
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1028
+ timeout: Optional[float] = None,
1029
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1030
+ ) -> operations_pb2.Operation:
1031
+ r"""Call the purge user events method over HTTP.
1032
+
1033
+ Args:
1034
+ request (~.purge_config.PurgeUserEventsRequest):
1035
+ The request object. Request message for PurgeUserEvents
1036
+ method.
1037
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1038
+ should be retried.
1039
+ timeout (float): The timeout for this request.
1040
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1041
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1042
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1043
+ be of type `bytes`.
1044
+
1045
+ Returns:
1046
+ ~.operations_pb2.Operation:
1047
+ This resource represents a
1048
+ long-running operation that is the
1049
+ result of a network API call.
1050
+
1051
+ """
1052
+
1053
+ http_options = (
1054
+ _BaseUserEventServiceRestTransport._BasePurgeUserEvents._get_http_options()
1055
+ )
1056
+
1057
+ request, metadata = self._interceptor.pre_purge_user_events(
1058
+ request, metadata
1059
+ )
1060
+ transcoded_request = _BaseUserEventServiceRestTransport._BasePurgeUserEvents._get_transcoded_request(
1061
+ http_options, request
1062
+ )
1063
+
1064
+ body = _BaseUserEventServiceRestTransport._BasePurgeUserEvents._get_request_body_json(
1065
+ transcoded_request
1066
+ )
1067
+
1068
+ # Jsonify the query params
1069
+ query_params = _BaseUserEventServiceRestTransport._BasePurgeUserEvents._get_query_params_json(
1070
+ transcoded_request
1071
+ )
1072
+
1073
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1074
+ logging.DEBUG
1075
+ ): # pragma: NO COVER
1076
+ request_url = "{host}{uri}".format(
1077
+ host=self._host, uri=transcoded_request["uri"]
1078
+ )
1079
+ method = transcoded_request["method"]
1080
+ try:
1081
+ request_payload = json_format.MessageToJson(request)
1082
+ except:
1083
+ request_payload = None
1084
+ http_request = {
1085
+ "payload": request_payload,
1086
+ "requestMethod": method,
1087
+ "requestUrl": request_url,
1088
+ "headers": dict(metadata),
1089
+ }
1090
+ _LOGGER.debug(
1091
+ f"Sending request for google.cloud.discoveryengine_v1beta.UserEventServiceClient.PurgeUserEvents",
1092
+ extra={
1093
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
1094
+ "rpcName": "PurgeUserEvents",
1095
+ "httpRequest": http_request,
1096
+ "metadata": http_request["headers"],
1097
+ },
1098
+ )
1099
+
1100
+ # Send the request
1101
+ response = UserEventServiceRestTransport._PurgeUserEvents._get_response(
1102
+ self._host,
1103
+ metadata,
1104
+ query_params,
1105
+ self._session,
1106
+ timeout,
1107
+ transcoded_request,
1108
+ body,
1109
+ )
1110
+
1111
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1112
+ # subclass.
1113
+ if response.status_code >= 400:
1114
+ raise core_exceptions.from_http_response(response)
1115
+
1116
+ # Return the response
1117
+ resp = operations_pb2.Operation()
1118
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
1119
+
1120
+ resp = self._interceptor.post_purge_user_events(resp)
1121
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
1122
+ resp, _ = self._interceptor.post_purge_user_events_with_metadata(
1123
+ resp, response_metadata
1124
+ )
1125
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1126
+ logging.DEBUG
1127
+ ): # pragma: NO COVER
1128
+ try:
1129
+ response_payload = json_format.MessageToJson(resp)
1130
+ except:
1131
+ response_payload = None
1132
+ http_response = {
1133
+ "payload": response_payload,
1134
+ "headers": dict(response.headers),
1135
+ "status": response.status_code,
1136
+ }
1137
+ _LOGGER.debug(
1138
+ "Received response for google.cloud.discoveryengine_v1beta.UserEventServiceClient.purge_user_events",
1139
+ extra={
1140
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
1141
+ "rpcName": "PurgeUserEvents",
1142
+ "metadata": http_response["headers"],
1143
+ "httpResponse": http_response,
1144
+ },
1145
+ )
1146
+ return resp
1147
+
1148
+ class _WriteUserEvent(
1149
+ _BaseUserEventServiceRestTransport._BaseWriteUserEvent, UserEventServiceRestStub
1150
+ ):
1151
+ def __hash__(self):
1152
+ return hash("UserEventServiceRestTransport.WriteUserEvent")
1153
+
1154
+ @staticmethod
1155
+ def _get_response(
1156
+ host,
1157
+ metadata,
1158
+ query_params,
1159
+ session,
1160
+ timeout,
1161
+ transcoded_request,
1162
+ body=None,
1163
+ ):
1164
+ uri = transcoded_request["uri"]
1165
+ method = transcoded_request["method"]
1166
+ headers = dict(metadata)
1167
+ headers["Content-Type"] = "application/json"
1168
+ response = getattr(session, method)(
1169
+ "{host}{uri}".format(host=host, uri=uri),
1170
+ timeout=timeout,
1171
+ headers=headers,
1172
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1173
+ data=body,
1174
+ )
1175
+ return response
1176
+
1177
+ def __call__(
1178
+ self,
1179
+ request: user_event_service.WriteUserEventRequest,
1180
+ *,
1181
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1182
+ timeout: Optional[float] = None,
1183
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1184
+ ) -> user_event.UserEvent:
1185
+ r"""Call the write user event method over HTTP.
1186
+
1187
+ Args:
1188
+ request (~.user_event_service.WriteUserEventRequest):
1189
+ The request object. Request message for WriteUserEvent
1190
+ method.
1191
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1192
+ should be retried.
1193
+ timeout (float): The timeout for this request.
1194
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1195
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1196
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1197
+ be of type `bytes`.
1198
+
1199
+ Returns:
1200
+ ~.user_event.UserEvent:
1201
+ UserEvent captures all metadata
1202
+ information Discovery Engine API needs
1203
+ to know about how end users interact
1204
+ with your website.
1205
+
1206
+ """
1207
+
1208
+ http_options = (
1209
+ _BaseUserEventServiceRestTransport._BaseWriteUserEvent._get_http_options()
1210
+ )
1211
+
1212
+ request, metadata = self._interceptor.pre_write_user_event(
1213
+ request, metadata
1214
+ )
1215
+ transcoded_request = _BaseUserEventServiceRestTransport._BaseWriteUserEvent._get_transcoded_request(
1216
+ http_options, request
1217
+ )
1218
+
1219
+ body = _BaseUserEventServiceRestTransport._BaseWriteUserEvent._get_request_body_json(
1220
+ transcoded_request
1221
+ )
1222
+
1223
+ # Jsonify the query params
1224
+ query_params = _BaseUserEventServiceRestTransport._BaseWriteUserEvent._get_query_params_json(
1225
+ transcoded_request
1226
+ )
1227
+
1228
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1229
+ logging.DEBUG
1230
+ ): # pragma: NO COVER
1231
+ request_url = "{host}{uri}".format(
1232
+ host=self._host, uri=transcoded_request["uri"]
1233
+ )
1234
+ method = transcoded_request["method"]
1235
+ try:
1236
+ request_payload = type(request).to_json(request)
1237
+ except:
1238
+ request_payload = None
1239
+ http_request = {
1240
+ "payload": request_payload,
1241
+ "requestMethod": method,
1242
+ "requestUrl": request_url,
1243
+ "headers": dict(metadata),
1244
+ }
1245
+ _LOGGER.debug(
1246
+ f"Sending request for google.cloud.discoveryengine_v1beta.UserEventServiceClient.WriteUserEvent",
1247
+ extra={
1248
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
1249
+ "rpcName": "WriteUserEvent",
1250
+ "httpRequest": http_request,
1251
+ "metadata": http_request["headers"],
1252
+ },
1253
+ )
1254
+
1255
+ # Send the request
1256
+ response = UserEventServiceRestTransport._WriteUserEvent._get_response(
1257
+ self._host,
1258
+ metadata,
1259
+ query_params,
1260
+ self._session,
1261
+ timeout,
1262
+ transcoded_request,
1263
+ body,
1264
+ )
1265
+
1266
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1267
+ # subclass.
1268
+ if response.status_code >= 400:
1269
+ raise core_exceptions.from_http_response(response)
1270
+
1271
+ # Return the response
1272
+ resp = user_event.UserEvent()
1273
+ pb_resp = user_event.UserEvent.pb(resp)
1274
+
1275
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
1276
+
1277
+ resp = self._interceptor.post_write_user_event(resp)
1278
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
1279
+ resp, _ = self._interceptor.post_write_user_event_with_metadata(
1280
+ resp, response_metadata
1281
+ )
1282
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1283
+ logging.DEBUG
1284
+ ): # pragma: NO COVER
1285
+ try:
1286
+ response_payload = user_event.UserEvent.to_json(response)
1287
+ except:
1288
+ response_payload = None
1289
+ http_response = {
1290
+ "payload": response_payload,
1291
+ "headers": dict(response.headers),
1292
+ "status": response.status_code,
1293
+ }
1294
+ _LOGGER.debug(
1295
+ "Received response for google.cloud.discoveryengine_v1beta.UserEventServiceClient.write_user_event",
1296
+ extra={
1297
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
1298
+ "rpcName": "WriteUserEvent",
1299
+ "metadata": http_response["headers"],
1300
+ "httpResponse": http_response,
1301
+ },
1302
+ )
1303
+ return resp
1304
+
1305
+ @property
1306
+ def collect_user_event(
1307
+ self,
1308
+ ) -> Callable[[user_event_service.CollectUserEventRequest], httpbody_pb2.HttpBody]:
1309
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
1310
+ # In C++ this would require a dynamic_cast
1311
+ return self._CollectUserEvent(self._session, self._host, self._interceptor) # type: ignore
1312
+
1313
+ @property
1314
+ def import_user_events(
1315
+ self,
1316
+ ) -> Callable[[import_config.ImportUserEventsRequest], operations_pb2.Operation]:
1317
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
1318
+ # In C++ this would require a dynamic_cast
1319
+ return self._ImportUserEvents(self._session, self._host, self._interceptor) # type: ignore
1320
+
1321
+ @property
1322
+ def purge_user_events(
1323
+ self,
1324
+ ) -> Callable[[purge_config.PurgeUserEventsRequest], operations_pb2.Operation]:
1325
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
1326
+ # In C++ this would require a dynamic_cast
1327
+ return self._PurgeUserEvents(self._session, self._host, self._interceptor) # type: ignore
1328
+
1329
+ @property
1330
+ def write_user_event(
1331
+ self,
1332
+ ) -> Callable[[user_event_service.WriteUserEventRequest], user_event.UserEvent]:
1333
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
1334
+ # In C++ this would require a dynamic_cast
1335
+ return self._WriteUserEvent(self._session, self._host, self._interceptor) # type: ignore
1336
+
1337
+ @property
1338
+ def cancel_operation(self):
1339
+ return self._CancelOperation(self._session, self._host, self._interceptor) # type: ignore
1340
+
1341
+ class _CancelOperation(
1342
+ _BaseUserEventServiceRestTransport._BaseCancelOperation,
1343
+ UserEventServiceRestStub,
1344
+ ):
1345
+ def __hash__(self):
1346
+ return hash("UserEventServiceRestTransport.CancelOperation")
1347
+
1348
+ @staticmethod
1349
+ def _get_response(
1350
+ host,
1351
+ metadata,
1352
+ query_params,
1353
+ session,
1354
+ timeout,
1355
+ transcoded_request,
1356
+ body=None,
1357
+ ):
1358
+ uri = transcoded_request["uri"]
1359
+ method = transcoded_request["method"]
1360
+ headers = dict(metadata)
1361
+ headers["Content-Type"] = "application/json"
1362
+ response = getattr(session, method)(
1363
+ "{host}{uri}".format(host=host, uri=uri),
1364
+ timeout=timeout,
1365
+ headers=headers,
1366
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1367
+ data=body,
1368
+ )
1369
+ return response
1370
+
1371
+ def __call__(
1372
+ self,
1373
+ request: operations_pb2.CancelOperationRequest,
1374
+ *,
1375
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1376
+ timeout: Optional[float] = None,
1377
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1378
+ ) -> None:
1379
+ r"""Call the cancel operation method over HTTP.
1380
+
1381
+ Args:
1382
+ request (operations_pb2.CancelOperationRequest):
1383
+ The request object for CancelOperation method.
1384
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1385
+ should be retried.
1386
+ timeout (float): The timeout for this request.
1387
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1388
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1389
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1390
+ be of type `bytes`.
1391
+ """
1392
+
1393
+ http_options = (
1394
+ _BaseUserEventServiceRestTransport._BaseCancelOperation._get_http_options()
1395
+ )
1396
+
1397
+ request, metadata = self._interceptor.pre_cancel_operation(
1398
+ request, metadata
1399
+ )
1400
+ transcoded_request = _BaseUserEventServiceRestTransport._BaseCancelOperation._get_transcoded_request(
1401
+ http_options, request
1402
+ )
1403
+
1404
+ body = _BaseUserEventServiceRestTransport._BaseCancelOperation._get_request_body_json(
1405
+ transcoded_request
1406
+ )
1407
+
1408
+ # Jsonify the query params
1409
+ query_params = _BaseUserEventServiceRestTransport._BaseCancelOperation._get_query_params_json(
1410
+ transcoded_request
1411
+ )
1412
+
1413
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1414
+ logging.DEBUG
1415
+ ): # pragma: NO COVER
1416
+ request_url = "{host}{uri}".format(
1417
+ host=self._host, uri=transcoded_request["uri"]
1418
+ )
1419
+ method = transcoded_request["method"]
1420
+ try:
1421
+ request_payload = json_format.MessageToJson(request)
1422
+ except:
1423
+ request_payload = None
1424
+ http_request = {
1425
+ "payload": request_payload,
1426
+ "requestMethod": method,
1427
+ "requestUrl": request_url,
1428
+ "headers": dict(metadata),
1429
+ }
1430
+ _LOGGER.debug(
1431
+ f"Sending request for google.cloud.discoveryengine_v1beta.UserEventServiceClient.CancelOperation",
1432
+ extra={
1433
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
1434
+ "rpcName": "CancelOperation",
1435
+ "httpRequest": http_request,
1436
+ "metadata": http_request["headers"],
1437
+ },
1438
+ )
1439
+
1440
+ # Send the request
1441
+ response = UserEventServiceRestTransport._CancelOperation._get_response(
1442
+ self._host,
1443
+ metadata,
1444
+ query_params,
1445
+ self._session,
1446
+ timeout,
1447
+ transcoded_request,
1448
+ body,
1449
+ )
1450
+
1451
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1452
+ # subclass.
1453
+ if response.status_code >= 400:
1454
+ raise core_exceptions.from_http_response(response)
1455
+
1456
+ return self._interceptor.post_cancel_operation(None)
1457
+
1458
+ @property
1459
+ def get_operation(self):
1460
+ return self._GetOperation(self._session, self._host, self._interceptor) # type: ignore
1461
+
1462
+ class _GetOperation(
1463
+ _BaseUserEventServiceRestTransport._BaseGetOperation, UserEventServiceRestStub
1464
+ ):
1465
+ def __hash__(self):
1466
+ return hash("UserEventServiceRestTransport.GetOperation")
1467
+
1468
+ @staticmethod
1469
+ def _get_response(
1470
+ host,
1471
+ metadata,
1472
+ query_params,
1473
+ session,
1474
+ timeout,
1475
+ transcoded_request,
1476
+ body=None,
1477
+ ):
1478
+ uri = transcoded_request["uri"]
1479
+ method = transcoded_request["method"]
1480
+ headers = dict(metadata)
1481
+ headers["Content-Type"] = "application/json"
1482
+ response = getattr(session, method)(
1483
+ "{host}{uri}".format(host=host, uri=uri),
1484
+ timeout=timeout,
1485
+ headers=headers,
1486
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1487
+ )
1488
+ return response
1489
+
1490
+ def __call__(
1491
+ self,
1492
+ request: operations_pb2.GetOperationRequest,
1493
+ *,
1494
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1495
+ timeout: Optional[float] = None,
1496
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1497
+ ) -> operations_pb2.Operation:
1498
+ r"""Call the get operation method over HTTP.
1499
+
1500
+ Args:
1501
+ request (operations_pb2.GetOperationRequest):
1502
+ The request object for GetOperation method.
1503
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1504
+ should be retried.
1505
+ timeout (float): The timeout for this request.
1506
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1507
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1508
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1509
+ be of type `bytes`.
1510
+
1511
+ Returns:
1512
+ operations_pb2.Operation: Response from GetOperation method.
1513
+ """
1514
+
1515
+ http_options = (
1516
+ _BaseUserEventServiceRestTransport._BaseGetOperation._get_http_options()
1517
+ )
1518
+
1519
+ request, metadata = self._interceptor.pre_get_operation(request, metadata)
1520
+ transcoded_request = _BaseUserEventServiceRestTransport._BaseGetOperation._get_transcoded_request(
1521
+ http_options, request
1522
+ )
1523
+
1524
+ # Jsonify the query params
1525
+ query_params = _BaseUserEventServiceRestTransport._BaseGetOperation._get_query_params_json(
1526
+ transcoded_request
1527
+ )
1528
+
1529
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1530
+ logging.DEBUG
1531
+ ): # pragma: NO COVER
1532
+ request_url = "{host}{uri}".format(
1533
+ host=self._host, uri=transcoded_request["uri"]
1534
+ )
1535
+ method = transcoded_request["method"]
1536
+ try:
1537
+ request_payload = json_format.MessageToJson(request)
1538
+ except:
1539
+ request_payload = None
1540
+ http_request = {
1541
+ "payload": request_payload,
1542
+ "requestMethod": method,
1543
+ "requestUrl": request_url,
1544
+ "headers": dict(metadata),
1545
+ }
1546
+ _LOGGER.debug(
1547
+ f"Sending request for google.cloud.discoveryengine_v1beta.UserEventServiceClient.GetOperation",
1548
+ extra={
1549
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
1550
+ "rpcName": "GetOperation",
1551
+ "httpRequest": http_request,
1552
+ "metadata": http_request["headers"],
1553
+ },
1554
+ )
1555
+
1556
+ # Send the request
1557
+ response = UserEventServiceRestTransport._GetOperation._get_response(
1558
+ self._host,
1559
+ metadata,
1560
+ query_params,
1561
+ self._session,
1562
+ timeout,
1563
+ transcoded_request,
1564
+ )
1565
+
1566
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1567
+ # subclass.
1568
+ if response.status_code >= 400:
1569
+ raise core_exceptions.from_http_response(response)
1570
+
1571
+ content = response.content.decode("utf-8")
1572
+ resp = operations_pb2.Operation()
1573
+ resp = json_format.Parse(content, resp)
1574
+ resp = self._interceptor.post_get_operation(resp)
1575
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1576
+ logging.DEBUG
1577
+ ): # pragma: NO COVER
1578
+ try:
1579
+ response_payload = json_format.MessageToJson(resp)
1580
+ except:
1581
+ response_payload = None
1582
+ http_response = {
1583
+ "payload": response_payload,
1584
+ "headers": dict(response.headers),
1585
+ "status": response.status_code,
1586
+ }
1587
+ _LOGGER.debug(
1588
+ "Received response for google.cloud.discoveryengine_v1beta.UserEventServiceAsyncClient.GetOperation",
1589
+ extra={
1590
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
1591
+ "rpcName": "GetOperation",
1592
+ "httpResponse": http_response,
1593
+ "metadata": http_response["headers"],
1594
+ },
1595
+ )
1596
+ return resp
1597
+
1598
+ @property
1599
+ def list_operations(self):
1600
+ return self._ListOperations(self._session, self._host, self._interceptor) # type: ignore
1601
+
1602
+ class _ListOperations(
1603
+ _BaseUserEventServiceRestTransport._BaseListOperations, UserEventServiceRestStub
1604
+ ):
1605
+ def __hash__(self):
1606
+ return hash("UserEventServiceRestTransport.ListOperations")
1607
+
1608
+ @staticmethod
1609
+ def _get_response(
1610
+ host,
1611
+ metadata,
1612
+ query_params,
1613
+ session,
1614
+ timeout,
1615
+ transcoded_request,
1616
+ body=None,
1617
+ ):
1618
+ uri = transcoded_request["uri"]
1619
+ method = transcoded_request["method"]
1620
+ headers = dict(metadata)
1621
+ headers["Content-Type"] = "application/json"
1622
+ response = getattr(session, method)(
1623
+ "{host}{uri}".format(host=host, uri=uri),
1624
+ timeout=timeout,
1625
+ headers=headers,
1626
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1627
+ )
1628
+ return response
1629
+
1630
+ def __call__(
1631
+ self,
1632
+ request: operations_pb2.ListOperationsRequest,
1633
+ *,
1634
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1635
+ timeout: Optional[float] = None,
1636
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1637
+ ) -> operations_pb2.ListOperationsResponse:
1638
+ r"""Call the list operations method over HTTP.
1639
+
1640
+ Args:
1641
+ request (operations_pb2.ListOperationsRequest):
1642
+ The request object for ListOperations method.
1643
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1644
+ should be retried.
1645
+ timeout (float): The timeout for this request.
1646
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1647
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1648
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1649
+ be of type `bytes`.
1650
+
1651
+ Returns:
1652
+ operations_pb2.ListOperationsResponse: Response from ListOperations method.
1653
+ """
1654
+
1655
+ http_options = (
1656
+ _BaseUserEventServiceRestTransport._BaseListOperations._get_http_options()
1657
+ )
1658
+
1659
+ request, metadata = self._interceptor.pre_list_operations(request, metadata)
1660
+ transcoded_request = _BaseUserEventServiceRestTransport._BaseListOperations._get_transcoded_request(
1661
+ http_options, request
1662
+ )
1663
+
1664
+ # Jsonify the query params
1665
+ query_params = _BaseUserEventServiceRestTransport._BaseListOperations._get_query_params_json(
1666
+ transcoded_request
1667
+ )
1668
+
1669
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1670
+ logging.DEBUG
1671
+ ): # pragma: NO COVER
1672
+ request_url = "{host}{uri}".format(
1673
+ host=self._host, uri=transcoded_request["uri"]
1674
+ )
1675
+ method = transcoded_request["method"]
1676
+ try:
1677
+ request_payload = json_format.MessageToJson(request)
1678
+ except:
1679
+ request_payload = None
1680
+ http_request = {
1681
+ "payload": request_payload,
1682
+ "requestMethod": method,
1683
+ "requestUrl": request_url,
1684
+ "headers": dict(metadata),
1685
+ }
1686
+ _LOGGER.debug(
1687
+ f"Sending request for google.cloud.discoveryengine_v1beta.UserEventServiceClient.ListOperations",
1688
+ extra={
1689
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
1690
+ "rpcName": "ListOperations",
1691
+ "httpRequest": http_request,
1692
+ "metadata": http_request["headers"],
1693
+ },
1694
+ )
1695
+
1696
+ # Send the request
1697
+ response = UserEventServiceRestTransport._ListOperations._get_response(
1698
+ self._host,
1699
+ metadata,
1700
+ query_params,
1701
+ self._session,
1702
+ timeout,
1703
+ transcoded_request,
1704
+ )
1705
+
1706
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1707
+ # subclass.
1708
+ if response.status_code >= 400:
1709
+ raise core_exceptions.from_http_response(response)
1710
+
1711
+ content = response.content.decode("utf-8")
1712
+ resp = operations_pb2.ListOperationsResponse()
1713
+ resp = json_format.Parse(content, resp)
1714
+ resp = self._interceptor.post_list_operations(resp)
1715
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1716
+ logging.DEBUG
1717
+ ): # pragma: NO COVER
1718
+ try:
1719
+ response_payload = json_format.MessageToJson(resp)
1720
+ except:
1721
+ response_payload = None
1722
+ http_response = {
1723
+ "payload": response_payload,
1724
+ "headers": dict(response.headers),
1725
+ "status": response.status_code,
1726
+ }
1727
+ _LOGGER.debug(
1728
+ "Received response for google.cloud.discoveryengine_v1beta.UserEventServiceAsyncClient.ListOperations",
1729
+ extra={
1730
+ "serviceName": "google.cloud.discoveryengine.v1beta.UserEventService",
1731
+ "rpcName": "ListOperations",
1732
+ "httpResponse": http_response,
1733
+ "metadata": http_response["headers"],
1734
+ },
1735
+ )
1736
+ return resp
1737
+
1738
+ @property
1739
+ def kind(self) -> str:
1740
+ return "rest"
1741
+
1742
+ def close(self):
1743
+ self._session.close()
1744
+
1745
+
1746
+ __all__ = ("UserEventServiceRestTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/services/user_event_service/transports/rest_base.py ADDED
@@ -0,0 +1,545 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import json # type: ignore
17
+ import re
18
+ from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
19
+
20
+ from google.api import httpbody_pb2 # type: ignore
21
+ from google.api_core import gapic_v1, path_template
22
+ from google.cloud.location import locations_pb2 # type: ignore
23
+ from google.longrunning import operations_pb2 # type: ignore
24
+ from google.protobuf import json_format
25
+
26
+ from google.cloud.discoveryengine_v1beta.types import (
27
+ import_config,
28
+ purge_config,
29
+ user_event,
30
+ user_event_service,
31
+ )
32
+
33
+ from .base import DEFAULT_CLIENT_INFO, UserEventServiceTransport
34
+
35
+
36
+ class _BaseUserEventServiceRestTransport(UserEventServiceTransport):
37
+ """Base REST backend transport for UserEventService.
38
+
39
+ Note: This class is not meant to be used directly. Use its sync and
40
+ async sub-classes instead.
41
+
42
+ This class defines the same methods as the primary client, so the
43
+ primary client can load the underlying transport implementation
44
+ and call it.
45
+
46
+ It sends JSON representations of protocol buffers over HTTP/1.1
47
+ """
48
+
49
+ def __init__(
50
+ self,
51
+ *,
52
+ host: str = "discoveryengine.googleapis.com",
53
+ credentials: Optional[Any] = None,
54
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
55
+ always_use_jwt_access: Optional[bool] = False,
56
+ url_scheme: str = "https",
57
+ api_audience: Optional[str] = None,
58
+ ) -> None:
59
+ """Instantiate the transport.
60
+ Args:
61
+ host (Optional[str]):
62
+ The hostname to connect to (default: 'discoveryengine.googleapis.com').
63
+ credentials (Optional[Any]): The
64
+ authorization credentials to attach to requests. These
65
+ credentials identify the application to the service; if none
66
+ are specified, the client will attempt to ascertain the
67
+ credentials from the environment.
68
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
69
+ The client info used to send a user-agent string along with
70
+ API requests. If ``None``, then default info will be used.
71
+ Generally, you only need to set this if you are developing
72
+ your own client library.
73
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
74
+ be used for service account credentials.
75
+ url_scheme: the protocol scheme for the API endpoint. Normally
76
+ "https", but for testing or local servers,
77
+ "http" can be specified.
78
+ """
79
+ # Run the base constructor
80
+ maybe_url_match = re.match("^(?P<scheme>http(?:s)?://)?(?P<host>.*)$", host)
81
+ if maybe_url_match is None:
82
+ raise ValueError(
83
+ f"Unexpected hostname structure: {host}"
84
+ ) # pragma: NO COVER
85
+
86
+ url_match_items = maybe_url_match.groupdict()
87
+
88
+ host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host
89
+
90
+ super().__init__(
91
+ host=host,
92
+ credentials=credentials,
93
+ client_info=client_info,
94
+ always_use_jwt_access=always_use_jwt_access,
95
+ api_audience=api_audience,
96
+ )
97
+
98
+ class _BaseCollectUserEvent:
99
+ def __hash__(self): # pragma: NO COVER
100
+ return NotImplementedError("__hash__ must be implemented.")
101
+
102
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
103
+ "userEvent": "",
104
+ }
105
+
106
+ @classmethod
107
+ def _get_unset_required_fields(cls, message_dict):
108
+ return {
109
+ k: v
110
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
111
+ if k not in message_dict
112
+ }
113
+
114
+ @staticmethod
115
+ def _get_http_options():
116
+ http_options: List[Dict[str, str]] = [
117
+ {
118
+ "method": "get",
119
+ "uri": "/v1beta/{parent=projects/*/locations/*/dataStores/*}/userEvents:collect",
120
+ },
121
+ {
122
+ "method": "get",
123
+ "uri": "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:collect",
124
+ },
125
+ {
126
+ "method": "get",
127
+ "uri": "/v1beta/{parent=projects/*/locations/*}/userEvents:collect",
128
+ },
129
+ ]
130
+ return http_options
131
+
132
+ @staticmethod
133
+ def _get_transcoded_request(http_options, request):
134
+ pb_request = user_event_service.CollectUserEventRequest.pb(request)
135
+ transcoded_request = path_template.transcode(http_options, pb_request)
136
+ return transcoded_request
137
+
138
+ @staticmethod
139
+ def _get_query_params_json(transcoded_request):
140
+ query_params = json.loads(
141
+ json_format.MessageToJson(
142
+ transcoded_request["query_params"],
143
+ use_integers_for_enums=True,
144
+ )
145
+ )
146
+ query_params.update(
147
+ _BaseUserEventServiceRestTransport._BaseCollectUserEvent._get_unset_required_fields(
148
+ query_params
149
+ )
150
+ )
151
+
152
+ query_params["$alt"] = "json;enum-encoding=int"
153
+ return query_params
154
+
155
+ class _BaseImportUserEvents:
156
+ def __hash__(self): # pragma: NO COVER
157
+ return NotImplementedError("__hash__ must be implemented.")
158
+
159
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
160
+
161
+ @classmethod
162
+ def _get_unset_required_fields(cls, message_dict):
163
+ return {
164
+ k: v
165
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
166
+ if k not in message_dict
167
+ }
168
+
169
+ @staticmethod
170
+ def _get_http_options():
171
+ http_options: List[Dict[str, str]] = [
172
+ {
173
+ "method": "post",
174
+ "uri": "/v1beta/{parent=projects/*/locations/*/dataStores/*}/userEvents:import",
175
+ "body": "*",
176
+ },
177
+ {
178
+ "method": "post",
179
+ "uri": "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:import",
180
+ "body": "*",
181
+ },
182
+ ]
183
+ return http_options
184
+
185
+ @staticmethod
186
+ def _get_transcoded_request(http_options, request):
187
+ pb_request = import_config.ImportUserEventsRequest.pb(request)
188
+ transcoded_request = path_template.transcode(http_options, pb_request)
189
+ return transcoded_request
190
+
191
+ @staticmethod
192
+ def _get_request_body_json(transcoded_request):
193
+ # Jsonify the request body
194
+
195
+ body = json_format.MessageToJson(
196
+ transcoded_request["body"], use_integers_for_enums=True
197
+ )
198
+ return body
199
+
200
+ @staticmethod
201
+ def _get_query_params_json(transcoded_request):
202
+ query_params = json.loads(
203
+ json_format.MessageToJson(
204
+ transcoded_request["query_params"],
205
+ use_integers_for_enums=True,
206
+ )
207
+ )
208
+ query_params.update(
209
+ _BaseUserEventServiceRestTransport._BaseImportUserEvents._get_unset_required_fields(
210
+ query_params
211
+ )
212
+ )
213
+
214
+ query_params["$alt"] = "json;enum-encoding=int"
215
+ return query_params
216
+
217
+ class _BasePurgeUserEvents:
218
+ def __hash__(self): # pragma: NO COVER
219
+ return NotImplementedError("__hash__ must be implemented.")
220
+
221
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
222
+
223
+ @classmethod
224
+ def _get_unset_required_fields(cls, message_dict):
225
+ return {
226
+ k: v
227
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
228
+ if k not in message_dict
229
+ }
230
+
231
+ @staticmethod
232
+ def _get_http_options():
233
+ http_options: List[Dict[str, str]] = [
234
+ {
235
+ "method": "post",
236
+ "uri": "/v1beta/{parent=projects/*/locations/*/dataStores/*}/userEvents:purge",
237
+ "body": "*",
238
+ },
239
+ {
240
+ "method": "post",
241
+ "uri": "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:purge",
242
+ "body": "*",
243
+ },
244
+ ]
245
+ return http_options
246
+
247
+ @staticmethod
248
+ def _get_transcoded_request(http_options, request):
249
+ pb_request = purge_config.PurgeUserEventsRequest.pb(request)
250
+ transcoded_request = path_template.transcode(http_options, pb_request)
251
+ return transcoded_request
252
+
253
+ @staticmethod
254
+ def _get_request_body_json(transcoded_request):
255
+ # Jsonify the request body
256
+
257
+ body = json_format.MessageToJson(
258
+ transcoded_request["body"], use_integers_for_enums=True
259
+ )
260
+ return body
261
+
262
+ @staticmethod
263
+ def _get_query_params_json(transcoded_request):
264
+ query_params = json.loads(
265
+ json_format.MessageToJson(
266
+ transcoded_request["query_params"],
267
+ use_integers_for_enums=True,
268
+ )
269
+ )
270
+ query_params.update(
271
+ _BaseUserEventServiceRestTransport._BasePurgeUserEvents._get_unset_required_fields(
272
+ query_params
273
+ )
274
+ )
275
+
276
+ query_params["$alt"] = "json;enum-encoding=int"
277
+ return query_params
278
+
279
+ class _BaseWriteUserEvent:
280
+ def __hash__(self): # pragma: NO COVER
281
+ return NotImplementedError("__hash__ must be implemented.")
282
+
283
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
284
+
285
+ @classmethod
286
+ def _get_unset_required_fields(cls, message_dict):
287
+ return {
288
+ k: v
289
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
290
+ if k not in message_dict
291
+ }
292
+
293
+ @staticmethod
294
+ def _get_http_options():
295
+ http_options: List[Dict[str, str]] = [
296
+ {
297
+ "method": "post",
298
+ "uri": "/v1beta/{parent=projects/*/locations/*/dataStores/*}/userEvents:write",
299
+ "body": "user_event",
300
+ },
301
+ {
302
+ "method": "post",
303
+ "uri": "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:write",
304
+ "body": "user_event",
305
+ },
306
+ {
307
+ "method": "post",
308
+ "uri": "/v1beta/{parent=projects/*/locations/*}/userEvents:write",
309
+ "body": "user_event",
310
+ },
311
+ ]
312
+ return http_options
313
+
314
+ @staticmethod
315
+ def _get_transcoded_request(http_options, request):
316
+ pb_request = user_event_service.WriteUserEventRequest.pb(request)
317
+ transcoded_request = path_template.transcode(http_options, pb_request)
318
+ return transcoded_request
319
+
320
+ @staticmethod
321
+ def _get_request_body_json(transcoded_request):
322
+ # Jsonify the request body
323
+
324
+ body = json_format.MessageToJson(
325
+ transcoded_request["body"], use_integers_for_enums=True
326
+ )
327
+ return body
328
+
329
+ @staticmethod
330
+ def _get_query_params_json(transcoded_request):
331
+ query_params = json.loads(
332
+ json_format.MessageToJson(
333
+ transcoded_request["query_params"],
334
+ use_integers_for_enums=True,
335
+ )
336
+ )
337
+ query_params.update(
338
+ _BaseUserEventServiceRestTransport._BaseWriteUserEvent._get_unset_required_fields(
339
+ query_params
340
+ )
341
+ )
342
+
343
+ query_params["$alt"] = "json;enum-encoding=int"
344
+ return query_params
345
+
346
+ class _BaseCancelOperation:
347
+ def __hash__(self): # pragma: NO COVER
348
+ return NotImplementedError("__hash__ must be implemented.")
349
+
350
+ @staticmethod
351
+ def _get_http_options():
352
+ http_options: List[Dict[str, str]] = [
353
+ {
354
+ "method": "post",
355
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel",
356
+ "body": "*",
357
+ },
358
+ {
359
+ "method": "post",
360
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel",
361
+ "body": "*",
362
+ },
363
+ ]
364
+ return http_options
365
+
366
+ @staticmethod
367
+ def _get_transcoded_request(http_options, request):
368
+ request_kwargs = json_format.MessageToDict(request)
369
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
370
+ return transcoded_request
371
+
372
+ @staticmethod
373
+ def _get_request_body_json(transcoded_request):
374
+ body = json.dumps(transcoded_request["body"])
375
+ return body
376
+
377
+ @staticmethod
378
+ def _get_query_params_json(transcoded_request):
379
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
380
+ return query_params
381
+
382
+ class _BaseGetOperation:
383
+ def __hash__(self): # pragma: NO COVER
384
+ return NotImplementedError("__hash__ must be implemented.")
385
+
386
+ @staticmethod
387
+ def _get_http_options():
388
+ http_options: List[Dict[str, str]] = [
389
+ {
390
+ "method": "get",
391
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}",
392
+ },
393
+ {
394
+ "method": "get",
395
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}",
396
+ },
397
+ {
398
+ "method": "get",
399
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/models/*/operations/*}",
400
+ },
401
+ {
402
+ "method": "get",
403
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/operations/*}",
404
+ },
405
+ {
406
+ "method": "get",
407
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*/operations/*}",
408
+ },
409
+ {
410
+ "method": "get",
411
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/operations/*}",
412
+ },
413
+ {
414
+ "method": "get",
415
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/operations/*}",
416
+ },
417
+ {
418
+ "method": "get",
419
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/engines/*/operations/*}",
420
+ },
421
+ {
422
+ "method": "get",
423
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/operations/*}",
424
+ },
425
+ {
426
+ "method": "get",
427
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}",
428
+ },
429
+ {
430
+ "method": "get",
431
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/models/*/operations/*}",
432
+ },
433
+ {
434
+ "method": "get",
435
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/operations/*}",
436
+ },
437
+ {
438
+ "method": "get",
439
+ "uri": "/v1beta/{name=projects/*/locations/*/evaluations/*/operations/*}",
440
+ },
441
+ {
442
+ "method": "get",
443
+ "uri": "/v1beta/{name=projects/*/locations/*/operations/*}",
444
+ },
445
+ {
446
+ "method": "get",
447
+ "uri": "/v1beta/{name=projects/*/locations/*/sampleQuerySets/*/operations/*}",
448
+ },
449
+ {
450
+ "method": "get",
451
+ "uri": "/v1beta/{name=projects/*/operations/*}",
452
+ },
453
+ ]
454
+ return http_options
455
+
456
+ @staticmethod
457
+ def _get_transcoded_request(http_options, request):
458
+ request_kwargs = json_format.MessageToDict(request)
459
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
460
+ return transcoded_request
461
+
462
+ @staticmethod
463
+ def _get_query_params_json(transcoded_request):
464
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
465
+ return query_params
466
+
467
+ class _BaseListOperations:
468
+ def __hash__(self): # pragma: NO COVER
469
+ return NotImplementedError("__hash__ must be implemented.")
470
+
471
+ @staticmethod
472
+ def _get_http_options():
473
+ http_options: List[Dict[str, str]] = [
474
+ {
475
+ "method": "get",
476
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataConnector}/operations",
477
+ },
478
+ {
479
+ "method": "get",
480
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*}/operations",
481
+ },
482
+ {
483
+ "method": "get",
484
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/models/*}/operations",
485
+ },
486
+ {
487
+ "method": "get",
488
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*}/operations",
489
+ },
490
+ {
491
+ "method": "get",
492
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites}/operations",
493
+ },
494
+ {
495
+ "method": "get",
496
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/operations",
497
+ },
498
+ {
499
+ "method": "get",
500
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*}/operations",
501
+ },
502
+ {
503
+ "method": "get",
504
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*/engines/*}/operations",
505
+ },
506
+ {
507
+ "method": "get",
508
+ "uri": "/v1beta/{name=projects/*/locations/*/collections/*}/operations",
509
+ },
510
+ {
511
+ "method": "get",
512
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*}/operations",
513
+ },
514
+ {
515
+ "method": "get",
516
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*/models/*}/operations",
517
+ },
518
+ {
519
+ "method": "get",
520
+ "uri": "/v1beta/{name=projects/*/locations/*/dataStores/*}/operations",
521
+ },
522
+ {
523
+ "method": "get",
524
+ "uri": "/v1beta/{name=projects/*/locations/*}/operations",
525
+ },
526
+ {
527
+ "method": "get",
528
+ "uri": "/v1beta/{name=projects/*}/operations",
529
+ },
530
+ ]
531
+ return http_options
532
+
533
+ @staticmethod
534
+ def _get_transcoded_request(http_options, request):
535
+ request_kwargs = json_format.MessageToDict(request)
536
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
537
+ return transcoded_request
538
+
539
+ @staticmethod
540
+ def _get_query_params_json(transcoded_request):
541
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
542
+ return query_params
543
+
544
+
545
+ __all__ = ("_BaseUserEventServiceRestTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/__init__.py ADDED
@@ -0,0 +1,516 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from .answer import Answer
17
+ from .chunk import Chunk
18
+ from .common import (
19
+ CustomAttribute,
20
+ DoubleList,
21
+ EmbeddingConfig,
22
+ IndustryVertical,
23
+ Interval,
24
+ SearchAddOn,
25
+ SearchTier,
26
+ SearchUseCase,
27
+ SolutionType,
28
+ UserInfo,
29
+ )
30
+ from .completion import CompletionSuggestion, SuggestionDenyListEntry
31
+ from .completion_service import (
32
+ AdvancedCompleteQueryRequest,
33
+ AdvancedCompleteQueryResponse,
34
+ CompleteQueryRequest,
35
+ CompleteQueryResponse,
36
+ )
37
+ from .control import Condition, Control
38
+ from .control_service import (
39
+ CreateControlRequest,
40
+ DeleteControlRequest,
41
+ GetControlRequest,
42
+ ListControlsRequest,
43
+ ListControlsResponse,
44
+ UpdateControlRequest,
45
+ )
46
+ from .conversation import (
47
+ Conversation,
48
+ ConversationContext,
49
+ ConversationMessage,
50
+ Reply,
51
+ TextInput,
52
+ )
53
+ from .conversational_search_service import (
54
+ AnswerQueryRequest,
55
+ AnswerQueryResponse,
56
+ ConverseConversationRequest,
57
+ ConverseConversationResponse,
58
+ CreateConversationRequest,
59
+ CreateSessionRequest,
60
+ DeleteConversationRequest,
61
+ DeleteSessionRequest,
62
+ GetAnswerRequest,
63
+ GetConversationRequest,
64
+ GetSessionRequest,
65
+ ListConversationsRequest,
66
+ ListConversationsResponse,
67
+ ListSessionsRequest,
68
+ ListSessionsResponse,
69
+ UpdateConversationRequest,
70
+ UpdateSessionRequest,
71
+ )
72
+ from .custom_tuning_model import CustomTuningModel
73
+ from .data_store import (
74
+ DataStore,
75
+ LanguageInfo,
76
+ NaturalLanguageQueryUnderstandingConfig,
77
+ WorkspaceConfig,
78
+ )
79
+ from .data_store_service import (
80
+ CreateDataStoreMetadata,
81
+ CreateDataStoreRequest,
82
+ DeleteDataStoreMetadata,
83
+ DeleteDataStoreRequest,
84
+ GetDataStoreRequest,
85
+ ListDataStoresRequest,
86
+ ListDataStoresResponse,
87
+ UpdateDataStoreRequest,
88
+ )
89
+ from .document import Document
90
+ from .document_processing_config import DocumentProcessingConfig
91
+ from .document_service import (
92
+ BatchGetDocumentsMetadataRequest,
93
+ BatchGetDocumentsMetadataResponse,
94
+ CreateDocumentRequest,
95
+ DeleteDocumentRequest,
96
+ GetDocumentRequest,
97
+ ListDocumentsRequest,
98
+ ListDocumentsResponse,
99
+ UpdateDocumentRequest,
100
+ )
101
+ from .engine import Engine
102
+ from .engine_service import (
103
+ CreateEngineMetadata,
104
+ CreateEngineRequest,
105
+ DeleteEngineMetadata,
106
+ DeleteEngineRequest,
107
+ GetEngineRequest,
108
+ ListEnginesRequest,
109
+ ListEnginesResponse,
110
+ PauseEngineRequest,
111
+ ResumeEngineRequest,
112
+ TuneEngineMetadata,
113
+ TuneEngineRequest,
114
+ TuneEngineResponse,
115
+ UpdateEngineRequest,
116
+ )
117
+ from .evaluation import Evaluation, QualityMetrics
118
+ from .evaluation_service import (
119
+ CreateEvaluationMetadata,
120
+ CreateEvaluationRequest,
121
+ GetEvaluationRequest,
122
+ ListEvaluationResultsRequest,
123
+ ListEvaluationResultsResponse,
124
+ ListEvaluationsRequest,
125
+ ListEvaluationsResponse,
126
+ )
127
+ from .grounded_generation_service import (
128
+ CheckGroundingRequest,
129
+ CheckGroundingResponse,
130
+ CheckGroundingSpec,
131
+ GenerateGroundedContentRequest,
132
+ GenerateGroundedContentResponse,
133
+ GroundedGenerationContent,
134
+ )
135
+ from .grounding import FactChunk, GroundingConfig, GroundingFact
136
+ from .import_config import (
137
+ AlloyDbSource,
138
+ BigQuerySource,
139
+ BigtableOptions,
140
+ BigtableSource,
141
+ CloudSqlSource,
142
+ FhirStoreSource,
143
+ FirestoreSource,
144
+ GcsSource,
145
+ ImportCompletionSuggestionsMetadata,
146
+ ImportCompletionSuggestionsRequest,
147
+ ImportCompletionSuggestionsResponse,
148
+ ImportDocumentsMetadata,
149
+ ImportDocumentsRequest,
150
+ ImportDocumentsResponse,
151
+ ImportErrorConfig,
152
+ ImportSampleQueriesMetadata,
153
+ ImportSampleQueriesRequest,
154
+ ImportSampleQueriesResponse,
155
+ ImportSuggestionDenyListEntriesMetadata,
156
+ ImportSuggestionDenyListEntriesRequest,
157
+ ImportSuggestionDenyListEntriesResponse,
158
+ ImportUserEventsMetadata,
159
+ ImportUserEventsRequest,
160
+ ImportUserEventsResponse,
161
+ SpannerSource,
162
+ )
163
+ from .project import Project
164
+ from .project_service import ProvisionProjectMetadata, ProvisionProjectRequest
165
+ from .purge_config import (
166
+ PurgeCompletionSuggestionsMetadata,
167
+ PurgeCompletionSuggestionsRequest,
168
+ PurgeCompletionSuggestionsResponse,
169
+ PurgeDocumentsMetadata,
170
+ PurgeDocumentsRequest,
171
+ PurgeDocumentsResponse,
172
+ PurgeErrorConfig,
173
+ PurgeSuggestionDenyListEntriesMetadata,
174
+ PurgeSuggestionDenyListEntriesRequest,
175
+ PurgeSuggestionDenyListEntriesResponse,
176
+ PurgeUserEventsMetadata,
177
+ PurgeUserEventsRequest,
178
+ PurgeUserEventsResponse,
179
+ )
180
+ from .rank_service import RankingRecord, RankRequest, RankResponse
181
+ from .recommendation_service import RecommendRequest, RecommendResponse
182
+ from .sample_query import SampleQuery
183
+ from .sample_query_service import (
184
+ CreateSampleQueryRequest,
185
+ DeleteSampleQueryRequest,
186
+ GetSampleQueryRequest,
187
+ ListSampleQueriesRequest,
188
+ ListSampleQueriesResponse,
189
+ UpdateSampleQueryRequest,
190
+ )
191
+ from .sample_query_set import SampleQuerySet
192
+ from .sample_query_set_service import (
193
+ CreateSampleQuerySetRequest,
194
+ DeleteSampleQuerySetRequest,
195
+ GetSampleQuerySetRequest,
196
+ ListSampleQuerySetsRequest,
197
+ ListSampleQuerySetsResponse,
198
+ UpdateSampleQuerySetRequest,
199
+ )
200
+ from .schema import Schema
201
+ from .schema_service import (
202
+ CreateSchemaMetadata,
203
+ CreateSchemaRequest,
204
+ DeleteSchemaMetadata,
205
+ DeleteSchemaRequest,
206
+ GetSchemaRequest,
207
+ ListSchemasRequest,
208
+ ListSchemasResponse,
209
+ UpdateSchemaMetadata,
210
+ UpdateSchemaRequest,
211
+ )
212
+ from .search_service import SearchRequest, SearchResponse
213
+ from .search_tuning_service import (
214
+ ListCustomModelsRequest,
215
+ ListCustomModelsResponse,
216
+ TrainCustomModelMetadata,
217
+ TrainCustomModelRequest,
218
+ TrainCustomModelResponse,
219
+ )
220
+ from .serving_config import ServingConfig
221
+ from .serving_config_service import (
222
+ GetServingConfigRequest,
223
+ ListServingConfigsRequest,
224
+ ListServingConfigsResponse,
225
+ UpdateServingConfigRequest,
226
+ )
227
+ from .session import Query, Session
228
+ from .site_search_engine import (
229
+ Sitemap,
230
+ SiteSearchEngine,
231
+ SiteVerificationInfo,
232
+ TargetSite,
233
+ )
234
+ from .site_search_engine_service import (
235
+ BatchCreateTargetSiteMetadata,
236
+ BatchCreateTargetSitesRequest,
237
+ BatchCreateTargetSitesResponse,
238
+ BatchVerifyTargetSitesMetadata,
239
+ BatchVerifyTargetSitesRequest,
240
+ BatchVerifyTargetSitesResponse,
241
+ CreateSitemapMetadata,
242
+ CreateSitemapRequest,
243
+ CreateTargetSiteMetadata,
244
+ CreateTargetSiteRequest,
245
+ DeleteSitemapMetadata,
246
+ DeleteSitemapRequest,
247
+ DeleteTargetSiteMetadata,
248
+ DeleteTargetSiteRequest,
249
+ DisableAdvancedSiteSearchMetadata,
250
+ DisableAdvancedSiteSearchRequest,
251
+ DisableAdvancedSiteSearchResponse,
252
+ EnableAdvancedSiteSearchMetadata,
253
+ EnableAdvancedSiteSearchRequest,
254
+ EnableAdvancedSiteSearchResponse,
255
+ FetchDomainVerificationStatusRequest,
256
+ FetchDomainVerificationStatusResponse,
257
+ FetchSitemapsRequest,
258
+ FetchSitemapsResponse,
259
+ GetSiteSearchEngineRequest,
260
+ GetTargetSiteRequest,
261
+ ListTargetSitesRequest,
262
+ ListTargetSitesResponse,
263
+ RecrawlUrisMetadata,
264
+ RecrawlUrisRequest,
265
+ RecrawlUrisResponse,
266
+ UpdateTargetSiteMetadata,
267
+ UpdateTargetSiteRequest,
268
+ )
269
+ from .user_event import (
270
+ CompletionInfo,
271
+ DocumentInfo,
272
+ MediaInfo,
273
+ PageInfo,
274
+ PanelInfo,
275
+ SearchInfo,
276
+ TransactionInfo,
277
+ UserEvent,
278
+ )
279
+ from .user_event_service import CollectUserEventRequest, WriteUserEventRequest
280
+
281
+ __all__ = (
282
+ "Answer",
283
+ "Chunk",
284
+ "CustomAttribute",
285
+ "DoubleList",
286
+ "EmbeddingConfig",
287
+ "Interval",
288
+ "UserInfo",
289
+ "IndustryVertical",
290
+ "SearchAddOn",
291
+ "SearchTier",
292
+ "SearchUseCase",
293
+ "SolutionType",
294
+ "CompletionSuggestion",
295
+ "SuggestionDenyListEntry",
296
+ "AdvancedCompleteQueryRequest",
297
+ "AdvancedCompleteQueryResponse",
298
+ "CompleteQueryRequest",
299
+ "CompleteQueryResponse",
300
+ "Condition",
301
+ "Control",
302
+ "CreateControlRequest",
303
+ "DeleteControlRequest",
304
+ "GetControlRequest",
305
+ "ListControlsRequest",
306
+ "ListControlsResponse",
307
+ "UpdateControlRequest",
308
+ "Conversation",
309
+ "ConversationContext",
310
+ "ConversationMessage",
311
+ "Reply",
312
+ "TextInput",
313
+ "AnswerQueryRequest",
314
+ "AnswerQueryResponse",
315
+ "ConverseConversationRequest",
316
+ "ConverseConversationResponse",
317
+ "CreateConversationRequest",
318
+ "CreateSessionRequest",
319
+ "DeleteConversationRequest",
320
+ "DeleteSessionRequest",
321
+ "GetAnswerRequest",
322
+ "GetConversationRequest",
323
+ "GetSessionRequest",
324
+ "ListConversationsRequest",
325
+ "ListConversationsResponse",
326
+ "ListSessionsRequest",
327
+ "ListSessionsResponse",
328
+ "UpdateConversationRequest",
329
+ "UpdateSessionRequest",
330
+ "CustomTuningModel",
331
+ "DataStore",
332
+ "LanguageInfo",
333
+ "NaturalLanguageQueryUnderstandingConfig",
334
+ "WorkspaceConfig",
335
+ "CreateDataStoreMetadata",
336
+ "CreateDataStoreRequest",
337
+ "DeleteDataStoreMetadata",
338
+ "DeleteDataStoreRequest",
339
+ "GetDataStoreRequest",
340
+ "ListDataStoresRequest",
341
+ "ListDataStoresResponse",
342
+ "UpdateDataStoreRequest",
343
+ "Document",
344
+ "DocumentProcessingConfig",
345
+ "BatchGetDocumentsMetadataRequest",
346
+ "BatchGetDocumentsMetadataResponse",
347
+ "CreateDocumentRequest",
348
+ "DeleteDocumentRequest",
349
+ "GetDocumentRequest",
350
+ "ListDocumentsRequest",
351
+ "ListDocumentsResponse",
352
+ "UpdateDocumentRequest",
353
+ "Engine",
354
+ "CreateEngineMetadata",
355
+ "CreateEngineRequest",
356
+ "DeleteEngineMetadata",
357
+ "DeleteEngineRequest",
358
+ "GetEngineRequest",
359
+ "ListEnginesRequest",
360
+ "ListEnginesResponse",
361
+ "PauseEngineRequest",
362
+ "ResumeEngineRequest",
363
+ "TuneEngineMetadata",
364
+ "TuneEngineRequest",
365
+ "TuneEngineResponse",
366
+ "UpdateEngineRequest",
367
+ "Evaluation",
368
+ "QualityMetrics",
369
+ "CreateEvaluationMetadata",
370
+ "CreateEvaluationRequest",
371
+ "GetEvaluationRequest",
372
+ "ListEvaluationResultsRequest",
373
+ "ListEvaluationResultsResponse",
374
+ "ListEvaluationsRequest",
375
+ "ListEvaluationsResponse",
376
+ "CheckGroundingRequest",
377
+ "CheckGroundingResponse",
378
+ "CheckGroundingSpec",
379
+ "GenerateGroundedContentRequest",
380
+ "GenerateGroundedContentResponse",
381
+ "GroundedGenerationContent",
382
+ "FactChunk",
383
+ "GroundingConfig",
384
+ "GroundingFact",
385
+ "AlloyDbSource",
386
+ "BigQuerySource",
387
+ "BigtableOptions",
388
+ "BigtableSource",
389
+ "CloudSqlSource",
390
+ "FhirStoreSource",
391
+ "FirestoreSource",
392
+ "GcsSource",
393
+ "ImportCompletionSuggestionsMetadata",
394
+ "ImportCompletionSuggestionsRequest",
395
+ "ImportCompletionSuggestionsResponse",
396
+ "ImportDocumentsMetadata",
397
+ "ImportDocumentsRequest",
398
+ "ImportDocumentsResponse",
399
+ "ImportErrorConfig",
400
+ "ImportSampleQueriesMetadata",
401
+ "ImportSampleQueriesRequest",
402
+ "ImportSampleQueriesResponse",
403
+ "ImportSuggestionDenyListEntriesMetadata",
404
+ "ImportSuggestionDenyListEntriesRequest",
405
+ "ImportSuggestionDenyListEntriesResponse",
406
+ "ImportUserEventsMetadata",
407
+ "ImportUserEventsRequest",
408
+ "ImportUserEventsResponse",
409
+ "SpannerSource",
410
+ "Project",
411
+ "ProvisionProjectMetadata",
412
+ "ProvisionProjectRequest",
413
+ "PurgeCompletionSuggestionsMetadata",
414
+ "PurgeCompletionSuggestionsRequest",
415
+ "PurgeCompletionSuggestionsResponse",
416
+ "PurgeDocumentsMetadata",
417
+ "PurgeDocumentsRequest",
418
+ "PurgeDocumentsResponse",
419
+ "PurgeErrorConfig",
420
+ "PurgeSuggestionDenyListEntriesMetadata",
421
+ "PurgeSuggestionDenyListEntriesRequest",
422
+ "PurgeSuggestionDenyListEntriesResponse",
423
+ "PurgeUserEventsMetadata",
424
+ "PurgeUserEventsRequest",
425
+ "PurgeUserEventsResponse",
426
+ "RankingRecord",
427
+ "RankRequest",
428
+ "RankResponse",
429
+ "RecommendRequest",
430
+ "RecommendResponse",
431
+ "SampleQuery",
432
+ "CreateSampleQueryRequest",
433
+ "DeleteSampleQueryRequest",
434
+ "GetSampleQueryRequest",
435
+ "ListSampleQueriesRequest",
436
+ "ListSampleQueriesResponse",
437
+ "UpdateSampleQueryRequest",
438
+ "SampleQuerySet",
439
+ "CreateSampleQuerySetRequest",
440
+ "DeleteSampleQuerySetRequest",
441
+ "GetSampleQuerySetRequest",
442
+ "ListSampleQuerySetsRequest",
443
+ "ListSampleQuerySetsResponse",
444
+ "UpdateSampleQuerySetRequest",
445
+ "Schema",
446
+ "CreateSchemaMetadata",
447
+ "CreateSchemaRequest",
448
+ "DeleteSchemaMetadata",
449
+ "DeleteSchemaRequest",
450
+ "GetSchemaRequest",
451
+ "ListSchemasRequest",
452
+ "ListSchemasResponse",
453
+ "UpdateSchemaMetadata",
454
+ "UpdateSchemaRequest",
455
+ "SearchRequest",
456
+ "SearchResponse",
457
+ "ListCustomModelsRequest",
458
+ "ListCustomModelsResponse",
459
+ "TrainCustomModelMetadata",
460
+ "TrainCustomModelRequest",
461
+ "TrainCustomModelResponse",
462
+ "ServingConfig",
463
+ "GetServingConfigRequest",
464
+ "ListServingConfigsRequest",
465
+ "ListServingConfigsResponse",
466
+ "UpdateServingConfigRequest",
467
+ "Query",
468
+ "Session",
469
+ "Sitemap",
470
+ "SiteSearchEngine",
471
+ "SiteVerificationInfo",
472
+ "TargetSite",
473
+ "BatchCreateTargetSiteMetadata",
474
+ "BatchCreateTargetSitesRequest",
475
+ "BatchCreateTargetSitesResponse",
476
+ "BatchVerifyTargetSitesMetadata",
477
+ "BatchVerifyTargetSitesRequest",
478
+ "BatchVerifyTargetSitesResponse",
479
+ "CreateSitemapMetadata",
480
+ "CreateSitemapRequest",
481
+ "CreateTargetSiteMetadata",
482
+ "CreateTargetSiteRequest",
483
+ "DeleteSitemapMetadata",
484
+ "DeleteSitemapRequest",
485
+ "DeleteTargetSiteMetadata",
486
+ "DeleteTargetSiteRequest",
487
+ "DisableAdvancedSiteSearchMetadata",
488
+ "DisableAdvancedSiteSearchRequest",
489
+ "DisableAdvancedSiteSearchResponse",
490
+ "EnableAdvancedSiteSearchMetadata",
491
+ "EnableAdvancedSiteSearchRequest",
492
+ "EnableAdvancedSiteSearchResponse",
493
+ "FetchDomainVerificationStatusRequest",
494
+ "FetchDomainVerificationStatusResponse",
495
+ "FetchSitemapsRequest",
496
+ "FetchSitemapsResponse",
497
+ "GetSiteSearchEngineRequest",
498
+ "GetTargetSiteRequest",
499
+ "ListTargetSitesRequest",
500
+ "ListTargetSitesResponse",
501
+ "RecrawlUrisMetadata",
502
+ "RecrawlUrisRequest",
503
+ "RecrawlUrisResponse",
504
+ "UpdateTargetSiteMetadata",
505
+ "UpdateTargetSiteRequest",
506
+ "CompletionInfo",
507
+ "DocumentInfo",
508
+ "MediaInfo",
509
+ "PageInfo",
510
+ "PanelInfo",
511
+ "SearchInfo",
512
+ "TransactionInfo",
513
+ "UserEvent",
514
+ "CollectUserEventRequest",
515
+ "WriteUserEventRequest",
516
+ )
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/answer.py ADDED
@@ -0,0 +1,749 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import struct_pb2 # type: ignore
21
+ from google.protobuf import timestamp_pb2 # type: ignore
22
+ import proto # type: ignore
23
+
24
+ __protobuf__ = proto.module(
25
+ package="google.cloud.discoveryengine.v1beta",
26
+ manifest={
27
+ "Answer",
28
+ },
29
+ )
30
+
31
+
32
+ class Answer(proto.Message):
33
+ r"""Defines an answer.
34
+
35
+ Attributes:
36
+ name (str):
37
+ Immutable. Fully qualified name
38
+ ``projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*``
39
+ state (google.cloud.discoveryengine_v1beta.types.Answer.State):
40
+ The state of the answer generation.
41
+ answer_text (str):
42
+ The textual answer.
43
+ citations (MutableSequence[google.cloud.discoveryengine_v1beta.types.Answer.Citation]):
44
+ Citations.
45
+ references (MutableSequence[google.cloud.discoveryengine_v1beta.types.Answer.Reference]):
46
+ References.
47
+ related_questions (MutableSequence[str]):
48
+ Suggested related questions.
49
+ steps (MutableSequence[google.cloud.discoveryengine_v1beta.types.Answer.Step]):
50
+ Answer generation steps.
51
+ query_understanding_info (google.cloud.discoveryengine_v1beta.types.Answer.QueryUnderstandingInfo):
52
+ Query understanding information.
53
+ answer_skipped_reasons (MutableSequence[google.cloud.discoveryengine_v1beta.types.Answer.AnswerSkippedReason]):
54
+ Additional answer-skipped reasons. This
55
+ provides the reason for ignored cases. If
56
+ nothing is skipped, this field is not set.
57
+ create_time (google.protobuf.timestamp_pb2.Timestamp):
58
+ Output only. Answer creation timestamp.
59
+ complete_time (google.protobuf.timestamp_pb2.Timestamp):
60
+ Output only. Answer completed timestamp.
61
+ """
62
+
63
+ class State(proto.Enum):
64
+ r"""Enumeration of the state of the answer generation.
65
+
66
+ Values:
67
+ STATE_UNSPECIFIED (0):
68
+ Unknown.
69
+ IN_PROGRESS (1):
70
+ Answer generation is currently in progress.
71
+ FAILED (2):
72
+ Answer generation currently failed.
73
+ SUCCEEDED (3):
74
+ Answer generation has succeeded.
75
+ """
76
+ STATE_UNSPECIFIED = 0
77
+ IN_PROGRESS = 1
78
+ FAILED = 2
79
+ SUCCEEDED = 3
80
+
81
+ class AnswerSkippedReason(proto.Enum):
82
+ r"""An enum for answer skipped reasons.
83
+
84
+ Values:
85
+ ANSWER_SKIPPED_REASON_UNSPECIFIED (0):
86
+ Default value. The answer skipped reason is
87
+ not specified.
88
+ ADVERSARIAL_QUERY_IGNORED (1):
89
+ The adversarial query ignored case.
90
+ NON_ANSWER_SEEKING_QUERY_IGNORED (2):
91
+ The non-answer seeking query ignored case
92
+
93
+ Google skips the answer if the query is chit
94
+ chat.
95
+ OUT_OF_DOMAIN_QUERY_IGNORED (3):
96
+ The out-of-domain query ignored case.
97
+
98
+ Google skips the answer if there are no
99
+ high-relevance search results.
100
+ POTENTIAL_POLICY_VIOLATION (4):
101
+ The potential policy violation case.
102
+
103
+ Google skips the answer if there is a potential
104
+ policy violation detected. This includes content
105
+ that may be violent or toxic.
106
+ NO_RELEVANT_CONTENT (5):
107
+ The no relevant content case.
108
+
109
+ Google skips the answer if there is no relevant
110
+ content in the retrieved search results.
111
+ JAIL_BREAKING_QUERY_IGNORED (6):
112
+ The jail-breaking query ignored case.
113
+
114
+ For example, "Reply in the tone of a competing
115
+ company's CEO". Google skips the answer if the
116
+ query is classified as a jail-breaking query.
117
+ CUSTOMER_POLICY_VIOLATION (7):
118
+ The customer policy violation case.
119
+
120
+ Google skips the summary if there is a customer
121
+ policy violation detected. The policy is defined
122
+ by the customer.
123
+ NON_ANSWER_SEEKING_QUERY_IGNORED_V2 (8):
124
+ The non-answer seeking query ignored case.
125
+
126
+ Google skips the answer if the query doesn't
127
+ have clear intent.
128
+ LOW_GROUNDED_ANSWER (9):
129
+ The low-grounded answer case.
130
+
131
+ Google skips the answer if a well grounded
132
+ answer was unable to be generated.
133
+ """
134
+ ANSWER_SKIPPED_REASON_UNSPECIFIED = 0
135
+ ADVERSARIAL_QUERY_IGNORED = 1
136
+ NON_ANSWER_SEEKING_QUERY_IGNORED = 2
137
+ OUT_OF_DOMAIN_QUERY_IGNORED = 3
138
+ POTENTIAL_POLICY_VIOLATION = 4
139
+ NO_RELEVANT_CONTENT = 5
140
+ JAIL_BREAKING_QUERY_IGNORED = 6
141
+ CUSTOMER_POLICY_VIOLATION = 7
142
+ NON_ANSWER_SEEKING_QUERY_IGNORED_V2 = 8
143
+ LOW_GROUNDED_ANSWER = 9
144
+
145
+ class Citation(proto.Message):
146
+ r"""Citation info for a segment.
147
+
148
+ Attributes:
149
+ start_index (int):
150
+ Index indicates the start of the segment,
151
+ measured in bytes (UTF-8 unicode).
152
+ end_index (int):
153
+ End of the attributed segment, exclusive.
154
+ sources (MutableSequence[google.cloud.discoveryengine_v1beta.types.Answer.CitationSource]):
155
+ Citation sources for the attributed segment.
156
+ """
157
+
158
+ start_index: int = proto.Field(
159
+ proto.INT64,
160
+ number=1,
161
+ )
162
+ end_index: int = proto.Field(
163
+ proto.INT64,
164
+ number=2,
165
+ )
166
+ sources: MutableSequence["Answer.CitationSource"] = proto.RepeatedField(
167
+ proto.MESSAGE,
168
+ number=3,
169
+ message="Answer.CitationSource",
170
+ )
171
+
172
+ class CitationSource(proto.Message):
173
+ r"""Citation source.
174
+
175
+ Attributes:
176
+ reference_id (str):
177
+ ID of the citation source.
178
+ """
179
+
180
+ reference_id: str = proto.Field(
181
+ proto.STRING,
182
+ number=1,
183
+ )
184
+
185
+ class Reference(proto.Message):
186
+ r"""Reference.
187
+
188
+ This message has `oneof`_ fields (mutually exclusive fields).
189
+ For each oneof, at most one member field can be set at the same time.
190
+ Setting any member of the oneof automatically clears all other
191
+ members.
192
+
193
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
194
+
195
+ Attributes:
196
+ unstructured_document_info (google.cloud.discoveryengine_v1beta.types.Answer.Reference.UnstructuredDocumentInfo):
197
+ Unstructured document information.
198
+
199
+ This field is a member of `oneof`_ ``content``.
200
+ chunk_info (google.cloud.discoveryengine_v1beta.types.Answer.Reference.ChunkInfo):
201
+ Chunk information.
202
+
203
+ This field is a member of `oneof`_ ``content``.
204
+ structured_document_info (google.cloud.discoveryengine_v1beta.types.Answer.Reference.StructuredDocumentInfo):
205
+ Structured document information.
206
+
207
+ This field is a member of `oneof`_ ``content``.
208
+ """
209
+
210
+ class UnstructuredDocumentInfo(proto.Message):
211
+ r"""Unstructured document information.
212
+
213
+ Attributes:
214
+ document (str):
215
+ Document resource name.
216
+ uri (str):
217
+ URI for the document.
218
+ title (str):
219
+ Title.
220
+ chunk_contents (MutableSequence[google.cloud.discoveryengine_v1beta.types.Answer.Reference.UnstructuredDocumentInfo.ChunkContent]):
221
+ List of cited chunk contents derived from
222
+ document content.
223
+ struct_data (google.protobuf.struct_pb2.Struct):
224
+ The structured JSON metadata for the
225
+ document. It is populated from the struct data
226
+ from the Chunk in search result.
227
+ """
228
+
229
+ class ChunkContent(proto.Message):
230
+ r"""Chunk content.
231
+
232
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
233
+
234
+ Attributes:
235
+ content (str):
236
+ Chunk textual content.
237
+ page_identifier (str):
238
+ Page identifier.
239
+ relevance_score (float):
240
+ The relevance of the chunk for a given query.
241
+ Values range from 0.0 (completely irrelevant) to
242
+ 1.0 (completely relevant). This value is for
243
+ informational purpose only. It may change for
244
+ the same query and chunk at any time due to a
245
+ model retraining or change in implementation.
246
+
247
+ This field is a member of `oneof`_ ``_relevance_score``.
248
+ """
249
+
250
+ content: str = proto.Field(
251
+ proto.STRING,
252
+ number=1,
253
+ )
254
+ page_identifier: str = proto.Field(
255
+ proto.STRING,
256
+ number=2,
257
+ )
258
+ relevance_score: float = proto.Field(
259
+ proto.FLOAT,
260
+ number=3,
261
+ optional=True,
262
+ )
263
+
264
+ document: str = proto.Field(
265
+ proto.STRING,
266
+ number=1,
267
+ )
268
+ uri: str = proto.Field(
269
+ proto.STRING,
270
+ number=2,
271
+ )
272
+ title: str = proto.Field(
273
+ proto.STRING,
274
+ number=3,
275
+ )
276
+ chunk_contents: MutableSequence[
277
+ "Answer.Reference.UnstructuredDocumentInfo.ChunkContent"
278
+ ] = proto.RepeatedField(
279
+ proto.MESSAGE,
280
+ number=4,
281
+ message="Answer.Reference.UnstructuredDocumentInfo.ChunkContent",
282
+ )
283
+ struct_data: struct_pb2.Struct = proto.Field(
284
+ proto.MESSAGE,
285
+ number=5,
286
+ message=struct_pb2.Struct,
287
+ )
288
+
289
+ class ChunkInfo(proto.Message):
290
+ r"""Chunk information.
291
+
292
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
293
+
294
+ Attributes:
295
+ chunk (str):
296
+ Chunk resource name.
297
+ content (str):
298
+ Chunk textual content.
299
+ relevance_score (float):
300
+ The relevance of the chunk for a given query.
301
+ Values range from 0.0 (completely irrelevant) to
302
+ 1.0 (completely relevant). This value is for
303
+ informational purpose only. It may change for
304
+ the same query and chunk at any time due to a
305
+ model retraining or change in implementation.
306
+
307
+ This field is a member of `oneof`_ ``_relevance_score``.
308
+ document_metadata (google.cloud.discoveryengine_v1beta.types.Answer.Reference.ChunkInfo.DocumentMetadata):
309
+ Document metadata.
310
+ """
311
+
312
+ class DocumentMetadata(proto.Message):
313
+ r"""Document metadata.
314
+
315
+ Attributes:
316
+ document (str):
317
+ Document resource name.
318
+ uri (str):
319
+ URI for the document.
320
+ title (str):
321
+ Title.
322
+ page_identifier (str):
323
+ Page identifier.
324
+ struct_data (google.protobuf.struct_pb2.Struct):
325
+ The structured JSON metadata for the
326
+ document. It is populated from the struct data
327
+ from the Chunk in search result.
328
+ """
329
+
330
+ document: str = proto.Field(
331
+ proto.STRING,
332
+ number=1,
333
+ )
334
+ uri: str = proto.Field(
335
+ proto.STRING,
336
+ number=2,
337
+ )
338
+ title: str = proto.Field(
339
+ proto.STRING,
340
+ number=3,
341
+ )
342
+ page_identifier: str = proto.Field(
343
+ proto.STRING,
344
+ number=4,
345
+ )
346
+ struct_data: struct_pb2.Struct = proto.Field(
347
+ proto.MESSAGE,
348
+ number=5,
349
+ message=struct_pb2.Struct,
350
+ )
351
+
352
+ chunk: str = proto.Field(
353
+ proto.STRING,
354
+ number=1,
355
+ )
356
+ content: str = proto.Field(
357
+ proto.STRING,
358
+ number=2,
359
+ )
360
+ relevance_score: float = proto.Field(
361
+ proto.FLOAT,
362
+ number=3,
363
+ optional=True,
364
+ )
365
+ document_metadata: "Answer.Reference.ChunkInfo.DocumentMetadata" = (
366
+ proto.Field(
367
+ proto.MESSAGE,
368
+ number=4,
369
+ message="Answer.Reference.ChunkInfo.DocumentMetadata",
370
+ )
371
+ )
372
+
373
+ class StructuredDocumentInfo(proto.Message):
374
+ r"""Structured search information.
375
+
376
+ Attributes:
377
+ document (str):
378
+ Document resource name.
379
+ struct_data (google.protobuf.struct_pb2.Struct):
380
+ Structured search data.
381
+ """
382
+
383
+ document: str = proto.Field(
384
+ proto.STRING,
385
+ number=1,
386
+ )
387
+ struct_data: struct_pb2.Struct = proto.Field(
388
+ proto.MESSAGE,
389
+ number=2,
390
+ message=struct_pb2.Struct,
391
+ )
392
+
393
+ unstructured_document_info: "Answer.Reference.UnstructuredDocumentInfo" = (
394
+ proto.Field(
395
+ proto.MESSAGE,
396
+ number=1,
397
+ oneof="content",
398
+ message="Answer.Reference.UnstructuredDocumentInfo",
399
+ )
400
+ )
401
+ chunk_info: "Answer.Reference.ChunkInfo" = proto.Field(
402
+ proto.MESSAGE,
403
+ number=2,
404
+ oneof="content",
405
+ message="Answer.Reference.ChunkInfo",
406
+ )
407
+ structured_document_info: "Answer.Reference.StructuredDocumentInfo" = (
408
+ proto.Field(
409
+ proto.MESSAGE,
410
+ number=3,
411
+ oneof="content",
412
+ message="Answer.Reference.StructuredDocumentInfo",
413
+ )
414
+ )
415
+
416
+ class Step(proto.Message):
417
+ r"""Step information.
418
+
419
+ Attributes:
420
+ state (google.cloud.discoveryengine_v1beta.types.Answer.Step.State):
421
+ The state of the step.
422
+ description (str):
423
+ The description of the step.
424
+ thought (str):
425
+ The thought of the step.
426
+ actions (MutableSequence[google.cloud.discoveryengine_v1beta.types.Answer.Step.Action]):
427
+ Actions.
428
+ """
429
+
430
+ class State(proto.Enum):
431
+ r"""Enumeration of the state of the step.
432
+
433
+ Values:
434
+ STATE_UNSPECIFIED (0):
435
+ Unknown.
436
+ IN_PROGRESS (1):
437
+ Step is currently in progress.
438
+ FAILED (2):
439
+ Step currently failed.
440
+ SUCCEEDED (3):
441
+ Step has succeeded.
442
+ """
443
+ STATE_UNSPECIFIED = 0
444
+ IN_PROGRESS = 1
445
+ FAILED = 2
446
+ SUCCEEDED = 3
447
+
448
+ class Action(proto.Message):
449
+ r"""Action.
450
+
451
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
452
+
453
+ Attributes:
454
+ search_action (google.cloud.discoveryengine_v1beta.types.Answer.Step.Action.SearchAction):
455
+ Search action.
456
+
457
+ This field is a member of `oneof`_ ``action``.
458
+ observation (google.cloud.discoveryengine_v1beta.types.Answer.Step.Action.Observation):
459
+ Observation.
460
+ """
461
+
462
+ class SearchAction(proto.Message):
463
+ r"""Search action.
464
+
465
+ Attributes:
466
+ query (str):
467
+ The query to search.
468
+ """
469
+
470
+ query: str = proto.Field(
471
+ proto.STRING,
472
+ number=1,
473
+ )
474
+
475
+ class Observation(proto.Message):
476
+ r"""Observation.
477
+
478
+ Attributes:
479
+ search_results (MutableSequence[google.cloud.discoveryengine_v1beta.types.Answer.Step.Action.Observation.SearchResult]):
480
+ Search results observed by the search action,
481
+ it can be snippets info or chunk info, depending
482
+ on the citation type set by the user.
483
+ """
484
+
485
+ class SearchResult(proto.Message):
486
+ r"""
487
+
488
+ Attributes:
489
+ document (str):
490
+ Document resource name.
491
+ uri (str):
492
+ URI for the document.
493
+ title (str):
494
+ Title.
495
+ snippet_info (MutableSequence[google.cloud.discoveryengine_v1beta.types.Answer.Step.Action.Observation.SearchResult.SnippetInfo]):
496
+ If citation_type is DOCUMENT_LEVEL_CITATION, populate
497
+ document level snippets.
498
+ chunk_info (MutableSequence[google.cloud.discoveryengine_v1beta.types.Answer.Step.Action.Observation.SearchResult.ChunkInfo]):
499
+ If citation_type is CHUNK_LEVEL_CITATION and chunk mode is
500
+ on, populate chunk info.
501
+ struct_data (google.protobuf.struct_pb2.Struct):
502
+ Data representation.
503
+ The structured JSON data for the document.
504
+ It's populated from the struct data from the
505
+ Document, or the Chunk in search result.
506
+ """
507
+
508
+ class SnippetInfo(proto.Message):
509
+ r"""Snippet information.
510
+
511
+ Attributes:
512
+ snippet (str):
513
+ Snippet content.
514
+ snippet_status (str):
515
+ Status of the snippet defined by the search
516
+ team.
517
+ """
518
+
519
+ snippet: str = proto.Field(
520
+ proto.STRING,
521
+ number=1,
522
+ )
523
+ snippet_status: str = proto.Field(
524
+ proto.STRING,
525
+ number=2,
526
+ )
527
+
528
+ class ChunkInfo(proto.Message):
529
+ r"""Chunk information.
530
+
531
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
532
+
533
+ Attributes:
534
+ chunk (str):
535
+ Chunk resource name.
536
+ content (str):
537
+ Chunk textual content.
538
+ relevance_score (float):
539
+ The relevance of the chunk for a given query.
540
+ Values range from 0.0 (completely irrelevant) to
541
+ 1.0 (completely relevant). This value is for
542
+ informational purpose only. It may change for
543
+ the same query and chunk at any time due to a
544
+ model retraining or change in implementation.
545
+
546
+ This field is a member of `oneof`_ ``_relevance_score``.
547
+ """
548
+
549
+ chunk: str = proto.Field(
550
+ proto.STRING,
551
+ number=1,
552
+ )
553
+ content: str = proto.Field(
554
+ proto.STRING,
555
+ number=2,
556
+ )
557
+ relevance_score: float = proto.Field(
558
+ proto.FLOAT,
559
+ number=3,
560
+ optional=True,
561
+ )
562
+
563
+ document: str = proto.Field(
564
+ proto.STRING,
565
+ number=1,
566
+ )
567
+ uri: str = proto.Field(
568
+ proto.STRING,
569
+ number=2,
570
+ )
571
+ title: str = proto.Field(
572
+ proto.STRING,
573
+ number=3,
574
+ )
575
+ snippet_info: MutableSequence[
576
+ "Answer.Step.Action.Observation.SearchResult.SnippetInfo"
577
+ ] = proto.RepeatedField(
578
+ proto.MESSAGE,
579
+ number=4,
580
+ message="Answer.Step.Action.Observation.SearchResult.SnippetInfo",
581
+ )
582
+ chunk_info: MutableSequence[
583
+ "Answer.Step.Action.Observation.SearchResult.ChunkInfo"
584
+ ] = proto.RepeatedField(
585
+ proto.MESSAGE,
586
+ number=5,
587
+ message="Answer.Step.Action.Observation.SearchResult.ChunkInfo",
588
+ )
589
+ struct_data: struct_pb2.Struct = proto.Field(
590
+ proto.MESSAGE,
591
+ number=6,
592
+ message=struct_pb2.Struct,
593
+ )
594
+
595
+ search_results: MutableSequence[
596
+ "Answer.Step.Action.Observation.SearchResult"
597
+ ] = proto.RepeatedField(
598
+ proto.MESSAGE,
599
+ number=2,
600
+ message="Answer.Step.Action.Observation.SearchResult",
601
+ )
602
+
603
+ search_action: "Answer.Step.Action.SearchAction" = proto.Field(
604
+ proto.MESSAGE,
605
+ number=2,
606
+ oneof="action",
607
+ message="Answer.Step.Action.SearchAction",
608
+ )
609
+ observation: "Answer.Step.Action.Observation" = proto.Field(
610
+ proto.MESSAGE,
611
+ number=3,
612
+ message="Answer.Step.Action.Observation",
613
+ )
614
+
615
+ state: "Answer.Step.State" = proto.Field(
616
+ proto.ENUM,
617
+ number=1,
618
+ enum="Answer.Step.State",
619
+ )
620
+ description: str = proto.Field(
621
+ proto.STRING,
622
+ number=2,
623
+ )
624
+ thought: str = proto.Field(
625
+ proto.STRING,
626
+ number=3,
627
+ )
628
+ actions: MutableSequence["Answer.Step.Action"] = proto.RepeatedField(
629
+ proto.MESSAGE,
630
+ number=4,
631
+ message="Answer.Step.Action",
632
+ )
633
+
634
+ class QueryUnderstandingInfo(proto.Message):
635
+ r"""Query understanding information.
636
+
637
+ Attributes:
638
+ query_classification_info (MutableSequence[google.cloud.discoveryengine_v1beta.types.Answer.QueryUnderstandingInfo.QueryClassificationInfo]):
639
+ Query classification information.
640
+ """
641
+
642
+ class QueryClassificationInfo(proto.Message):
643
+ r"""Query classification information.
644
+
645
+ Attributes:
646
+ type_ (google.cloud.discoveryengine_v1beta.types.Answer.QueryUnderstandingInfo.QueryClassificationInfo.Type):
647
+ Query classification type.
648
+ positive (bool):
649
+ Classification output.
650
+ """
651
+
652
+ class Type(proto.Enum):
653
+ r"""Query classification types.
654
+
655
+ Values:
656
+ TYPE_UNSPECIFIED (0):
657
+ Unspecified query classification type.
658
+ ADVERSARIAL_QUERY (1):
659
+ Adversarial query classification type.
660
+ NON_ANSWER_SEEKING_QUERY (2):
661
+ Non-answer-seeking query classification type,
662
+ for chit chat.
663
+ JAIL_BREAKING_QUERY (3):
664
+ Jail-breaking query classification type.
665
+ NON_ANSWER_SEEKING_QUERY_V2 (4):
666
+ Non-answer-seeking query classification type,
667
+ for no clear intent.
668
+ """
669
+ TYPE_UNSPECIFIED = 0
670
+ ADVERSARIAL_QUERY = 1
671
+ NON_ANSWER_SEEKING_QUERY = 2
672
+ JAIL_BREAKING_QUERY = 3
673
+ NON_ANSWER_SEEKING_QUERY_V2 = 4
674
+
675
+ type_: "Answer.QueryUnderstandingInfo.QueryClassificationInfo.Type" = (
676
+ proto.Field(
677
+ proto.ENUM,
678
+ number=1,
679
+ enum="Answer.QueryUnderstandingInfo.QueryClassificationInfo.Type",
680
+ )
681
+ )
682
+ positive: bool = proto.Field(
683
+ proto.BOOL,
684
+ number=2,
685
+ )
686
+
687
+ query_classification_info: MutableSequence[
688
+ "Answer.QueryUnderstandingInfo.QueryClassificationInfo"
689
+ ] = proto.RepeatedField(
690
+ proto.MESSAGE,
691
+ number=1,
692
+ message="Answer.QueryUnderstandingInfo.QueryClassificationInfo",
693
+ )
694
+
695
+ name: str = proto.Field(
696
+ proto.STRING,
697
+ number=1,
698
+ )
699
+ state: State = proto.Field(
700
+ proto.ENUM,
701
+ number=2,
702
+ enum=State,
703
+ )
704
+ answer_text: str = proto.Field(
705
+ proto.STRING,
706
+ number=3,
707
+ )
708
+ citations: MutableSequence[Citation] = proto.RepeatedField(
709
+ proto.MESSAGE,
710
+ number=4,
711
+ message=Citation,
712
+ )
713
+ references: MutableSequence[Reference] = proto.RepeatedField(
714
+ proto.MESSAGE,
715
+ number=5,
716
+ message=Reference,
717
+ )
718
+ related_questions: MutableSequence[str] = proto.RepeatedField(
719
+ proto.STRING,
720
+ number=6,
721
+ )
722
+ steps: MutableSequence[Step] = proto.RepeatedField(
723
+ proto.MESSAGE,
724
+ number=7,
725
+ message=Step,
726
+ )
727
+ query_understanding_info: QueryUnderstandingInfo = proto.Field(
728
+ proto.MESSAGE,
729
+ number=10,
730
+ message=QueryUnderstandingInfo,
731
+ )
732
+ answer_skipped_reasons: MutableSequence[AnswerSkippedReason] = proto.RepeatedField(
733
+ proto.ENUM,
734
+ number=11,
735
+ enum=AnswerSkippedReason,
736
+ )
737
+ create_time: timestamp_pb2.Timestamp = proto.Field(
738
+ proto.MESSAGE,
739
+ number=8,
740
+ message=timestamp_pb2.Timestamp,
741
+ )
742
+ complete_time: timestamp_pb2.Timestamp = proto.Field(
743
+ proto.MESSAGE,
744
+ number=9,
745
+ message=timestamp_pb2.Timestamp,
746
+ )
747
+
748
+
749
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/chunk.py ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import struct_pb2 # type: ignore
21
+ import proto # type: ignore
22
+
23
+ __protobuf__ = proto.module(
24
+ package="google.cloud.discoveryengine.v1beta",
25
+ manifest={
26
+ "Chunk",
27
+ },
28
+ )
29
+
30
+
31
+ class Chunk(proto.Message):
32
+ r"""Chunk captures all raw metadata information of items to be
33
+ recommended or searched in the chunk mode.
34
+
35
+
36
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
37
+
38
+ Attributes:
39
+ name (str):
40
+ The full resource name of the chunk. Format:
41
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_id}/chunks/{chunk_id}``.
42
+
43
+ This field must be a UTF-8 encoded string with a length
44
+ limit of 1024 characters.
45
+ id (str):
46
+ Unique chunk ID of the current chunk.
47
+ content (str):
48
+ Content is a string from a document (parsed
49
+ content).
50
+ relevance_score (float):
51
+ Output only. Represents the relevance score based on
52
+ similarity. Higher score indicates higher chunk relevance.
53
+ The score is in range [-1.0, 1.0]. Only populated on
54
+ [SearchService.SearchResponse][].
55
+
56
+ This field is a member of `oneof`_ ``_relevance_score``.
57
+ document_metadata (google.cloud.discoveryengine_v1beta.types.Chunk.DocumentMetadata):
58
+ Metadata of the document from the current
59
+ chunk.
60
+ derived_struct_data (google.protobuf.struct_pb2.Struct):
61
+ Output only. This field is OUTPUT_ONLY. It contains derived
62
+ data that are not in the original input document.
63
+ page_span (google.cloud.discoveryengine_v1beta.types.Chunk.PageSpan):
64
+ Page span of the chunk.
65
+ chunk_metadata (google.cloud.discoveryengine_v1beta.types.Chunk.ChunkMetadata):
66
+ Output only. Metadata of the current chunk.
67
+ """
68
+
69
+ class DocumentMetadata(proto.Message):
70
+ r"""Document metadata contains the information of the document of
71
+ the current chunk.
72
+
73
+ Attributes:
74
+ uri (str):
75
+ Uri of the document.
76
+ title (str):
77
+ Title of the document.
78
+ struct_data (google.protobuf.struct_pb2.Struct):
79
+ Data representation. The structured JSON data for the
80
+ document. It should conform to the registered
81
+ [Schema][google.cloud.discoveryengine.v1beta.Schema] or an
82
+ ``INVALID_ARGUMENT`` error is thrown.
83
+ """
84
+
85
+ uri: str = proto.Field(
86
+ proto.STRING,
87
+ number=1,
88
+ )
89
+ title: str = proto.Field(
90
+ proto.STRING,
91
+ number=2,
92
+ )
93
+ struct_data: struct_pb2.Struct = proto.Field(
94
+ proto.MESSAGE,
95
+ number=3,
96
+ message=struct_pb2.Struct,
97
+ )
98
+
99
+ class PageSpan(proto.Message):
100
+ r"""Page span of the chunk.
101
+
102
+ Attributes:
103
+ page_start (int):
104
+ The start page of the chunk.
105
+ page_end (int):
106
+ The end page of the chunk.
107
+ """
108
+
109
+ page_start: int = proto.Field(
110
+ proto.INT32,
111
+ number=1,
112
+ )
113
+ page_end: int = proto.Field(
114
+ proto.INT32,
115
+ number=2,
116
+ )
117
+
118
+ class ChunkMetadata(proto.Message):
119
+ r"""Metadata of the current chunk. This field is only populated on
120
+ [SearchService.Search][google.cloud.discoveryengine.v1beta.SearchService.Search]
121
+ API.
122
+
123
+ Attributes:
124
+ previous_chunks (MutableSequence[google.cloud.discoveryengine_v1beta.types.Chunk]):
125
+ The previous chunks of the current chunk. The number is
126
+ controlled by
127
+ [SearchRequest.ContentSearchSpec.ChunkSpec.num_previous_chunks][google.cloud.discoveryengine.v1beta.SearchRequest.ContentSearchSpec.ChunkSpec.num_previous_chunks].
128
+ This field is only populated on
129
+ [SearchService.Search][google.cloud.discoveryengine.v1beta.SearchService.Search]
130
+ API.
131
+ next_chunks (MutableSequence[google.cloud.discoveryengine_v1beta.types.Chunk]):
132
+ The next chunks of the current chunk. The number is
133
+ controlled by
134
+ [SearchRequest.ContentSearchSpec.ChunkSpec.num_next_chunks][google.cloud.discoveryengine.v1beta.SearchRequest.ContentSearchSpec.ChunkSpec.num_next_chunks].
135
+ This field is only populated on
136
+ [SearchService.Search][google.cloud.discoveryengine.v1beta.SearchService.Search]
137
+ API.
138
+ """
139
+
140
+ previous_chunks: MutableSequence["Chunk"] = proto.RepeatedField(
141
+ proto.MESSAGE,
142
+ number=1,
143
+ message="Chunk",
144
+ )
145
+ next_chunks: MutableSequence["Chunk"] = proto.RepeatedField(
146
+ proto.MESSAGE,
147
+ number=2,
148
+ message="Chunk",
149
+ )
150
+
151
+ name: str = proto.Field(
152
+ proto.STRING,
153
+ number=1,
154
+ )
155
+ id: str = proto.Field(
156
+ proto.STRING,
157
+ number=2,
158
+ )
159
+ content: str = proto.Field(
160
+ proto.STRING,
161
+ number=3,
162
+ )
163
+ relevance_score: float = proto.Field(
164
+ proto.DOUBLE,
165
+ number=8,
166
+ optional=True,
167
+ )
168
+ document_metadata: DocumentMetadata = proto.Field(
169
+ proto.MESSAGE,
170
+ number=5,
171
+ message=DocumentMetadata,
172
+ )
173
+ derived_struct_data: struct_pb2.Struct = proto.Field(
174
+ proto.MESSAGE,
175
+ number=4,
176
+ message=struct_pb2.Struct,
177
+ )
178
+ page_span: PageSpan = proto.Field(
179
+ proto.MESSAGE,
180
+ number=6,
181
+ message=PageSpan,
182
+ )
183
+ chunk_metadata: ChunkMetadata = proto.Field(
184
+ proto.MESSAGE,
185
+ number=7,
186
+ message=ChunkMetadata,
187
+ )
188
+
189
+
190
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/common.py ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ import proto # type: ignore
21
+
22
+ __protobuf__ = proto.module(
23
+ package="google.cloud.discoveryengine.v1beta",
24
+ manifest={
25
+ "IndustryVertical",
26
+ "SolutionType",
27
+ "SearchUseCase",
28
+ "SearchTier",
29
+ "SearchAddOn",
30
+ "Interval",
31
+ "CustomAttribute",
32
+ "UserInfo",
33
+ "EmbeddingConfig",
34
+ "DoubleList",
35
+ },
36
+ )
37
+
38
+
39
+ class IndustryVertical(proto.Enum):
40
+ r"""The industry vertical associated with the
41
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
42
+
43
+ Values:
44
+ INDUSTRY_VERTICAL_UNSPECIFIED (0):
45
+ Value used when unset.
46
+ GENERIC (1):
47
+ The generic vertical for documents that are
48
+ not specific to any industry vertical.
49
+ MEDIA (2):
50
+ The media industry vertical.
51
+ HEALTHCARE_FHIR (7):
52
+ The healthcare FHIR vertical.
53
+ """
54
+ INDUSTRY_VERTICAL_UNSPECIFIED = 0
55
+ GENERIC = 1
56
+ MEDIA = 2
57
+ HEALTHCARE_FHIR = 7
58
+
59
+
60
+ class SolutionType(proto.Enum):
61
+ r"""The type of solution.
62
+
63
+ Values:
64
+ SOLUTION_TYPE_UNSPECIFIED (0):
65
+ Default value.
66
+ SOLUTION_TYPE_RECOMMENDATION (1):
67
+ Used for Recommendations AI.
68
+ SOLUTION_TYPE_SEARCH (2):
69
+ Used for Discovery Search.
70
+ SOLUTION_TYPE_CHAT (3):
71
+ Used for use cases related to the Generative
72
+ AI agent.
73
+ SOLUTION_TYPE_GENERATIVE_CHAT (4):
74
+ Used for use cases related to the Generative Chat agent.
75
+ It's used for Generative chat engine only, the associated
76
+ data stores must enrolled with ``SOLUTION_TYPE_CHAT``
77
+ solution.
78
+ """
79
+ SOLUTION_TYPE_UNSPECIFIED = 0
80
+ SOLUTION_TYPE_RECOMMENDATION = 1
81
+ SOLUTION_TYPE_SEARCH = 2
82
+ SOLUTION_TYPE_CHAT = 3
83
+ SOLUTION_TYPE_GENERATIVE_CHAT = 4
84
+
85
+
86
+ class SearchUseCase(proto.Enum):
87
+ r"""Defines a further subdivision of ``SolutionType``. Specifically
88
+ applies to
89
+ [SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_SEARCH].
90
+
91
+ Values:
92
+ SEARCH_USE_CASE_UNSPECIFIED (0):
93
+ Value used when unset. Will not occur in CSS.
94
+ SEARCH_USE_CASE_SEARCH (1):
95
+ Search use case. Expects the traffic has a non-empty
96
+ [query][google.cloud.discoveryengine.v1beta.SearchRequest.query].
97
+ SEARCH_USE_CASE_BROWSE (2):
98
+ Browse use case. Expects the traffic has an empty
99
+ [query][google.cloud.discoveryengine.v1beta.SearchRequest.query].
100
+ """
101
+ SEARCH_USE_CASE_UNSPECIFIED = 0
102
+ SEARCH_USE_CASE_SEARCH = 1
103
+ SEARCH_USE_CASE_BROWSE = 2
104
+
105
+
106
+ class SearchTier(proto.Enum):
107
+ r"""Tiers of search features. Different tiers might have
108
+ different pricing. To learn more, check the pricing
109
+ documentation.
110
+
111
+ Values:
112
+ SEARCH_TIER_UNSPECIFIED (0):
113
+ Default value when the enum is unspecified.
114
+ This is invalid to use.
115
+ SEARCH_TIER_STANDARD (1):
116
+ Standard tier.
117
+ SEARCH_TIER_ENTERPRISE (2):
118
+ Enterprise tier.
119
+ """
120
+ SEARCH_TIER_UNSPECIFIED = 0
121
+ SEARCH_TIER_STANDARD = 1
122
+ SEARCH_TIER_ENTERPRISE = 2
123
+
124
+
125
+ class SearchAddOn(proto.Enum):
126
+ r"""Add-on that provides additional functionality for search.
127
+
128
+ Values:
129
+ SEARCH_ADD_ON_UNSPECIFIED (0):
130
+ Default value when the enum is unspecified.
131
+ This is invalid to use.
132
+ SEARCH_ADD_ON_LLM (1):
133
+ Large language model add-on.
134
+ """
135
+ SEARCH_ADD_ON_UNSPECIFIED = 0
136
+ SEARCH_ADD_ON_LLM = 1
137
+
138
+
139
+ class Interval(proto.Message):
140
+ r"""A floating point interval.
141
+
142
+ This message has `oneof`_ fields (mutually exclusive fields).
143
+ For each oneof, at most one member field can be set at the same time.
144
+ Setting any member of the oneof automatically clears all other
145
+ members.
146
+
147
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
148
+
149
+ Attributes:
150
+ minimum (float):
151
+ Inclusive lower bound.
152
+
153
+ This field is a member of `oneof`_ ``min``.
154
+ exclusive_minimum (float):
155
+ Exclusive lower bound.
156
+
157
+ This field is a member of `oneof`_ ``min``.
158
+ maximum (float):
159
+ Inclusive upper bound.
160
+
161
+ This field is a member of `oneof`_ ``max``.
162
+ exclusive_maximum (float):
163
+ Exclusive upper bound.
164
+
165
+ This field is a member of `oneof`_ ``max``.
166
+ """
167
+
168
+ minimum: float = proto.Field(
169
+ proto.DOUBLE,
170
+ number=1,
171
+ oneof="min",
172
+ )
173
+ exclusive_minimum: float = proto.Field(
174
+ proto.DOUBLE,
175
+ number=2,
176
+ oneof="min",
177
+ )
178
+ maximum: float = proto.Field(
179
+ proto.DOUBLE,
180
+ number=3,
181
+ oneof="max",
182
+ )
183
+ exclusive_maximum: float = proto.Field(
184
+ proto.DOUBLE,
185
+ number=4,
186
+ oneof="max",
187
+ )
188
+
189
+
190
+ class CustomAttribute(proto.Message):
191
+ r"""A custom attribute that is not explicitly modeled in a resource,
192
+ e.g. [UserEvent][google.cloud.discoveryengine.v1beta.UserEvent].
193
+
194
+ Attributes:
195
+ text (MutableSequence[str]):
196
+ The textual values of this custom attribute. For example,
197
+ ``["yellow", "green"]`` when the key is "color".
198
+
199
+ Empty string is not allowed. Otherwise, an
200
+ ``INVALID_ARGUMENT`` error is returned.
201
+
202
+ Exactly one of
203
+ [CustomAttribute.text][google.cloud.discoveryengine.v1beta.CustomAttribute.text]
204
+ or
205
+ [CustomAttribute.numbers][google.cloud.discoveryengine.v1beta.CustomAttribute.numbers]
206
+ should be set. Otherwise, an ``INVALID_ARGUMENT`` error is
207
+ returned.
208
+ numbers (MutableSequence[float]):
209
+ The numerical values of this custom attribute. For example,
210
+ ``[2.3, 15.4]`` when the key is "lengths_cm".
211
+
212
+ Exactly one of
213
+ [CustomAttribute.text][google.cloud.discoveryengine.v1beta.CustomAttribute.text]
214
+ or
215
+ [CustomAttribute.numbers][google.cloud.discoveryengine.v1beta.CustomAttribute.numbers]
216
+ should be set. Otherwise, an ``INVALID_ARGUMENT`` error is
217
+ returned.
218
+ """
219
+
220
+ text: MutableSequence[str] = proto.RepeatedField(
221
+ proto.STRING,
222
+ number=1,
223
+ )
224
+ numbers: MutableSequence[float] = proto.RepeatedField(
225
+ proto.DOUBLE,
226
+ number=2,
227
+ )
228
+
229
+
230
+ class UserInfo(proto.Message):
231
+ r"""Information of an end user.
232
+
233
+ Attributes:
234
+ user_id (str):
235
+ Highly recommended for logged-in users. Unique identifier
236
+ for logged-in user, such as a user name. Don't set for
237
+ anonymous users.
238
+
239
+ Always use a hashed value for this ID.
240
+
241
+ Don't set the field to the same fixed ID for different
242
+ users. This mixes the event history of those users together,
243
+ which results in degraded model quality.
244
+
245
+ The field must be a UTF-8 encoded string with a length limit
246
+ of 128 characters. Otherwise, an ``INVALID_ARGUMENT`` error
247
+ is returned.
248
+ user_agent (str):
249
+ User agent as included in the HTTP header.
250
+
251
+ The field must be a UTF-8 encoded string with a length limit
252
+ of 1,000 characters. Otherwise, an ``INVALID_ARGUMENT``
253
+ error is returned.
254
+
255
+ This should not be set when using the client side event
256
+ reporting with GTM or JavaScript tag in
257
+ [UserEventService.CollectUserEvent][google.cloud.discoveryengine.v1beta.UserEventService.CollectUserEvent]
258
+ or if
259
+ [UserEvent.direct_user_request][google.cloud.discoveryengine.v1beta.UserEvent.direct_user_request]
260
+ is set.
261
+ """
262
+
263
+ user_id: str = proto.Field(
264
+ proto.STRING,
265
+ number=1,
266
+ )
267
+ user_agent: str = proto.Field(
268
+ proto.STRING,
269
+ number=2,
270
+ )
271
+
272
+
273
+ class EmbeddingConfig(proto.Message):
274
+ r"""Defines embedding config, used for bring your own embeddings
275
+ feature.
276
+
277
+ Attributes:
278
+ field_path (str):
279
+ Full field path in the schema mapped as
280
+ embedding field.
281
+ """
282
+
283
+ field_path: str = proto.Field(
284
+ proto.STRING,
285
+ number=1,
286
+ )
287
+
288
+
289
+ class DoubleList(proto.Message):
290
+ r"""Double list.
291
+
292
+ Attributes:
293
+ values (MutableSequence[float]):
294
+ Double values.
295
+ """
296
+
297
+ values: MutableSequence[float] = proto.RepeatedField(
298
+ proto.DOUBLE,
299
+ number=1,
300
+ )
301
+
302
+
303
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/completion.py ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ import proto # type: ignore
21
+
22
+ __protobuf__ = proto.module(
23
+ package="google.cloud.discoveryengine.v1beta",
24
+ manifest={
25
+ "SuggestionDenyListEntry",
26
+ "CompletionSuggestion",
27
+ },
28
+ )
29
+
30
+
31
+ class SuggestionDenyListEntry(proto.Message):
32
+ r"""Suggestion deny list entry identifying the phrase to block
33
+ from suggestions and the applied operation for the phrase.
34
+
35
+ Attributes:
36
+ block_phrase (str):
37
+ Required. Phrase to block from suggestions
38
+ served. Can be maximum 125 characters.
39
+ match_operator (google.cloud.discoveryengine_v1beta.types.SuggestionDenyListEntry.MatchOperator):
40
+ Required. The match operator to apply for
41
+ this phrase. Whether to block the exact phrase,
42
+ or block any suggestions containing this phrase.
43
+ """
44
+
45
+ class MatchOperator(proto.Enum):
46
+ r"""Operator for matching with the generated suggestions.
47
+
48
+ Values:
49
+ MATCH_OPERATOR_UNSPECIFIED (0):
50
+ Default value. Should not be used
51
+ EXACT_MATCH (1):
52
+ If the suggestion is an exact match to the block_phrase,
53
+ then block it.
54
+ CONTAINS (2):
55
+ If the suggestion contains the block_phrase, then block it.
56
+ """
57
+ MATCH_OPERATOR_UNSPECIFIED = 0
58
+ EXACT_MATCH = 1
59
+ CONTAINS = 2
60
+
61
+ block_phrase: str = proto.Field(
62
+ proto.STRING,
63
+ number=1,
64
+ )
65
+ match_operator: MatchOperator = proto.Field(
66
+ proto.ENUM,
67
+ number=2,
68
+ enum=MatchOperator,
69
+ )
70
+
71
+
72
+ class CompletionSuggestion(proto.Message):
73
+ r"""Autocomplete suggestions that are imported from Customer.
74
+
75
+ This message has `oneof`_ fields (mutually exclusive fields).
76
+ For each oneof, at most one member field can be set at the same time.
77
+ Setting any member of the oneof automatically clears all other
78
+ members.
79
+
80
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
81
+
82
+ Attributes:
83
+ global_score (float):
84
+ Global score of this suggestion. Control how
85
+ this suggestion would be scored / ranked.
86
+
87
+ This field is a member of `oneof`_ ``ranking_info``.
88
+ frequency (int):
89
+ Frequency of this suggestion. Will be used to
90
+ rank suggestions when score is not available.
91
+
92
+ This field is a member of `oneof`_ ``ranking_info``.
93
+ suggestion (str):
94
+ Required. The suggestion text.
95
+ language_code (str):
96
+ BCP-47 language code of this suggestion.
97
+ group_id (str):
98
+ If two suggestions have the same groupId,
99
+ they will not be returned together. Instead the
100
+ one ranked higher will be returned. This can be
101
+ used to deduplicate semantically identical
102
+ suggestions.
103
+ group_score (float):
104
+ The score of this suggestion within its
105
+ group.
106
+ alternative_phrases (MutableSequence[str]):
107
+ Alternative matching phrases for this
108
+ suggestion.
109
+ """
110
+
111
+ global_score: float = proto.Field(
112
+ proto.DOUBLE,
113
+ number=2,
114
+ oneof="ranking_info",
115
+ )
116
+ frequency: int = proto.Field(
117
+ proto.INT64,
118
+ number=3,
119
+ oneof="ranking_info",
120
+ )
121
+ suggestion: str = proto.Field(
122
+ proto.STRING,
123
+ number=1,
124
+ )
125
+ language_code: str = proto.Field(
126
+ proto.STRING,
127
+ number=4,
128
+ )
129
+ group_id: str = proto.Field(
130
+ proto.STRING,
131
+ number=5,
132
+ )
133
+ group_score: float = proto.Field(
134
+ proto.DOUBLE,
135
+ number=6,
136
+ )
137
+ alternative_phrases: MutableSequence[str] = proto.RepeatedField(
138
+ proto.STRING,
139
+ number=7,
140
+ )
141
+
142
+
143
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/completion_service.py ADDED
@@ -0,0 +1,601 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import timestamp_pb2 # type: ignore
21
+ import proto # type: ignore
22
+
23
+ from google.cloud.discoveryengine_v1beta.types import common
24
+ from google.cloud.discoveryengine_v1beta.types import document as gcd_document
25
+
26
+ __protobuf__ = proto.module(
27
+ package="google.cloud.discoveryengine.v1beta",
28
+ manifest={
29
+ "CompleteQueryRequest",
30
+ "CompleteQueryResponse",
31
+ "AdvancedCompleteQueryRequest",
32
+ "AdvancedCompleteQueryResponse",
33
+ },
34
+ )
35
+
36
+
37
+ class CompleteQueryRequest(proto.Message):
38
+ r"""Request message for
39
+ [CompletionService.CompleteQuery][google.cloud.discoveryengine.v1beta.CompletionService.CompleteQuery]
40
+ method.
41
+
42
+ Attributes:
43
+ data_store (str):
44
+ Required. The parent data store resource name for which the
45
+ completion is performed, such as
46
+ ``projects/*/locations/global/collections/default_collection/dataStores/default_data_store``.
47
+ query (str):
48
+ Required. The typeahead input used to fetch
49
+ suggestions. Maximum length is 128 characters.
50
+ query_model (str):
51
+ Specifies the autocomplete data model. This overrides any
52
+ model specified in the Configuration > Autocomplete section
53
+ of the Cloud console. Currently supported values:
54
+
55
+ - ``document`` - Using suggestions generated from
56
+ user-imported documents.
57
+ - ``search-history`` - Using suggestions generated from the
58
+ past history of
59
+ [SearchService.Search][google.cloud.discoveryengine.v1beta.SearchService.Search]
60
+ API calls. Do not use it when there is no traffic for
61
+ Search API.
62
+ - ``user-event`` - Using suggestions generated from
63
+ user-imported search events.
64
+ - ``document-completable`` - Using suggestions taken
65
+ directly from user-imported document fields marked as
66
+ completable.
67
+
68
+ Default values:
69
+
70
+ - ``document`` is the default model for regular dataStores.
71
+ - ``search-history`` is the default model for site search
72
+ dataStores.
73
+ user_pseudo_id (str):
74
+ A unique identifier for tracking visitors. For example, this
75
+ could be implemented with an HTTP cookie, which should be
76
+ able to uniquely identify a visitor on a single device. This
77
+ unique identifier should not change if the visitor logs in
78
+ or out of the website.
79
+
80
+ This field should NOT have a fixed value such as
81
+ ``unknown_visitor``.
82
+
83
+ This should be the same identifier as
84
+ [UserEvent.user_pseudo_id][google.cloud.discoveryengine.v1beta.UserEvent.user_pseudo_id]
85
+ and
86
+ [SearchRequest.user_pseudo_id][google.cloud.discoveryengine.v1beta.SearchRequest.user_pseudo_id].
87
+
88
+ The field must be a UTF-8 encoded string with a length limit
89
+ of 128 characters. Otherwise, an ``INVALID_ARGUMENT`` error
90
+ is returned.
91
+ include_tail_suggestions (bool):
92
+ Indicates if tail suggestions should be
93
+ returned if there are no suggestions that match
94
+ the full query. Even if set to true, if there
95
+ are suggestions that match the full query, those
96
+ are returned and no tail suggestions are
97
+ returned.
98
+ """
99
+
100
+ data_store: str = proto.Field(
101
+ proto.STRING,
102
+ number=1,
103
+ )
104
+ query: str = proto.Field(
105
+ proto.STRING,
106
+ number=2,
107
+ )
108
+ query_model: str = proto.Field(
109
+ proto.STRING,
110
+ number=3,
111
+ )
112
+ user_pseudo_id: str = proto.Field(
113
+ proto.STRING,
114
+ number=4,
115
+ )
116
+ include_tail_suggestions: bool = proto.Field(
117
+ proto.BOOL,
118
+ number=5,
119
+ )
120
+
121
+
122
+ class CompleteQueryResponse(proto.Message):
123
+ r"""Response message for
124
+ [CompletionService.CompleteQuery][google.cloud.discoveryengine.v1beta.CompletionService.CompleteQuery]
125
+ method.
126
+
127
+ Attributes:
128
+ query_suggestions (MutableSequence[google.cloud.discoveryengine_v1beta.types.CompleteQueryResponse.QuerySuggestion]):
129
+ Results of the matched query suggestions. The
130
+ result list is ordered and the first result is a
131
+ top suggestion.
132
+ tail_match_triggered (bool):
133
+ True if the returned suggestions are all tail suggestions.
134
+
135
+ For tail matching to be triggered, include_tail_suggestions
136
+ in the request must be true and there must be no suggestions
137
+ that match the full query.
138
+ """
139
+
140
+ class QuerySuggestion(proto.Message):
141
+ r"""Suggestions as search queries.
142
+
143
+ Attributes:
144
+ suggestion (str):
145
+ The suggestion for the query.
146
+ completable_field_paths (MutableSequence[str]):
147
+ The unique document field paths that serve as
148
+ the source of this suggestion if it was
149
+ generated from completable fields.
150
+
151
+ This field is only populated for the
152
+ document-completable model.
153
+ """
154
+
155
+ suggestion: str = proto.Field(
156
+ proto.STRING,
157
+ number=1,
158
+ )
159
+ completable_field_paths: MutableSequence[str] = proto.RepeatedField(
160
+ proto.STRING,
161
+ number=2,
162
+ )
163
+
164
+ query_suggestions: MutableSequence[QuerySuggestion] = proto.RepeatedField(
165
+ proto.MESSAGE,
166
+ number=1,
167
+ message=QuerySuggestion,
168
+ )
169
+ tail_match_triggered: bool = proto.Field(
170
+ proto.BOOL,
171
+ number=2,
172
+ )
173
+
174
+
175
+ class AdvancedCompleteQueryRequest(proto.Message):
176
+ r"""Request message for
177
+ [CompletionService.AdvancedCompleteQuery][google.cloud.discoveryengine.v1beta.CompletionService.AdvancedCompleteQuery]
178
+ method. .
179
+
180
+ Attributes:
181
+ completion_config (str):
182
+ Required. The completion_config of the parent dataStore or
183
+ engine resource name for which the completion is performed,
184
+ such as
185
+ ``projects/*/locations/global/collections/default_collection/dataStores/*/completionConfig``
186
+ ``projects/*/locations/global/collections/default_collection/engines/*/completionConfig``.
187
+ query (str):
188
+ Required. The typeahead input used to fetch suggestions.
189
+ Maximum length is 128 characters.
190
+
191
+ The query can not be empty for most of the suggestion types.
192
+ If it is empty, an ``INVALID_ARGUMENT`` error is returned.
193
+ The exception is when the suggestion_types contains only the
194
+ type ``RECENT_SEARCH``, the query can be an empty string.
195
+ The is called "zero prefix" feature, which returns user's
196
+ recently searched queries given the empty query.
197
+ query_model (str):
198
+ Specifies the autocomplete data model. This overrides any
199
+ model specified in the Configuration > Autocomplete section
200
+ of the Cloud console. Currently supported values:
201
+
202
+ - ``document`` - Using suggestions generated from
203
+ user-imported documents.
204
+ - ``search-history`` - Using suggestions generated from the
205
+ past history of
206
+ [SearchService.Search][google.cloud.discoveryengine.v1beta.SearchService.Search]
207
+ API calls. Do not use it when there is no traffic for
208
+ Search API.
209
+ - ``user-event`` - Using suggestions generated from
210
+ user-imported search events.
211
+ - ``document-completable`` - Using suggestions taken
212
+ directly from user-imported document fields marked as
213
+ completable.
214
+
215
+ Default values:
216
+
217
+ - ``document`` is the default model for regular dataStores.
218
+ - ``search-history`` is the default model for site search
219
+ dataStores.
220
+ user_pseudo_id (str):
221
+ A unique identifier for tracking visitors. For example, this
222
+ could be implemented with an HTTP cookie, which should be
223
+ able to uniquely identify a visitor on a single device. This
224
+ unique identifier should not change if the visitor logs in
225
+ or out of the website.
226
+
227
+ This field should NOT have a fixed value such as
228
+ ``unknown_visitor``.
229
+
230
+ This should be the same identifier as
231
+ [UserEvent.user_pseudo_id][google.cloud.discoveryengine.v1beta.UserEvent.user_pseudo_id]
232
+ and
233
+ [SearchRequest.user_pseudo_id][google.cloud.discoveryengine.v1beta.SearchRequest.user_pseudo_id].
234
+
235
+ The field must be a UTF-8 encoded string with a length limit
236
+ of 128
237
+ user_info (google.cloud.discoveryengine_v1beta.types.UserInfo):
238
+ Optional. Information about the end user.
239
+
240
+ This should be the same identifier information as
241
+ [UserEvent.user_info][google.cloud.discoveryengine.v1beta.UserEvent.user_info]
242
+ and
243
+ [SearchRequest.user_info][google.cloud.discoveryengine.v1beta.SearchRequest.user_info].
244
+ include_tail_suggestions (bool):
245
+ Indicates if tail suggestions should be
246
+ returned if there are no suggestions that match
247
+ the full query. Even if set to true, if there
248
+ are suggestions that match the full query, those
249
+ are returned and no tail suggestions are
250
+ returned.
251
+ boost_spec (google.cloud.discoveryengine_v1beta.types.AdvancedCompleteQueryRequest.BoostSpec):
252
+ Optional. Specification to boost suggestions
253
+ matching the condition.
254
+ suggestion_types (MutableSequence[google.cloud.discoveryengine_v1beta.types.AdvancedCompleteQueryRequest.SuggestionType]):
255
+ Optional. Suggestion types to return. If
256
+ empty or unspecified, query suggestions are
257
+ returned. Only one suggestion type is supported
258
+ at the moment.
259
+ """
260
+
261
+ class SuggestionType(proto.Enum):
262
+ r"""Suggestion type to return.
263
+
264
+ Values:
265
+ SUGGESTION_TYPE_UNSPECIFIED (0):
266
+ Default value.
267
+ QUERY (1):
268
+ Returns query suggestions.
269
+ PEOPLE (2):
270
+ Returns people suggestions.
271
+ CONTENT (3):
272
+ Returns content suggestions.
273
+ RECENT_SEARCH (4):
274
+ Returns recent search suggestions.
275
+ GOOGLE_WORKSPACE (5):
276
+ Returns Google Workspace suggestions.
277
+ """
278
+ SUGGESTION_TYPE_UNSPECIFIED = 0
279
+ QUERY = 1
280
+ PEOPLE = 2
281
+ CONTENT = 3
282
+ RECENT_SEARCH = 4
283
+ GOOGLE_WORKSPACE = 5
284
+
285
+ class BoostSpec(proto.Message):
286
+ r"""Specification to boost suggestions based on the condtion of
287
+ the suggestion.
288
+
289
+ Attributes:
290
+ condition_boost_specs (MutableSequence[google.cloud.discoveryengine_v1beta.types.AdvancedCompleteQueryRequest.BoostSpec.ConditionBoostSpec]):
291
+ Condition boost specifications. If a
292
+ suggestion matches multiple conditions in the
293
+ specifictions, boost values from these
294
+ specifications are all applied and combined in a
295
+ non-linear way. Maximum number of specifications
296
+ is 20.
297
+
298
+ Note: Currently only support language condition
299
+ boost.
300
+ """
301
+
302
+ class ConditionBoostSpec(proto.Message):
303
+ r"""Boost applies to suggestions which match a condition.
304
+
305
+ Attributes:
306
+ condition (str):
307
+ An expression which specifies a boost condition. The syntax
308
+ is the same as `filter expression
309
+ syntax <https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata#filter-expression-syntax>`__.
310
+ Currently, the only supported condition is a list of BCP-47
311
+ lang codes.
312
+
313
+ Example:
314
+
315
+ - To boost suggestions in languages ``en`` or ``fr``:
316
+ ``(lang_code: ANY("en", "fr"))``
317
+ boost (float):
318
+ Strength of the boost, which should be in [-1, 1]. Negative
319
+ boost means demotion. Default is 0.0.
320
+
321
+ Setting to 1.0 gives the suggestions a big promotion.
322
+ However, it does not necessarily mean that the top result
323
+ will be a boosted suggestion.
324
+
325
+ Setting to -1.0 gives the suggestions a big demotion.
326
+ However, other suggestions that are relevant might still be
327
+ shown.
328
+
329
+ Setting to 0.0 means no boost applied. The boosting
330
+ condition is ignored.
331
+ """
332
+
333
+ condition: str = proto.Field(
334
+ proto.STRING,
335
+ number=1,
336
+ )
337
+ boost: float = proto.Field(
338
+ proto.FLOAT,
339
+ number=2,
340
+ )
341
+
342
+ condition_boost_specs: MutableSequence[
343
+ "AdvancedCompleteQueryRequest.BoostSpec.ConditionBoostSpec"
344
+ ] = proto.RepeatedField(
345
+ proto.MESSAGE,
346
+ number=1,
347
+ message="AdvancedCompleteQueryRequest.BoostSpec.ConditionBoostSpec",
348
+ )
349
+
350
+ completion_config: str = proto.Field(
351
+ proto.STRING,
352
+ number=1,
353
+ )
354
+ query: str = proto.Field(
355
+ proto.STRING,
356
+ number=2,
357
+ )
358
+ query_model: str = proto.Field(
359
+ proto.STRING,
360
+ number=3,
361
+ )
362
+ user_pseudo_id: str = proto.Field(
363
+ proto.STRING,
364
+ number=4,
365
+ )
366
+ user_info: common.UserInfo = proto.Field(
367
+ proto.MESSAGE,
368
+ number=9,
369
+ message=common.UserInfo,
370
+ )
371
+ include_tail_suggestions: bool = proto.Field(
372
+ proto.BOOL,
373
+ number=5,
374
+ )
375
+ boost_spec: BoostSpec = proto.Field(
376
+ proto.MESSAGE,
377
+ number=6,
378
+ message=BoostSpec,
379
+ )
380
+ suggestion_types: MutableSequence[SuggestionType] = proto.RepeatedField(
381
+ proto.ENUM,
382
+ number=7,
383
+ enum=SuggestionType,
384
+ )
385
+
386
+
387
+ class AdvancedCompleteQueryResponse(proto.Message):
388
+ r"""Response message for
389
+ [CompletionService.AdvancedCompleteQuery][google.cloud.discoveryengine.v1beta.CompletionService.AdvancedCompleteQuery]
390
+ method.
391
+
392
+ Attributes:
393
+ query_suggestions (MutableSequence[google.cloud.discoveryengine_v1beta.types.AdvancedCompleteQueryResponse.QuerySuggestion]):
394
+ Results of the matched query suggestions. The
395
+ result list is ordered and the first result is a
396
+ top suggestion.
397
+ tail_match_triggered (bool):
398
+ True if the returned suggestions are all tail suggestions.
399
+
400
+ For tail matching to be triggered, include_tail_suggestions
401
+ in the request must be true and there must be no suggestions
402
+ that match the full query.
403
+ people_suggestions (MutableSequence[google.cloud.discoveryengine_v1beta.types.AdvancedCompleteQueryResponse.PersonSuggestion]):
404
+ Results of the matched people suggestions.
405
+ The result list is ordered and the first result
406
+ is the top suggestion.
407
+ content_suggestions (MutableSequence[google.cloud.discoveryengine_v1beta.types.AdvancedCompleteQueryResponse.ContentSuggestion]):
408
+ Results of the matched content suggestions.
409
+ The result list is ordered and the first result
410
+ is the top suggestion.
411
+ recent_search_suggestions (MutableSequence[google.cloud.discoveryengine_v1beta.types.AdvancedCompleteQueryResponse.RecentSearchSuggestion]):
412
+ Results of the matched "recent search"
413
+ suggestions. The result list is ordered and the
414
+ first result is the top suggestion.
415
+ """
416
+
417
+ class QuerySuggestion(proto.Message):
418
+ r"""Suggestions as search queries.
419
+
420
+ Attributes:
421
+ suggestion (str):
422
+ The suggestion for the query.
423
+ completable_field_paths (MutableSequence[str]):
424
+ The unique document field paths that serve as
425
+ the source of this suggestion if it was
426
+ generated from completable fields.
427
+
428
+ This field is only populated for the
429
+ document-completable model.
430
+ data_store (MutableSequence[str]):
431
+ The name of the dataStore that this
432
+ suggestion belongs to.
433
+ """
434
+
435
+ suggestion: str = proto.Field(
436
+ proto.STRING,
437
+ number=1,
438
+ )
439
+ completable_field_paths: MutableSequence[str] = proto.RepeatedField(
440
+ proto.STRING,
441
+ number=2,
442
+ )
443
+ data_store: MutableSequence[str] = proto.RepeatedField(
444
+ proto.STRING,
445
+ number=3,
446
+ )
447
+
448
+ class PersonSuggestion(proto.Message):
449
+ r"""Suggestions as people.
450
+
451
+ Attributes:
452
+ suggestion (str):
453
+ The suggestion for the query.
454
+ person_type (google.cloud.discoveryengine_v1beta.types.AdvancedCompleteQueryResponse.PersonSuggestion.PersonType):
455
+ The type of the person.
456
+ document (google.cloud.discoveryengine_v1beta.types.Document):
457
+ The document data snippet in the suggestion.
458
+ Only a subset of fields is populated.
459
+ data_store (str):
460
+ The name of the dataStore that this
461
+ suggestion belongs to.
462
+ """
463
+
464
+ class PersonType(proto.Enum):
465
+ r"""The type of the person based on the source.
466
+
467
+ Values:
468
+ PERSON_TYPE_UNSPECIFIED (0):
469
+ Default value.
470
+ CLOUD_IDENTITY (1):
471
+ The suggestion is from a GOOGLE_IDENTITY source.
472
+ THIRD_PARTY_IDENTITY (2):
473
+ The suggestion is from a THIRD_PARTY_IDENTITY source.
474
+ """
475
+ PERSON_TYPE_UNSPECIFIED = 0
476
+ CLOUD_IDENTITY = 1
477
+ THIRD_PARTY_IDENTITY = 2
478
+
479
+ suggestion: str = proto.Field(
480
+ proto.STRING,
481
+ number=1,
482
+ )
483
+ person_type: "AdvancedCompleteQueryResponse.PersonSuggestion.PersonType" = (
484
+ proto.Field(
485
+ proto.ENUM,
486
+ number=2,
487
+ enum="AdvancedCompleteQueryResponse.PersonSuggestion.PersonType",
488
+ )
489
+ )
490
+ document: gcd_document.Document = proto.Field(
491
+ proto.MESSAGE,
492
+ number=4,
493
+ message=gcd_document.Document,
494
+ )
495
+ data_store: str = proto.Field(
496
+ proto.STRING,
497
+ number=5,
498
+ )
499
+
500
+ class ContentSuggestion(proto.Message):
501
+ r"""Suggestions as content.
502
+
503
+ Attributes:
504
+ suggestion (str):
505
+ The suggestion for the query.
506
+ content_type (google.cloud.discoveryengine_v1beta.types.AdvancedCompleteQueryResponse.ContentSuggestion.ContentType):
507
+ The type of the content suggestion.
508
+ document (google.cloud.discoveryengine_v1beta.types.Document):
509
+ The document data snippet in the suggestion.
510
+ Only a subset of fields will be populated.
511
+ data_store (str):
512
+ The name of the dataStore that this
513
+ suggestion belongs to.
514
+ """
515
+
516
+ class ContentType(proto.Enum):
517
+ r"""The type of the content returned for content suggestions.
518
+
519
+ Values:
520
+ CONTENT_TYPE_UNSPECIFIED (0):
521
+ Default value.
522
+ GOOGLE_WORKSPACE (1):
523
+ The suggestion is from a Google Workspace
524
+ source.
525
+ THIRD_PARTY (2):
526
+ The suggestion is from a third party source.
527
+ """
528
+ CONTENT_TYPE_UNSPECIFIED = 0
529
+ GOOGLE_WORKSPACE = 1
530
+ THIRD_PARTY = 2
531
+
532
+ suggestion: str = proto.Field(
533
+ proto.STRING,
534
+ number=1,
535
+ )
536
+ content_type: "AdvancedCompleteQueryResponse.ContentSuggestion.ContentType" = (
537
+ proto.Field(
538
+ proto.ENUM,
539
+ number=2,
540
+ enum="AdvancedCompleteQueryResponse.ContentSuggestion.ContentType",
541
+ )
542
+ )
543
+ document: gcd_document.Document = proto.Field(
544
+ proto.MESSAGE,
545
+ number=4,
546
+ message=gcd_document.Document,
547
+ )
548
+ data_store: str = proto.Field(
549
+ proto.STRING,
550
+ number=5,
551
+ )
552
+
553
+ class RecentSearchSuggestion(proto.Message):
554
+ r"""Suggestions from recent search history.
555
+
556
+ Attributes:
557
+ suggestion (str):
558
+ The suggestion for the query.
559
+ recent_search_time (google.protobuf.timestamp_pb2.Timestamp):
560
+ The time when this recent rearch happened.
561
+ """
562
+
563
+ suggestion: str = proto.Field(
564
+ proto.STRING,
565
+ number=1,
566
+ )
567
+ recent_search_time: timestamp_pb2.Timestamp = proto.Field(
568
+ proto.MESSAGE,
569
+ number=2,
570
+ message=timestamp_pb2.Timestamp,
571
+ )
572
+
573
+ query_suggestions: MutableSequence[QuerySuggestion] = proto.RepeatedField(
574
+ proto.MESSAGE,
575
+ number=1,
576
+ message=QuerySuggestion,
577
+ )
578
+ tail_match_triggered: bool = proto.Field(
579
+ proto.BOOL,
580
+ number=2,
581
+ )
582
+ people_suggestions: MutableSequence[PersonSuggestion] = proto.RepeatedField(
583
+ proto.MESSAGE,
584
+ number=3,
585
+ message=PersonSuggestion,
586
+ )
587
+ content_suggestions: MutableSequence[ContentSuggestion] = proto.RepeatedField(
588
+ proto.MESSAGE,
589
+ number=4,
590
+ message=ContentSuggestion,
591
+ )
592
+ recent_search_suggestions: MutableSequence[
593
+ RecentSearchSuggestion
594
+ ] = proto.RepeatedField(
595
+ proto.MESSAGE,
596
+ number=5,
597
+ message=RecentSearchSuggestion,
598
+ )
599
+
600
+
601
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/control.py ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import timestamp_pb2 # type: ignore
21
+ import proto # type: ignore
22
+
23
+ from google.cloud.discoveryengine_v1beta.types import common
24
+
25
+ __protobuf__ = proto.module(
26
+ package="google.cloud.discoveryengine.v1beta",
27
+ manifest={
28
+ "Condition",
29
+ "Control",
30
+ },
31
+ )
32
+
33
+
34
+ class Condition(proto.Message):
35
+ r"""Defines circumstances to be checked before allowing a
36
+ behavior
37
+
38
+ Attributes:
39
+ query_terms (MutableSequence[google.cloud.discoveryengine_v1beta.types.Condition.QueryTerm]):
40
+ Search only A list of terms to match the query on. Cannot be
41
+ set when
42
+ [Condition.query_regex][google.cloud.discoveryengine.v1beta.Condition.query_regex]
43
+ is set.
44
+
45
+ Maximum of 10 query terms.
46
+ active_time_range (MutableSequence[google.cloud.discoveryengine_v1beta.types.Condition.TimeRange]):
47
+ Range of time(s) specifying when condition is
48
+ active.
49
+ Maximum of 10 time ranges.
50
+ query_regex (str):
51
+ Optional. Query regex to match the whole search query.
52
+ Cannot be set when
53
+ [Condition.query_terms][google.cloud.discoveryengine.v1beta.Condition.query_terms]
54
+ is set. This is currently supporting promotion use case.
55
+ """
56
+
57
+ class QueryTerm(proto.Message):
58
+ r"""Matcher for search request query
59
+
60
+ Attributes:
61
+ value (str):
62
+ The specific query value to match against
63
+
64
+ Must be lowercase, must be UTF-8. Can have at most 3 space
65
+ separated terms if full_match is true. Cannot be an empty
66
+ string. Maximum length of 5000 characters.
67
+ full_match (bool):
68
+ Whether the search query needs to exactly
69
+ match the query term.
70
+ """
71
+
72
+ value: str = proto.Field(
73
+ proto.STRING,
74
+ number=1,
75
+ )
76
+ full_match: bool = proto.Field(
77
+ proto.BOOL,
78
+ number=2,
79
+ )
80
+
81
+ class TimeRange(proto.Message):
82
+ r"""Used for time-dependent conditions.
83
+
84
+ Attributes:
85
+ start_time (google.protobuf.timestamp_pb2.Timestamp):
86
+ Start of time range.
87
+
88
+ Range is inclusive.
89
+ end_time (google.protobuf.timestamp_pb2.Timestamp):
90
+ End of time range.
91
+
92
+ Range is inclusive.
93
+ Must be in the future.
94
+ """
95
+
96
+ start_time: timestamp_pb2.Timestamp = proto.Field(
97
+ proto.MESSAGE,
98
+ number=1,
99
+ message=timestamp_pb2.Timestamp,
100
+ )
101
+ end_time: timestamp_pb2.Timestamp = proto.Field(
102
+ proto.MESSAGE,
103
+ number=2,
104
+ message=timestamp_pb2.Timestamp,
105
+ )
106
+
107
+ query_terms: MutableSequence[QueryTerm] = proto.RepeatedField(
108
+ proto.MESSAGE,
109
+ number=2,
110
+ message=QueryTerm,
111
+ )
112
+ active_time_range: MutableSequence[TimeRange] = proto.RepeatedField(
113
+ proto.MESSAGE,
114
+ number=3,
115
+ message=TimeRange,
116
+ )
117
+ query_regex: str = proto.Field(
118
+ proto.STRING,
119
+ number=4,
120
+ )
121
+
122
+
123
+ class Control(proto.Message):
124
+ r"""Defines a conditioned behavior to employ during serving. Must be
125
+ attached to a
126
+ [ServingConfig][google.cloud.discoveryengine.v1beta.ServingConfig]
127
+ to be considered at serving time. Permitted actions dependent on
128
+ ``SolutionType``.
129
+
130
+ This message has `oneof`_ fields (mutually exclusive fields).
131
+ For each oneof, at most one member field can be set at the same time.
132
+ Setting any member of the oneof automatically clears all other
133
+ members.
134
+
135
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
136
+
137
+ Attributes:
138
+ boost_action (google.cloud.discoveryengine_v1beta.types.Control.BoostAction):
139
+ Defines a boost-type control
140
+
141
+ This field is a member of `oneof`_ ``action``.
142
+ filter_action (google.cloud.discoveryengine_v1beta.types.Control.FilterAction):
143
+ Defines a filter-type control
144
+ Currently not supported by Recommendation
145
+
146
+ This field is a member of `oneof`_ ``action``.
147
+ redirect_action (google.cloud.discoveryengine_v1beta.types.Control.RedirectAction):
148
+ Defines a redirect-type control.
149
+
150
+ This field is a member of `oneof`_ ``action``.
151
+ synonyms_action (google.cloud.discoveryengine_v1beta.types.Control.SynonymsAction):
152
+ Treats a group of terms as synonyms of one
153
+ another.
154
+
155
+ This field is a member of `oneof`_ ``action``.
156
+ name (str):
157
+ Immutable. Fully qualified name
158
+ ``projects/*/locations/global/dataStore/*/controls/*``
159
+ display_name (str):
160
+ Required. Human readable name. The identifier
161
+ used in UI views.
162
+ Must be UTF-8 encoded string. Length limit is
163
+ 128 characters. Otherwise an INVALID ARGUMENT
164
+ error is thrown.
165
+ associated_serving_config_ids (MutableSequence[str]):
166
+ Output only. List of all
167
+ [ServingConfig][google.cloud.discoveryengine.v1beta.ServingConfig]
168
+ IDs this control is attached to. May take up to 10 minutes
169
+ to update after changes.
170
+ solution_type (google.cloud.discoveryengine_v1beta.types.SolutionType):
171
+ Required. Immutable. What solution the
172
+ control belongs to.
173
+ Must be compatible with vertical of resource.
174
+ Otherwise an INVALID ARGUMENT error is thrown.
175
+ use_cases (MutableSequence[google.cloud.discoveryengine_v1beta.types.SearchUseCase]):
176
+ Specifies the use case for the control. Affects what
177
+ condition fields can be set. Only applies to
178
+ [SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_SEARCH].
179
+ Currently only allow one use case per control. Must be set
180
+ when solution_type is
181
+ [SolutionType.SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_SEARCH].
182
+ conditions (MutableSequence[google.cloud.discoveryengine_v1beta.types.Condition]):
183
+ Determines when the associated action will
184
+ trigger.
185
+ Omit to always apply the action.
186
+ Currently only a single condition may be
187
+ specified. Otherwise an INVALID ARGUMENT error
188
+ is thrown.
189
+ """
190
+
191
+ class BoostAction(proto.Message):
192
+ r"""Adjusts order of products in returned list.
193
+
194
+ Attributes:
195
+ boost (float):
196
+ Required. Strength of the boost, which should be in [-1, 1].
197
+ Negative boost means demotion. Default is 0.0 (No-op).
198
+ filter (str):
199
+ Required. Specifies which products to apply
200
+ the boost to.
201
+ If no filter is provided all products will be
202
+ boosted (No-op). Syntax documentation:
203
+
204
+ https://cloud.google.com/retail/docs/filter-and-order
205
+ Maximum length is 5000 characters.
206
+ Otherwise an INVALID ARGUMENT error is thrown.
207
+ data_store (str):
208
+ Required. Specifies which data store's documents can be
209
+ boosted by this control. Full data store name e.g.
210
+ projects/123/locations/global/collections/default_collection/dataStores/default_data_store
211
+ """
212
+
213
+ boost: float = proto.Field(
214
+ proto.FLOAT,
215
+ number=1,
216
+ )
217
+ filter: str = proto.Field(
218
+ proto.STRING,
219
+ number=2,
220
+ )
221
+ data_store: str = proto.Field(
222
+ proto.STRING,
223
+ number=3,
224
+ )
225
+
226
+ class FilterAction(proto.Message):
227
+ r"""Specified which products may be included in results.
228
+ Uses same filter as boost.
229
+
230
+ Attributes:
231
+ filter (str):
232
+ Required. A filter to apply on the matching
233
+ condition results.
234
+ Required
235
+ Syntax documentation:
236
+
237
+ https://cloud.google.com/retail/docs/filter-and-order
238
+ Maximum length is 5000 characters. Otherwise an
239
+ INVALID ARGUMENT error is thrown.
240
+ data_store (str):
241
+ Required. Specifies which data store's documents can be
242
+ filtered by this control. Full data store name e.g.
243
+ projects/123/locations/global/collections/default_collection/dataStores/default_data_store
244
+ """
245
+
246
+ filter: str = proto.Field(
247
+ proto.STRING,
248
+ number=1,
249
+ )
250
+ data_store: str = proto.Field(
251
+ proto.STRING,
252
+ number=2,
253
+ )
254
+
255
+ class RedirectAction(proto.Message):
256
+ r"""Redirects a shopper to the provided URI.
257
+
258
+ Attributes:
259
+ redirect_uri (str):
260
+ Required. The URI to which the shopper will
261
+ be redirected.
262
+ Required.
263
+ URI must have length equal or less than 2000
264
+ characters. Otherwise an INVALID ARGUMENT error
265
+ is thrown.
266
+ """
267
+
268
+ redirect_uri: str = proto.Field(
269
+ proto.STRING,
270
+ number=1,
271
+ )
272
+
273
+ class SynonymsAction(proto.Message):
274
+ r"""Creates a set of terms that will act as synonyms of one
275
+ another.
276
+ Example: "happy" will also be considered as "glad", "glad" will
277
+ also be considered as "happy".
278
+
279
+ Attributes:
280
+ synonyms (MutableSequence[str]):
281
+ Defines a set of synonyms.
282
+ Can specify up to 100 synonyms.
283
+ Must specify at least 2 synonyms. Otherwise an
284
+ INVALID ARGUMENT error is thrown.
285
+ """
286
+
287
+ synonyms: MutableSequence[str] = proto.RepeatedField(
288
+ proto.STRING,
289
+ number=1,
290
+ )
291
+
292
+ boost_action: BoostAction = proto.Field(
293
+ proto.MESSAGE,
294
+ number=6,
295
+ oneof="action",
296
+ message=BoostAction,
297
+ )
298
+ filter_action: FilterAction = proto.Field(
299
+ proto.MESSAGE,
300
+ number=7,
301
+ oneof="action",
302
+ message=FilterAction,
303
+ )
304
+ redirect_action: RedirectAction = proto.Field(
305
+ proto.MESSAGE,
306
+ number=9,
307
+ oneof="action",
308
+ message=RedirectAction,
309
+ )
310
+ synonyms_action: SynonymsAction = proto.Field(
311
+ proto.MESSAGE,
312
+ number=10,
313
+ oneof="action",
314
+ message=SynonymsAction,
315
+ )
316
+ name: str = proto.Field(
317
+ proto.STRING,
318
+ number=1,
319
+ )
320
+ display_name: str = proto.Field(
321
+ proto.STRING,
322
+ number=2,
323
+ )
324
+ associated_serving_config_ids: MutableSequence[str] = proto.RepeatedField(
325
+ proto.STRING,
326
+ number=3,
327
+ )
328
+ solution_type: common.SolutionType = proto.Field(
329
+ proto.ENUM,
330
+ number=4,
331
+ enum=common.SolutionType,
332
+ )
333
+ use_cases: MutableSequence[common.SearchUseCase] = proto.RepeatedField(
334
+ proto.ENUM,
335
+ number=8,
336
+ enum=common.SearchUseCase,
337
+ )
338
+ conditions: MutableSequence["Condition"] = proto.RepeatedField(
339
+ proto.MESSAGE,
340
+ number=5,
341
+ message="Condition",
342
+ )
343
+
344
+
345
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/control_service.py ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import field_mask_pb2 # type: ignore
21
+ import proto # type: ignore
22
+
23
+ from google.cloud.discoveryengine_v1beta.types import control as gcd_control
24
+
25
+ __protobuf__ = proto.module(
26
+ package="google.cloud.discoveryengine.v1beta",
27
+ manifest={
28
+ "CreateControlRequest",
29
+ "UpdateControlRequest",
30
+ "DeleteControlRequest",
31
+ "GetControlRequest",
32
+ "ListControlsRequest",
33
+ "ListControlsResponse",
34
+ },
35
+ )
36
+
37
+
38
+ class CreateControlRequest(proto.Message):
39
+ r"""Request for CreateControl method.
40
+
41
+ Attributes:
42
+ parent (str):
43
+ Required. Full resource name of parent data store. Format:
44
+ ``projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}``
45
+ or
46
+ ``projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}``.
47
+ control (google.cloud.discoveryengine_v1beta.types.Control):
48
+ Required. The Control to create.
49
+ control_id (str):
50
+ Required. The ID to use for the Control, which will become
51
+ the final component of the Control's resource name.
52
+
53
+ This value must be within 1-63 characters. Valid characters
54
+ are /[a-z][0-9]-\_/.
55
+ """
56
+
57
+ parent: str = proto.Field(
58
+ proto.STRING,
59
+ number=1,
60
+ )
61
+ control: gcd_control.Control = proto.Field(
62
+ proto.MESSAGE,
63
+ number=2,
64
+ message=gcd_control.Control,
65
+ )
66
+ control_id: str = proto.Field(
67
+ proto.STRING,
68
+ number=3,
69
+ )
70
+
71
+
72
+ class UpdateControlRequest(proto.Message):
73
+ r"""Request for UpdateControl method.
74
+
75
+ Attributes:
76
+ control (google.cloud.discoveryengine_v1beta.types.Control):
77
+ Required. The Control to update.
78
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
79
+ Optional. Indicates which fields in the provided
80
+ [Control][google.cloud.discoveryengine.v1beta.Control] to
81
+ update. The following are NOT supported:
82
+
83
+ - [Control.name][google.cloud.discoveryengine.v1beta.Control.name]
84
+ - [Control.solution_type][google.cloud.discoveryengine.v1beta.Control.solution_type]
85
+
86
+ If not set or empty, all supported fields are updated.
87
+ """
88
+
89
+ control: gcd_control.Control = proto.Field(
90
+ proto.MESSAGE,
91
+ number=1,
92
+ message=gcd_control.Control,
93
+ )
94
+ update_mask: field_mask_pb2.FieldMask = proto.Field(
95
+ proto.MESSAGE,
96
+ number=2,
97
+ message=field_mask_pb2.FieldMask,
98
+ )
99
+
100
+
101
+ class DeleteControlRequest(proto.Message):
102
+ r"""Request for DeleteControl method.
103
+
104
+ Attributes:
105
+ name (str):
106
+ Required. The resource name of the Control to delete.
107
+ Format:
108
+ ``projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}``
109
+ """
110
+
111
+ name: str = proto.Field(
112
+ proto.STRING,
113
+ number=1,
114
+ )
115
+
116
+
117
+ class GetControlRequest(proto.Message):
118
+ r"""Request for GetControl method.
119
+
120
+ Attributes:
121
+ name (str):
122
+ Required. The resource name of the Control to get. Format:
123
+ ``projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}``
124
+ """
125
+
126
+ name: str = proto.Field(
127
+ proto.STRING,
128
+ number=1,
129
+ )
130
+
131
+
132
+ class ListControlsRequest(proto.Message):
133
+ r"""Request for ListControls method.
134
+
135
+ Attributes:
136
+ parent (str):
137
+ Required. The data store resource name. Format:
138
+ ``projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}``
139
+ or
140
+ ``projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}``.
141
+ page_size (int):
142
+ Optional. Maximum number of results to
143
+ return. If unspecified, defaults to 50. Max
144
+ allowed value is 1000.
145
+ page_token (str):
146
+ Optional. A page token, received from a previous
147
+ ``ListControls`` call. Provide this to retrieve the
148
+ subsequent page.
149
+ filter (str):
150
+ Optional. A filter to apply on the list results. Supported
151
+ features:
152
+
153
+ - List all the products under the parent branch if
154
+ [filter][google.cloud.discoveryengine.v1beta.ListControlsRequest.filter]
155
+ is unset. Currently this field is unsupported.
156
+ """
157
+
158
+ parent: str = proto.Field(
159
+ proto.STRING,
160
+ number=1,
161
+ )
162
+ page_size: int = proto.Field(
163
+ proto.INT32,
164
+ number=2,
165
+ )
166
+ page_token: str = proto.Field(
167
+ proto.STRING,
168
+ number=3,
169
+ )
170
+ filter: str = proto.Field(
171
+ proto.STRING,
172
+ number=4,
173
+ )
174
+
175
+
176
+ class ListControlsResponse(proto.Message):
177
+ r"""Response for ListControls method.
178
+
179
+ Attributes:
180
+ controls (MutableSequence[google.cloud.discoveryengine_v1beta.types.Control]):
181
+ All the Controls for a given data store.
182
+ next_page_token (str):
183
+ Pagination token, if not returned indicates
184
+ the last page.
185
+ """
186
+
187
+ @property
188
+ def raw_page(self):
189
+ return self
190
+
191
+ controls: MutableSequence[gcd_control.Control] = proto.RepeatedField(
192
+ proto.MESSAGE,
193
+ number=1,
194
+ message=gcd_control.Control,
195
+ )
196
+ next_page_token: str = proto.Field(
197
+ proto.STRING,
198
+ number=2,
199
+ )
200
+
201
+
202
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/conversation.py ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import timestamp_pb2 # type: ignore
21
+ import proto # type: ignore
22
+
23
+ from google.cloud.discoveryengine_v1beta.types import search_service
24
+
25
+ __protobuf__ = proto.module(
26
+ package="google.cloud.discoveryengine.v1beta",
27
+ manifest={
28
+ "Conversation",
29
+ "Reply",
30
+ "ConversationContext",
31
+ "TextInput",
32
+ "ConversationMessage",
33
+ },
34
+ )
35
+
36
+
37
+ class Conversation(proto.Message):
38
+ r"""External conversation proto definition.
39
+
40
+ Attributes:
41
+ name (str):
42
+ Immutable. Fully qualified name
43
+ ``projects/{project}/locations/global/collections/{collection}/dataStore/*/conversations/*``
44
+ or
45
+ ``projects/{project}/locations/global/collections/{collection}/engines/*/conversations/*``.
46
+ state (google.cloud.discoveryengine_v1beta.types.Conversation.State):
47
+ The state of the Conversation.
48
+ user_pseudo_id (str):
49
+ A unique identifier for tracking users.
50
+ messages (MutableSequence[google.cloud.discoveryengine_v1beta.types.ConversationMessage]):
51
+ Conversation messages.
52
+ start_time (google.protobuf.timestamp_pb2.Timestamp):
53
+ Output only. The time the conversation
54
+ started.
55
+ end_time (google.protobuf.timestamp_pb2.Timestamp):
56
+ Output only. The time the conversation
57
+ finished.
58
+ """
59
+
60
+ class State(proto.Enum):
61
+ r"""Enumeration of the state of the conversation.
62
+
63
+ Values:
64
+ STATE_UNSPECIFIED (0):
65
+ Unknown.
66
+ IN_PROGRESS (1):
67
+ Conversation is currently open.
68
+ COMPLETED (2):
69
+ Conversation has been completed.
70
+ """
71
+ STATE_UNSPECIFIED = 0
72
+ IN_PROGRESS = 1
73
+ COMPLETED = 2
74
+
75
+ name: str = proto.Field(
76
+ proto.STRING,
77
+ number=1,
78
+ )
79
+ state: State = proto.Field(
80
+ proto.ENUM,
81
+ number=2,
82
+ enum=State,
83
+ )
84
+ user_pseudo_id: str = proto.Field(
85
+ proto.STRING,
86
+ number=3,
87
+ )
88
+ messages: MutableSequence["ConversationMessage"] = proto.RepeatedField(
89
+ proto.MESSAGE,
90
+ number=4,
91
+ message="ConversationMessage",
92
+ )
93
+ start_time: timestamp_pb2.Timestamp = proto.Field(
94
+ proto.MESSAGE,
95
+ number=5,
96
+ message=timestamp_pb2.Timestamp,
97
+ )
98
+ end_time: timestamp_pb2.Timestamp = proto.Field(
99
+ proto.MESSAGE,
100
+ number=6,
101
+ message=timestamp_pb2.Timestamp,
102
+ )
103
+
104
+
105
+ class Reply(proto.Message):
106
+ r"""Defines a reply message to user.
107
+
108
+ Attributes:
109
+ reply (str):
110
+ DEPRECATED: use ``summary`` instead. Text reply.
111
+ references (MutableSequence[google.cloud.discoveryengine_v1beta.types.Reply.Reference]):
112
+ References in the reply.
113
+ summary (google.cloud.discoveryengine_v1beta.types.SearchResponse.Summary):
114
+ Summary based on search results.
115
+ """
116
+
117
+ class Reference(proto.Message):
118
+ r"""Defines reference in reply.
119
+
120
+ Attributes:
121
+ uri (str):
122
+ URI link reference.
123
+ anchor_text (str):
124
+ Anchor text.
125
+ start (int):
126
+ Anchor text start index.
127
+ end (int):
128
+ Anchor text end index.
129
+ """
130
+
131
+ uri: str = proto.Field(
132
+ proto.STRING,
133
+ number=1,
134
+ )
135
+ anchor_text: str = proto.Field(
136
+ proto.STRING,
137
+ number=2,
138
+ )
139
+ start: int = proto.Field(
140
+ proto.INT32,
141
+ number=3,
142
+ )
143
+ end: int = proto.Field(
144
+ proto.INT32,
145
+ number=4,
146
+ )
147
+
148
+ reply: str = proto.Field(
149
+ proto.STRING,
150
+ number=1,
151
+ )
152
+ references: MutableSequence[Reference] = proto.RepeatedField(
153
+ proto.MESSAGE,
154
+ number=2,
155
+ message=Reference,
156
+ )
157
+ summary: search_service.SearchResponse.Summary = proto.Field(
158
+ proto.MESSAGE,
159
+ number=3,
160
+ message=search_service.SearchResponse.Summary,
161
+ )
162
+
163
+
164
+ class ConversationContext(proto.Message):
165
+ r"""Defines context of the conversation
166
+
167
+ Attributes:
168
+ context_documents (MutableSequence[str]):
169
+ The current list of documents the user is
170
+ seeing. It contains the document resource
171
+ references.
172
+ active_document (str):
173
+ The current active document the user opened.
174
+ It contains the document resource reference.
175
+ """
176
+
177
+ context_documents: MutableSequence[str] = proto.RepeatedField(
178
+ proto.STRING,
179
+ number=1,
180
+ )
181
+ active_document: str = proto.Field(
182
+ proto.STRING,
183
+ number=2,
184
+ )
185
+
186
+
187
+ class TextInput(proto.Message):
188
+ r"""Defines text input.
189
+
190
+ Attributes:
191
+ input (str):
192
+ Text input.
193
+ context (google.cloud.discoveryengine_v1beta.types.ConversationContext):
194
+ Conversation context of the input.
195
+ """
196
+
197
+ input: str = proto.Field(
198
+ proto.STRING,
199
+ number=1,
200
+ )
201
+ context: "ConversationContext" = proto.Field(
202
+ proto.MESSAGE,
203
+ number=2,
204
+ message="ConversationContext",
205
+ )
206
+
207
+
208
+ class ConversationMessage(proto.Message):
209
+ r"""Defines a conversation message.
210
+
211
+ This message has `oneof`_ fields (mutually exclusive fields).
212
+ For each oneof, at most one member field can be set at the same time.
213
+ Setting any member of the oneof automatically clears all other
214
+ members.
215
+
216
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
217
+
218
+ Attributes:
219
+ user_input (google.cloud.discoveryengine_v1beta.types.TextInput):
220
+ User text input.
221
+
222
+ This field is a member of `oneof`_ ``message``.
223
+ reply (google.cloud.discoveryengine_v1beta.types.Reply):
224
+ Search reply.
225
+
226
+ This field is a member of `oneof`_ ``message``.
227
+ create_time (google.protobuf.timestamp_pb2.Timestamp):
228
+ Output only. Message creation timestamp.
229
+ """
230
+
231
+ user_input: "TextInput" = proto.Field(
232
+ proto.MESSAGE,
233
+ number=1,
234
+ oneof="message",
235
+ message="TextInput",
236
+ )
237
+ reply: "Reply" = proto.Field(
238
+ proto.MESSAGE,
239
+ number=2,
240
+ oneof="message",
241
+ message="Reply",
242
+ )
243
+ create_time: timestamp_pb2.Timestamp = proto.Field(
244
+ proto.MESSAGE,
245
+ number=3,
246
+ message=timestamp_pb2.Timestamp,
247
+ )
248
+
249
+
250
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/conversational_search_service.py ADDED
@@ -0,0 +1,1388 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import field_mask_pb2 # type: ignore
21
+ import proto # type: ignore
22
+
23
+ from google.cloud.discoveryengine_v1beta.types import conversation as gcd_conversation
24
+ from google.cloud.discoveryengine_v1beta.types import answer as gcd_answer
25
+ from google.cloud.discoveryengine_v1beta.types import search_service
26
+ from google.cloud.discoveryengine_v1beta.types import session as gcd_session
27
+
28
+ __protobuf__ = proto.module(
29
+ package="google.cloud.discoveryengine.v1beta",
30
+ manifest={
31
+ "ConverseConversationRequest",
32
+ "ConverseConversationResponse",
33
+ "CreateConversationRequest",
34
+ "UpdateConversationRequest",
35
+ "DeleteConversationRequest",
36
+ "GetConversationRequest",
37
+ "ListConversationsRequest",
38
+ "ListConversationsResponse",
39
+ "AnswerQueryRequest",
40
+ "AnswerQueryResponse",
41
+ "GetAnswerRequest",
42
+ "CreateSessionRequest",
43
+ "UpdateSessionRequest",
44
+ "DeleteSessionRequest",
45
+ "GetSessionRequest",
46
+ "ListSessionsRequest",
47
+ "ListSessionsResponse",
48
+ },
49
+ )
50
+
51
+
52
+ class ConverseConversationRequest(proto.Message):
53
+ r"""Request message for
54
+ [ConversationalSearchService.ConverseConversation][google.cloud.discoveryengine.v1beta.ConversationalSearchService.ConverseConversation]
55
+ method.
56
+
57
+ Attributes:
58
+ name (str):
59
+ Required. The resource name of the Conversation to get.
60
+ Format:
61
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}``.
62
+ Use
63
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/conversations/-``
64
+ to activate auto session mode, which automatically creates a
65
+ new conversation inside a ConverseConversation session.
66
+ query (google.cloud.discoveryengine_v1beta.types.TextInput):
67
+ Required. Current user input.
68
+ serving_config (str):
69
+ The resource name of the Serving Config to use. Format:
70
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/servingConfigs/{serving_config_id}``
71
+ If this is not set, the default serving config will be used.
72
+ conversation (google.cloud.discoveryengine_v1beta.types.Conversation):
73
+ The conversation to be used by auto session
74
+ only. The name field will be ignored as we
75
+ automatically assign new name for the
76
+ conversation in auto session.
77
+ safe_search (bool):
78
+ Whether to turn on safe search.
79
+ user_labels (MutableMapping[str, str]):
80
+ The user labels applied to a resource must meet the
81
+ following requirements:
82
+
83
+ - Each resource can have multiple labels, up to a maximum of
84
+ 64.
85
+ - Each label must be a key-value pair.
86
+ - Keys have a minimum length of 1 character and a maximum
87
+ length of 63 characters and cannot be empty. Values can be
88
+ empty and have a maximum length of 63 characters.
89
+ - Keys and values can contain only lowercase letters,
90
+ numeric characters, underscores, and dashes. All
91
+ characters must use UTF-8 encoding, and international
92
+ characters are allowed.
93
+ - The key portion of a label must be unique. However, you
94
+ can use the same key with multiple resources.
95
+ - Keys must start with a lowercase letter or international
96
+ character.
97
+
98
+ See `Google Cloud
99
+ Document <https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements>`__
100
+ for more details.
101
+ summary_spec (google.cloud.discoveryengine_v1beta.types.SearchRequest.ContentSearchSpec.SummarySpec):
102
+ A specification for configuring the summary
103
+ returned in the response.
104
+ filter (str):
105
+ The filter syntax consists of an expression language for
106
+ constructing a predicate from one or more fields of the
107
+ documents being filtered. Filter expression is
108
+ case-sensitive. This will be used to filter search results
109
+ which may affect the summary response.
110
+
111
+ If this field is unrecognizable, an ``INVALID_ARGUMENT`` is
112
+ returned.
113
+
114
+ Filtering in Vertex AI Search is done by mapping the LHS
115
+ filter key to a key property defined in the Vertex AI Search
116
+ backend -- this mapping is defined by the customer in their
117
+ schema. For example a media customer might have a field
118
+ 'name' in their schema. In this case the filter would look
119
+ like this: filter --> name:'ANY("king kong")'
120
+
121
+ For more information about filtering including syntax and
122
+ filter operators, see
123
+ `Filter <https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata>`__
124
+ boost_spec (google.cloud.discoveryengine_v1beta.types.SearchRequest.BoostSpec):
125
+ Boost specification to boost certain documents in search
126
+ results which may affect the converse response. For more
127
+ information on boosting, see
128
+ `Boosting <https://cloud.google.com/retail/docs/boosting#boost>`__
129
+ """
130
+
131
+ name: str = proto.Field(
132
+ proto.STRING,
133
+ number=1,
134
+ )
135
+ query: gcd_conversation.TextInput = proto.Field(
136
+ proto.MESSAGE,
137
+ number=2,
138
+ message=gcd_conversation.TextInput,
139
+ )
140
+ serving_config: str = proto.Field(
141
+ proto.STRING,
142
+ number=3,
143
+ )
144
+ conversation: gcd_conversation.Conversation = proto.Field(
145
+ proto.MESSAGE,
146
+ number=5,
147
+ message=gcd_conversation.Conversation,
148
+ )
149
+ safe_search: bool = proto.Field(
150
+ proto.BOOL,
151
+ number=6,
152
+ )
153
+ user_labels: MutableMapping[str, str] = proto.MapField(
154
+ proto.STRING,
155
+ proto.STRING,
156
+ number=7,
157
+ )
158
+ summary_spec: search_service.SearchRequest.ContentSearchSpec.SummarySpec = (
159
+ proto.Field(
160
+ proto.MESSAGE,
161
+ number=8,
162
+ message=search_service.SearchRequest.ContentSearchSpec.SummarySpec,
163
+ )
164
+ )
165
+ filter: str = proto.Field(
166
+ proto.STRING,
167
+ number=9,
168
+ )
169
+ boost_spec: search_service.SearchRequest.BoostSpec = proto.Field(
170
+ proto.MESSAGE,
171
+ number=10,
172
+ message=search_service.SearchRequest.BoostSpec,
173
+ )
174
+
175
+
176
+ class ConverseConversationResponse(proto.Message):
177
+ r"""Response message for
178
+ [ConversationalSearchService.ConverseConversation][google.cloud.discoveryengine.v1beta.ConversationalSearchService.ConverseConversation]
179
+ method.
180
+
181
+ Attributes:
182
+ reply (google.cloud.discoveryengine_v1beta.types.Reply):
183
+ Answer to the current query.
184
+ conversation (google.cloud.discoveryengine_v1beta.types.Conversation):
185
+ Updated conversation including the answer.
186
+ related_questions (MutableSequence[str]):
187
+ Suggested related questions.
188
+ search_results (MutableSequence[google.cloud.discoveryengine_v1beta.types.SearchResponse.SearchResult]):
189
+ Search Results.
190
+ """
191
+
192
+ reply: gcd_conversation.Reply = proto.Field(
193
+ proto.MESSAGE,
194
+ number=1,
195
+ message=gcd_conversation.Reply,
196
+ )
197
+ conversation: gcd_conversation.Conversation = proto.Field(
198
+ proto.MESSAGE,
199
+ number=2,
200
+ message=gcd_conversation.Conversation,
201
+ )
202
+ related_questions: MutableSequence[str] = proto.RepeatedField(
203
+ proto.STRING,
204
+ number=6,
205
+ )
206
+ search_results: MutableSequence[
207
+ search_service.SearchResponse.SearchResult
208
+ ] = proto.RepeatedField(
209
+ proto.MESSAGE,
210
+ number=3,
211
+ message=search_service.SearchResponse.SearchResult,
212
+ )
213
+
214
+
215
+ class CreateConversationRequest(proto.Message):
216
+ r"""Request for CreateConversation method.
217
+
218
+ Attributes:
219
+ parent (str):
220
+ Required. Full resource name of parent data store. Format:
221
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}``
222
+ conversation (google.cloud.discoveryengine_v1beta.types.Conversation):
223
+ Required. The conversation to create.
224
+ """
225
+
226
+ parent: str = proto.Field(
227
+ proto.STRING,
228
+ number=1,
229
+ )
230
+ conversation: gcd_conversation.Conversation = proto.Field(
231
+ proto.MESSAGE,
232
+ number=2,
233
+ message=gcd_conversation.Conversation,
234
+ )
235
+
236
+
237
+ class UpdateConversationRequest(proto.Message):
238
+ r"""Request for UpdateConversation method.
239
+
240
+ Attributes:
241
+ conversation (google.cloud.discoveryengine_v1beta.types.Conversation):
242
+ Required. The Conversation to update.
243
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
244
+ Indicates which fields in the provided
245
+ [Conversation][google.cloud.discoveryengine.v1beta.Conversation]
246
+ to update. The following are NOT supported:
247
+
248
+ - [Conversation.name][google.cloud.discoveryengine.v1beta.Conversation.name]
249
+
250
+ If not set or empty, all supported fields are updated.
251
+ """
252
+
253
+ conversation: gcd_conversation.Conversation = proto.Field(
254
+ proto.MESSAGE,
255
+ number=1,
256
+ message=gcd_conversation.Conversation,
257
+ )
258
+ update_mask: field_mask_pb2.FieldMask = proto.Field(
259
+ proto.MESSAGE,
260
+ number=2,
261
+ message=field_mask_pb2.FieldMask,
262
+ )
263
+
264
+
265
+ class DeleteConversationRequest(proto.Message):
266
+ r"""Request for DeleteConversation method.
267
+
268
+ Attributes:
269
+ name (str):
270
+ Required. The resource name of the Conversation to delete.
271
+ Format:
272
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}``
273
+ """
274
+
275
+ name: str = proto.Field(
276
+ proto.STRING,
277
+ number=1,
278
+ )
279
+
280
+
281
+ class GetConversationRequest(proto.Message):
282
+ r"""Request for GetConversation method.
283
+
284
+ Attributes:
285
+ name (str):
286
+ Required. The resource name of the Conversation to get.
287
+ Format:
288
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}``
289
+ """
290
+
291
+ name: str = proto.Field(
292
+ proto.STRING,
293
+ number=1,
294
+ )
295
+
296
+
297
+ class ListConversationsRequest(proto.Message):
298
+ r"""Request for ListConversations method.
299
+
300
+ Attributes:
301
+ parent (str):
302
+ Required. The data store resource name. Format:
303
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}``
304
+ page_size (int):
305
+ Maximum number of results to return. If
306
+ unspecified, defaults to 50. Max allowed value
307
+ is 1000.
308
+ page_token (str):
309
+ A page token, received from a previous ``ListConversations``
310
+ call. Provide this to retrieve the subsequent page.
311
+ filter (str):
312
+ A filter to apply on the list results. The supported
313
+ features are: user_pseudo_id, state.
314
+
315
+ Example: "user_pseudo_id = some_id".
316
+ order_by (str):
317
+ A comma-separated list of fields to order by, sorted in
318
+ ascending order. Use "desc" after a field name for
319
+ descending. Supported fields:
320
+
321
+ - ``update_time``
322
+ - ``create_time``
323
+ - ``conversation_name``
324
+
325
+ Example: "update_time desc" "create_time".
326
+ """
327
+
328
+ parent: str = proto.Field(
329
+ proto.STRING,
330
+ number=1,
331
+ )
332
+ page_size: int = proto.Field(
333
+ proto.INT32,
334
+ number=2,
335
+ )
336
+ page_token: str = proto.Field(
337
+ proto.STRING,
338
+ number=3,
339
+ )
340
+ filter: str = proto.Field(
341
+ proto.STRING,
342
+ number=4,
343
+ )
344
+ order_by: str = proto.Field(
345
+ proto.STRING,
346
+ number=5,
347
+ )
348
+
349
+
350
+ class ListConversationsResponse(proto.Message):
351
+ r"""Response for ListConversations method.
352
+
353
+ Attributes:
354
+ conversations (MutableSequence[google.cloud.discoveryengine_v1beta.types.Conversation]):
355
+ All the Conversations for a given data store.
356
+ next_page_token (str):
357
+ Pagination token, if not returned indicates
358
+ the last page.
359
+ """
360
+
361
+ @property
362
+ def raw_page(self):
363
+ return self
364
+
365
+ conversations: MutableSequence[gcd_conversation.Conversation] = proto.RepeatedField(
366
+ proto.MESSAGE,
367
+ number=1,
368
+ message=gcd_conversation.Conversation,
369
+ )
370
+ next_page_token: str = proto.Field(
371
+ proto.STRING,
372
+ number=2,
373
+ )
374
+
375
+
376
+ class AnswerQueryRequest(proto.Message):
377
+ r"""Request message for
378
+ [ConversationalSearchService.AnswerQuery][google.cloud.discoveryengine.v1beta.ConversationalSearchService.AnswerQuery]
379
+ method.
380
+
381
+ Attributes:
382
+ serving_config (str):
383
+ Required. The resource name of the Search serving config,
384
+ such as
385
+ ``projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config``,
386
+ or
387
+ ``projects/*/locations/global/collections/default_collection/dataStores/*/servingConfigs/default_serving_config``.
388
+ This field is used to identify the serving configuration
389
+ name, set of models used to make the search.
390
+ query (google.cloud.discoveryengine_v1beta.types.Query):
391
+ Required. Current user query.
392
+ session (str):
393
+ The session resource name. Not required.
394
+
395
+ When session field is not set, the API is in sessionless
396
+ mode.
397
+
398
+ We support auto session mode: users can use the wildcard
399
+ symbol ``-`` as session ID. A new ID will be automatically
400
+ generated and assigned.
401
+ safety_spec (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.SafetySpec):
402
+ Model specification.
403
+ related_questions_spec (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.RelatedQuestionsSpec):
404
+ Related questions specification.
405
+ grounding_spec (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.GroundingSpec):
406
+ Optional. Grounding specification.
407
+ answer_generation_spec (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.AnswerGenerationSpec):
408
+ Answer generation specification.
409
+ search_spec (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.SearchSpec):
410
+ Search specification.
411
+ query_understanding_spec (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.QueryUnderstandingSpec):
412
+ Query understanding specification.
413
+ asynchronous_mode (bool):
414
+ Deprecated: This field is deprecated. Streaming Answer API
415
+ will be supported.
416
+
417
+ Asynchronous mode control.
418
+
419
+ If enabled, the response will be returned with
420
+ answer/session resource name without final answer. The API
421
+ users need to do the polling to get the latest status of
422
+ answer/session by calling
423
+ [ConversationalSearchService.GetAnswer][google.cloud.discoveryengine.v1beta.ConversationalSearchService.GetAnswer]
424
+ or
425
+ [ConversationalSearchService.GetSession][google.cloud.discoveryengine.v1beta.ConversationalSearchService.GetSession]
426
+ method.
427
+ user_pseudo_id (str):
428
+ A unique identifier for tracking visitors. For example, this
429
+ could be implemented with an HTTP cookie, which should be
430
+ able to uniquely identify a visitor on a single device. This
431
+ unique identifier should not change if the visitor logs in
432
+ or out of the website.
433
+
434
+ This field should NOT have a fixed value such as
435
+ ``unknown_visitor``.
436
+
437
+ The field must be a UTF-8 encoded string with a length limit
438
+ of 128 characters. Otherwise, an ``INVALID_ARGUMENT`` error
439
+ is returned.
440
+ user_labels (MutableMapping[str, str]):
441
+ The user labels applied to a resource must meet the
442
+ following requirements:
443
+
444
+ - Each resource can have multiple labels, up to a maximum of
445
+ 64.
446
+ - Each label must be a key-value pair.
447
+ - Keys have a minimum length of 1 character and a maximum
448
+ length of 63 characters and cannot be empty. Values can be
449
+ empty and have a maximum length of 63 characters.
450
+ - Keys and values can contain only lowercase letters,
451
+ numeric characters, underscores, and dashes. All
452
+ characters must use UTF-8 encoding, and international
453
+ characters are allowed.
454
+ - The key portion of a label must be unique. However, you
455
+ can use the same key with multiple resources.
456
+ - Keys must start with a lowercase letter or international
457
+ character.
458
+
459
+ See `Google Cloud
460
+ Document <https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements>`__
461
+ for more details.
462
+ """
463
+
464
+ class SafetySpec(proto.Message):
465
+ r"""Safety specification.
466
+
467
+ Attributes:
468
+ enable (bool):
469
+ Enable the safety filtering on the answer
470
+ response. It is false by default.
471
+ """
472
+
473
+ enable: bool = proto.Field(
474
+ proto.BOOL,
475
+ number=1,
476
+ )
477
+
478
+ class RelatedQuestionsSpec(proto.Message):
479
+ r"""Related questions specification.
480
+
481
+ Attributes:
482
+ enable (bool):
483
+ Enable related questions feature if true.
484
+ """
485
+
486
+ enable: bool = proto.Field(
487
+ proto.BOOL,
488
+ number=1,
489
+ )
490
+
491
+ class GroundingSpec(proto.Message):
492
+ r"""Grounding specification.
493
+
494
+ Attributes:
495
+ include_grounding_supports (bool):
496
+ Optional. Specifies whether to include grounding_supports in
497
+ the answer. The default value is ``false``.
498
+
499
+ When this field is set to ``true``, returned answer will
500
+ have ``grounding_score`` and will contain GroundingSupports
501
+ for each claim.
502
+ filtering_level (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.GroundingSpec.FilteringLevel):
503
+ Optional. Specifies whether to enable the
504
+ filtering based on grounding score and at what
505
+ level.
506
+ """
507
+
508
+ class FilteringLevel(proto.Enum):
509
+ r"""Level to filter based on answer grounding.
510
+
511
+ Values:
512
+ FILTERING_LEVEL_UNSPECIFIED (0):
513
+ Default is no filter
514
+ FILTERING_LEVEL_LOW (1):
515
+ Filter answers based on a low threshold.
516
+ FILTERING_LEVEL_HIGH (2):
517
+ Filter answers based on a high threshold.
518
+ """
519
+ FILTERING_LEVEL_UNSPECIFIED = 0
520
+ FILTERING_LEVEL_LOW = 1
521
+ FILTERING_LEVEL_HIGH = 2
522
+
523
+ include_grounding_supports: bool = proto.Field(
524
+ proto.BOOL,
525
+ number=2,
526
+ )
527
+ filtering_level: "AnswerQueryRequest.GroundingSpec.FilteringLevel" = (
528
+ proto.Field(
529
+ proto.ENUM,
530
+ number=3,
531
+ enum="AnswerQueryRequest.GroundingSpec.FilteringLevel",
532
+ )
533
+ )
534
+
535
+ class AnswerGenerationSpec(proto.Message):
536
+ r"""Answer generation specification.
537
+
538
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
539
+
540
+ Attributes:
541
+ model_spec (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.AnswerGenerationSpec.ModelSpec):
542
+ Answer generation model specification.
543
+ prompt_spec (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.AnswerGenerationSpec.PromptSpec):
544
+ Answer generation prompt specification.
545
+ include_citations (bool):
546
+ Specifies whether to include citation metadata in the
547
+ answer. The default value is ``false``.
548
+ answer_language_code (str):
549
+ Language code for Answer. Use language tags defined by
550
+ `BCP47 <https://www.rfc-editor.org/rfc/bcp/bcp47.txt>`__.
551
+ Note: This is an experimental feature.
552
+ ignore_adversarial_query (bool):
553
+ Specifies whether to filter out adversarial queries. The
554
+ default value is ``false``.
555
+
556
+ Google employs search-query classification to detect
557
+ adversarial queries. No answer is returned if the search
558
+ query is classified as an adversarial query. For example, a
559
+ user might ask a question regarding negative comments about
560
+ the company or submit a query designed to generate unsafe,
561
+ policy-violating output. If this field is set to ``true``,
562
+ we skip generating answers for adversarial queries and
563
+ return fallback messages instead.
564
+ ignore_non_answer_seeking_query (bool):
565
+ Specifies whether to filter out queries that are not
566
+ answer-seeking. The default value is ``false``.
567
+
568
+ Google employs search-query classification to detect
569
+ answer-seeking queries. No answer is returned if the search
570
+ query is classified as a non-answer seeking query. If this
571
+ field is set to ``true``, we skip generating answers for
572
+ non-answer seeking queries and return fallback messages
573
+ instead.
574
+ ignore_low_relevant_content (bool):
575
+ Specifies whether to filter out queries that have low
576
+ relevance.
577
+
578
+ If this field is set to ``false``, all search results are
579
+ used regardless of relevance to generate answers. If set to
580
+ ``true`` or unset, the behavior will be determined
581
+ automatically by the service.
582
+
583
+ This field is a member of `oneof`_ ``_ignore_low_relevant_content``.
584
+ ignore_jail_breaking_query (bool):
585
+ Optional. Specifies whether to filter out jail-breaking
586
+ queries. The default value is ``false``.
587
+
588
+ Google employs search-query classification to detect
589
+ jail-breaking queries. No summary is returned if the search
590
+ query is classified as a jail-breaking query. A user might
591
+ add instructions to the query to change the tone, style,
592
+ language, content of the answer, or ask the model to act as
593
+ a different entity, e.g. "Reply in the tone of a competing
594
+ company's CEO". If this field is set to ``true``, we skip
595
+ generating summaries for jail-breaking queries and return
596
+ fallback messages instead.
597
+ """
598
+
599
+ class ModelSpec(proto.Message):
600
+ r"""Answer Generation Model specification.
601
+
602
+ Attributes:
603
+ model_version (str):
604
+ Model version. If not set, it will use the
605
+ default stable model. Allowed values are:
606
+ stable, preview.
607
+ """
608
+
609
+ model_version: str = proto.Field(
610
+ proto.STRING,
611
+ number=1,
612
+ )
613
+
614
+ class PromptSpec(proto.Message):
615
+ r"""Answer generation prompt specification.
616
+
617
+ Attributes:
618
+ preamble (str):
619
+ Customized preamble.
620
+ """
621
+
622
+ preamble: str = proto.Field(
623
+ proto.STRING,
624
+ number=1,
625
+ )
626
+
627
+ model_spec: "AnswerQueryRequest.AnswerGenerationSpec.ModelSpec" = proto.Field(
628
+ proto.MESSAGE,
629
+ number=1,
630
+ message="AnswerQueryRequest.AnswerGenerationSpec.ModelSpec",
631
+ )
632
+ prompt_spec: "AnswerQueryRequest.AnswerGenerationSpec.PromptSpec" = proto.Field(
633
+ proto.MESSAGE,
634
+ number=2,
635
+ message="AnswerQueryRequest.AnswerGenerationSpec.PromptSpec",
636
+ )
637
+ include_citations: bool = proto.Field(
638
+ proto.BOOL,
639
+ number=3,
640
+ )
641
+ answer_language_code: str = proto.Field(
642
+ proto.STRING,
643
+ number=4,
644
+ )
645
+ ignore_adversarial_query: bool = proto.Field(
646
+ proto.BOOL,
647
+ number=5,
648
+ )
649
+ ignore_non_answer_seeking_query: bool = proto.Field(
650
+ proto.BOOL,
651
+ number=6,
652
+ )
653
+ ignore_low_relevant_content: bool = proto.Field(
654
+ proto.BOOL,
655
+ number=7,
656
+ optional=True,
657
+ )
658
+ ignore_jail_breaking_query: bool = proto.Field(
659
+ proto.BOOL,
660
+ number=8,
661
+ )
662
+
663
+ class SearchSpec(proto.Message):
664
+ r"""Search specification.
665
+
666
+ This message has `oneof`_ fields (mutually exclusive fields).
667
+ For each oneof, at most one member field can be set at the same time.
668
+ Setting any member of the oneof automatically clears all other
669
+ members.
670
+
671
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
672
+
673
+ Attributes:
674
+ search_params (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.SearchSpec.SearchParams):
675
+ Search parameters.
676
+
677
+ This field is a member of `oneof`_ ``input``.
678
+ search_result_list (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.SearchSpec.SearchResultList):
679
+ Search result list.
680
+
681
+ This field is a member of `oneof`_ ``input``.
682
+ """
683
+
684
+ class SearchParams(proto.Message):
685
+ r"""Search parameters.
686
+
687
+ Attributes:
688
+ max_return_results (int):
689
+ Number of search results to return.
690
+ The default value is 10.
691
+ filter (str):
692
+ The filter syntax consists of an expression language for
693
+ constructing a predicate from one or more fields of the
694
+ documents being filtered. Filter expression is
695
+ case-sensitive. This will be used to filter search results
696
+ which may affect the Answer response.
697
+
698
+ If this field is unrecognizable, an ``INVALID_ARGUMENT`` is
699
+ returned.
700
+
701
+ Filtering in Vertex AI Search is done by mapping the LHS
702
+ filter key to a key property defined in the Vertex AI Search
703
+ backend -- this mapping is defined by the customer in their
704
+ schema. For example a media customers might have a field
705
+ 'name' in their schema. In this case the filter would look
706
+ like this: filter --> name:'ANY("king kong")'
707
+
708
+ For more information about filtering including syntax and
709
+ filter operators, see
710
+ `Filter <https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata>`__
711
+ boost_spec (google.cloud.discoveryengine_v1beta.types.SearchRequest.BoostSpec):
712
+ Boost specification to boost certain documents in search
713
+ results which may affect the answer query response. For more
714
+ information on boosting, see
715
+ `Boosting <https://cloud.google.com/retail/docs/boosting#boost>`__
716
+ order_by (str):
717
+ The order in which documents are returned. Documents can be
718
+ ordered by a field in an
719
+ [Document][google.cloud.discoveryengine.v1beta.Document]
720
+ object. Leave it unset if ordered by relevance. ``order_by``
721
+ expression is case-sensitive. For more information on
722
+ ordering, see
723
+ `Ordering <https://cloud.google.com/retail/docs/filter-and-order#order>`__
724
+
725
+ If this field is unrecognizable, an ``INVALID_ARGUMENT`` is
726
+ returned.
727
+ search_result_mode (google.cloud.discoveryengine_v1beta.types.SearchRequest.ContentSearchSpec.SearchResultMode):
728
+ Specifies the search result mode. If unspecified, the search
729
+ result mode defaults to ``DOCUMENTS``. See `parse and chunk
730
+ documents <https://cloud.google.com/generative-ai-app-builder/docs/parse-chunk-documents>`__
731
+ data_store_specs (MutableSequence[google.cloud.discoveryengine_v1beta.types.SearchRequest.DataStoreSpec]):
732
+ Specs defining dataStores to filter on in a
733
+ search call and configurations for those
734
+ dataStores. This is only considered for engines
735
+ with multiple dataStores use case. For single
736
+ dataStore within an engine, they should use the
737
+ specs at the top level.
738
+ natural_language_query_understanding_spec (google.cloud.discoveryengine_v1beta.types.SearchRequest.NaturalLanguageQueryUnderstandingSpec):
739
+ Optional. Specification to enable natural
740
+ language understanding capabilities for search
741
+ requests.
742
+ """
743
+
744
+ max_return_results: int = proto.Field(
745
+ proto.INT32,
746
+ number=1,
747
+ )
748
+ filter: str = proto.Field(
749
+ proto.STRING,
750
+ number=2,
751
+ )
752
+ boost_spec: search_service.SearchRequest.BoostSpec = proto.Field(
753
+ proto.MESSAGE,
754
+ number=3,
755
+ message=search_service.SearchRequest.BoostSpec,
756
+ )
757
+ order_by: str = proto.Field(
758
+ proto.STRING,
759
+ number=4,
760
+ )
761
+ search_result_mode: search_service.SearchRequest.ContentSearchSpec.SearchResultMode = proto.Field(
762
+ proto.ENUM,
763
+ number=5,
764
+ enum=search_service.SearchRequest.ContentSearchSpec.SearchResultMode,
765
+ )
766
+ data_store_specs: MutableSequence[
767
+ search_service.SearchRequest.DataStoreSpec
768
+ ] = proto.RepeatedField(
769
+ proto.MESSAGE,
770
+ number=7,
771
+ message=search_service.SearchRequest.DataStoreSpec,
772
+ )
773
+ natural_language_query_understanding_spec: search_service.SearchRequest.NaturalLanguageQueryUnderstandingSpec = proto.Field(
774
+ proto.MESSAGE,
775
+ number=8,
776
+ message=search_service.SearchRequest.NaturalLanguageQueryUnderstandingSpec,
777
+ )
778
+
779
+ class SearchResultList(proto.Message):
780
+ r"""Search result list.
781
+
782
+ Attributes:
783
+ search_results (MutableSequence[google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult]):
784
+ Search results.
785
+ """
786
+
787
+ class SearchResult(proto.Message):
788
+ r"""Search result.
789
+
790
+ This message has `oneof`_ fields (mutually exclusive fields).
791
+ For each oneof, at most one member field can be set at the same time.
792
+ Setting any member of the oneof automatically clears all other
793
+ members.
794
+
795
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
796
+
797
+ Attributes:
798
+ unstructured_document_info (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo):
799
+ Unstructured document information.
800
+
801
+ This field is a member of `oneof`_ ``content``.
802
+ chunk_info (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.ChunkInfo):
803
+ Chunk information.
804
+
805
+ This field is a member of `oneof`_ ``content``.
806
+ """
807
+
808
+ class UnstructuredDocumentInfo(proto.Message):
809
+ r"""Unstructured document information.
810
+
811
+ Attributes:
812
+ document (str):
813
+ Document resource name.
814
+ uri (str):
815
+ URI for the document.
816
+ title (str):
817
+ Title.
818
+ document_contexts (MutableSequence[google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.DocumentContext]):
819
+ List of document contexts. The content will
820
+ be used for Answer Generation. This is supposed
821
+ to be the main content of the document that can
822
+ be long and comprehensive.
823
+ extractive_segments (MutableSequence[google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.ExtractiveSegment]):
824
+ List of extractive segments.
825
+ extractive_answers (MutableSequence[google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.ExtractiveAnswer]):
826
+ Deprecated: This field is deprecated and will have no effect
827
+ on the Answer generation. Please use document_contexts and
828
+ extractive_segments fields. List of extractive answers.
829
+ """
830
+
831
+ class DocumentContext(proto.Message):
832
+ r"""Document context.
833
+
834
+ Attributes:
835
+ page_identifier (str):
836
+ Page identifier.
837
+ content (str):
838
+ Document content to be used for answer
839
+ generation.
840
+ """
841
+
842
+ page_identifier: str = proto.Field(
843
+ proto.STRING,
844
+ number=1,
845
+ )
846
+ content: str = proto.Field(
847
+ proto.STRING,
848
+ number=2,
849
+ )
850
+
851
+ class ExtractiveSegment(proto.Message):
852
+ r"""Extractive segment.
853
+ `Guide <https://cloud.google.com/generative-ai-app-builder/docs/snippets#extractive-segments>`__
854
+ Answer generation will only use it if document_contexts is empty.
855
+ This is supposed to be shorter snippets.
856
+
857
+ Attributes:
858
+ page_identifier (str):
859
+ Page identifier.
860
+ content (str):
861
+ Extractive segment content.
862
+ """
863
+
864
+ page_identifier: str = proto.Field(
865
+ proto.STRING,
866
+ number=1,
867
+ )
868
+ content: str = proto.Field(
869
+ proto.STRING,
870
+ number=2,
871
+ )
872
+
873
+ class ExtractiveAnswer(proto.Message):
874
+ r"""Extractive answer.
875
+ `Guide <https://cloud.google.com/generative-ai-app-builder/docs/snippets#get-answers>`__
876
+
877
+ Attributes:
878
+ page_identifier (str):
879
+ Page identifier.
880
+ content (str):
881
+ Extractive answer content.
882
+ """
883
+
884
+ page_identifier: str = proto.Field(
885
+ proto.STRING,
886
+ number=1,
887
+ )
888
+ content: str = proto.Field(
889
+ proto.STRING,
890
+ number=2,
891
+ )
892
+
893
+ document: str = proto.Field(
894
+ proto.STRING,
895
+ number=1,
896
+ )
897
+ uri: str = proto.Field(
898
+ proto.STRING,
899
+ number=2,
900
+ )
901
+ title: str = proto.Field(
902
+ proto.STRING,
903
+ number=3,
904
+ )
905
+ document_contexts: MutableSequence[
906
+ "AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.DocumentContext"
907
+ ] = proto.RepeatedField(
908
+ proto.MESSAGE,
909
+ number=4,
910
+ message="AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.DocumentContext",
911
+ )
912
+ extractive_segments: MutableSequence[
913
+ "AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.ExtractiveSegment"
914
+ ] = proto.RepeatedField(
915
+ proto.MESSAGE,
916
+ number=5,
917
+ message="AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.ExtractiveSegment",
918
+ )
919
+ extractive_answers: MutableSequence[
920
+ "AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.ExtractiveAnswer"
921
+ ] = proto.RepeatedField(
922
+ proto.MESSAGE,
923
+ number=6,
924
+ message="AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.ExtractiveAnswer",
925
+ )
926
+
927
+ class ChunkInfo(proto.Message):
928
+ r"""Chunk information.
929
+
930
+ Attributes:
931
+ chunk (str):
932
+ Chunk resource name.
933
+ content (str):
934
+ Chunk textual content.
935
+ document_metadata (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.ChunkInfo.DocumentMetadata):
936
+ Metadata of the document from the current
937
+ chunk.
938
+ """
939
+
940
+ class DocumentMetadata(proto.Message):
941
+ r"""Document metadata contains the information of the document of
942
+ the current chunk.
943
+
944
+ Attributes:
945
+ uri (str):
946
+ Uri of the document.
947
+ title (str):
948
+ Title of the document.
949
+ """
950
+
951
+ uri: str = proto.Field(
952
+ proto.STRING,
953
+ number=1,
954
+ )
955
+ title: str = proto.Field(
956
+ proto.STRING,
957
+ number=2,
958
+ )
959
+
960
+ chunk: str = proto.Field(
961
+ proto.STRING,
962
+ number=1,
963
+ )
964
+ content: str = proto.Field(
965
+ proto.STRING,
966
+ number=2,
967
+ )
968
+ document_metadata: "AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.ChunkInfo.DocumentMetadata" = proto.Field(
969
+ proto.MESSAGE,
970
+ number=4,
971
+ message="AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.ChunkInfo.DocumentMetadata",
972
+ )
973
+
974
+ unstructured_document_info: "AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo" = proto.Field(
975
+ proto.MESSAGE,
976
+ number=1,
977
+ oneof="content",
978
+ message="AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo",
979
+ )
980
+ chunk_info: "AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.ChunkInfo" = proto.Field(
981
+ proto.MESSAGE,
982
+ number=2,
983
+ oneof="content",
984
+ message="AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.ChunkInfo",
985
+ )
986
+
987
+ search_results: MutableSequence[
988
+ "AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult"
989
+ ] = proto.RepeatedField(
990
+ proto.MESSAGE,
991
+ number=1,
992
+ message="AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult",
993
+ )
994
+
995
+ search_params: "AnswerQueryRequest.SearchSpec.SearchParams" = proto.Field(
996
+ proto.MESSAGE,
997
+ number=1,
998
+ oneof="input",
999
+ message="AnswerQueryRequest.SearchSpec.SearchParams",
1000
+ )
1001
+ search_result_list: "AnswerQueryRequest.SearchSpec.SearchResultList" = (
1002
+ proto.Field(
1003
+ proto.MESSAGE,
1004
+ number=2,
1005
+ oneof="input",
1006
+ message="AnswerQueryRequest.SearchSpec.SearchResultList",
1007
+ )
1008
+ )
1009
+
1010
+ class QueryUnderstandingSpec(proto.Message):
1011
+ r"""Query understanding specification.
1012
+
1013
+ Attributes:
1014
+ query_classification_spec (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.QueryUnderstandingSpec.QueryClassificationSpec):
1015
+ Query classification specification.
1016
+ query_rephraser_spec (google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.QueryUnderstandingSpec.QueryRephraserSpec):
1017
+ Query rephraser specification.
1018
+ """
1019
+
1020
+ class QueryClassificationSpec(proto.Message):
1021
+ r"""Query classification specification.
1022
+
1023
+ Attributes:
1024
+ types (MutableSequence[google.cloud.discoveryengine_v1beta.types.AnswerQueryRequest.QueryUnderstandingSpec.QueryClassificationSpec.Type]):
1025
+ Enabled query classification types.
1026
+ """
1027
+
1028
+ class Type(proto.Enum):
1029
+ r"""Query classification types.
1030
+
1031
+ Values:
1032
+ TYPE_UNSPECIFIED (0):
1033
+ Unspecified query classification type.
1034
+ ADVERSARIAL_QUERY (1):
1035
+ Adversarial query classification type.
1036
+ NON_ANSWER_SEEKING_QUERY (2):
1037
+ Non-answer-seeking query classification type,
1038
+ for chit chat.
1039
+ JAIL_BREAKING_QUERY (3):
1040
+ Jail-breaking query classification type.
1041
+ NON_ANSWER_SEEKING_QUERY_V2 (4):
1042
+ Non-answer-seeking query classification type,
1043
+ for no clear intent.
1044
+ """
1045
+ TYPE_UNSPECIFIED = 0
1046
+ ADVERSARIAL_QUERY = 1
1047
+ NON_ANSWER_SEEKING_QUERY = 2
1048
+ JAIL_BREAKING_QUERY = 3
1049
+ NON_ANSWER_SEEKING_QUERY_V2 = 4
1050
+
1051
+ types: MutableSequence[
1052
+ "AnswerQueryRequest.QueryUnderstandingSpec.QueryClassificationSpec.Type"
1053
+ ] = proto.RepeatedField(
1054
+ proto.ENUM,
1055
+ number=1,
1056
+ enum="AnswerQueryRequest.QueryUnderstandingSpec.QueryClassificationSpec.Type",
1057
+ )
1058
+
1059
+ class QueryRephraserSpec(proto.Message):
1060
+ r"""Query rephraser specification.
1061
+
1062
+ Attributes:
1063
+ disable (bool):
1064
+ Disable query rephraser.
1065
+ max_rephrase_steps (int):
1066
+ Max rephrase steps.
1067
+ The max number is 5 steps.
1068
+ If not set or set to < 1, it will be set to 1 by
1069
+ default.
1070
+ """
1071
+
1072
+ disable: bool = proto.Field(
1073
+ proto.BOOL,
1074
+ number=1,
1075
+ )
1076
+ max_rephrase_steps: int = proto.Field(
1077
+ proto.INT32,
1078
+ number=2,
1079
+ )
1080
+
1081
+ query_classification_spec: "AnswerQueryRequest.QueryUnderstandingSpec.QueryClassificationSpec" = proto.Field(
1082
+ proto.MESSAGE,
1083
+ number=1,
1084
+ message="AnswerQueryRequest.QueryUnderstandingSpec.QueryClassificationSpec",
1085
+ )
1086
+ query_rephraser_spec: "AnswerQueryRequest.QueryUnderstandingSpec.QueryRephraserSpec" = proto.Field(
1087
+ proto.MESSAGE,
1088
+ number=2,
1089
+ message="AnswerQueryRequest.QueryUnderstandingSpec.QueryRephraserSpec",
1090
+ )
1091
+
1092
+ serving_config: str = proto.Field(
1093
+ proto.STRING,
1094
+ number=1,
1095
+ )
1096
+ query: gcd_session.Query = proto.Field(
1097
+ proto.MESSAGE,
1098
+ number=2,
1099
+ message=gcd_session.Query,
1100
+ )
1101
+ session: str = proto.Field(
1102
+ proto.STRING,
1103
+ number=3,
1104
+ )
1105
+ safety_spec: SafetySpec = proto.Field(
1106
+ proto.MESSAGE,
1107
+ number=4,
1108
+ message=SafetySpec,
1109
+ )
1110
+ related_questions_spec: RelatedQuestionsSpec = proto.Field(
1111
+ proto.MESSAGE,
1112
+ number=5,
1113
+ message=RelatedQuestionsSpec,
1114
+ )
1115
+ grounding_spec: GroundingSpec = proto.Field(
1116
+ proto.MESSAGE,
1117
+ number=6,
1118
+ message=GroundingSpec,
1119
+ )
1120
+ answer_generation_spec: AnswerGenerationSpec = proto.Field(
1121
+ proto.MESSAGE,
1122
+ number=7,
1123
+ message=AnswerGenerationSpec,
1124
+ )
1125
+ search_spec: SearchSpec = proto.Field(
1126
+ proto.MESSAGE,
1127
+ number=8,
1128
+ message=SearchSpec,
1129
+ )
1130
+ query_understanding_spec: QueryUnderstandingSpec = proto.Field(
1131
+ proto.MESSAGE,
1132
+ number=9,
1133
+ message=QueryUnderstandingSpec,
1134
+ )
1135
+ asynchronous_mode: bool = proto.Field(
1136
+ proto.BOOL,
1137
+ number=10,
1138
+ )
1139
+ user_pseudo_id: str = proto.Field(
1140
+ proto.STRING,
1141
+ number=12,
1142
+ )
1143
+ user_labels: MutableMapping[str, str] = proto.MapField(
1144
+ proto.STRING,
1145
+ proto.STRING,
1146
+ number=13,
1147
+ )
1148
+
1149
+
1150
+ class AnswerQueryResponse(proto.Message):
1151
+ r"""Response message for
1152
+ [ConversationalSearchService.AnswerQuery][google.cloud.discoveryengine.v1beta.ConversationalSearchService.AnswerQuery]
1153
+ method.
1154
+
1155
+ Attributes:
1156
+ answer (google.cloud.discoveryengine_v1beta.types.Answer):
1157
+ Answer resource object. If
1158
+ [AnswerQueryRequest.QueryUnderstandingSpec.QueryRephraserSpec.max_rephrase_steps][google.cloud.discoveryengine.v1beta.AnswerQueryRequest.QueryUnderstandingSpec.QueryRephraserSpec.max_rephrase_steps]
1159
+ is greater than 1, use
1160
+ [Answer.name][google.cloud.discoveryengine.v1beta.Answer.name]
1161
+ to fetch answer information using
1162
+ [ConversationalSearchService.GetAnswer][google.cloud.discoveryengine.v1beta.ConversationalSearchService.GetAnswer]
1163
+ API.
1164
+ session (google.cloud.discoveryengine_v1beta.types.Session):
1165
+ Session resource object. It will be only available when
1166
+ session field is set and valid in the
1167
+ [AnswerQueryRequest][google.cloud.discoveryengine.v1beta.AnswerQueryRequest]
1168
+ request.
1169
+ answer_query_token (str):
1170
+ A global unique ID used for logging.
1171
+ """
1172
+
1173
+ answer: gcd_answer.Answer = proto.Field(
1174
+ proto.MESSAGE,
1175
+ number=1,
1176
+ message=gcd_answer.Answer,
1177
+ )
1178
+ session: gcd_session.Session = proto.Field(
1179
+ proto.MESSAGE,
1180
+ number=2,
1181
+ message=gcd_session.Session,
1182
+ )
1183
+ answer_query_token: str = proto.Field(
1184
+ proto.STRING,
1185
+ number=3,
1186
+ )
1187
+
1188
+
1189
+ class GetAnswerRequest(proto.Message):
1190
+ r"""Request for GetAnswer method.
1191
+
1192
+ Attributes:
1193
+ name (str):
1194
+ Required. The resource name of the Answer to get. Format:
1195
+ ``projects/{project}/locations/{location}/collections/{collection}/engines/{engine_id}/sessions/{session_id}/answers/{answer_id}``
1196
+ """
1197
+
1198
+ name: str = proto.Field(
1199
+ proto.STRING,
1200
+ number=1,
1201
+ )
1202
+
1203
+
1204
+ class CreateSessionRequest(proto.Message):
1205
+ r"""Request for CreateSession method.
1206
+
1207
+ Attributes:
1208
+ parent (str):
1209
+ Required. Full resource name of parent data store. Format:
1210
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}``
1211
+ session (google.cloud.discoveryengine_v1beta.types.Session):
1212
+ Required. The session to create.
1213
+ """
1214
+
1215
+ parent: str = proto.Field(
1216
+ proto.STRING,
1217
+ number=1,
1218
+ )
1219
+ session: gcd_session.Session = proto.Field(
1220
+ proto.MESSAGE,
1221
+ number=2,
1222
+ message=gcd_session.Session,
1223
+ )
1224
+
1225
+
1226
+ class UpdateSessionRequest(proto.Message):
1227
+ r"""Request for UpdateSession method.
1228
+
1229
+ Attributes:
1230
+ session (google.cloud.discoveryengine_v1beta.types.Session):
1231
+ Required. The Session to update.
1232
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
1233
+ Indicates which fields in the provided
1234
+ [Session][google.cloud.discoveryengine.v1beta.Session] to
1235
+ update. The following are NOT supported:
1236
+
1237
+ - [Session.name][google.cloud.discoveryengine.v1beta.Session.name]
1238
+
1239
+ If not set or empty, all supported fields are updated.
1240
+ """
1241
+
1242
+ session: gcd_session.Session = proto.Field(
1243
+ proto.MESSAGE,
1244
+ number=1,
1245
+ message=gcd_session.Session,
1246
+ )
1247
+ update_mask: field_mask_pb2.FieldMask = proto.Field(
1248
+ proto.MESSAGE,
1249
+ number=2,
1250
+ message=field_mask_pb2.FieldMask,
1251
+ )
1252
+
1253
+
1254
+ class DeleteSessionRequest(proto.Message):
1255
+ r"""Request for DeleteSession method.
1256
+
1257
+ Attributes:
1258
+ name (str):
1259
+ Required. The resource name of the Session to delete.
1260
+ Format:
1261
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}``
1262
+ """
1263
+
1264
+ name: str = proto.Field(
1265
+ proto.STRING,
1266
+ number=1,
1267
+ )
1268
+
1269
+
1270
+ class GetSessionRequest(proto.Message):
1271
+ r"""Request for GetSession method.
1272
+
1273
+ Attributes:
1274
+ name (str):
1275
+ Required. The resource name of the Session to get. Format:
1276
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}``
1277
+ include_answer_details (bool):
1278
+ Optional. If set to true, the full session
1279
+ including all answer details will be returned.
1280
+ """
1281
+
1282
+ name: str = proto.Field(
1283
+ proto.STRING,
1284
+ number=1,
1285
+ )
1286
+ include_answer_details: bool = proto.Field(
1287
+ proto.BOOL,
1288
+ number=2,
1289
+ )
1290
+
1291
+
1292
+ class ListSessionsRequest(proto.Message):
1293
+ r"""Request for ListSessions method.
1294
+
1295
+ Attributes:
1296
+ parent (str):
1297
+ Required. The data store resource name. Format:
1298
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}``
1299
+ page_size (int):
1300
+ Maximum number of results to return. If
1301
+ unspecified, defaults to 50. Max allowed value
1302
+ is 1000.
1303
+ page_token (str):
1304
+ A page token, received from a previous ``ListSessions``
1305
+ call. Provide this to retrieve the subsequent page.
1306
+ filter (str):
1307
+ A comma-separated list of fields to filter by, in EBNF
1308
+ grammar. The supported fields are:
1309
+
1310
+ - ``user_pseudo_id``
1311
+ - ``state``
1312
+ - ``display_name``
1313
+ - ``starred``
1314
+ - ``is_pinned``
1315
+ - ``labels``
1316
+ - ``create_time``
1317
+ - ``update_time``
1318
+
1319
+ Examples: "user_pseudo_id = some_id" "display_name =
1320
+ "some_name"" "starred = true" "is_pinned=true AND (NOT
1321
+ labels:hidden)" "create_time > "1970-01-01T12:00:00Z"".
1322
+ order_by (str):
1323
+ A comma-separated list of fields to order by, sorted in
1324
+ ascending order. Use "desc" after a field name for
1325
+ descending. Supported fields:
1326
+
1327
+ - ``update_time``
1328
+ - ``create_time``
1329
+ - ``session_name``
1330
+ - ``is_pinned``
1331
+
1332
+ Example:
1333
+
1334
+ - "update_time desc"
1335
+ - "create_time"
1336
+ - "is_pinned desc,update_time desc": list sessions by
1337
+ is_pinned first, then by update_time.
1338
+ """
1339
+
1340
+ parent: str = proto.Field(
1341
+ proto.STRING,
1342
+ number=1,
1343
+ )
1344
+ page_size: int = proto.Field(
1345
+ proto.INT32,
1346
+ number=2,
1347
+ )
1348
+ page_token: str = proto.Field(
1349
+ proto.STRING,
1350
+ number=3,
1351
+ )
1352
+ filter: str = proto.Field(
1353
+ proto.STRING,
1354
+ number=4,
1355
+ )
1356
+ order_by: str = proto.Field(
1357
+ proto.STRING,
1358
+ number=5,
1359
+ )
1360
+
1361
+
1362
+ class ListSessionsResponse(proto.Message):
1363
+ r"""Response for ListSessions method.
1364
+
1365
+ Attributes:
1366
+ sessions (MutableSequence[google.cloud.discoveryengine_v1beta.types.Session]):
1367
+ All the Sessions for a given data store.
1368
+ next_page_token (str):
1369
+ Pagination token, if not returned indicates
1370
+ the last page.
1371
+ """
1372
+
1373
+ @property
1374
+ def raw_page(self):
1375
+ return self
1376
+
1377
+ sessions: MutableSequence[gcd_session.Session] = proto.RepeatedField(
1378
+ proto.MESSAGE,
1379
+ number=1,
1380
+ message=gcd_session.Session,
1381
+ )
1382
+ next_page_token: str = proto.Field(
1383
+ proto.STRING,
1384
+ number=2,
1385
+ )
1386
+
1387
+
1388
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/custom_tuning_model.py ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import timestamp_pb2 # type: ignore
21
+ import proto # type: ignore
22
+
23
+ __protobuf__ = proto.module(
24
+ package="google.cloud.discoveryengine.v1beta",
25
+ manifest={
26
+ "CustomTuningModel",
27
+ },
28
+ )
29
+
30
+
31
+ class CustomTuningModel(proto.Message):
32
+ r"""Metadata that describes a custom tuned model.
33
+
34
+ Attributes:
35
+ name (str):
36
+ Required. The fully qualified resource name of the model.
37
+
38
+ Format:
39
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/customTuningModels/{custom_tuning_model}``.
40
+
41
+ Model must be an alpha-numerical string with limit of 40
42
+ characters.
43
+ display_name (str):
44
+ The display name of the model.
45
+ model_version (int):
46
+ The version of the model.
47
+ model_state (google.cloud.discoveryengine_v1beta.types.CustomTuningModel.ModelState):
48
+ The state that the model is in (e.g.\ ``TRAINING`` or
49
+ ``TRAINING_FAILED``).
50
+ create_time (google.protobuf.timestamp_pb2.Timestamp):
51
+ Deprecated: Timestamp the Model was created
52
+ at.
53
+ training_start_time (google.protobuf.timestamp_pb2.Timestamp):
54
+ Timestamp the model training was initiated.
55
+ metrics (MutableMapping[str, float]):
56
+ The metrics of the trained model.
57
+ error_message (str):
58
+ Currently this is only populated if the model state is
59
+ ``INPUT_VALIDATION_FAILED``.
60
+ """
61
+
62
+ class ModelState(proto.Enum):
63
+ r"""The state of the model.
64
+
65
+ Values:
66
+ MODEL_STATE_UNSPECIFIED (0):
67
+ Default value.
68
+ TRAINING_PAUSED (1):
69
+ The model is in a paused training state.
70
+ TRAINING (2):
71
+ The model is currently training.
72
+ TRAINING_COMPLETE (3):
73
+ The model has successfully completed
74
+ training.
75
+ READY_FOR_SERVING (4):
76
+ The model is ready for serving.
77
+ TRAINING_FAILED (5):
78
+ The model training failed.
79
+ NO_IMPROVEMENT (6):
80
+ The model training finished successfully but
81
+ metrics did not improve.
82
+ INPUT_VALIDATION_FAILED (7):
83
+ Input data validation failed. Model training
84
+ didn't start.
85
+ """
86
+ MODEL_STATE_UNSPECIFIED = 0
87
+ TRAINING_PAUSED = 1
88
+ TRAINING = 2
89
+ TRAINING_COMPLETE = 3
90
+ READY_FOR_SERVING = 4
91
+ TRAINING_FAILED = 5
92
+ NO_IMPROVEMENT = 6
93
+ INPUT_VALIDATION_FAILED = 7
94
+
95
+ name: str = proto.Field(
96
+ proto.STRING,
97
+ number=1,
98
+ )
99
+ display_name: str = proto.Field(
100
+ proto.STRING,
101
+ number=2,
102
+ )
103
+ model_version: int = proto.Field(
104
+ proto.INT64,
105
+ number=3,
106
+ )
107
+ model_state: ModelState = proto.Field(
108
+ proto.ENUM,
109
+ number=4,
110
+ enum=ModelState,
111
+ )
112
+ create_time: timestamp_pb2.Timestamp = proto.Field(
113
+ proto.MESSAGE,
114
+ number=5,
115
+ message=timestamp_pb2.Timestamp,
116
+ )
117
+ training_start_time: timestamp_pb2.Timestamp = proto.Field(
118
+ proto.MESSAGE,
119
+ number=6,
120
+ message=timestamp_pb2.Timestamp,
121
+ )
122
+ metrics: MutableMapping[str, float] = proto.MapField(
123
+ proto.STRING,
124
+ proto.DOUBLE,
125
+ number=7,
126
+ )
127
+ error_message: str = proto.Field(
128
+ proto.STRING,
129
+ number=8,
130
+ )
131
+
132
+
133
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/data_store.py ADDED
@@ -0,0 +1,427 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import timestamp_pb2 # type: ignore
21
+ import proto # type: ignore
22
+
23
+ from google.cloud.discoveryengine_v1beta.types import (
24
+ document_processing_config as gcd_document_processing_config,
25
+ )
26
+ from google.cloud.discoveryengine_v1beta.types import common
27
+ from google.cloud.discoveryengine_v1beta.types import schema
28
+
29
+ __protobuf__ = proto.module(
30
+ package="google.cloud.discoveryengine.v1beta",
31
+ manifest={
32
+ "DataStore",
33
+ "LanguageInfo",
34
+ "NaturalLanguageQueryUnderstandingConfig",
35
+ "WorkspaceConfig",
36
+ },
37
+ )
38
+
39
+
40
+ class DataStore(proto.Message):
41
+ r"""DataStore captures global settings and configs at the
42
+ DataStore level.
43
+
44
+ Attributes:
45
+ name (str):
46
+ Immutable. The full resource name of the data store. Format:
47
+ ``projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}``.
48
+
49
+ This field must be a UTF-8 encoded string with a length
50
+ limit of 1024 characters.
51
+ display_name (str):
52
+ Required. The data store display name.
53
+
54
+ This field must be a UTF-8 encoded string with a length
55
+ limit of 128 characters. Otherwise, an INVALID_ARGUMENT
56
+ error is returned.
57
+ industry_vertical (google.cloud.discoveryengine_v1beta.types.IndustryVertical):
58
+ Immutable. The industry vertical that the
59
+ data store registers.
60
+ solution_types (MutableSequence[google.cloud.discoveryengine_v1beta.types.SolutionType]):
61
+ The solutions that the data store enrolls. Available
62
+ solutions for each
63
+ [industry_vertical][google.cloud.discoveryengine.v1beta.DataStore.industry_vertical]:
64
+
65
+ - ``MEDIA``: ``SOLUTION_TYPE_RECOMMENDATION`` and
66
+ ``SOLUTION_TYPE_SEARCH``.
67
+ - ``SITE_SEARCH``: ``SOLUTION_TYPE_SEARCH`` is automatically
68
+ enrolled. Other solutions cannot be enrolled.
69
+ default_schema_id (str):
70
+ Output only. The id of the default
71
+ [Schema][google.cloud.discoveryengine.v1beta.Schema]
72
+ asscociated to this data store.
73
+ content_config (google.cloud.discoveryengine_v1beta.types.DataStore.ContentConfig):
74
+ Immutable. The content config of the data store. If this
75
+ field is unset, the server behavior defaults to
76
+ [ContentConfig.NO_CONTENT][google.cloud.discoveryengine.v1beta.DataStore.ContentConfig.NO_CONTENT].
77
+ create_time (google.protobuf.timestamp_pb2.Timestamp):
78
+ Output only. Timestamp the
79
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]
80
+ was created at.
81
+ language_info (google.cloud.discoveryengine_v1beta.types.LanguageInfo):
82
+ Language info for DataStore.
83
+ natural_language_query_understanding_config (google.cloud.discoveryengine_v1beta.types.NaturalLanguageQueryUnderstandingConfig):
84
+ Optional. Configuration for Natural Language
85
+ Query Understanding.
86
+ billing_estimation (google.cloud.discoveryengine_v1beta.types.DataStore.BillingEstimation):
87
+ Output only. Data size estimation for
88
+ billing.
89
+ workspace_config (google.cloud.discoveryengine_v1beta.types.WorkspaceConfig):
90
+ Config to store data store type configuration for workspace
91
+ data. This must be set when
92
+ [DataStore.content_config][google.cloud.discoveryengine.v1beta.DataStore.content_config]
93
+ is set as
94
+ [DataStore.ContentConfig.GOOGLE_WORKSPACE][google.cloud.discoveryengine.v1beta.DataStore.ContentConfig.GOOGLE_WORKSPACE].
95
+ document_processing_config (google.cloud.discoveryengine_v1beta.types.DocumentProcessingConfig):
96
+ Configuration for Document understanding and
97
+ enrichment.
98
+ starting_schema (google.cloud.discoveryengine_v1beta.types.Schema):
99
+ The start schema to use for this
100
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]
101
+ when provisioning it. If unset, a default vertical
102
+ specialized schema will be used.
103
+
104
+ This field is only used by [CreateDataStore][] API, and will
105
+ be ignored if used in other APIs. This field will be omitted
106
+ from all API responses including [CreateDataStore][] API. To
107
+ retrieve a schema of a
108
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore],
109
+ use
110
+ [SchemaService.GetSchema][google.cloud.discoveryengine.v1beta.SchemaService.GetSchema]
111
+ API instead.
112
+
113
+ The provided schema will be validated against certain rules
114
+ on schema. Learn more from `this
115
+ doc <https://cloud.google.com/generative-ai-app-builder/docs/provide-schema>`__.
116
+ serving_config_data_store (google.cloud.discoveryengine_v1beta.types.DataStore.ServingConfigDataStore):
117
+ Optional. Stores serving config at DataStore
118
+ level.
119
+ """
120
+
121
+ class ContentConfig(proto.Enum):
122
+ r"""Content config of the data store.
123
+
124
+ Values:
125
+ CONTENT_CONFIG_UNSPECIFIED (0):
126
+ Default value.
127
+ NO_CONTENT (1):
128
+ Only contains documents without any
129
+ [Document.content][google.cloud.discoveryengine.v1beta.Document.content].
130
+ CONTENT_REQUIRED (2):
131
+ Only contains documents with
132
+ [Document.content][google.cloud.discoveryengine.v1beta.Document.content].
133
+ PUBLIC_WEBSITE (3):
134
+ The data store is used for public website
135
+ search.
136
+ GOOGLE_WORKSPACE (4):
137
+ The data store is used for workspace search. Details of
138
+ workspace data store are specified in the
139
+ [WorkspaceConfig][google.cloud.discoveryengine.v1beta.WorkspaceConfig].
140
+ """
141
+ CONTENT_CONFIG_UNSPECIFIED = 0
142
+ NO_CONTENT = 1
143
+ CONTENT_REQUIRED = 2
144
+ PUBLIC_WEBSITE = 3
145
+ GOOGLE_WORKSPACE = 4
146
+
147
+ class BillingEstimation(proto.Message):
148
+ r"""Estimation of data size per data store.
149
+
150
+ Attributes:
151
+ structured_data_size (int):
152
+ Data size for structured data in terms of
153
+ bytes.
154
+ unstructured_data_size (int):
155
+ Data size for unstructured data in terms of
156
+ bytes.
157
+ website_data_size (int):
158
+ Data size for websites in terms of bytes.
159
+ structured_data_update_time (google.protobuf.timestamp_pb2.Timestamp):
160
+ Last updated timestamp for structured data.
161
+ unstructured_data_update_time (google.protobuf.timestamp_pb2.Timestamp):
162
+ Last updated timestamp for unstructured data.
163
+ website_data_update_time (google.protobuf.timestamp_pb2.Timestamp):
164
+ Last updated timestamp for websites.
165
+ """
166
+
167
+ structured_data_size: int = proto.Field(
168
+ proto.INT64,
169
+ number=1,
170
+ )
171
+ unstructured_data_size: int = proto.Field(
172
+ proto.INT64,
173
+ number=2,
174
+ )
175
+ website_data_size: int = proto.Field(
176
+ proto.INT64,
177
+ number=3,
178
+ )
179
+ structured_data_update_time: timestamp_pb2.Timestamp = proto.Field(
180
+ proto.MESSAGE,
181
+ number=4,
182
+ message=timestamp_pb2.Timestamp,
183
+ )
184
+ unstructured_data_update_time: timestamp_pb2.Timestamp = proto.Field(
185
+ proto.MESSAGE,
186
+ number=5,
187
+ message=timestamp_pb2.Timestamp,
188
+ )
189
+ website_data_update_time: timestamp_pb2.Timestamp = proto.Field(
190
+ proto.MESSAGE,
191
+ number=6,
192
+ message=timestamp_pb2.Timestamp,
193
+ )
194
+
195
+ class ServingConfigDataStore(proto.Message):
196
+ r"""Stores information regarding the serving configurations at
197
+ DataStore level.
198
+
199
+ Attributes:
200
+ disabled_for_serving (bool):
201
+ If set true, the DataStore will not be
202
+ available for serving search requests.
203
+ """
204
+
205
+ disabled_for_serving: bool = proto.Field(
206
+ proto.BOOL,
207
+ number=1,
208
+ )
209
+
210
+ name: str = proto.Field(
211
+ proto.STRING,
212
+ number=1,
213
+ )
214
+ display_name: str = proto.Field(
215
+ proto.STRING,
216
+ number=2,
217
+ )
218
+ industry_vertical: common.IndustryVertical = proto.Field(
219
+ proto.ENUM,
220
+ number=3,
221
+ enum=common.IndustryVertical,
222
+ )
223
+ solution_types: MutableSequence[common.SolutionType] = proto.RepeatedField(
224
+ proto.ENUM,
225
+ number=5,
226
+ enum=common.SolutionType,
227
+ )
228
+ default_schema_id: str = proto.Field(
229
+ proto.STRING,
230
+ number=7,
231
+ )
232
+ content_config: ContentConfig = proto.Field(
233
+ proto.ENUM,
234
+ number=6,
235
+ enum=ContentConfig,
236
+ )
237
+ create_time: timestamp_pb2.Timestamp = proto.Field(
238
+ proto.MESSAGE,
239
+ number=4,
240
+ message=timestamp_pb2.Timestamp,
241
+ )
242
+ language_info: "LanguageInfo" = proto.Field(
243
+ proto.MESSAGE,
244
+ number=14,
245
+ message="LanguageInfo",
246
+ )
247
+ natural_language_query_understanding_config: "NaturalLanguageQueryUnderstandingConfig" = proto.Field(
248
+ proto.MESSAGE,
249
+ number=34,
250
+ message="NaturalLanguageQueryUnderstandingConfig",
251
+ )
252
+ billing_estimation: BillingEstimation = proto.Field(
253
+ proto.MESSAGE,
254
+ number=23,
255
+ message=BillingEstimation,
256
+ )
257
+ workspace_config: "WorkspaceConfig" = proto.Field(
258
+ proto.MESSAGE,
259
+ number=25,
260
+ message="WorkspaceConfig",
261
+ )
262
+ document_processing_config: gcd_document_processing_config.DocumentProcessingConfig = proto.Field(
263
+ proto.MESSAGE,
264
+ number=27,
265
+ message=gcd_document_processing_config.DocumentProcessingConfig,
266
+ )
267
+ starting_schema: schema.Schema = proto.Field(
268
+ proto.MESSAGE,
269
+ number=28,
270
+ message=schema.Schema,
271
+ )
272
+ serving_config_data_store: ServingConfigDataStore = proto.Field(
273
+ proto.MESSAGE,
274
+ number=30,
275
+ message=ServingConfigDataStore,
276
+ )
277
+
278
+
279
+ class LanguageInfo(proto.Message):
280
+ r"""Language info for DataStore.
281
+
282
+ Attributes:
283
+ language_code (str):
284
+ The language code for the DataStore.
285
+ normalized_language_code (str):
286
+ Output only. This is the normalized form of language_code.
287
+ E.g.: language_code of ``en-GB``, ``en_GB``, ``en-UK`` or
288
+ ``en-gb`` will have normalized_language_code of ``en-GB``.
289
+ language (str):
290
+ Output only. Language part of normalized_language_code.
291
+ E.g.: ``en-US`` -> ``en``, ``zh-Hans-HK`` -> ``zh``, ``en``
292
+ -> ``en``.
293
+ region (str):
294
+ Output only. Region part of normalized_language_code, if
295
+ present. E.g.: ``en-US`` -> ``US``, ``zh-Hans-HK`` ->
296
+ ``HK``, ``en`` -> \`\`.
297
+ """
298
+
299
+ language_code: str = proto.Field(
300
+ proto.STRING,
301
+ number=1,
302
+ )
303
+ normalized_language_code: str = proto.Field(
304
+ proto.STRING,
305
+ number=2,
306
+ )
307
+ language: str = proto.Field(
308
+ proto.STRING,
309
+ number=3,
310
+ )
311
+ region: str = proto.Field(
312
+ proto.STRING,
313
+ number=4,
314
+ )
315
+
316
+
317
+ class NaturalLanguageQueryUnderstandingConfig(proto.Message):
318
+ r"""Configuration for Natural Language Query Understanding.
319
+
320
+ Attributes:
321
+ mode (google.cloud.discoveryengine_v1beta.types.NaturalLanguageQueryUnderstandingConfig.Mode):
322
+ Mode of Natural Language Query Understanding. If this field
323
+ is unset, the behavior defaults to
324
+ [NaturalLanguageQueryUnderstandingConfig.Mode.DISABLED][google.cloud.discoveryengine.v1beta.NaturalLanguageQueryUnderstandingConfig.Mode.DISABLED].
325
+ """
326
+
327
+ class Mode(proto.Enum):
328
+ r"""Mode of Natural Language Query Understanding. When the
329
+ NaturalLanguageQueryUnderstandingConfig.Mode is ENABLED, the
330
+ natural language understanding capabilities will be enabled for
331
+ a search request if the
332
+ NaturalLanguageQueryUnderstandingSpec.FilterExtractionCondition
333
+ in the SearchRequest is ENABLED.
334
+
335
+ Values:
336
+ MODE_UNSPECIFIED (0):
337
+ Default value.
338
+ DISABLED (1):
339
+ Natural Language Query Understanding is
340
+ disabled.
341
+ ENABLED (2):
342
+ Natural Language Query Understanding is
343
+ enabled.
344
+ """
345
+ MODE_UNSPECIFIED = 0
346
+ DISABLED = 1
347
+ ENABLED = 2
348
+
349
+ mode: Mode = proto.Field(
350
+ proto.ENUM,
351
+ number=1,
352
+ enum=Mode,
353
+ )
354
+
355
+
356
+ class WorkspaceConfig(proto.Message):
357
+ r"""Config to store data store type configuration for workspace
358
+ data
359
+
360
+ Attributes:
361
+ type_ (google.cloud.discoveryengine_v1beta.types.WorkspaceConfig.Type):
362
+ The Google Workspace data source.
363
+ dasher_customer_id (str):
364
+ Obfuscated Dasher customer ID.
365
+ super_admin_service_account (str):
366
+ Optional. The super admin service account for
367
+ the workspace that will be used for access token
368
+ generation. For now we only use it for Native
369
+ Google Drive connector data ingestion.
370
+ super_admin_email_address (str):
371
+ Optional. The super admin email address for
372
+ the workspace that will be used for access token
373
+ generation. For now we only use it for Native
374
+ Google Drive connector data ingestion.
375
+ """
376
+
377
+ class Type(proto.Enum):
378
+ r"""Specifies the type of Workspace App supported by this
379
+ DataStore
380
+
381
+ Values:
382
+ TYPE_UNSPECIFIED (0):
383
+ Defaults to an unspecified Workspace type.
384
+ GOOGLE_DRIVE (1):
385
+ Workspace Data Store contains Drive data
386
+ GOOGLE_MAIL (2):
387
+ Workspace Data Store contains Mail data
388
+ GOOGLE_SITES (3):
389
+ Workspace Data Store contains Sites data
390
+ GOOGLE_CALENDAR (4):
391
+ Workspace Data Store contains Calendar data
392
+ GOOGLE_CHAT (5):
393
+ Workspace Data Store contains Chat data
394
+ GOOGLE_GROUPS (6):
395
+ Workspace Data Store contains Groups data
396
+ GOOGLE_KEEP (7):
397
+ Workspace Data Store contains Keep data
398
+ """
399
+ TYPE_UNSPECIFIED = 0
400
+ GOOGLE_DRIVE = 1
401
+ GOOGLE_MAIL = 2
402
+ GOOGLE_SITES = 3
403
+ GOOGLE_CALENDAR = 4
404
+ GOOGLE_CHAT = 5
405
+ GOOGLE_GROUPS = 6
406
+ GOOGLE_KEEP = 7
407
+
408
+ type_: Type = proto.Field(
409
+ proto.ENUM,
410
+ number=1,
411
+ enum=Type,
412
+ )
413
+ dasher_customer_id: str = proto.Field(
414
+ proto.STRING,
415
+ number=2,
416
+ )
417
+ super_admin_service_account: str = proto.Field(
418
+ proto.STRING,
419
+ number=4,
420
+ )
421
+ super_admin_email_address: str = proto.Field(
422
+ proto.STRING,
423
+ number=5,
424
+ )
425
+
426
+
427
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/data_store_service.py ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import field_mask_pb2 # type: ignore
21
+ from google.protobuf import timestamp_pb2 # type: ignore
22
+ import proto # type: ignore
23
+
24
+ from google.cloud.discoveryengine_v1beta.types import data_store as gcd_data_store
25
+
26
+ __protobuf__ = proto.module(
27
+ package="google.cloud.discoveryengine.v1beta",
28
+ manifest={
29
+ "CreateDataStoreRequest",
30
+ "GetDataStoreRequest",
31
+ "CreateDataStoreMetadata",
32
+ "ListDataStoresRequest",
33
+ "ListDataStoresResponse",
34
+ "DeleteDataStoreRequest",
35
+ "UpdateDataStoreRequest",
36
+ "DeleteDataStoreMetadata",
37
+ },
38
+ )
39
+
40
+
41
+ class CreateDataStoreRequest(proto.Message):
42
+ r"""Request for
43
+ [DataStoreService.CreateDataStore][google.cloud.discoveryengine.v1beta.DataStoreService.CreateDataStore]
44
+ method.
45
+
46
+ Attributes:
47
+ parent (str):
48
+ Required. The parent resource name, such as
49
+ ``projects/{project}/locations/{location}/collections/{collection}``.
50
+ data_store (google.cloud.discoveryengine_v1beta.types.DataStore):
51
+ Required. The
52
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]
53
+ to create.
54
+ data_store_id (str):
55
+ Required. The ID to use for the
56
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore],
57
+ which will become the final component of the
58
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]'s
59
+ resource name.
60
+
61
+ This field must conform to
62
+ `RFC-1034 <https://tools.ietf.org/html/rfc1034>`__ standard
63
+ with a length limit of 63 characters. Otherwise, an
64
+ INVALID_ARGUMENT error is returned.
65
+ create_advanced_site_search (bool):
66
+ A boolean flag indicating whether user want to directly
67
+ create an advanced data store for site search. If the data
68
+ store is not configured as site search (GENERIC vertical and
69
+ PUBLIC_WEBSITE content_config), this flag will be ignored.
70
+ skip_default_schema_creation (bool):
71
+ A boolean flag indicating whether to skip the default schema
72
+ creation for the data store. Only enable this flag if you
73
+ are certain that the default schema is incompatible with
74
+ your use case.
75
+
76
+ If set to true, you must manually create a schema for the
77
+ data store before any documents can be ingested.
78
+
79
+ This flag cannot be specified if
80
+ ``data_store.starting_schema`` is specified.
81
+ """
82
+
83
+ parent: str = proto.Field(
84
+ proto.STRING,
85
+ number=1,
86
+ )
87
+ data_store: gcd_data_store.DataStore = proto.Field(
88
+ proto.MESSAGE,
89
+ number=2,
90
+ message=gcd_data_store.DataStore,
91
+ )
92
+ data_store_id: str = proto.Field(
93
+ proto.STRING,
94
+ number=3,
95
+ )
96
+ create_advanced_site_search: bool = proto.Field(
97
+ proto.BOOL,
98
+ number=4,
99
+ )
100
+ skip_default_schema_creation: bool = proto.Field(
101
+ proto.BOOL,
102
+ number=7,
103
+ )
104
+
105
+
106
+ class GetDataStoreRequest(proto.Message):
107
+ r"""Request message for
108
+ [DataStoreService.GetDataStore][google.cloud.discoveryengine.v1beta.DataStoreService.GetDataStore]
109
+ method.
110
+
111
+ Attributes:
112
+ name (str):
113
+ Required. Full resource name of
114
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore],
115
+ such as
116
+ ``projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}``.
117
+
118
+ If the caller does not have permission to access the
119
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore],
120
+ regardless of whether or not it exists, a PERMISSION_DENIED
121
+ error is returned.
122
+
123
+ If the requested
124
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]
125
+ does not exist, a NOT_FOUND error is returned.
126
+ """
127
+
128
+ name: str = proto.Field(
129
+ proto.STRING,
130
+ number=1,
131
+ )
132
+
133
+
134
+ class CreateDataStoreMetadata(proto.Message):
135
+ r"""Metadata related to the progress of the
136
+ [DataStoreService.CreateDataStore][google.cloud.discoveryengine.v1beta.DataStoreService.CreateDataStore]
137
+ operation. This will be returned by the
138
+ google.longrunning.Operation.metadata field.
139
+
140
+ Attributes:
141
+ create_time (google.protobuf.timestamp_pb2.Timestamp):
142
+ Operation create time.
143
+ update_time (google.protobuf.timestamp_pb2.Timestamp):
144
+ Operation last update time. If the operation
145
+ is done, this is also the finish time.
146
+ """
147
+
148
+ create_time: timestamp_pb2.Timestamp = proto.Field(
149
+ proto.MESSAGE,
150
+ number=1,
151
+ message=timestamp_pb2.Timestamp,
152
+ )
153
+ update_time: timestamp_pb2.Timestamp = proto.Field(
154
+ proto.MESSAGE,
155
+ number=2,
156
+ message=timestamp_pb2.Timestamp,
157
+ )
158
+
159
+
160
+ class ListDataStoresRequest(proto.Message):
161
+ r"""Request message for
162
+ [DataStoreService.ListDataStores][google.cloud.discoveryengine.v1beta.DataStoreService.ListDataStores]
163
+ method.
164
+
165
+ Attributes:
166
+ parent (str):
167
+ Required. The parent branch resource name, such as
168
+ ``projects/{project}/locations/{location}/collections/{collection_id}``.
169
+
170
+ If the caller does not have permission to list
171
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]s
172
+ under this location, regardless of whether or not this data
173
+ store exists, a PERMISSION_DENIED error is returned.
174
+ page_size (int):
175
+ Maximum number of
176
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]s
177
+ to return. If unspecified, defaults to 10. The maximum
178
+ allowed value is 50. Values above 50 will be coerced to 50.
179
+
180
+ If this field is negative, an INVALID_ARGUMENT is returned.
181
+ page_token (str):
182
+ A page token
183
+ [ListDataStoresResponse.next_page_token][google.cloud.discoveryengine.v1beta.ListDataStoresResponse.next_page_token],
184
+ received from a previous
185
+ [DataStoreService.ListDataStores][google.cloud.discoveryengine.v1beta.DataStoreService.ListDataStores]
186
+ call. Provide this to retrieve the subsequent page.
187
+
188
+ When paginating, all other parameters provided to
189
+ [DataStoreService.ListDataStores][google.cloud.discoveryengine.v1beta.DataStoreService.ListDataStores]
190
+ must match the call that provided the page token. Otherwise,
191
+ an INVALID_ARGUMENT error is returned.
192
+ filter (str):
193
+ Filter by solution type . For example:
194
+ ``filter = 'solution_type:SOLUTION_TYPE_SEARCH'``
195
+ """
196
+
197
+ parent: str = proto.Field(
198
+ proto.STRING,
199
+ number=1,
200
+ )
201
+ page_size: int = proto.Field(
202
+ proto.INT32,
203
+ number=2,
204
+ )
205
+ page_token: str = proto.Field(
206
+ proto.STRING,
207
+ number=3,
208
+ )
209
+ filter: str = proto.Field(
210
+ proto.STRING,
211
+ number=4,
212
+ )
213
+
214
+
215
+ class ListDataStoresResponse(proto.Message):
216
+ r"""Response message for
217
+ [DataStoreService.ListDataStores][google.cloud.discoveryengine.v1beta.DataStoreService.ListDataStores]
218
+ method.
219
+
220
+ Attributes:
221
+ data_stores (MutableSequence[google.cloud.discoveryengine_v1beta.types.DataStore]):
222
+ All the customer's
223
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]s.
224
+ next_page_token (str):
225
+ A token that can be sent as
226
+ [ListDataStoresRequest.page_token][google.cloud.discoveryengine.v1beta.ListDataStoresRequest.page_token]
227
+ to retrieve the next page. If this field is omitted, there
228
+ are no subsequent pages.
229
+ """
230
+
231
+ @property
232
+ def raw_page(self):
233
+ return self
234
+
235
+ data_stores: MutableSequence[gcd_data_store.DataStore] = proto.RepeatedField(
236
+ proto.MESSAGE,
237
+ number=1,
238
+ message=gcd_data_store.DataStore,
239
+ )
240
+ next_page_token: str = proto.Field(
241
+ proto.STRING,
242
+ number=2,
243
+ )
244
+
245
+
246
+ class DeleteDataStoreRequest(proto.Message):
247
+ r"""Request message for
248
+ [DataStoreService.DeleteDataStore][google.cloud.discoveryengine.v1beta.DataStoreService.DeleteDataStore]
249
+ method.
250
+
251
+ Attributes:
252
+ name (str):
253
+ Required. Full resource name of
254
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore],
255
+ such as
256
+ ``projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}``.
257
+
258
+ If the caller does not have permission to delete the
259
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore],
260
+ regardless of whether or not it exists, a PERMISSION_DENIED
261
+ error is returned.
262
+
263
+ If the
264
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]
265
+ to delete does not exist, a NOT_FOUND error is returned.
266
+ """
267
+
268
+ name: str = proto.Field(
269
+ proto.STRING,
270
+ number=1,
271
+ )
272
+
273
+
274
+ class UpdateDataStoreRequest(proto.Message):
275
+ r"""Request message for
276
+ [DataStoreService.UpdateDataStore][google.cloud.discoveryengine.v1beta.DataStoreService.UpdateDataStore]
277
+ method.
278
+
279
+ Attributes:
280
+ data_store (google.cloud.discoveryengine_v1beta.types.DataStore):
281
+ Required. The
282
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]
283
+ to update.
284
+
285
+ If the caller does not have permission to update the
286
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore],
287
+ regardless of whether or not it exists, a PERMISSION_DENIED
288
+ error is returned.
289
+
290
+ If the
291
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]
292
+ to update does not exist, a NOT_FOUND error is returned.
293
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
294
+ Indicates which fields in the provided
295
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]
296
+ to update.
297
+
298
+ If an unsupported or unknown field is provided, an
299
+ INVALID_ARGUMENT error is returned.
300
+ """
301
+
302
+ data_store: gcd_data_store.DataStore = proto.Field(
303
+ proto.MESSAGE,
304
+ number=1,
305
+ message=gcd_data_store.DataStore,
306
+ )
307
+ update_mask: field_mask_pb2.FieldMask = proto.Field(
308
+ proto.MESSAGE,
309
+ number=2,
310
+ message=field_mask_pb2.FieldMask,
311
+ )
312
+
313
+
314
+ class DeleteDataStoreMetadata(proto.Message):
315
+ r"""Metadata related to the progress of the
316
+ [DataStoreService.DeleteDataStore][google.cloud.discoveryengine.v1beta.DataStoreService.DeleteDataStore]
317
+ operation. This will be returned by the
318
+ google.longrunning.Operation.metadata field.
319
+
320
+ Attributes:
321
+ create_time (google.protobuf.timestamp_pb2.Timestamp):
322
+ Operation create time.
323
+ update_time (google.protobuf.timestamp_pb2.Timestamp):
324
+ Operation last update time. If the operation
325
+ is done, this is also the finish time.
326
+ """
327
+
328
+ create_time: timestamp_pb2.Timestamp = proto.Field(
329
+ proto.MESSAGE,
330
+ number=1,
331
+ message=timestamp_pb2.Timestamp,
332
+ )
333
+ update_time: timestamp_pb2.Timestamp = proto.Field(
334
+ proto.MESSAGE,
335
+ number=2,
336
+ message=timestamp_pb2.Timestamp,
337
+ )
338
+
339
+
340
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/document.py ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import struct_pb2 # type: ignore
21
+ from google.protobuf import timestamp_pb2 # type: ignore
22
+ from google.rpc import status_pb2 # type: ignore
23
+ import proto # type: ignore
24
+
25
+ __protobuf__ = proto.module(
26
+ package="google.cloud.discoveryengine.v1beta",
27
+ manifest={
28
+ "Document",
29
+ },
30
+ )
31
+
32
+
33
+ class Document(proto.Message):
34
+ r"""Document captures all raw metadata information of items to be
35
+ recommended or searched.
36
+
37
+ This message has `oneof`_ fields (mutually exclusive fields).
38
+ For each oneof, at most one member field can be set at the same time.
39
+ Setting any member of the oneof automatically clears all other
40
+ members.
41
+
42
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
43
+
44
+ Attributes:
45
+ struct_data (google.protobuf.struct_pb2.Struct):
46
+ The structured JSON data for the document. It should conform
47
+ to the registered
48
+ [Schema][google.cloud.discoveryengine.v1beta.Schema] or an
49
+ ``INVALID_ARGUMENT`` error is thrown.
50
+
51
+ This field is a member of `oneof`_ ``data``.
52
+ json_data (str):
53
+ The JSON string representation of the document. It should
54
+ conform to the registered
55
+ [Schema][google.cloud.discoveryengine.v1beta.Schema] or an
56
+ ``INVALID_ARGUMENT`` error is thrown.
57
+
58
+ This field is a member of `oneof`_ ``data``.
59
+ name (str):
60
+ Immutable. The full resource name of the document. Format:
61
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_id}``.
62
+
63
+ This field must be a UTF-8 encoded string with a length
64
+ limit of 1024 characters.
65
+ id (str):
66
+ Immutable. The identifier of the document.
67
+
68
+ Id should conform to
69
+ `RFC-1034 <https://tools.ietf.org/html/rfc1034>`__ standard
70
+ with a length limit of 63 characters.
71
+ schema_id (str):
72
+ The identifier of the schema located in the
73
+ same data store.
74
+ content (google.cloud.discoveryengine_v1beta.types.Document.Content):
75
+ The unstructured data linked to this document. Content must
76
+ be set if this document is under a ``CONTENT_REQUIRED`` data
77
+ store.
78
+ parent_document_id (str):
79
+ The identifier of the parent document. Currently supports at
80
+ most two level document hierarchy.
81
+
82
+ Id should conform to
83
+ `RFC-1034 <https://tools.ietf.org/html/rfc1034>`__ standard
84
+ with a length limit of 63 characters.
85
+ derived_struct_data (google.protobuf.struct_pb2.Struct):
86
+ Output only. This field is OUTPUT_ONLY. It contains derived
87
+ data that are not in the original input document.
88
+ index_time (google.protobuf.timestamp_pb2.Timestamp):
89
+ Output only. The last time the document was indexed. If this
90
+ field is set, the document could be returned in search
91
+ results.
92
+
93
+ This field is OUTPUT_ONLY. If this field is not populated,
94
+ it means the document has never been indexed.
95
+ index_status (google.cloud.discoveryengine_v1beta.types.Document.IndexStatus):
96
+ Output only. The index status of the document.
97
+
98
+ - If document is indexed successfully, the index_time field
99
+ is populated.
100
+ - Otherwise, if document is not indexed due to errors, the
101
+ error_samples field is populated.
102
+ - Otherwise, index_status is unset.
103
+ """
104
+
105
+ class Content(proto.Message):
106
+ r"""Unstructured data linked to this document.
107
+
108
+ This message has `oneof`_ fields (mutually exclusive fields).
109
+ For each oneof, at most one member field can be set at the same time.
110
+ Setting any member of the oneof automatically clears all other
111
+ members.
112
+
113
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
114
+
115
+ Attributes:
116
+ raw_bytes (bytes):
117
+ The content represented as a stream of bytes. The maximum
118
+ length is 1,000,000 bytes (1 MB / ~0.95 MiB).
119
+
120
+ Note: As with all ``bytes`` fields, this field is
121
+ represented as pure binary in Protocol Buffers and
122
+ base64-encoded string in JSON. For example,
123
+ ``abc123!?$*&()'-=@~`` should be represented as
124
+ ``YWJjMTIzIT8kKiYoKSctPUB+`` in JSON. See
125
+ https://developers.google.com/protocol-buffers/docs/proto3#json.
126
+
127
+ This field is a member of `oneof`_ ``content``.
128
+ uri (str):
129
+ The URI of the content. Only Cloud Storage URIs (e.g.
130
+ ``gs://bucket-name/path/to/file``) are supported. The
131
+ maximum file size is 2.5 MB for text-based formats, 200 MB
132
+ for other formats.
133
+
134
+ This field is a member of `oneof`_ ``content``.
135
+ mime_type (str):
136
+ The MIME type of the content. Supported types:
137
+
138
+ - ``application/pdf`` (PDF, only native PDFs are supported
139
+ for now)
140
+ - ``text/html`` (HTML)
141
+ - ``application/vnd.openxmlformats-officedocument.wordprocessingml.document``
142
+ (DOCX)
143
+ - ``application/vnd.openxmlformats-officedocument.presentationml.presentation``
144
+ (PPTX)
145
+ - ``text/plain`` (TXT)
146
+
147
+ See
148
+ https://www.iana.org/assignments/media-types/media-types.xhtml.
149
+ """
150
+
151
+ raw_bytes: bytes = proto.Field(
152
+ proto.BYTES,
153
+ number=2,
154
+ oneof="content",
155
+ )
156
+ uri: str = proto.Field(
157
+ proto.STRING,
158
+ number=3,
159
+ oneof="content",
160
+ )
161
+ mime_type: str = proto.Field(
162
+ proto.STRING,
163
+ number=1,
164
+ )
165
+
166
+ class IndexStatus(proto.Message):
167
+ r"""Index status of the document.
168
+
169
+ Attributes:
170
+ index_time (google.protobuf.timestamp_pb2.Timestamp):
171
+ The time when the document was indexed.
172
+ If this field is populated, it means the
173
+ document has been indexed.
174
+ error_samples (MutableSequence[google.rpc.status_pb2.Status]):
175
+ A sample of errors encountered while indexing
176
+ the document. If this field is populated, the
177
+ document is not indexed due to errors.
178
+ """
179
+
180
+ index_time: timestamp_pb2.Timestamp = proto.Field(
181
+ proto.MESSAGE,
182
+ number=1,
183
+ message=timestamp_pb2.Timestamp,
184
+ )
185
+ error_samples: MutableSequence[status_pb2.Status] = proto.RepeatedField(
186
+ proto.MESSAGE,
187
+ number=2,
188
+ message=status_pb2.Status,
189
+ )
190
+
191
+ struct_data: struct_pb2.Struct = proto.Field(
192
+ proto.MESSAGE,
193
+ number=4,
194
+ oneof="data",
195
+ message=struct_pb2.Struct,
196
+ )
197
+ json_data: str = proto.Field(
198
+ proto.STRING,
199
+ number=5,
200
+ oneof="data",
201
+ )
202
+ name: str = proto.Field(
203
+ proto.STRING,
204
+ number=1,
205
+ )
206
+ id: str = proto.Field(
207
+ proto.STRING,
208
+ number=2,
209
+ )
210
+ schema_id: str = proto.Field(
211
+ proto.STRING,
212
+ number=3,
213
+ )
214
+ content: Content = proto.Field(
215
+ proto.MESSAGE,
216
+ number=10,
217
+ message=Content,
218
+ )
219
+ parent_document_id: str = proto.Field(
220
+ proto.STRING,
221
+ number=7,
222
+ )
223
+ derived_struct_data: struct_pb2.Struct = proto.Field(
224
+ proto.MESSAGE,
225
+ number=6,
226
+ message=struct_pb2.Struct,
227
+ )
228
+ index_time: timestamp_pb2.Timestamp = proto.Field(
229
+ proto.MESSAGE,
230
+ number=13,
231
+ message=timestamp_pb2.Timestamp,
232
+ )
233
+ index_status: IndexStatus = proto.Field(
234
+ proto.MESSAGE,
235
+ number=15,
236
+ message=IndexStatus,
237
+ )
238
+
239
+
240
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/document_processing_config.py ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ import proto # type: ignore
21
+
22
+ __protobuf__ = proto.module(
23
+ package="google.cloud.discoveryengine.v1beta",
24
+ manifest={
25
+ "DocumentProcessingConfig",
26
+ },
27
+ )
28
+
29
+
30
+ class DocumentProcessingConfig(proto.Message):
31
+ r"""A singleton resource of
32
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]. If it's
33
+ empty when
34
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore] is
35
+ created and
36
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore] is set to
37
+ [DataStore.ContentConfig.CONTENT_REQUIRED][google.cloud.discoveryengine.v1beta.DataStore.ContentConfig.CONTENT_REQUIRED],
38
+ the default parser will default to digital parser.
39
+
40
+ Attributes:
41
+ name (str):
42
+ The full resource name of the Document Processing Config.
43
+ Format:
44
+ ``projects/*/locations/*/collections/*/dataStores/*/documentProcessingConfig``.
45
+ chunking_config (google.cloud.discoveryengine_v1beta.types.DocumentProcessingConfig.ChunkingConfig):
46
+ Whether chunking mode is enabled.
47
+ default_parsing_config (google.cloud.discoveryengine_v1beta.types.DocumentProcessingConfig.ParsingConfig):
48
+ Configurations for default Document parser.
49
+ If not specified, we will configure it as
50
+ default DigitalParsingConfig, and the default
51
+ parsing config will be applied to all file types
52
+ for Document parsing.
53
+ parsing_config_overrides (MutableMapping[str, google.cloud.discoveryengine_v1beta.types.DocumentProcessingConfig.ParsingConfig]):
54
+ Map from file type to override the default parsing
55
+ configuration based on the file type. Supported keys:
56
+
57
+ - ``pdf``: Override parsing config for PDF files, either
58
+ digital parsing, ocr parsing or layout parsing is
59
+ supported.
60
+ - ``html``: Override parsing config for HTML files, only
61
+ digital parsing and layout parsing are supported.
62
+ - ``docx``: Override parsing config for DOCX files, only
63
+ digital parsing and layout parsing are supported.
64
+ - ``pptx``: Override parsing config for PPTX files, only
65
+ digital parsing and layout parsing are supported.
66
+ - ``xlsm``: Override parsing config for XLSM files, only
67
+ digital parsing and layout parsing are supported.
68
+ - ``xlsx``: Override parsing config for XLSX files, only
69
+ digital parsing and layout parsing are supported.
70
+ """
71
+
72
+ class ChunkingConfig(proto.Message):
73
+ r"""Configuration for chunking config.
74
+
75
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
76
+
77
+ Attributes:
78
+ layout_based_chunking_config (google.cloud.discoveryengine_v1beta.types.DocumentProcessingConfig.ChunkingConfig.LayoutBasedChunkingConfig):
79
+ Configuration for the layout based chunking.
80
+
81
+ This field is a member of `oneof`_ ``chunk_mode``.
82
+ """
83
+
84
+ class LayoutBasedChunkingConfig(proto.Message):
85
+ r"""Configuration for the layout based chunking.
86
+
87
+ Attributes:
88
+ chunk_size (int):
89
+ The token size limit for each chunk.
90
+
91
+ Supported values: 100-500 (inclusive).
92
+ Default value: 500.
93
+ include_ancestor_headings (bool):
94
+ Whether to include appending different levels
95
+ of headings to chunks from the middle of the
96
+ document to prevent context loss.
97
+
98
+ Default value: False.
99
+ """
100
+
101
+ chunk_size: int = proto.Field(
102
+ proto.INT32,
103
+ number=1,
104
+ )
105
+ include_ancestor_headings: bool = proto.Field(
106
+ proto.BOOL,
107
+ number=2,
108
+ )
109
+
110
+ layout_based_chunking_config: "DocumentProcessingConfig.ChunkingConfig.LayoutBasedChunkingConfig" = proto.Field(
111
+ proto.MESSAGE,
112
+ number=1,
113
+ oneof="chunk_mode",
114
+ message="DocumentProcessingConfig.ChunkingConfig.LayoutBasedChunkingConfig",
115
+ )
116
+
117
+ class ParsingConfig(proto.Message):
118
+ r"""Related configurations applied to a specific type of document
119
+ parser.
120
+
121
+ This message has `oneof`_ fields (mutually exclusive fields).
122
+ For each oneof, at most one member field can be set at the same time.
123
+ Setting any member of the oneof automatically clears all other
124
+ members.
125
+
126
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
127
+
128
+ Attributes:
129
+ digital_parsing_config (google.cloud.discoveryengine_v1beta.types.DocumentProcessingConfig.ParsingConfig.DigitalParsingConfig):
130
+ Configurations applied to digital parser.
131
+
132
+ This field is a member of `oneof`_ ``type_dedicated_config``.
133
+ ocr_parsing_config (google.cloud.discoveryengine_v1beta.types.DocumentProcessingConfig.ParsingConfig.OcrParsingConfig):
134
+ Configurations applied to OCR parser.
135
+ Currently it only applies to PDFs.
136
+
137
+ This field is a member of `oneof`_ ``type_dedicated_config``.
138
+ layout_parsing_config (google.cloud.discoveryengine_v1beta.types.DocumentProcessingConfig.ParsingConfig.LayoutParsingConfig):
139
+ Configurations applied to layout parser.
140
+
141
+ This field is a member of `oneof`_ ``type_dedicated_config``.
142
+ """
143
+
144
+ class DigitalParsingConfig(proto.Message):
145
+ r"""The digital parsing configurations for documents."""
146
+
147
+ class OcrParsingConfig(proto.Message):
148
+ r"""The OCR parsing configurations for documents.
149
+
150
+ Attributes:
151
+ enhanced_document_elements (MutableSequence[str]):
152
+ [DEPRECATED] This field is deprecated. To use the additional
153
+ enhanced document elements processing, please switch to
154
+ ``layout_parsing_config``.
155
+ use_native_text (bool):
156
+ If true, will use native text instead of OCR
157
+ text on pages containing native text.
158
+ """
159
+
160
+ enhanced_document_elements: MutableSequence[str] = proto.RepeatedField(
161
+ proto.STRING,
162
+ number=1,
163
+ )
164
+ use_native_text: bool = proto.Field(
165
+ proto.BOOL,
166
+ number=2,
167
+ )
168
+
169
+ class LayoutParsingConfig(proto.Message):
170
+ r"""The layout parsing configurations for documents."""
171
+
172
+ digital_parsing_config: "DocumentProcessingConfig.ParsingConfig.DigitalParsingConfig" = proto.Field(
173
+ proto.MESSAGE,
174
+ number=1,
175
+ oneof="type_dedicated_config",
176
+ message="DocumentProcessingConfig.ParsingConfig.DigitalParsingConfig",
177
+ )
178
+ ocr_parsing_config: "DocumentProcessingConfig.ParsingConfig.OcrParsingConfig" = proto.Field(
179
+ proto.MESSAGE,
180
+ number=2,
181
+ oneof="type_dedicated_config",
182
+ message="DocumentProcessingConfig.ParsingConfig.OcrParsingConfig",
183
+ )
184
+ layout_parsing_config: "DocumentProcessingConfig.ParsingConfig.LayoutParsingConfig" = proto.Field(
185
+ proto.MESSAGE,
186
+ number=3,
187
+ oneof="type_dedicated_config",
188
+ message="DocumentProcessingConfig.ParsingConfig.LayoutParsingConfig",
189
+ )
190
+
191
+ name: str = proto.Field(
192
+ proto.STRING,
193
+ number=1,
194
+ )
195
+ chunking_config: ChunkingConfig = proto.Field(
196
+ proto.MESSAGE,
197
+ number=3,
198
+ message=ChunkingConfig,
199
+ )
200
+ default_parsing_config: ParsingConfig = proto.Field(
201
+ proto.MESSAGE,
202
+ number=4,
203
+ message=ParsingConfig,
204
+ )
205
+ parsing_config_overrides: MutableMapping[str, ParsingConfig] = proto.MapField(
206
+ proto.STRING,
207
+ proto.MESSAGE,
208
+ number=5,
209
+ message=ParsingConfig,
210
+ )
211
+
212
+
213
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/document_service.py ADDED
@@ -0,0 +1,491 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import field_mask_pb2 # type: ignore
21
+ from google.protobuf import timestamp_pb2 # type: ignore
22
+ import proto # type: ignore
23
+
24
+ from google.cloud.discoveryengine_v1beta.types import document as gcd_document
25
+
26
+ __protobuf__ = proto.module(
27
+ package="google.cloud.discoveryengine.v1beta",
28
+ manifest={
29
+ "GetDocumentRequest",
30
+ "ListDocumentsRequest",
31
+ "ListDocumentsResponse",
32
+ "CreateDocumentRequest",
33
+ "UpdateDocumentRequest",
34
+ "DeleteDocumentRequest",
35
+ "BatchGetDocumentsMetadataRequest",
36
+ "BatchGetDocumentsMetadataResponse",
37
+ },
38
+ )
39
+
40
+
41
+ class GetDocumentRequest(proto.Message):
42
+ r"""Request message for
43
+ [DocumentService.GetDocument][google.cloud.discoveryengine.v1beta.DocumentService.GetDocument]
44
+ method.
45
+
46
+ Attributes:
47
+ name (str):
48
+ Required. Full resource name of
49
+ [Document][google.cloud.discoveryengine.v1beta.Document],
50
+ such as
51
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}``.
52
+
53
+ If the caller does not have permission to access the
54
+ [Document][google.cloud.discoveryengine.v1beta.Document],
55
+ regardless of whether or not it exists, a
56
+ ``PERMISSION_DENIED`` error is returned.
57
+
58
+ If the requested
59
+ [Document][google.cloud.discoveryengine.v1beta.Document]
60
+ does not exist, a ``NOT_FOUND`` error is returned.
61
+ """
62
+
63
+ name: str = proto.Field(
64
+ proto.STRING,
65
+ number=1,
66
+ )
67
+
68
+
69
+ class ListDocumentsRequest(proto.Message):
70
+ r"""Request message for
71
+ [DocumentService.ListDocuments][google.cloud.discoveryengine.v1beta.DocumentService.ListDocuments]
72
+ method.
73
+
74
+ Attributes:
75
+ parent (str):
76
+ Required. The parent branch resource name, such as
77
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}``.
78
+ Use ``default_branch`` as the branch ID, to list documents
79
+ under the default branch.
80
+
81
+ If the caller does not have permission to list
82
+ [Document][google.cloud.discoveryengine.v1beta.Document]s
83
+ under this branch, regardless of whether or not this branch
84
+ exists, a ``PERMISSION_DENIED`` error is returned.
85
+ page_size (int):
86
+ Maximum number of
87
+ [Document][google.cloud.discoveryengine.v1beta.Document]s to
88
+ return. If unspecified, defaults to 100. The maximum allowed
89
+ value is 1000. Values above 1000 are set to 1000.
90
+
91
+ If this field is negative, an ``INVALID_ARGUMENT`` error is
92
+ returned.
93
+ page_token (str):
94
+ A page token
95
+ [ListDocumentsResponse.next_page_token][google.cloud.discoveryengine.v1beta.ListDocumentsResponse.next_page_token],
96
+ received from a previous
97
+ [DocumentService.ListDocuments][google.cloud.discoveryengine.v1beta.DocumentService.ListDocuments]
98
+ call. Provide this to retrieve the subsequent page.
99
+
100
+ When paginating, all other parameters provided to
101
+ [DocumentService.ListDocuments][google.cloud.discoveryengine.v1beta.DocumentService.ListDocuments]
102
+ must match the call that provided the page token. Otherwise,
103
+ an ``INVALID_ARGUMENT`` error is returned.
104
+ """
105
+
106
+ parent: str = proto.Field(
107
+ proto.STRING,
108
+ number=1,
109
+ )
110
+ page_size: int = proto.Field(
111
+ proto.INT32,
112
+ number=2,
113
+ )
114
+ page_token: str = proto.Field(
115
+ proto.STRING,
116
+ number=3,
117
+ )
118
+
119
+
120
+ class ListDocumentsResponse(proto.Message):
121
+ r"""Response message for
122
+ [DocumentService.ListDocuments][google.cloud.discoveryengine.v1beta.DocumentService.ListDocuments]
123
+ method.
124
+
125
+ Attributes:
126
+ documents (MutableSequence[google.cloud.discoveryengine_v1beta.types.Document]):
127
+ The
128
+ [Document][google.cloud.discoveryengine.v1beta.Document]s.
129
+ next_page_token (str):
130
+ A token that can be sent as
131
+ [ListDocumentsRequest.page_token][google.cloud.discoveryengine.v1beta.ListDocumentsRequest.page_token]
132
+ to retrieve the next page. If this field is omitted, there
133
+ are no subsequent pages.
134
+ """
135
+
136
+ @property
137
+ def raw_page(self):
138
+ return self
139
+
140
+ documents: MutableSequence[gcd_document.Document] = proto.RepeatedField(
141
+ proto.MESSAGE,
142
+ number=1,
143
+ message=gcd_document.Document,
144
+ )
145
+ next_page_token: str = proto.Field(
146
+ proto.STRING,
147
+ number=2,
148
+ )
149
+
150
+
151
+ class CreateDocumentRequest(proto.Message):
152
+ r"""Request message for
153
+ [DocumentService.CreateDocument][google.cloud.discoveryengine.v1beta.DocumentService.CreateDocument]
154
+ method.
155
+
156
+ Attributes:
157
+ parent (str):
158
+ Required. The parent resource name, such as
159
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}``.
160
+ document (google.cloud.discoveryengine_v1beta.types.Document):
161
+ Required. The
162
+ [Document][google.cloud.discoveryengine.v1beta.Document] to
163
+ create.
164
+ document_id (str):
165
+ Required. The ID to use for the
166
+ [Document][google.cloud.discoveryengine.v1beta.Document],
167
+ which becomes the final component of the
168
+ [Document.name][google.cloud.discoveryengine.v1beta.Document.name].
169
+
170
+ If the caller does not have permission to create the
171
+ [Document][google.cloud.discoveryengine.v1beta.Document],
172
+ regardless of whether or not it exists, a
173
+ ``PERMISSION_DENIED`` error is returned.
174
+
175
+ This field must be unique among all
176
+ [Document][google.cloud.discoveryengine.v1beta.Document]s
177
+ with the same
178
+ [parent][google.cloud.discoveryengine.v1beta.CreateDocumentRequest.parent].
179
+ Otherwise, an ``ALREADY_EXISTS`` error is returned.
180
+
181
+ This field must conform to
182
+ `RFC-1034 <https://tools.ietf.org/html/rfc1034>`__ standard
183
+ with a length limit of 63 characters. Otherwise, an
184
+ ``INVALID_ARGUMENT`` error is returned.
185
+ """
186
+
187
+ parent: str = proto.Field(
188
+ proto.STRING,
189
+ number=1,
190
+ )
191
+ document: gcd_document.Document = proto.Field(
192
+ proto.MESSAGE,
193
+ number=2,
194
+ message=gcd_document.Document,
195
+ )
196
+ document_id: str = proto.Field(
197
+ proto.STRING,
198
+ number=3,
199
+ )
200
+
201
+
202
+ class UpdateDocumentRequest(proto.Message):
203
+ r"""Request message for
204
+ [DocumentService.UpdateDocument][google.cloud.discoveryengine.v1beta.DocumentService.UpdateDocument]
205
+ method.
206
+
207
+ Attributes:
208
+ document (google.cloud.discoveryengine_v1beta.types.Document):
209
+ Required. The document to update/create.
210
+
211
+ If the caller does not have permission to update the
212
+ [Document][google.cloud.discoveryengine.v1beta.Document],
213
+ regardless of whether or not it exists, a
214
+ ``PERMISSION_DENIED`` error is returned.
215
+
216
+ If the
217
+ [Document][google.cloud.discoveryengine.v1beta.Document] to
218
+ update does not exist and
219
+ [allow_missing][google.cloud.discoveryengine.v1beta.UpdateDocumentRequest.allow_missing]
220
+ is not set, a ``NOT_FOUND`` error is returned.
221
+ allow_missing (bool):
222
+ If set to ``true`` and the
223
+ [Document][google.cloud.discoveryengine.v1beta.Document] is
224
+ not found, a new
225
+ [Document][google.cloud.discoveryengine.v1beta.Document] is
226
+ be created.
227
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
228
+ Indicates which fields in the provided
229
+ imported 'document' to update. If not set, by
230
+ default updates all fields.
231
+ """
232
+
233
+ document: gcd_document.Document = proto.Field(
234
+ proto.MESSAGE,
235
+ number=1,
236
+ message=gcd_document.Document,
237
+ )
238
+ allow_missing: bool = proto.Field(
239
+ proto.BOOL,
240
+ number=2,
241
+ )
242
+ update_mask: field_mask_pb2.FieldMask = proto.Field(
243
+ proto.MESSAGE,
244
+ number=3,
245
+ message=field_mask_pb2.FieldMask,
246
+ )
247
+
248
+
249
+ class DeleteDocumentRequest(proto.Message):
250
+ r"""Request message for
251
+ [DocumentService.DeleteDocument][google.cloud.discoveryengine.v1beta.DocumentService.DeleteDocument]
252
+ method.
253
+
254
+ Attributes:
255
+ name (str):
256
+ Required. Full resource name of
257
+ [Document][google.cloud.discoveryengine.v1beta.Document],
258
+ such as
259
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}``.
260
+
261
+ If the caller does not have permission to delete the
262
+ [Document][google.cloud.discoveryengine.v1beta.Document],
263
+ regardless of whether or not it exists, a
264
+ ``PERMISSION_DENIED`` error is returned.
265
+
266
+ If the
267
+ [Document][google.cloud.discoveryengine.v1beta.Document] to
268
+ delete does not exist, a ``NOT_FOUND`` error is returned.
269
+ """
270
+
271
+ name: str = proto.Field(
272
+ proto.STRING,
273
+ number=1,
274
+ )
275
+
276
+
277
+ class BatchGetDocumentsMetadataRequest(proto.Message):
278
+ r"""Request message for
279
+ [DocumentService.BatchGetDocumentsMetadata][google.cloud.discoveryengine.v1beta.DocumentService.BatchGetDocumentsMetadata]
280
+ method.
281
+
282
+ Attributes:
283
+ parent (str):
284
+ Required. The parent branch resource name, such as
285
+ ``projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}``.
286
+ matcher (google.cloud.discoveryengine_v1beta.types.BatchGetDocumentsMetadataRequest.Matcher):
287
+ Required. Matcher for the
288
+ [Document][google.cloud.discoveryengine.v1beta.Document]s.
289
+ """
290
+
291
+ class UrisMatcher(proto.Message):
292
+ r"""Matcher for the
293
+ [Document][google.cloud.discoveryengine.v1beta.Document]s by exact
294
+ uris.
295
+
296
+ Attributes:
297
+ uris (MutableSequence[str]):
298
+ The exact URIs to match by.
299
+ """
300
+
301
+ uris: MutableSequence[str] = proto.RepeatedField(
302
+ proto.STRING,
303
+ number=1,
304
+ )
305
+
306
+ class FhirMatcher(proto.Message):
307
+ r"""Matcher for the
308
+ [Document][google.cloud.discoveryengine.v1beta.Document]s by FHIR
309
+ resource names.
310
+
311
+ Attributes:
312
+ fhir_resources (MutableSequence[str]):
313
+ Required. The FHIR resources to match by. Format:
314
+ projects/{project}/locations/{location}/datasets/{dataset}/fhirStores/{fhir_store}/fhir/{resource_type}/{fhir_resource_id}
315
+ """
316
+
317
+ fhir_resources: MutableSequence[str] = proto.RepeatedField(
318
+ proto.STRING,
319
+ number=1,
320
+ )
321
+
322
+ class Matcher(proto.Message):
323
+ r"""Matcher for the
324
+ [Document][google.cloud.discoveryengine.v1beta.Document]s. Currently
325
+ supports matching by exact URIs.
326
+
327
+ This message has `oneof`_ fields (mutually exclusive fields).
328
+ For each oneof, at most one member field can be set at the same time.
329
+ Setting any member of the oneof automatically clears all other
330
+ members.
331
+
332
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
333
+
334
+ Attributes:
335
+ uris_matcher (google.cloud.discoveryengine_v1beta.types.BatchGetDocumentsMetadataRequest.UrisMatcher):
336
+ Matcher by exact URIs.
337
+
338
+ This field is a member of `oneof`_ ``matcher``.
339
+ fhir_matcher (google.cloud.discoveryengine_v1beta.types.BatchGetDocumentsMetadataRequest.FhirMatcher):
340
+ Matcher by FHIR resource names.
341
+
342
+ This field is a member of `oneof`_ ``matcher``.
343
+ """
344
+
345
+ uris_matcher: "BatchGetDocumentsMetadataRequest.UrisMatcher" = proto.Field(
346
+ proto.MESSAGE,
347
+ number=1,
348
+ oneof="matcher",
349
+ message="BatchGetDocumentsMetadataRequest.UrisMatcher",
350
+ )
351
+ fhir_matcher: "BatchGetDocumentsMetadataRequest.FhirMatcher" = proto.Field(
352
+ proto.MESSAGE,
353
+ number=2,
354
+ oneof="matcher",
355
+ message="BatchGetDocumentsMetadataRequest.FhirMatcher",
356
+ )
357
+
358
+ parent: str = proto.Field(
359
+ proto.STRING,
360
+ number=1,
361
+ )
362
+ matcher: Matcher = proto.Field(
363
+ proto.MESSAGE,
364
+ number=2,
365
+ message=Matcher,
366
+ )
367
+
368
+
369
+ class BatchGetDocumentsMetadataResponse(proto.Message):
370
+ r"""Response message for
371
+ [DocumentService.BatchGetDocumentsMetadata][google.cloud.discoveryengine.v1beta.DocumentService.BatchGetDocumentsMetadata]
372
+ method.
373
+
374
+ Attributes:
375
+ documents_metadata (MutableSequence[google.cloud.discoveryengine_v1beta.types.BatchGetDocumentsMetadataResponse.DocumentMetadata]):
376
+ The metadata of the
377
+ [Document][google.cloud.discoveryengine.v1beta.Document]s.
378
+ """
379
+
380
+ class State(proto.Enum):
381
+ r"""The state of the
382
+ [Document][google.cloud.discoveryengine.v1beta.Document].
383
+
384
+ Values:
385
+ STATE_UNSPECIFIED (0):
386
+ Should never be set.
387
+ INDEXED (1):
388
+ The [Document][google.cloud.discoveryengine.v1beta.Document]
389
+ is indexed.
390
+ NOT_IN_TARGET_SITE (2):
391
+ The [Document][google.cloud.discoveryengine.v1beta.Document]
392
+ is not indexed because its URI is not in the
393
+ [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite].
394
+ NOT_IN_INDEX (3):
395
+ The [Document][google.cloud.discoveryengine.v1beta.Document]
396
+ is not indexed.
397
+ """
398
+ STATE_UNSPECIFIED = 0
399
+ INDEXED = 1
400
+ NOT_IN_TARGET_SITE = 2
401
+ NOT_IN_INDEX = 3
402
+
403
+ class DocumentMetadata(proto.Message):
404
+ r"""The metadata of a
405
+ [Document][google.cloud.discoveryengine.v1beta.Document].
406
+
407
+ Attributes:
408
+ matcher_value (google.cloud.discoveryengine_v1beta.types.BatchGetDocumentsMetadataResponse.DocumentMetadata.MatcherValue):
409
+ The value of the matcher that was used to match the
410
+ [Document][google.cloud.discoveryengine.v1beta.Document].
411
+ state (google.cloud.discoveryengine_v1beta.types.BatchGetDocumentsMetadataResponse.State):
412
+ The state of the document.
413
+ last_refreshed_time (google.protobuf.timestamp_pb2.Timestamp):
414
+ The timestamp of the last time the
415
+ [Document][google.cloud.discoveryengine.v1beta.Document] was
416
+ last indexed.
417
+ data_ingestion_source (str):
418
+ The data ingestion source of the
419
+ [Document][google.cloud.discoveryengine.v1beta.Document].
420
+
421
+ Allowed values are:
422
+
423
+ - ``batch``: Data ingested via Batch API, e.g.,
424
+ ImportDocuments.
425
+ - ``streaming`` Data ingested via Streaming API, e.g., FHIR
426
+ streaming.
427
+ """
428
+
429
+ class MatcherValue(proto.Message):
430
+ r"""The value of the matcher that was used to match the
431
+ [Document][google.cloud.discoveryengine.v1beta.Document].
432
+
433
+ This message has `oneof`_ fields (mutually exclusive fields).
434
+ For each oneof, at most one member field can be set at the same time.
435
+ Setting any member of the oneof automatically clears all other
436
+ members.
437
+
438
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
439
+
440
+ Attributes:
441
+ uri (str):
442
+ If match by URI, the URI of the
443
+ [Document][google.cloud.discoveryengine.v1beta.Document].
444
+
445
+ This field is a member of `oneof`_ ``matcher_value``.
446
+ fhir_resource (str):
447
+ Format:
448
+ projects/{project}/locations/{location}/datasets/{dataset}/fhirStores/{fhir_store}/fhir/{resource_type}/{fhir_resource_id}
449
+
450
+ This field is a member of `oneof`_ ``matcher_value``.
451
+ """
452
+
453
+ uri: str = proto.Field(
454
+ proto.STRING,
455
+ number=1,
456
+ oneof="matcher_value",
457
+ )
458
+ fhir_resource: str = proto.Field(
459
+ proto.STRING,
460
+ number=2,
461
+ oneof="matcher_value",
462
+ )
463
+
464
+ matcher_value: "BatchGetDocumentsMetadataResponse.DocumentMetadata.MatcherValue" = proto.Field(
465
+ proto.MESSAGE,
466
+ number=2,
467
+ message="BatchGetDocumentsMetadataResponse.DocumentMetadata.MatcherValue",
468
+ )
469
+ state: "BatchGetDocumentsMetadataResponse.State" = proto.Field(
470
+ proto.ENUM,
471
+ number=3,
472
+ enum="BatchGetDocumentsMetadataResponse.State",
473
+ )
474
+ last_refreshed_time: timestamp_pb2.Timestamp = proto.Field(
475
+ proto.MESSAGE,
476
+ number=4,
477
+ message=timestamp_pb2.Timestamp,
478
+ )
479
+ data_ingestion_source: str = proto.Field(
480
+ proto.STRING,
481
+ number=5,
482
+ )
483
+
484
+ documents_metadata: MutableSequence[DocumentMetadata] = proto.RepeatedField(
485
+ proto.MESSAGE,
486
+ number=1,
487
+ message=DocumentMetadata,
488
+ )
489
+
490
+
491
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/engine.py ADDED
@@ -0,0 +1,347 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import timestamp_pb2 # type: ignore
21
+ import proto # type: ignore
22
+
23
+ from google.cloud.discoveryengine_v1beta.types import common
24
+
25
+ __protobuf__ = proto.module(
26
+ package="google.cloud.discoveryengine.v1beta",
27
+ manifest={
28
+ "Engine",
29
+ },
30
+ )
31
+
32
+
33
+ class Engine(proto.Message):
34
+ r"""Metadata that describes the training and serving parameters of an
35
+ [Engine][google.cloud.discoveryengine.v1beta.Engine].
36
+
37
+ This message has `oneof`_ fields (mutually exclusive fields).
38
+ For each oneof, at most one member field can be set at the same time.
39
+ Setting any member of the oneof automatically clears all other
40
+ members.
41
+
42
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
43
+
44
+ Attributes:
45
+ chat_engine_config (google.cloud.discoveryengine_v1beta.types.Engine.ChatEngineConfig):
46
+ Configurations for the Chat Engine. Only applicable if
47
+ [solution_type][google.cloud.discoveryengine.v1beta.Engine.solution_type]
48
+ is
49
+ [SOLUTION_TYPE_CHAT][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_CHAT].
50
+
51
+ This field is a member of `oneof`_ ``engine_config``.
52
+ search_engine_config (google.cloud.discoveryengine_v1beta.types.Engine.SearchEngineConfig):
53
+ Configurations for the Search Engine. Only applicable if
54
+ [solution_type][google.cloud.discoveryengine.v1beta.Engine.solution_type]
55
+ is
56
+ [SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_SEARCH].
57
+
58
+ This field is a member of `oneof`_ ``engine_config``.
59
+ chat_engine_metadata (google.cloud.discoveryengine_v1beta.types.Engine.ChatEngineMetadata):
60
+ Output only. Additional information of the Chat Engine. Only
61
+ applicable if
62
+ [solution_type][google.cloud.discoveryengine.v1beta.Engine.solution_type]
63
+ is
64
+ [SOLUTION_TYPE_CHAT][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_CHAT].
65
+
66
+ This field is a member of `oneof`_ ``engine_metadata``.
67
+ name (str):
68
+ Immutable. The fully qualified resource name of the engine.
69
+
70
+ This field must be a UTF-8 encoded string with a length
71
+ limit of 1024 characters.
72
+
73
+ Format:
74
+ ``projects/{project}/locations/{location}/collections/{collection}/engines/{engine}``
75
+ engine should be 1-63 characters, and valid characters are
76
+ /[a-z0-9][a-z0-9-\_]*/. Otherwise, an INVALID_ARGUMENT error
77
+ is returned.
78
+ display_name (str):
79
+ Required. The display name of the engine.
80
+ Should be human readable. UTF-8 encoded string
81
+ with limit of 1024 characters.
82
+ create_time (google.protobuf.timestamp_pb2.Timestamp):
83
+ Output only. Timestamp the Recommendation
84
+ Engine was created at.
85
+ update_time (google.protobuf.timestamp_pb2.Timestamp):
86
+ Output only. Timestamp the Recommendation
87
+ Engine was last updated.
88
+ data_store_ids (MutableSequence[str]):
89
+ The data stores associated with this engine.
90
+
91
+ For
92
+ [SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_SEARCH]
93
+ and
94
+ [SOLUTION_TYPE_RECOMMENDATION][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_RECOMMENDATION]
95
+ type of engines, they can only associate with at most one
96
+ data store.
97
+
98
+ If
99
+ [solution_type][google.cloud.discoveryengine.v1beta.Engine.solution_type]
100
+ is
101
+ [SOLUTION_TYPE_CHAT][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_CHAT],
102
+ multiple
103
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]s
104
+ in the same
105
+ [Collection][google.cloud.discoveryengine.v1beta.Collection]
106
+ can be associated here.
107
+
108
+ Note that when used in
109
+ [CreateEngineRequest][google.cloud.discoveryengine.v1beta.CreateEngineRequest],
110
+ one DataStore id must be provided as the system will use it
111
+ for necessary initializations.
112
+ solution_type (google.cloud.discoveryengine_v1beta.types.SolutionType):
113
+ Required. The solutions of the engine.
114
+ industry_vertical (google.cloud.discoveryengine_v1beta.types.IndustryVertical):
115
+ The industry vertical that the engine registers. The
116
+ restriction of the Engine industry vertical is based on
117
+ [DataStore][google.cloud.discoveryengine.v1beta.DataStore]:
118
+ If unspecified, default to ``GENERIC``. Vertical on Engine
119
+ has to match vertical of the DataStore linked to the engine.
120
+ common_config (google.cloud.discoveryengine_v1beta.types.Engine.CommonConfig):
121
+ Common config spec that specifies the
122
+ metadata of the engine.
123
+ disable_analytics (bool):
124
+ Optional. Whether to disable analytics for
125
+ searches performed on this engine.
126
+ """
127
+
128
+ class SearchEngineConfig(proto.Message):
129
+ r"""Configurations for a Search Engine.
130
+
131
+ Attributes:
132
+ search_tier (google.cloud.discoveryengine_v1beta.types.SearchTier):
133
+ The search feature tier of this engine.
134
+
135
+ Different tiers might have different pricing. To learn more,
136
+ check the pricing documentation.
137
+
138
+ Defaults to
139
+ [SearchTier.SEARCH_TIER_STANDARD][google.cloud.discoveryengine.v1beta.SearchTier.SEARCH_TIER_STANDARD]
140
+ if not specified.
141
+ search_add_ons (MutableSequence[google.cloud.discoveryengine_v1beta.types.SearchAddOn]):
142
+ The add-on that this search engine enables.
143
+ """
144
+
145
+ search_tier: common.SearchTier = proto.Field(
146
+ proto.ENUM,
147
+ number=1,
148
+ enum=common.SearchTier,
149
+ )
150
+ search_add_ons: MutableSequence[common.SearchAddOn] = proto.RepeatedField(
151
+ proto.ENUM,
152
+ number=2,
153
+ enum=common.SearchAddOn,
154
+ )
155
+
156
+ class ChatEngineConfig(proto.Message):
157
+ r"""Configurations for a Chat Engine.
158
+
159
+ Attributes:
160
+ agent_creation_config (google.cloud.discoveryengine_v1beta.types.Engine.ChatEngineConfig.AgentCreationConfig):
161
+ The configurationt generate the Dialogflow agent that is
162
+ associated to this Engine.
163
+
164
+ Note that these configurations are one-time consumed by and
165
+ passed to Dialogflow service. It means they cannot be
166
+ retrieved using
167
+ [EngineService.GetEngine][google.cloud.discoveryengine.v1beta.EngineService.GetEngine]
168
+ or
169
+ [EngineService.ListEngines][google.cloud.discoveryengine.v1beta.EngineService.ListEngines]
170
+ API after engine creation.
171
+ dialogflow_agent_to_link (str):
172
+ The resource name of an exist Dialogflow agent to link to
173
+ this Chat Engine. Customers can either provide
174
+ ``agent_creation_config`` to create agent or provide an
175
+ agent name that links the agent with the Chat engine.
176
+
177
+ Format:
178
+ ``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>``.
179
+
180
+ Note that the ``dialogflow_agent_to_link`` are one-time
181
+ consumed by and passed to Dialogflow service. It means they
182
+ cannot be retrieved using
183
+ [EngineService.GetEngine][google.cloud.discoveryengine.v1beta.EngineService.GetEngine]
184
+ or
185
+ [EngineService.ListEngines][google.cloud.discoveryengine.v1beta.EngineService.ListEngines]
186
+ API after engine creation. Use
187
+ [ChatEngineMetadata.dialogflow_agent][google.cloud.discoveryengine.v1beta.Engine.ChatEngineMetadata.dialogflow_agent]
188
+ for actual agent association after Engine is created.
189
+ """
190
+
191
+ class AgentCreationConfig(proto.Message):
192
+ r"""Configurations for generating a Dialogflow agent.
193
+
194
+ Note that these configurations are one-time consumed by and passed
195
+ to Dialogflow service. It means they cannot be retrieved using
196
+ [EngineService.GetEngine][google.cloud.discoveryengine.v1beta.EngineService.GetEngine]
197
+ or
198
+ [EngineService.ListEngines][google.cloud.discoveryengine.v1beta.EngineService.ListEngines]
199
+ API after engine creation.
200
+
201
+ Attributes:
202
+ business (str):
203
+ Name of the company, organization or other
204
+ entity that the agent represents. Used for
205
+ knowledge connector LLM prompt and for knowledge
206
+ search.
207
+ default_language_code (str):
208
+ Required. The default language of the agent as a language
209
+ tag. See `Language
210
+ Support <https://cloud.google.com/dialogflow/docs/reference/language>`__
211
+ for a list of the currently supported language codes.
212
+ time_zone (str):
213
+ Required. The time zone of the agent from the `time zone
214
+ database <https://www.iana.org/time-zones>`__, e.g.,
215
+ America/New_York, Europe/Paris.
216
+ location (str):
217
+ Agent location for Agent creation, supported
218
+ values: global/us/eu. If not provided, us Engine
219
+ will create Agent using us-central-1 by default;
220
+ eu Engine will create Agent using eu-west-1 by
221
+ default.
222
+ """
223
+
224
+ business: str = proto.Field(
225
+ proto.STRING,
226
+ number=1,
227
+ )
228
+ default_language_code: str = proto.Field(
229
+ proto.STRING,
230
+ number=2,
231
+ )
232
+ time_zone: str = proto.Field(
233
+ proto.STRING,
234
+ number=3,
235
+ )
236
+ location: str = proto.Field(
237
+ proto.STRING,
238
+ number=4,
239
+ )
240
+
241
+ agent_creation_config: "Engine.ChatEngineConfig.AgentCreationConfig" = (
242
+ proto.Field(
243
+ proto.MESSAGE,
244
+ number=1,
245
+ message="Engine.ChatEngineConfig.AgentCreationConfig",
246
+ )
247
+ )
248
+ dialogflow_agent_to_link: str = proto.Field(
249
+ proto.STRING,
250
+ number=2,
251
+ )
252
+
253
+ class CommonConfig(proto.Message):
254
+ r"""Common configurations for an Engine.
255
+
256
+ Attributes:
257
+ company_name (str):
258
+ The name of the company, business or entity
259
+ that is associated with the engine. Setting this
260
+ may help improve LLM related features.
261
+ """
262
+
263
+ company_name: str = proto.Field(
264
+ proto.STRING,
265
+ number=1,
266
+ )
267
+
268
+ class ChatEngineMetadata(proto.Message):
269
+ r"""Additional information of a Chat Engine.
270
+ Fields in this message are output only.
271
+
272
+ Attributes:
273
+ dialogflow_agent (str):
274
+ The resource name of a Dialogflow agent, that this Chat
275
+ Engine refers to.
276
+
277
+ Format:
278
+ ``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>``.
279
+ """
280
+
281
+ dialogflow_agent: str = proto.Field(
282
+ proto.STRING,
283
+ number=1,
284
+ )
285
+
286
+ chat_engine_config: ChatEngineConfig = proto.Field(
287
+ proto.MESSAGE,
288
+ number=11,
289
+ oneof="engine_config",
290
+ message=ChatEngineConfig,
291
+ )
292
+ search_engine_config: SearchEngineConfig = proto.Field(
293
+ proto.MESSAGE,
294
+ number=13,
295
+ oneof="engine_config",
296
+ message=SearchEngineConfig,
297
+ )
298
+ chat_engine_metadata: ChatEngineMetadata = proto.Field(
299
+ proto.MESSAGE,
300
+ number=12,
301
+ oneof="engine_metadata",
302
+ message=ChatEngineMetadata,
303
+ )
304
+ name: str = proto.Field(
305
+ proto.STRING,
306
+ number=1,
307
+ )
308
+ display_name: str = proto.Field(
309
+ proto.STRING,
310
+ number=2,
311
+ )
312
+ create_time: timestamp_pb2.Timestamp = proto.Field(
313
+ proto.MESSAGE,
314
+ number=3,
315
+ message=timestamp_pb2.Timestamp,
316
+ )
317
+ update_time: timestamp_pb2.Timestamp = proto.Field(
318
+ proto.MESSAGE,
319
+ number=4,
320
+ message=timestamp_pb2.Timestamp,
321
+ )
322
+ data_store_ids: MutableSequence[str] = proto.RepeatedField(
323
+ proto.STRING,
324
+ number=5,
325
+ )
326
+ solution_type: common.SolutionType = proto.Field(
327
+ proto.ENUM,
328
+ number=6,
329
+ enum=common.SolutionType,
330
+ )
331
+ industry_vertical: common.IndustryVertical = proto.Field(
332
+ proto.ENUM,
333
+ number=16,
334
+ enum=common.IndustryVertical,
335
+ )
336
+ common_config: CommonConfig = proto.Field(
337
+ proto.MESSAGE,
338
+ number=15,
339
+ message=CommonConfig,
340
+ )
341
+ disable_analytics: bool = proto.Field(
342
+ proto.BOOL,
343
+ number=26,
344
+ )
345
+
346
+
347
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/engine_service.py ADDED
@@ -0,0 +1,354 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import field_mask_pb2 # type: ignore
21
+ from google.protobuf import timestamp_pb2 # type: ignore
22
+ import proto # type: ignore
23
+
24
+ from google.cloud.discoveryengine_v1beta.types import engine as gcd_engine
25
+
26
+ __protobuf__ = proto.module(
27
+ package="google.cloud.discoveryengine.v1beta",
28
+ manifest={
29
+ "CreateEngineRequest",
30
+ "CreateEngineMetadata",
31
+ "DeleteEngineRequest",
32
+ "DeleteEngineMetadata",
33
+ "GetEngineRequest",
34
+ "ListEnginesRequest",
35
+ "ListEnginesResponse",
36
+ "UpdateEngineRequest",
37
+ "PauseEngineRequest",
38
+ "ResumeEngineRequest",
39
+ "TuneEngineRequest",
40
+ "TuneEngineMetadata",
41
+ "TuneEngineResponse",
42
+ },
43
+ )
44
+
45
+
46
+ class CreateEngineRequest(proto.Message):
47
+ r"""Request for
48
+ [EngineService.CreateEngine][google.cloud.discoveryengine.v1beta.EngineService.CreateEngine]
49
+ method.
50
+
51
+ Attributes:
52
+ parent (str):
53
+ Required. The parent resource name, such as
54
+ ``projects/{project}/locations/{location}/collections/{collection}``.
55
+ engine (google.cloud.discoveryengine_v1beta.types.Engine):
56
+ Required. The
57
+ [Engine][google.cloud.discoveryengine.v1beta.Engine] to
58
+ create.
59
+ engine_id (str):
60
+ Required. The ID to use for the
61
+ [Engine][google.cloud.discoveryengine.v1beta.Engine], which
62
+ will become the final component of the
63
+ [Engine][google.cloud.discoveryengine.v1beta.Engine]'s
64
+ resource name.
65
+
66
+ This field must conform to
67
+ `RFC-1034 <https://tools.ietf.org/html/rfc1034>`__ standard
68
+ with a length limit of 63 characters. Otherwise, an
69
+ INVALID_ARGUMENT error is returned.
70
+ """
71
+
72
+ parent: str = proto.Field(
73
+ proto.STRING,
74
+ number=1,
75
+ )
76
+ engine: gcd_engine.Engine = proto.Field(
77
+ proto.MESSAGE,
78
+ number=2,
79
+ message=gcd_engine.Engine,
80
+ )
81
+ engine_id: str = proto.Field(
82
+ proto.STRING,
83
+ number=3,
84
+ )
85
+
86
+
87
+ class CreateEngineMetadata(proto.Message):
88
+ r"""Metadata related to the progress of the
89
+ [EngineService.CreateEngine][google.cloud.discoveryengine.v1beta.EngineService.CreateEngine]
90
+ operation. This will be returned by the
91
+ google.longrunning.Operation.metadata field.
92
+
93
+ Attributes:
94
+ create_time (google.protobuf.timestamp_pb2.Timestamp):
95
+ Operation create time.
96
+ update_time (google.protobuf.timestamp_pb2.Timestamp):
97
+ Operation last update time. If the operation
98
+ is done, this is also the finish time.
99
+ """
100
+
101
+ create_time: timestamp_pb2.Timestamp = proto.Field(
102
+ proto.MESSAGE,
103
+ number=1,
104
+ message=timestamp_pb2.Timestamp,
105
+ )
106
+ update_time: timestamp_pb2.Timestamp = proto.Field(
107
+ proto.MESSAGE,
108
+ number=2,
109
+ message=timestamp_pb2.Timestamp,
110
+ )
111
+
112
+
113
+ class DeleteEngineRequest(proto.Message):
114
+ r"""Request message for
115
+ [EngineService.DeleteEngine][google.cloud.discoveryengine.v1beta.EngineService.DeleteEngine]
116
+ method.
117
+
118
+ Attributes:
119
+ name (str):
120
+ Required. Full resource name of
121
+ [Engine][google.cloud.discoveryengine.v1beta.Engine], such
122
+ as
123
+ ``projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}``.
124
+
125
+ If the caller does not have permission to delete the
126
+ [Engine][google.cloud.discoveryengine.v1beta.Engine],
127
+ regardless of whether or not it exists, a PERMISSION_DENIED
128
+ error is returned.
129
+
130
+ If the [Engine][google.cloud.discoveryengine.v1beta.Engine]
131
+ to delete does not exist, a NOT_FOUND error is returned.
132
+ """
133
+
134
+ name: str = proto.Field(
135
+ proto.STRING,
136
+ number=1,
137
+ )
138
+
139
+
140
+ class DeleteEngineMetadata(proto.Message):
141
+ r"""Metadata related to the progress of the
142
+ [EngineService.DeleteEngine][google.cloud.discoveryengine.v1beta.EngineService.DeleteEngine]
143
+ operation. This will be returned by the
144
+ google.longrunning.Operation.metadata field.
145
+
146
+ Attributes:
147
+ create_time (google.protobuf.timestamp_pb2.Timestamp):
148
+ Operation create time.
149
+ update_time (google.protobuf.timestamp_pb2.Timestamp):
150
+ Operation last update time. If the operation
151
+ is done, this is also the finish time.
152
+ """
153
+
154
+ create_time: timestamp_pb2.Timestamp = proto.Field(
155
+ proto.MESSAGE,
156
+ number=1,
157
+ message=timestamp_pb2.Timestamp,
158
+ )
159
+ update_time: timestamp_pb2.Timestamp = proto.Field(
160
+ proto.MESSAGE,
161
+ number=2,
162
+ message=timestamp_pb2.Timestamp,
163
+ )
164
+
165
+
166
+ class GetEngineRequest(proto.Message):
167
+ r"""Request message for
168
+ [EngineService.GetEngine][google.cloud.discoveryengine.v1beta.EngineService.GetEngine]
169
+ method.
170
+
171
+ Attributes:
172
+ name (str):
173
+ Required. Full resource name of
174
+ [Engine][google.cloud.discoveryengine.v1beta.Engine], such
175
+ as
176
+ ``projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}``.
177
+ """
178
+
179
+ name: str = proto.Field(
180
+ proto.STRING,
181
+ number=1,
182
+ )
183
+
184
+
185
+ class ListEnginesRequest(proto.Message):
186
+ r"""Request message for
187
+ [EngineService.ListEngines][google.cloud.discoveryengine.v1beta.EngineService.ListEngines]
188
+ method.
189
+
190
+ Attributes:
191
+ parent (str):
192
+ Required. The parent resource name, such as
193
+ ``projects/{project}/locations/{location}/collections/{collection_id}``.
194
+ page_size (int):
195
+ Optional. Not supported.
196
+ page_token (str):
197
+ Optional. Not supported.
198
+ filter (str):
199
+ Optional. Filter by solution type. For example:
200
+ solution_type=SOLUTION_TYPE_SEARCH
201
+ """
202
+
203
+ parent: str = proto.Field(
204
+ proto.STRING,
205
+ number=1,
206
+ )
207
+ page_size: int = proto.Field(
208
+ proto.INT32,
209
+ number=2,
210
+ )
211
+ page_token: str = proto.Field(
212
+ proto.STRING,
213
+ number=3,
214
+ )
215
+ filter: str = proto.Field(
216
+ proto.STRING,
217
+ number=4,
218
+ )
219
+
220
+
221
+ class ListEnginesResponse(proto.Message):
222
+ r"""Response message for
223
+ [EngineService.ListEngines][google.cloud.discoveryengine.v1beta.EngineService.ListEngines]
224
+ method.
225
+
226
+ Attributes:
227
+ engines (MutableSequence[google.cloud.discoveryengine_v1beta.types.Engine]):
228
+ All the customer's
229
+ [Engine][google.cloud.discoveryengine.v1beta.Engine]s.
230
+ next_page_token (str):
231
+ Not supported.
232
+ """
233
+
234
+ @property
235
+ def raw_page(self):
236
+ return self
237
+
238
+ engines: MutableSequence[gcd_engine.Engine] = proto.RepeatedField(
239
+ proto.MESSAGE,
240
+ number=1,
241
+ message=gcd_engine.Engine,
242
+ )
243
+ next_page_token: str = proto.Field(
244
+ proto.STRING,
245
+ number=2,
246
+ )
247
+
248
+
249
+ class UpdateEngineRequest(proto.Message):
250
+ r"""Request message for
251
+ [EngineService.UpdateEngine][google.cloud.discoveryengine.v1beta.EngineService.UpdateEngine]
252
+ method.
253
+
254
+ Attributes:
255
+ engine (google.cloud.discoveryengine_v1beta.types.Engine):
256
+ Required. The
257
+ [Engine][google.cloud.discoveryengine.v1beta.Engine] to
258
+ update.
259
+
260
+ If the caller does not have permission to update the
261
+ [Engine][google.cloud.discoveryengine.v1beta.Engine],
262
+ regardless of whether or not it exists, a PERMISSION_DENIED
263
+ error is returned.
264
+
265
+ If the [Engine][google.cloud.discoveryengine.v1beta.Engine]
266
+ to update does not exist, a NOT_FOUND error is returned.
267
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
268
+ Indicates which fields in the provided
269
+ [Engine][google.cloud.discoveryengine.v1beta.Engine] to
270
+ update.
271
+
272
+ If an unsupported or unknown field is provided, an
273
+ INVALID_ARGUMENT error is returned.
274
+ """
275
+
276
+ engine: gcd_engine.Engine = proto.Field(
277
+ proto.MESSAGE,
278
+ number=1,
279
+ message=gcd_engine.Engine,
280
+ )
281
+ update_mask: field_mask_pb2.FieldMask = proto.Field(
282
+ proto.MESSAGE,
283
+ number=2,
284
+ message=field_mask_pb2.FieldMask,
285
+ )
286
+
287
+
288
+ class PauseEngineRequest(proto.Message):
289
+ r"""Request for pausing training of an engine.
290
+
291
+ Attributes:
292
+ name (str):
293
+ Required. The name of the engine to pause. Format:
294
+ ``projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}``
295
+ """
296
+
297
+ name: str = proto.Field(
298
+ proto.STRING,
299
+ number=1,
300
+ )
301
+
302
+
303
+ class ResumeEngineRequest(proto.Message):
304
+ r"""Request for resuming training of an engine.
305
+
306
+ Attributes:
307
+ name (str):
308
+ Required. The name of the engine to resume. Format:
309
+ ``projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}``
310
+ """
311
+
312
+ name: str = proto.Field(
313
+ proto.STRING,
314
+ number=1,
315
+ )
316
+
317
+
318
+ class TuneEngineRequest(proto.Message):
319
+ r"""Request to manually start a tuning process now (instead of
320
+ waiting for the periodically scheduled tuning to happen).
321
+
322
+ Attributes:
323
+ name (str):
324
+ Required. The resource name of the engine to tune. Format:
325
+ ``projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}``
326
+ """
327
+
328
+ name: str = proto.Field(
329
+ proto.STRING,
330
+ number=1,
331
+ )
332
+
333
+
334
+ class TuneEngineMetadata(proto.Message):
335
+ r"""Metadata associated with a tune operation.
336
+
337
+ Attributes:
338
+ engine (str):
339
+ Required. The resource name of the engine that this tune
340
+ applies to. Format:
341
+ ``projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}``
342
+ """
343
+
344
+ engine: str = proto.Field(
345
+ proto.STRING,
346
+ number=1,
347
+ )
348
+
349
+
350
+ class TuneEngineResponse(proto.Message):
351
+ r"""Response associated with a tune operation."""
352
+
353
+
354
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/evaluation.py ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import timestamp_pb2 # type: ignore
21
+ from google.rpc import status_pb2 # type: ignore
22
+ import proto # type: ignore
23
+
24
+ from google.cloud.discoveryengine_v1beta.types import search_service
25
+
26
+ __protobuf__ = proto.module(
27
+ package="google.cloud.discoveryengine.v1beta",
28
+ manifest={
29
+ "Evaluation",
30
+ "QualityMetrics",
31
+ },
32
+ )
33
+
34
+
35
+ class Evaluation(proto.Message):
36
+ r"""An evaluation is a single execution (or run) of an evaluation
37
+ process. It encapsulates the state of the evaluation and the
38
+ resulting data.
39
+
40
+ Attributes:
41
+ name (str):
42
+ Identifier. The full resource name of the
43
+ [Evaluation][google.cloud.discoveryengine.v1beta.Evaluation],
44
+ in the format of
45
+ ``projects/{project}/locations/{location}/evaluations/{evaluation}``.
46
+
47
+ This field must be a UTF-8 encoded string with a length
48
+ limit of 1024 characters.
49
+ evaluation_spec (google.cloud.discoveryengine_v1beta.types.Evaluation.EvaluationSpec):
50
+ Required. The specification of the
51
+ evaluation.
52
+ quality_metrics (google.cloud.discoveryengine_v1beta.types.QualityMetrics):
53
+ Output only. The metrics produced by the evaluation,
54
+ averaged across all
55
+ [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery]s
56
+ in the
57
+ [SampleQuerySet][google.cloud.discoveryengine.v1beta.SampleQuerySet].
58
+
59
+ Only populated when the evaluation's state is SUCCEEDED.
60
+ state (google.cloud.discoveryengine_v1beta.types.Evaluation.State):
61
+ Output only. The state of the evaluation.
62
+ error (google.rpc.status_pb2.Status):
63
+ Output only. The error that occurred during
64
+ evaluation. Only populated when the evaluation's
65
+ state is FAILED.
66
+ create_time (google.protobuf.timestamp_pb2.Timestamp):
67
+ Output only. Timestamp the
68
+ [Evaluation][google.cloud.discoveryengine.v1beta.Evaluation]
69
+ was created at.
70
+ end_time (google.protobuf.timestamp_pb2.Timestamp):
71
+ Output only. Timestamp the
72
+ [Evaluation][google.cloud.discoveryengine.v1beta.Evaluation]
73
+ was completed at.
74
+ error_samples (MutableSequence[google.rpc.status_pb2.Status]):
75
+ Output only. A sample of errors encountered
76
+ while processing the request.
77
+ """
78
+
79
+ class State(proto.Enum):
80
+ r"""Describes the state of an evaluation.
81
+
82
+ Values:
83
+ STATE_UNSPECIFIED (0):
84
+ The evaluation is unspecified.
85
+ PENDING (1):
86
+ The service is preparing to run the
87
+ evaluation.
88
+ RUNNING (2):
89
+ The evaluation is in progress.
90
+ SUCCEEDED (3):
91
+ The evaluation completed successfully.
92
+ FAILED (4):
93
+ The evaluation failed.
94
+ """
95
+ STATE_UNSPECIFIED = 0
96
+ PENDING = 1
97
+ RUNNING = 2
98
+ SUCCEEDED = 3
99
+ FAILED = 4
100
+
101
+ class EvaluationSpec(proto.Message):
102
+ r"""Describes the specification of the evaluation.
103
+
104
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
105
+
106
+ Attributes:
107
+ search_request (google.cloud.discoveryengine_v1beta.types.SearchRequest):
108
+ Required. The search request that is used to perform the
109
+ evaluation.
110
+
111
+ Only the following fields within SearchRequest are
112
+ supported; if any other fields are provided, an UNSUPPORTED
113
+ error will be returned:
114
+
115
+ - [SearchRequest.serving_config][google.cloud.discoveryengine.v1beta.SearchRequest.serving_config]
116
+ - [SearchRequest.branch][google.cloud.discoveryengine.v1beta.SearchRequest.branch]
117
+ - [SearchRequest.canonical_filter][google.cloud.discoveryengine.v1beta.SearchRequest.canonical_filter]
118
+ - [SearchRequest.query_expansion_spec][google.cloud.discoveryengine.v1beta.SearchRequest.query_expansion_spec]
119
+ - [SearchRequest.spell_correction_spec][google.cloud.discoveryengine.v1beta.SearchRequest.spell_correction_spec]
120
+ - [SearchRequest.content_search_spec][google.cloud.discoveryengine.v1beta.SearchRequest.content_search_spec]
121
+ - [SearchRequest.user_pseudo_id][google.cloud.discoveryengine.v1beta.SearchRequest.user_pseudo_id]
122
+
123
+ This field is a member of `oneof`_ ``search_spec``.
124
+ query_set_spec (google.cloud.discoveryengine_v1beta.types.Evaluation.EvaluationSpec.QuerySetSpec):
125
+ Required. The specification of the query set.
126
+ """
127
+
128
+ class QuerySetSpec(proto.Message):
129
+ r"""Describes the specification of the query set.
130
+
131
+ Attributes:
132
+ sample_query_set (str):
133
+ Required. The full resource name of the
134
+ [SampleQuerySet][google.cloud.discoveryengine.v1beta.SampleQuerySet]
135
+ used for the evaluation, in the format of
136
+ ``projects/{project}/locations/{location}/sampleQuerySets/{sampleQuerySet}``.
137
+ """
138
+
139
+ sample_query_set: str = proto.Field(
140
+ proto.STRING,
141
+ number=1,
142
+ )
143
+
144
+ search_request: search_service.SearchRequest = proto.Field(
145
+ proto.MESSAGE,
146
+ number=2,
147
+ oneof="search_spec",
148
+ message=search_service.SearchRequest,
149
+ )
150
+ query_set_spec: "Evaluation.EvaluationSpec.QuerySetSpec" = proto.Field(
151
+ proto.MESSAGE,
152
+ number=1,
153
+ message="Evaluation.EvaluationSpec.QuerySetSpec",
154
+ )
155
+
156
+ name: str = proto.Field(
157
+ proto.STRING,
158
+ number=1,
159
+ )
160
+ evaluation_spec: EvaluationSpec = proto.Field(
161
+ proto.MESSAGE,
162
+ number=2,
163
+ message=EvaluationSpec,
164
+ )
165
+ quality_metrics: "QualityMetrics" = proto.Field(
166
+ proto.MESSAGE,
167
+ number=3,
168
+ message="QualityMetrics",
169
+ )
170
+ state: State = proto.Field(
171
+ proto.ENUM,
172
+ number=4,
173
+ enum=State,
174
+ )
175
+ error: status_pb2.Status = proto.Field(
176
+ proto.MESSAGE,
177
+ number=5,
178
+ message=status_pb2.Status,
179
+ )
180
+ create_time: timestamp_pb2.Timestamp = proto.Field(
181
+ proto.MESSAGE,
182
+ number=6,
183
+ message=timestamp_pb2.Timestamp,
184
+ )
185
+ end_time: timestamp_pb2.Timestamp = proto.Field(
186
+ proto.MESSAGE,
187
+ number=7,
188
+ message=timestamp_pb2.Timestamp,
189
+ )
190
+ error_samples: MutableSequence[status_pb2.Status] = proto.RepeatedField(
191
+ proto.MESSAGE,
192
+ number=8,
193
+ message=status_pb2.Status,
194
+ )
195
+
196
+
197
+ class QualityMetrics(proto.Message):
198
+ r"""Describes the metrics produced by the evaluation.
199
+
200
+ Attributes:
201
+ doc_recall (google.cloud.discoveryengine_v1beta.types.QualityMetrics.TopkMetrics):
202
+ Recall per document, at various top-k cutoff levels.
203
+
204
+ Recall is the fraction of relevant documents retrieved out
205
+ of all relevant documents.
206
+
207
+ Example (top-5):
208
+
209
+ - For a single
210
+ [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery],
211
+ If 3 out of 5 relevant documents are retrieved in the
212
+ top-5, recall@5 = 3/5 = 0.6
213
+ doc_precision (google.cloud.discoveryengine_v1beta.types.QualityMetrics.TopkMetrics):
214
+ Precision per document, at various top-k cutoff levels.
215
+
216
+ Precision is the fraction of retrieved documents that are
217
+ relevant.
218
+
219
+ Example (top-5):
220
+
221
+ - For a single
222
+ [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery],
223
+ If 4 out of 5 retrieved documents in the top-5 are
224
+ relevant, precision@5 = 4/5 = 0.8
225
+ doc_ndcg (google.cloud.discoveryengine_v1beta.types.QualityMetrics.TopkMetrics):
226
+ Normalized discounted cumulative gain (NDCG) per document,
227
+ at various top-k cutoff levels.
228
+
229
+ NDCG measures the ranking quality, giving higher relevance
230
+ to top results.
231
+
232
+ Example (top-3): Suppose
233
+ [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery]
234
+ with three retrieved documents (D1, D2, D3) and binary
235
+ relevance judgements (1 for relevant, 0 for not relevant):
236
+
237
+ Retrieved: [D3 (0), D1 (1), D2 (1)] Ideal: [D1 (1), D2 (1),
238
+ D3 (0)]
239
+
240
+ Calculate NDCG@3 for each
241
+ [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery]:
242
+ \* DCG@3: 0/log2(1+1) + 1/log2(2+1) + 1/log2(3+1) = 1.13 \*
243
+ Ideal DCG@3: 1/log2(1+1) + 1/log2(2+1) + 0/log2(3+1) = 1.63
244
+ \* NDCG@3: 1.13/1.63 = 0.693
245
+ page_recall (google.cloud.discoveryengine_v1beta.types.QualityMetrics.TopkMetrics):
246
+ Recall per page, at various top-k cutoff levels.
247
+
248
+ Recall is the fraction of relevant pages retrieved out of
249
+ all relevant pages.
250
+
251
+ Example (top-5):
252
+
253
+ - For a single
254
+ [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery],
255
+ if 3 out of 5 relevant pages are retrieved in the top-5,
256
+ recall@5 = 3/5 = 0.6
257
+ page_ndcg (google.cloud.discoveryengine_v1beta.types.QualityMetrics.TopkMetrics):
258
+ Normalized discounted cumulative gain (NDCG) per page, at
259
+ various top-k cutoff levels.
260
+
261
+ NDCG measures the ranking quality, giving higher relevance
262
+ to top results.
263
+
264
+ Example (top-3): Suppose
265
+ [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery]
266
+ with three retrieved pages (P1, P2, P3) and binary relevance
267
+ judgements (1 for relevant, 0 for not relevant):
268
+
269
+ Retrieved: [P3 (0), P1 (1), P2 (1)] Ideal: [P1 (1), P2 (1),
270
+ P3 (0)]
271
+
272
+ Calculate NDCG@3 for
273
+ [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery]:
274
+ \* DCG@3: 0/log2(1+1) + 1/log2(2+1) + 1/log2(3+1) = 1.13 \*
275
+ Ideal DCG@3: 1/log2(1+1) + 1/log2(2+1) + 0/log2(3+1) = 1.63
276
+ \* NDCG@3: 1.13/1.63 = 0.693
277
+ """
278
+
279
+ class TopkMetrics(proto.Message):
280
+ r"""Stores the metric values at specific top-k levels.
281
+
282
+ Attributes:
283
+ top_1 (float):
284
+ The top-1 value.
285
+ top_3 (float):
286
+ The top-3 value.
287
+ top_5 (float):
288
+ The top-5 value.
289
+ top_10 (float):
290
+ The top-10 value.
291
+ """
292
+
293
+ top_1: float = proto.Field(
294
+ proto.DOUBLE,
295
+ number=1,
296
+ )
297
+ top_3: float = proto.Field(
298
+ proto.DOUBLE,
299
+ number=2,
300
+ )
301
+ top_5: float = proto.Field(
302
+ proto.DOUBLE,
303
+ number=3,
304
+ )
305
+ top_10: float = proto.Field(
306
+ proto.DOUBLE,
307
+ number=4,
308
+ )
309
+
310
+ doc_recall: TopkMetrics = proto.Field(
311
+ proto.MESSAGE,
312
+ number=1,
313
+ message=TopkMetrics,
314
+ )
315
+ doc_precision: TopkMetrics = proto.Field(
316
+ proto.MESSAGE,
317
+ number=2,
318
+ message=TopkMetrics,
319
+ )
320
+ doc_ndcg: TopkMetrics = proto.Field(
321
+ proto.MESSAGE,
322
+ number=3,
323
+ message=TopkMetrics,
324
+ )
325
+ page_recall: TopkMetrics = proto.Field(
326
+ proto.MESSAGE,
327
+ number=4,
328
+ message=TopkMetrics,
329
+ )
330
+ page_ndcg: TopkMetrics = proto.Field(
331
+ proto.MESSAGE,
332
+ number=5,
333
+ message=TopkMetrics,
334
+ )
335
+
336
+
337
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/evaluation_service.py ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ import proto # type: ignore
21
+
22
+ from google.cloud.discoveryengine_v1beta.types import evaluation as gcd_evaluation
23
+ from google.cloud.discoveryengine_v1beta.types import sample_query as gcd_sample_query
24
+
25
+ __protobuf__ = proto.module(
26
+ package="google.cloud.discoveryengine.v1beta",
27
+ manifest={
28
+ "GetEvaluationRequest",
29
+ "ListEvaluationsRequest",
30
+ "ListEvaluationsResponse",
31
+ "CreateEvaluationRequest",
32
+ "CreateEvaluationMetadata",
33
+ "ListEvaluationResultsRequest",
34
+ "ListEvaluationResultsResponse",
35
+ },
36
+ )
37
+
38
+
39
+ class GetEvaluationRequest(proto.Message):
40
+ r"""Request message for
41
+ [EvaluationService.GetEvaluation][google.cloud.discoveryengine.v1beta.EvaluationService.GetEvaluation]
42
+ method.
43
+
44
+ Attributes:
45
+ name (str):
46
+ Required. Full resource name of
47
+ [Evaluation][google.cloud.discoveryengine.v1beta.Evaluation],
48
+ such as
49
+ ``projects/{project}/locations/{location}/evaluations/{evaluation}``.
50
+
51
+ If the caller does not have permission to access the
52
+ [Evaluation][google.cloud.discoveryengine.v1beta.Evaluation],
53
+ regardless of whether or not it exists, a PERMISSION_DENIED
54
+ error is returned.
55
+
56
+ If the requested
57
+ [Evaluation][google.cloud.discoveryengine.v1beta.Evaluation]
58
+ does not exist, a NOT_FOUND error is returned.
59
+ """
60
+
61
+ name: str = proto.Field(
62
+ proto.STRING,
63
+ number=1,
64
+ )
65
+
66
+
67
+ class ListEvaluationsRequest(proto.Message):
68
+ r"""Request message for
69
+ [EvaluationService.ListEvaluations][google.cloud.discoveryengine.v1beta.EvaluationService.ListEvaluations]
70
+ method.
71
+
72
+ Attributes:
73
+ parent (str):
74
+ Required. The parent location resource name, such as
75
+ ``projects/{project}/locations/{location}``.
76
+
77
+ If the caller does not have permission to list
78
+ [Evaluation][google.cloud.discoveryengine.v1beta.Evaluation]s
79
+ under this location, regardless of whether or not this
80
+ location exists, a ``PERMISSION_DENIED`` error is returned.
81
+ page_size (int):
82
+ Maximum number of
83
+ [Evaluation][google.cloud.discoveryengine.v1beta.Evaluation]s
84
+ to return. If unspecified, defaults to 100. The maximum
85
+ allowed value is 1000. Values above 1000 will be coerced to
86
+ 1000.
87
+
88
+ If this field is negative, an ``INVALID_ARGUMENT`` error is
89
+ returned.
90
+ page_token (str):
91
+ A page token
92
+ [ListEvaluationsResponse.next_page_token][google.cloud.discoveryengine.v1beta.ListEvaluationsResponse.next_page_token],
93
+ received from a previous
94
+ [EvaluationService.ListEvaluations][google.cloud.discoveryengine.v1beta.EvaluationService.ListEvaluations]
95
+ call. Provide this to retrieve the subsequent page.
96
+
97
+ When paginating, all other parameters provided to
98
+ [EvaluationService.ListEvaluations][google.cloud.discoveryengine.v1beta.EvaluationService.ListEvaluations]
99
+ must match the call that provided the page token. Otherwise,
100
+ an ``INVALID_ARGUMENT`` error is returned.
101
+ """
102
+
103
+ parent: str = proto.Field(
104
+ proto.STRING,
105
+ number=1,
106
+ )
107
+ page_size: int = proto.Field(
108
+ proto.INT32,
109
+ number=2,
110
+ )
111
+ page_token: str = proto.Field(
112
+ proto.STRING,
113
+ number=3,
114
+ )
115
+
116
+
117
+ class ListEvaluationsResponse(proto.Message):
118
+ r"""Response message for
119
+ [EvaluationService.ListEvaluations][google.cloud.discoveryengine.v1beta.EvaluationService.ListEvaluations]
120
+ method.
121
+
122
+ Attributes:
123
+ evaluations (MutableSequence[google.cloud.discoveryengine_v1beta.types.Evaluation]):
124
+ The
125
+ [Evaluation][google.cloud.discoveryengine.v1beta.Evaluation]s.
126
+ next_page_token (str):
127
+ A token that can be sent as
128
+ [ListEvaluationsRequest.page_token][google.cloud.discoveryengine.v1beta.ListEvaluationsRequest.page_token]
129
+ to retrieve the next page. If this field is omitted, there
130
+ are no subsequent pages.
131
+ """
132
+
133
+ @property
134
+ def raw_page(self):
135
+ return self
136
+
137
+ evaluations: MutableSequence[gcd_evaluation.Evaluation] = proto.RepeatedField(
138
+ proto.MESSAGE,
139
+ number=1,
140
+ message=gcd_evaluation.Evaluation,
141
+ )
142
+ next_page_token: str = proto.Field(
143
+ proto.STRING,
144
+ number=2,
145
+ )
146
+
147
+
148
+ class CreateEvaluationRequest(proto.Message):
149
+ r"""Request message for
150
+ [EvaluationService.CreateEvaluation][google.cloud.discoveryengine.v1beta.EvaluationService.CreateEvaluation]
151
+ method.
152
+
153
+ Attributes:
154
+ parent (str):
155
+ Required. The parent resource name, such as
156
+ ``projects/{project}/locations/{location}``.
157
+ evaluation (google.cloud.discoveryengine_v1beta.types.Evaluation):
158
+ Required. The
159
+ [Evaluation][google.cloud.discoveryengine.v1beta.Evaluation]
160
+ to create.
161
+ """
162
+
163
+ parent: str = proto.Field(
164
+ proto.STRING,
165
+ number=1,
166
+ )
167
+ evaluation: gcd_evaluation.Evaluation = proto.Field(
168
+ proto.MESSAGE,
169
+ number=2,
170
+ message=gcd_evaluation.Evaluation,
171
+ )
172
+
173
+
174
+ class CreateEvaluationMetadata(proto.Message):
175
+ r"""Metadata for
176
+ [EvaluationService.CreateEvaluation][google.cloud.discoveryengine.v1beta.EvaluationService.CreateEvaluation]
177
+ method.
178
+
179
+ """
180
+
181
+
182
+ class ListEvaluationResultsRequest(proto.Message):
183
+ r"""Request message for
184
+ [EvaluationService.ListEvaluationResults][google.cloud.discoveryengine.v1beta.EvaluationService.ListEvaluationResults]
185
+ method.
186
+
187
+ Attributes:
188
+ evaluation (str):
189
+ Required. The evaluation resource name, such as
190
+ ``projects/{project}/locations/{location}/evaluations/{evaluation}``.
191
+
192
+ If the caller does not have permission to list
193
+ [EvaluationResult][] under this evaluation, regardless of
194
+ whether or not this evaluation set exists, a
195
+ ``PERMISSION_DENIED`` error is returned.
196
+ page_size (int):
197
+ Maximum number of [EvaluationResult][] to return. If
198
+ unspecified, defaults to 100. The maximum allowed value is
199
+ 1000. Values above 1000 will be coerced to 1000.
200
+
201
+ If this field is negative, an ``INVALID_ARGUMENT`` error is
202
+ returned.
203
+ page_token (str):
204
+ A page token
205
+ [ListEvaluationResultsResponse.next_page_token][google.cloud.discoveryengine.v1beta.ListEvaluationResultsResponse.next_page_token],
206
+ received from a previous
207
+ [EvaluationService.ListEvaluationResults][google.cloud.discoveryengine.v1beta.EvaluationService.ListEvaluationResults]
208
+ call. Provide this to retrieve the subsequent page.
209
+
210
+ When paginating, all other parameters provided to
211
+ [EvaluationService.ListEvaluationResults][google.cloud.discoveryengine.v1beta.EvaluationService.ListEvaluationResults]
212
+ must match the call that provided the page token. Otherwise,
213
+ an ``INVALID_ARGUMENT`` error is returned.
214
+ """
215
+
216
+ evaluation: str = proto.Field(
217
+ proto.STRING,
218
+ number=1,
219
+ )
220
+ page_size: int = proto.Field(
221
+ proto.INT32,
222
+ number=2,
223
+ )
224
+ page_token: str = proto.Field(
225
+ proto.STRING,
226
+ number=3,
227
+ )
228
+
229
+
230
+ class ListEvaluationResultsResponse(proto.Message):
231
+ r"""Response message for
232
+ [EvaluationService.ListEvaluationResults][google.cloud.discoveryengine.v1beta.EvaluationService.ListEvaluationResults]
233
+ method.
234
+
235
+ Attributes:
236
+ evaluation_results (MutableSequence[google.cloud.discoveryengine_v1beta.types.ListEvaluationResultsResponse.EvaluationResult]):
237
+ The
238
+ [EvaluationResult][google.cloud.discoveryengine.v1beta.ListEvaluationResultsResponse.EvaluationResult]s.
239
+ next_page_token (str):
240
+ A token that can be sent as
241
+ [ListEvaluationResultsRequest.page_token][google.cloud.discoveryengine.v1beta.ListEvaluationResultsRequest.page_token]
242
+ to retrieve the next page. If this field is omitted, there
243
+ are no subsequent pages.
244
+ """
245
+
246
+ class EvaluationResult(proto.Message):
247
+ r"""Represents the results of an evaluation for a single
248
+ [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery].
249
+
250
+ Attributes:
251
+ sample_query (google.cloud.discoveryengine_v1beta.types.SampleQuery):
252
+ Output only. The
253
+ [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery]
254
+ that was evaluated.
255
+ quality_metrics (google.cloud.discoveryengine_v1beta.types.QualityMetrics):
256
+ Output only. The metrics produced by the evaluation, for a
257
+ given
258
+ [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery].
259
+ """
260
+
261
+ sample_query: gcd_sample_query.SampleQuery = proto.Field(
262
+ proto.MESSAGE,
263
+ number=1,
264
+ message=gcd_sample_query.SampleQuery,
265
+ )
266
+ quality_metrics: gcd_evaluation.QualityMetrics = proto.Field(
267
+ proto.MESSAGE,
268
+ number=2,
269
+ message=gcd_evaluation.QualityMetrics,
270
+ )
271
+
272
+ @property
273
+ def raw_page(self):
274
+ return self
275
+
276
+ evaluation_results: MutableSequence[EvaluationResult] = proto.RepeatedField(
277
+ proto.MESSAGE,
278
+ number=1,
279
+ message=EvaluationResult,
280
+ )
281
+ next_page_token: str = proto.Field(
282
+ proto.STRING,
283
+ number=2,
284
+ )
285
+
286
+
287
+ __all__ = tuple(sorted(__protobuf__.manifest))
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/discoveryengine_v1beta/types/grounded_generation_service.py ADDED
@@ -0,0 +1,942 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ import proto # type: ignore
21
+
22
+ from google.cloud.discoveryengine_v1beta.types import grounding
23
+
24
+ __protobuf__ = proto.module(
25
+ package="google.cloud.discoveryengine.v1beta",
26
+ manifest={
27
+ "GroundedGenerationContent",
28
+ "GenerateGroundedContentRequest",
29
+ "GenerateGroundedContentResponse",
30
+ "CheckGroundingSpec",
31
+ "CheckGroundingRequest",
32
+ "CheckGroundingResponse",
33
+ },
34
+ )
35
+
36
+
37
+ class GroundedGenerationContent(proto.Message):
38
+ r"""Base structured datatype containing multi-part content of a
39
+ message.
40
+
41
+ Attributes:
42
+ role (str):
43
+ Producer of the content. Must be either ``user`` or
44
+ ``model``.
45
+
46
+ Intended to be used for multi-turn conversations. Otherwise,
47
+ it can be left unset.
48
+ parts (MutableSequence[google.cloud.discoveryengine_v1beta.types.GroundedGenerationContent.Part]):
49
+ Ordered ``Parts`` that constitute a single message.
50
+ """
51
+
52
+ class Part(proto.Message):
53
+ r"""Single part of content.
54
+
55
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
56
+
57
+ Attributes:
58
+ text (str):
59
+ Inline text.
60
+
61
+ This field is a member of `oneof`_ ``data``.
62
+ """
63
+
64
+ text: str = proto.Field(
65
+ proto.STRING,
66
+ number=1,
67
+ oneof="data",
68
+ )
69
+
70
+ role: str = proto.Field(
71
+ proto.STRING,
72
+ number=1,
73
+ )
74
+ parts: MutableSequence[Part] = proto.RepeatedField(
75
+ proto.MESSAGE,
76
+ number=2,
77
+ message=Part,
78
+ )
79
+
80
+
81
+ class GenerateGroundedContentRequest(proto.Message):
82
+ r"""Top-level message sent by the client for the
83
+ ``GenerateGroundedContent`` method.
84
+
85
+ Attributes:
86
+ location (str):
87
+ Required. Location resource.
88
+
89
+ Format: ``projects/{project}/locations/{location}``.
90
+ system_instruction (google.cloud.discoveryengine_v1beta.types.GroundedGenerationContent):
91
+ Content of the system instruction for the
92
+ current API.
93
+ These instructions will take priority over any
94
+ other prompt instructions if the selected model
95
+ is supporting them.
96
+ contents (MutableSequence[google.cloud.discoveryengine_v1beta.types.GroundedGenerationContent]):
97
+ Content of the current conversation with the
98
+ model.
99
+ For single-turn queries, this is a single
100
+ instance. For multi-turn queries, this is a
101
+ repeated field that contains conversation
102
+ history + latest request.
103
+ generation_spec (google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentRequest.GenerationSpec):
104
+ Content generation specification.
105
+ grounding_spec (google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentRequest.GroundingSpec):
106
+ Grounding specification.
107
+ user_labels (MutableMapping[str, str]):
108
+ The user labels applied to a resource must meet the
109
+ following requirements:
110
+
111
+ - Each resource can have multiple labels, up to a maximum of
112
+ 64.
113
+ - Each label must be a key-value pair.
114
+ - Keys have a minimum length of 1 character and a maximum
115
+ length of 63 characters and cannot be empty. Values can be
116
+ empty and have a maximum length of 63 characters.
117
+ - Keys and values can contain only lowercase letters,
118
+ numeric characters, underscores, and dashes. All
119
+ characters must use UTF-8 encoding, and international
120
+ characters are allowed.
121
+ - The key portion of a label must be unique. However, you
122
+ can use the same key with multiple resources.
123
+ - Keys must start with a lowercase letter or international
124
+ character.
125
+
126
+ See `Google Cloud
127
+ Document <https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements>`__
128
+ for more details.
129
+ """
130
+
131
+ class GenerationSpec(proto.Message):
132
+ r"""Content generation specification.
133
+
134
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
135
+
136
+ Attributes:
137
+ model_id (str):
138
+ Specifies which Vertex model id to use for
139
+ generation.
140
+ language_code (str):
141
+ Language code for content. Use language tags defined by
142
+ `BCP47 <https://www.rfc-editor.org/rfc/bcp/bcp47.txt>`__.
143
+ temperature (float):
144
+ If specified, custom value for the
145
+ temperature will be used.
146
+
147
+ This field is a member of `oneof`_ ``_temperature``.
148
+ top_p (float):
149
+ If specified, custom value for nucleus
150
+ sampling will be used.
151
+
152
+ This field is a member of `oneof`_ ``_top_p``.
153
+ top_k (int):
154
+ If specified, custom value for top-k sampling
155
+ will be used.
156
+
157
+ This field is a member of `oneof`_ ``_top_k``.
158
+ frequency_penalty (float):
159
+ If specified, custom value for frequency
160
+ penalty will be used.
161
+
162
+ This field is a member of `oneof`_ ``_frequency_penalty``.
163
+ presence_penalty (float):
164
+ If specified, custom value for presence
165
+ penalty will be used.
166
+
167
+ This field is a member of `oneof`_ ``_presence_penalty``.
168
+ max_output_tokens (int):
169
+ If specified, custom value for max output
170
+ tokens will be used.
171
+
172
+ This field is a member of `oneof`_ ``_max_output_tokens``.
173
+ """
174
+
175
+ model_id: str = proto.Field(
176
+ proto.STRING,
177
+ number=3,
178
+ )
179
+ language_code: str = proto.Field(
180
+ proto.STRING,
181
+ number=2,
182
+ )
183
+ temperature: float = proto.Field(
184
+ proto.FLOAT,
185
+ number=4,
186
+ optional=True,
187
+ )
188
+ top_p: float = proto.Field(
189
+ proto.FLOAT,
190
+ number=5,
191
+ optional=True,
192
+ )
193
+ top_k: int = proto.Field(
194
+ proto.INT32,
195
+ number=7,
196
+ optional=True,
197
+ )
198
+ frequency_penalty: float = proto.Field(
199
+ proto.FLOAT,
200
+ number=8,
201
+ optional=True,
202
+ )
203
+ presence_penalty: float = proto.Field(
204
+ proto.FLOAT,
205
+ number=9,
206
+ optional=True,
207
+ )
208
+ max_output_tokens: int = proto.Field(
209
+ proto.INT32,
210
+ number=10,
211
+ optional=True,
212
+ )
213
+
214
+ class DynamicRetrievalConfiguration(proto.Message):
215
+ r"""Describes the options to customize dynamic retrieval.
216
+
217
+ Attributes:
218
+ predictor (google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentRequest.DynamicRetrievalConfiguration.DynamicRetrievalPredictor):
219
+ Specification for the predictor for dynamic
220
+ retrieval.
221
+ """
222
+
223
+ class DynamicRetrievalPredictor(proto.Message):
224
+ r"""Describes the predictor settings for dynamic retrieval.
225
+
226
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
227
+
228
+ Attributes:
229
+ version (google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentRequest.DynamicRetrievalConfiguration.DynamicRetrievalPredictor.Version):
230
+ The version of the predictor to be used in
231
+ dynamic retrieval.
232
+ threshold (float):
233
+ The value of the threshold. If the predictor
234
+ will predict a value smaller than this, it would
235
+ suppress grounding in the source.
236
+
237
+ This field is a member of `oneof`_ ``_threshold``.
238
+ """
239
+
240
+ class Version(proto.Enum):
241
+ r"""The version of the predictor to be used in dynamic retrieval.
242
+
243
+ Values:
244
+ VERSION_UNSPECIFIED (0):
245
+ Automatically choose the best version of the
246
+ retrieval predictor.
247
+ V1_INDEPENDENT (1):
248
+ The V1 model which is evaluating each source
249
+ independently.
250
+ """
251
+ VERSION_UNSPECIFIED = 0
252
+ V1_INDEPENDENT = 1
253
+
254
+ version: "GenerateGroundedContentRequest.DynamicRetrievalConfiguration.DynamicRetrievalPredictor.Version" = proto.Field(
255
+ proto.ENUM,
256
+ number=1,
257
+ enum="GenerateGroundedContentRequest.DynamicRetrievalConfiguration.DynamicRetrievalPredictor.Version",
258
+ )
259
+ threshold: float = proto.Field(
260
+ proto.FLOAT,
261
+ number=2,
262
+ optional=True,
263
+ )
264
+
265
+ predictor: "GenerateGroundedContentRequest.DynamicRetrievalConfiguration.DynamicRetrievalPredictor" = proto.Field(
266
+ proto.MESSAGE,
267
+ number=1,
268
+ message="GenerateGroundedContentRequest.DynamicRetrievalConfiguration.DynamicRetrievalPredictor",
269
+ )
270
+
271
+ class GroundingSource(proto.Message):
272
+ r"""Grounding source.
273
+
274
+ This message has `oneof`_ fields (mutually exclusive fields).
275
+ For each oneof, at most one member field can be set at the same time.
276
+ Setting any member of the oneof automatically clears all other
277
+ members.
278
+
279
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
280
+
281
+ Attributes:
282
+ inline_source (google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentRequest.GroundingSource.InlineSource):
283
+ If set, grounding is performed with inline
284
+ content.
285
+
286
+ This field is a member of `oneof`_ ``source``.
287
+ search_source (google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentRequest.GroundingSource.SearchSource):
288
+ If set, grounding is performed with Vertex AI
289
+ Search.
290
+
291
+ This field is a member of `oneof`_ ``source``.
292
+ google_search_source (google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentRequest.GroundingSource.GoogleSearchSource):
293
+ If set, grounding is performed with Google
294
+ Search.
295
+
296
+ This field is a member of `oneof`_ ``source``.
297
+ """
298
+
299
+ class InlineSource(proto.Message):
300
+ r"""Message to be used for grounding based on inline content.
301
+
302
+ Attributes:
303
+ grounding_facts (MutableSequence[google.cloud.discoveryengine_v1beta.types.GroundingFact]):
304
+ List of facts to be used for grounding.
305
+ attributes (MutableMapping[str, str]):
306
+ Attributes associated with the content.
307
+
308
+ Common attributes include ``source`` (indicating where the
309
+ content was sourced from) and ``author`` (indicating the
310
+ author of the content).
311
+ """
312
+
313
+ grounding_facts: MutableSequence[
314
+ grounding.GroundingFact
315
+ ] = proto.RepeatedField(
316
+ proto.MESSAGE,
317
+ number=1,
318
+ message=grounding.GroundingFact,
319
+ )
320
+ attributes: MutableMapping[str, str] = proto.MapField(
321
+ proto.STRING,
322
+ proto.STRING,
323
+ number=2,
324
+ )
325
+
326
+ class SearchSource(proto.Message):
327
+ r"""Message to be used for grounding with Vertex AI Search.
328
+
329
+ Attributes:
330
+ serving_config (str):
331
+ The resource name of the Engine to use.
332
+
333
+ Format:
334
+ ``projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}/servingConfigs/{serving_config_id}``
335
+ max_result_count (int):
336
+ Number of search results to return.
337
+
338
+ The default value is 10. The maximumm allowed
339
+ value is 10.
340
+ filter (str):
341
+ Filter expression to be applied to the search.
342
+
343
+ The syntax is the same as
344
+ [SearchRequest.filter][google.cloud.discoveryengine.v1beta.SearchRequest.filter].
345
+ safe_search (bool):
346
+ If set, safe search is enabled in Vertex AI
347
+ Search requests.
348
+ """
349
+
350
+ serving_config: str = proto.Field(
351
+ proto.STRING,
352
+ number=1,
353
+ )
354
+ max_result_count: int = proto.Field(
355
+ proto.INT32,
356
+ number=2,
357
+ )
358
+ filter: str = proto.Field(
359
+ proto.STRING,
360
+ number=3,
361
+ )
362
+ safe_search: bool = proto.Field(
363
+ proto.BOOL,
364
+ number=5,
365
+ )
366
+
367
+ class GoogleSearchSource(proto.Message):
368
+ r"""Google Search config parameters.
369
+
370
+ Attributes:
371
+ dynamic_retrieval_config (google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentRequest.DynamicRetrievalConfiguration):
372
+ Optional. Specifies the dynamic retrieval
373
+ configuration for the given source.
374
+ """
375
+
376
+ dynamic_retrieval_config: "GenerateGroundedContentRequest.DynamicRetrievalConfiguration" = proto.Field(
377
+ proto.MESSAGE,
378
+ number=2,
379
+ message="GenerateGroundedContentRequest.DynamicRetrievalConfiguration",
380
+ )
381
+
382
+ inline_source: "GenerateGroundedContentRequest.GroundingSource.InlineSource" = (
383
+ proto.Field(
384
+ proto.MESSAGE,
385
+ number=1,
386
+ oneof="source",
387
+ message="GenerateGroundedContentRequest.GroundingSource.InlineSource",
388
+ )
389
+ )
390
+ search_source: "GenerateGroundedContentRequest.GroundingSource.SearchSource" = (
391
+ proto.Field(
392
+ proto.MESSAGE,
393
+ number=2,
394
+ oneof="source",
395
+ message="GenerateGroundedContentRequest.GroundingSource.SearchSource",
396
+ )
397
+ )
398
+ google_search_source: "GenerateGroundedContentRequest.GroundingSource.GoogleSearchSource" = proto.Field(
399
+ proto.MESSAGE,
400
+ number=3,
401
+ oneof="source",
402
+ message="GenerateGroundedContentRequest.GroundingSource.GoogleSearchSource",
403
+ )
404
+
405
+ class GroundingSpec(proto.Message):
406
+ r"""Grounding specification.
407
+
408
+ Attributes:
409
+ grounding_sources (MutableSequence[google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentRequest.GroundingSource]):
410
+ Grounding sources.
411
+ """
412
+
413
+ grounding_sources: MutableSequence[
414
+ "GenerateGroundedContentRequest.GroundingSource"
415
+ ] = proto.RepeatedField(
416
+ proto.MESSAGE,
417
+ number=1,
418
+ message="GenerateGroundedContentRequest.GroundingSource",
419
+ )
420
+
421
+ location: str = proto.Field(
422
+ proto.STRING,
423
+ number=1,
424
+ )
425
+ system_instruction: "GroundedGenerationContent" = proto.Field(
426
+ proto.MESSAGE,
427
+ number=5,
428
+ message="GroundedGenerationContent",
429
+ )
430
+ contents: MutableSequence["GroundedGenerationContent"] = proto.RepeatedField(
431
+ proto.MESSAGE,
432
+ number=2,
433
+ message="GroundedGenerationContent",
434
+ )
435
+ generation_spec: GenerationSpec = proto.Field(
436
+ proto.MESSAGE,
437
+ number=3,
438
+ message=GenerationSpec,
439
+ )
440
+ grounding_spec: GroundingSpec = proto.Field(
441
+ proto.MESSAGE,
442
+ number=4,
443
+ message=GroundingSpec,
444
+ )
445
+ user_labels: MutableMapping[str, str] = proto.MapField(
446
+ proto.STRING,
447
+ proto.STRING,
448
+ number=6,
449
+ )
450
+
451
+
452
+ class GenerateGroundedContentResponse(proto.Message):
453
+ r"""Response for the ``GenerateGroundedContent`` method.
454
+
455
+ Attributes:
456
+ candidates (MutableSequence[google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentResponse.Candidate]):
457
+ Generated candidates.
458
+ """
459
+
460
+ class Candidate(proto.Message):
461
+ r"""A response candidate generated from the model.
462
+
463
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
464
+
465
+ Attributes:
466
+ index (int):
467
+ Index of the candidate.
468
+ content (google.cloud.discoveryengine_v1beta.types.GroundedGenerationContent):
469
+ Content of the candidate.
470
+ grounding_score (float):
471
+ The overall grounding score for the candidate, in the range
472
+ of [0, 1].
473
+
474
+ This field is a member of `oneof`_ ``_grounding_score``.
475
+ grounding_metadata (google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentResponse.Candidate.GroundingMetadata):
476
+ Grounding metadata for the generated content.
477
+ """
478
+
479
+ class GroundingMetadata(proto.Message):
480
+ r"""Citation for the generated content.
481
+
482
+ Attributes:
483
+ retrieval_metadata (MutableSequence[google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentResponse.Candidate.GroundingMetadata.RetrievalMetadata]):
484
+ Retrieval metadata to provide an
485
+ understanding in the retrieval steps performed
486
+ by the model. There can be multiple such
487
+ messages which can correspond to different parts
488
+ of the retrieval. This is a mechanism used to
489
+ ensure transparency to our users.
490
+ support_chunks (MutableSequence[google.cloud.discoveryengine_v1beta.types.FactChunk]):
491
+ List of chunks to be attributed across all
492
+ claims in the candidate. These are derived from
493
+ the grounding sources supplied in the request.
494
+ web_search_queries (MutableSequence[str]):
495
+ Web search queries for the following-up web
496
+ search.
497
+ search_entry_point (google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentResponse.Candidate.GroundingMetadata.SearchEntryPoint):
498
+ Google search entry for the following-up web
499
+ searches.
500
+ grounding_support (MutableSequence[google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentResponse.Candidate.GroundingMetadata.GroundingSupport]):
501
+ GroundingSupport across all claims in the
502
+ answer candidate. An support to a fact indicates
503
+ that the claim is supported by the fact.
504
+ """
505
+
506
+ class RetrievalMetadata(proto.Message):
507
+ r"""Describes the metadata associated with a retrieval step.
508
+
509
+ Attributes:
510
+ source (google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentResponse.Candidate.GroundingMetadata.RetrievalMetadata.Source):
511
+ Describes the source to which the metadata is
512
+ referring to.
513
+ dynamic_retrieval_metadata (google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentResponse.Candidate.GroundingMetadata.DynamicRetrievalMetadata):
514
+ Metadata for dynamic retrieval.
515
+ """
516
+
517
+ class Source(proto.Enum):
518
+ r"""Describes the source to which the metadata is associated to.
519
+
520
+ Values:
521
+ SOURCE_UNSPECIFIED (0):
522
+ Unspecified source.
523
+ VERTEX_AI_SEARCH (1):
524
+ Vertex AI search.
525
+ GOOGLE_SEARCH (3):
526
+ Google Search.
527
+ INLINE_CONTENT (2):
528
+ User inline provided content.
529
+ GOOGLE_MAPS (4):
530
+ Google Maps.
531
+ """
532
+ SOURCE_UNSPECIFIED = 0
533
+ VERTEX_AI_SEARCH = 1
534
+ GOOGLE_SEARCH = 3
535
+ INLINE_CONTENT = 2
536
+ GOOGLE_MAPS = 4
537
+
538
+ source: "GenerateGroundedContentResponse.Candidate.GroundingMetadata.RetrievalMetadata.Source" = proto.Field(
539
+ proto.ENUM,
540
+ number=1,
541
+ enum="GenerateGroundedContentResponse.Candidate.GroundingMetadata.RetrievalMetadata.Source",
542
+ )
543
+ dynamic_retrieval_metadata: "GenerateGroundedContentResponse.Candidate.GroundingMetadata.DynamicRetrievalMetadata" = proto.Field(
544
+ proto.MESSAGE,
545
+ number=2,
546
+ message="GenerateGroundedContentResponse.Candidate.GroundingMetadata.DynamicRetrievalMetadata",
547
+ )
548
+
549
+ class DynamicRetrievalMetadata(proto.Message):
550
+ r"""Describes the metadata about dynamic retrieval.
551
+
552
+ Attributes:
553
+ predictor_metadata (google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentResponse.Candidate.GroundingMetadata.DynamicRetrievalPredictorMetadata):
554
+ Metadata for the dynamic retrieval predictor.
555
+ """
556
+
557
+ predictor_metadata: "GenerateGroundedContentResponse.Candidate.GroundingMetadata.DynamicRetrievalPredictorMetadata" = proto.Field(
558
+ proto.MESSAGE,
559
+ number=1,
560
+ message="GenerateGroundedContentResponse.Candidate.GroundingMetadata.DynamicRetrievalPredictorMetadata",
561
+ )
562
+
563
+ class DynamicRetrievalPredictorMetadata(proto.Message):
564
+ r"""Describes the metadata about the dynamic retrieval predictor.
565
+
566
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
567
+
568
+ Attributes:
569
+ version (google.cloud.discoveryengine_v1beta.types.GenerateGroundedContentResponse.Candidate.GroundingMetadata.DynamicRetrievalPredictorMetadata.Version):
570
+ The version of the predictor which was used
571
+ in dynamic retrieval.
572
+ prediction (float):
573
+ The value of the predictor. This should be between [0, 1]
574
+ where a value of 0 means that the query would not benefit
575
+ from grounding, while a value of 1.0 means that the query
576
+ would benefit the most. In between values allow to
577
+ differentiate between different usefulness scores for
578
+ grounding.
579
+
580
+ This field is a member of `oneof`_ ``_prediction``.
581
+ """
582
+
583
+ class Version(proto.Enum):
584
+ r"""The version of the predictor which was used in dynamic
585
+ retrieval.
586
+
587
+ Values:
588
+ VERSION_UNSPECIFIED (0):
589
+ Unspecified version, should never be used.
590
+ V1_INDEPENDENT (1):
591
+ The V1 model which is evaluating each source
592
+ independently.
593
+ """
594
+ VERSION_UNSPECIFIED = 0
595
+ V1_INDEPENDENT = 1
596
+
597
+ version: "GenerateGroundedContentResponse.Candidate.GroundingMetadata.DynamicRetrievalPredictorMetadata.Version" = proto.Field(
598
+ proto.ENUM,
599
+ number=1,
600
+ enum="GenerateGroundedContentResponse.Candidate.GroundingMetadata.DynamicRetrievalPredictorMetadata.Version",
601
+ )
602
+ prediction: float = proto.Field(
603
+ proto.FLOAT,
604
+ number=2,
605
+ optional=True,
606
+ )
607
+
608
+ class SearchEntryPoint(proto.Message):
609
+ r"""Google search entry point.
610
+
611
+ Attributes:
612
+ rendered_content (str):
613
+ Web content snippet that can be embedded in a
614
+ web page or an app webview.
615
+ sdk_blob (bytes):
616
+ Base64 encoded JSON representing array of
617
+ <search term, search url> tuple.
618
+ """
619
+
620
+ rendered_content: str = proto.Field(
621
+ proto.STRING,
622
+ number=1,
623
+ )
624
+ sdk_blob: bytes = proto.Field(
625
+ proto.BYTES,
626
+ number=2,
627
+ )
628
+
629
+ class GroundingSupport(proto.Message):
630
+ r"""Grounding info for a claim in the candidate and its support.
631
+
632
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
633
+
634
+ Attributes:
635
+ claim_text (str):
636
+ Text for the claim in the candidate. Always
637
+ provided when a support is found.
638
+ support_chunk_indices (MutableSequence[int]):
639
+ A list of indices (into 'support_chunks') specifying the
640
+ citations associated with the claim. For instance [1,3,4]
641
+ means that support_chunks[1], support_chunks[3],
642
+ support_chunks[4] are the chunks attributed to the claim.
643
+ support_score (float):
644
+ A score in the range of [0, 1] describing how grounded is a
645
+ specific claim in the support chunks indicated. Higher value
646
+ means that the claim is better supported by the chunks.
647
+
648
+ This field is a member of `oneof`_ ``_support_score``.
649
+ """
650
+
651
+ claim_text: str = proto.Field(
652
+ proto.STRING,
653
+ number=1,
654
+ )
655
+ support_chunk_indices: MutableSequence[int] = proto.RepeatedField(
656
+ proto.INT32,
657
+ number=3,
658
+ )
659
+ support_score: float = proto.Field(
660
+ proto.FLOAT,
661
+ number=2,
662
+ optional=True,
663
+ )
664
+
665
+ retrieval_metadata: MutableSequence[
666
+ "GenerateGroundedContentResponse.Candidate.GroundingMetadata.RetrievalMetadata"
667
+ ] = proto.RepeatedField(
668
+ proto.MESSAGE,
669
+ number=5,
670
+ message="GenerateGroundedContentResponse.Candidate.GroundingMetadata.RetrievalMetadata",
671
+ )
672
+ support_chunks: MutableSequence[grounding.FactChunk] = proto.RepeatedField(
673
+ proto.MESSAGE,
674
+ number=1,
675
+ message=grounding.FactChunk,
676
+ )
677
+ web_search_queries: MutableSequence[str] = proto.RepeatedField(
678
+ proto.STRING,
679
+ number=3,
680
+ )
681
+ search_entry_point: "GenerateGroundedContentResponse.Candidate.GroundingMetadata.SearchEntryPoint" = proto.Field(
682
+ proto.MESSAGE,
683
+ number=4,
684
+ message="GenerateGroundedContentResponse.Candidate.GroundingMetadata.SearchEntryPoint",
685
+ )
686
+ grounding_support: MutableSequence[
687
+ "GenerateGroundedContentResponse.Candidate.GroundingMetadata.GroundingSupport"
688
+ ] = proto.RepeatedField(
689
+ proto.MESSAGE,
690
+ number=2,
691
+ message="GenerateGroundedContentResponse.Candidate.GroundingMetadata.GroundingSupport",
692
+ )
693
+
694
+ index: int = proto.Field(
695
+ proto.INT32,
696
+ number=1,
697
+ )
698
+ content: "GroundedGenerationContent" = proto.Field(
699
+ proto.MESSAGE,
700
+ number=2,
701
+ message="GroundedGenerationContent",
702
+ )
703
+ grounding_score: float = proto.Field(
704
+ proto.FLOAT,
705
+ number=3,
706
+ optional=True,
707
+ )
708
+ grounding_metadata: "GenerateGroundedContentResponse.Candidate.GroundingMetadata" = proto.Field(
709
+ proto.MESSAGE,
710
+ number=4,
711
+ message="GenerateGroundedContentResponse.Candidate.GroundingMetadata",
712
+ )
713
+
714
+ candidates: MutableSequence[Candidate] = proto.RepeatedField(
715
+ proto.MESSAGE,
716
+ number=1,
717
+ message=Candidate,
718
+ )
719
+
720
+
721
+ class CheckGroundingSpec(proto.Message):
722
+ r"""Specification for the grounding check.
723
+
724
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
725
+
726
+ Attributes:
727
+ citation_threshold (float):
728
+ The threshold (in [0,1]) used for determining whether a fact
729
+ must be cited for a claim in the answer candidate. Choosing
730
+ a higher threshold will lead to fewer but very strong
731
+ citations, while choosing a lower threshold may lead to more
732
+ but somewhat weaker citations. If unset, the threshold will
733
+ default to 0.6.
734
+
735
+ This field is a member of `oneof`_ ``_citation_threshold``.
736
+ """
737
+
738
+ citation_threshold: float = proto.Field(
739
+ proto.DOUBLE,
740
+ number=1,
741
+ optional=True,
742
+ )
743
+
744
+
745
+ class CheckGroundingRequest(proto.Message):
746
+ r"""Request message for
747
+ [GroundedGenerationService.CheckGrounding][google.cloud.discoveryengine.v1beta.GroundedGenerationService.CheckGrounding]
748
+ method.
749
+
750
+ Attributes:
751
+ grounding_config (str):
752
+ Required. The resource name of the grounding config, such as
753
+ ``projects/*/locations/global/groundingConfigs/default_grounding_config``.
754
+ answer_candidate (str):
755
+ Answer candidate to check. It can have a
756
+ maximum length of 4096 tokens.
757
+ facts (MutableSequence[google.cloud.discoveryengine_v1beta.types.GroundingFact]):
758
+ List of facts for the grounding check.
759
+ We support up to 200 facts.
760
+ grounding_spec (google.cloud.discoveryengine_v1beta.types.CheckGroundingSpec):
761
+ Configuration of the grounding check.
762
+ user_labels (MutableMapping[str, str]):
763
+ The user labels applied to a resource must meet the
764
+ following requirements:
765
+
766
+ - Each resource can have multiple labels, up to a maximum of
767
+ 64.
768
+ - Each label must be a key-value pair.
769
+ - Keys have a minimum length of 1 character and a maximum
770
+ length of 63 characters and cannot be empty. Values can be
771
+ empty and have a maximum length of 63 characters.
772
+ - Keys and values can contain only lowercase letters,
773
+ numeric characters, underscores, and dashes. All
774
+ characters must use UTF-8 encoding, and international
775
+ characters are allowed.
776
+ - The key portion of a label must be unique. However, you
777
+ can use the same key with multiple resources.
778
+ - Keys must start with a lowercase letter or international
779
+ character.
780
+
781
+ See `Google Cloud
782
+ Document <https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements>`__
783
+ for more details.
784
+ """
785
+
786
+ grounding_config: str = proto.Field(
787
+ proto.STRING,
788
+ number=1,
789
+ )
790
+ answer_candidate: str = proto.Field(
791
+ proto.STRING,
792
+ number=2,
793
+ )
794
+ facts: MutableSequence[grounding.GroundingFact] = proto.RepeatedField(
795
+ proto.MESSAGE,
796
+ number=3,
797
+ message=grounding.GroundingFact,
798
+ )
799
+ grounding_spec: "CheckGroundingSpec" = proto.Field(
800
+ proto.MESSAGE,
801
+ number=4,
802
+ message="CheckGroundingSpec",
803
+ )
804
+ user_labels: MutableMapping[str, str] = proto.MapField(
805
+ proto.STRING,
806
+ proto.STRING,
807
+ number=5,
808
+ )
809
+
810
+
811
+ class CheckGroundingResponse(proto.Message):
812
+ r"""Response message for the
813
+ [GroundedGenerationService.CheckGrounding][google.cloud.discoveryengine.v1beta.GroundedGenerationService.CheckGrounding]
814
+ method.
815
+
816
+
817
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
818
+
819
+ Attributes:
820
+ support_score (float):
821
+ The support score for the input answer
822
+ candidate. Higher the score, higher is the
823
+ fraction of claims that are supported by the
824
+ provided facts. This is always set when a
825
+ response is returned.
826
+
827
+ This field is a member of `oneof`_ ``_support_score``.
828
+ cited_chunks (MutableSequence[google.cloud.discoveryengine_v1beta.types.FactChunk]):
829
+ List of facts cited across all claims in the
830
+ answer candidate. These are derived from the
831
+ facts supplied in the request.
832
+ cited_facts (MutableSequence[google.cloud.discoveryengine_v1beta.types.CheckGroundingResponse.CheckGroundingFactChunk]):
833
+ List of facts cited across all claims in the
834
+ answer candidate. These are derived from the
835
+ facts supplied in the request.
836
+ claims (MutableSequence[google.cloud.discoveryengine_v1beta.types.CheckGroundingResponse.Claim]):
837
+ Claim texts and citation info across all
838
+ claims in the answer candidate.
839
+ """
840
+
841
+ class CheckGroundingFactChunk(proto.Message):
842
+ r"""Fact chunk for grounding check.
843
+
844
+ Attributes:
845
+ chunk_text (str):
846
+ Text content of the fact chunk. Can be at
847
+ most 10K characters long.
848
+ """
849
+
850
+ chunk_text: str = proto.Field(
851
+ proto.STRING,
852
+ number=1,
853
+ )
854
+
855
+ class Claim(proto.Message):
856
+ r"""Text and citation info for a claim in the answer candidate.
857
+
858
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
859
+
860
+ Attributes:
861
+ start_pos (int):
862
+ Position indicating the start of the claim in
863
+ the answer candidate, measured in bytes.
864
+
865
+ This field is a member of `oneof`_ ``_start_pos``.
866
+ end_pos (int):
867
+ Position indicating the end of the claim in
868
+ the answer candidate, exclusive.
869
+
870
+ This field is a member of `oneof`_ ``_end_pos``.
871
+ claim_text (str):
872
+ Text for the claim in the answer candidate.
873
+ Always provided regardless of whether citations
874
+ or anti-citations are found.
875
+ citation_indices (MutableSequence[int]):
876
+ A list of indices (into 'cited_chunks') specifying the
877
+ citations associated with the claim. For instance [1,3,4]
878
+ means that cited_chunks[1], cited_chunks[3], cited_chunks[4]
879
+ are the facts cited supporting for the claim. A citation to
880
+ a fact indicates that the claim is supported by the fact.
881
+ grounding_check_required (bool):
882
+ Indicates that this claim required grounding check. When the
883
+ system decided this claim doesn't require
884
+ attribution/grounding check, this field will be set to
885
+ false. In that case, no grounding check was done for the
886
+ claim and therefore
887
+ [citation_indices][google.cloud.discoveryengine.v1beta.CheckGroundingResponse.Claim.citation_indices],
888
+ [anti_citation_indices][google.cloud.discoveryengine.v1beta.CheckGroundingResponse.Claim.anti_citation_indices],
889
+ and
890
+ [score][google.cloud.discoveryengine.v1beta.CheckGroundingResponse.Claim.score]
891
+ should not be returned.
892
+
893
+ This field is a member of `oneof`_ ``_grounding_check_required``.
894
+ """
895
+
896
+ start_pos: int = proto.Field(
897
+ proto.INT32,
898
+ number=1,
899
+ optional=True,
900
+ )
901
+ end_pos: int = proto.Field(
902
+ proto.INT32,
903
+ number=2,
904
+ optional=True,
905
+ )
906
+ claim_text: str = proto.Field(
907
+ proto.STRING,
908
+ number=3,
909
+ )
910
+ citation_indices: MutableSequence[int] = proto.RepeatedField(
911
+ proto.INT32,
912
+ number=4,
913
+ )
914
+ grounding_check_required: bool = proto.Field(
915
+ proto.BOOL,
916
+ number=6,
917
+ optional=True,
918
+ )
919
+
920
+ support_score: float = proto.Field(
921
+ proto.FLOAT,
922
+ number=1,
923
+ optional=True,
924
+ )
925
+ cited_chunks: MutableSequence[grounding.FactChunk] = proto.RepeatedField(
926
+ proto.MESSAGE,
927
+ number=3,
928
+ message=grounding.FactChunk,
929
+ )
930
+ cited_facts: MutableSequence[CheckGroundingFactChunk] = proto.RepeatedField(
931
+ proto.MESSAGE,
932
+ number=6,
933
+ message=CheckGroundingFactChunk,
934
+ )
935
+ claims: MutableSequence[Claim] = proto.RepeatedField(
936
+ proto.MESSAGE,
937
+ number=4,
938
+ message=Claim,
939
+ )
940
+
941
+
942
+ __all__ = tuple(sorted(__protobuf__.manifest))