@@ -194,18 +194,20 @@ def encryption_spec_key_name(self) -> Optional[str]:
194
194
return self ._encryption_spec_key_name
195
195
196
196
def get_client_options (
197
- self , location_override : Optional [str ] = None , prediction_client : bool = False
197
+ self ,
198
+ location_override : Optional [str ] = None ,
199
+ prediction_client : bool = False ,
200
+ api_base_path_override : Optional [str ] = None ,
198
201
) -> client_options .ClientOptions :
199
202
"""Creates GAPIC client_options using location and type.
200
203
201
204
Args:
202
205
location_override (str):
203
- Set this parameter to get client options for a location different from
204
- location set by initializer. Must be a GCP region supported by AI
205
- Platform (Unified).
206
- prediction_client (str): Optional flag to use a prediction endpoint.
207
-
208
-
206
+ Optional. Set this parameter to get client options for a location different
207
+ from location set by initializer. Must be a GCP region supported by
208
+ Vertex AI.
209
+ prediction_client (str): Optional. flag to use a prediction endpoint.
210
+ api_base_path_override (str): Optional. Override default API base path.
209
211
Returns:
210
212
clients_options (google.api_core.client_options.ClientOptions):
211
213
A ClientOptions object set with regionalized API endpoint, i.e.
@@ -222,7 +224,7 @@ def get_client_options(
222
224
223
225
utils .validate_region (region )
224
226
225
- service_base_path = (
227
+ service_base_path = api_base_path_override or (
226
228
constants .PREDICTION_API_BASE_PATH
227
229
if prediction_client
228
230
else constants .API_BASE_PATH
@@ -261,17 +263,19 @@ def create_client(
261
263
credentials : Optional [auth_credentials .Credentials ] = None ,
262
264
location_override : Optional [str ] = None ,
263
265
prediction_client : bool = False ,
266
+ api_base_path_override : Optional [str ] = None ,
264
267
) -> utils .VertexAiServiceClientWithOverride :
265
268
"""Instantiates a given VertexAiServiceClient with optional
266
269
overrides.
267
270
268
271
Args:
269
272
client_class (utils.VertexAiServiceClientWithOverride):
270
- ( Required) A Vertex AI Service Client with optional overrides.
273
+ Required. A Vertex AI Service Client with optional overrides.
271
274
credentials (auth_credentials.Credentials):
272
- Custom auth credentials. If not provided will use the current config.
273
- location_override (str): Optional location override.
274
- prediction_client (str): Optional flag to use a prediction endpoint.
275
+ Optional. Custom auth credentials. If not provided will use the current config.
276
+ location_override (str): Optional. location override.
277
+ prediction_client (str): Optional. flag to use a prediction endpoint.
278
+ api_base_path_override (str): Optional. Override default api base path.
275
279
Returns:
276
280
client: Instantiated Vertex AI Service client with optional overrides
277
281
"""
@@ -288,6 +292,7 @@ def create_client(
288
292
"client_options" : self .get_client_options (
289
293
location_override = location_override ,
290
294
prediction_client = prediction_client ,
295
+ api_base_path_override = api_base_path_override ,
291
296
),
292
297
"client_info" : client_info ,
293
298
}
0 commit comments