File tree Expand file tree Collapse file tree
tests/unit/vertexai/genai Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,6 +52,13 @@ def test_genai_client(self):
5252 assert test_client ._api_client .project == _TEST_PROJECT
5353 assert test_client ._api_client .location == _TEST_LOCATION
5454
55+ @pytest .mark .parametrize ("location" , ["us" , "eu" ])
56+ @pytest .mark .usefixtures ("google_auth_mock" )
57+ def test_genai_client_mrep (self , location ):
58+ test_client = vertexai .Client (project = _TEST_PROJECT , location = location )
59+ expected_url = f"https://aiplatform.{ location } .rep.googleapis.com/"
60+ assert test_client ._api_client ._http_options .base_url == expected_url
61+
5562 @pytest .mark .asyncio
5663 @pytest .mark .usefixtures ("google_auth_mock" )
5764 async def test_async_client (self ):
Original file line number Diff line number Diff line change @@ -219,6 +219,12 @@ def __init__(
219219 if http_options .headers is None :
220220 http_options .headers = {}
221221
222+ # Set the base URL for MREP locations.
223+ if location in ["us" , "eu" ] and not http_options .base_url :
224+ http_options .base_url = (
225+ f"https://aiplatform.{ location } .rep.googleapis.com/"
226+ )
227+
222228 tracking_label = f"{ _GENAI_MODULES_TELEMETRY_HEADER } /{ aip_version .__version__ } "
223229
224230 if "user-agent" in http_options .headers :
You can’t perform that action at this time.
0 commit comments