File tree Expand file tree Collapse file tree
anthropic-java-vertex/src
main/kotlin/com/anthropic/vertex/backends
test/kotlin/com/anthropic/vertex/backends Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,8 +45,11 @@ private constructor(
4545 }
4646
4747 override fun baseUrl (): String =
48- if (region == " global" ) " https://aiplatform.googleapis.com"
49- else " https://$region -aiplatform.googleapis.com"
48+ when (region) {
49+ " global" -> " https://aiplatform.googleapis.com"
50+ " us" -> " https://aiplatform.us.rep.googleapis.com"
51+ else -> " https://$region -aiplatform.googleapis.com"
52+ }
5053
5154 override fun prepareRequest (request : HttpRequest ): HttpRequest {
5255 val pathSegments = request.pathSegments
Original file line number Diff line number Diff line change @@ -71,6 +71,22 @@ internal class VertexBackendTest {
7171 assertThat(backend.baseUrl()).isEqualTo(" https://$GC_REGION -aiplatform.googleapis.com" )
7272 }
7373
74+ @Test
75+ fun baseUrlGlobalRegion () {
76+ val backend1 = createBackend()
77+ val globalBackend = createBackend(backend1.googleCredentials, " global" , backend1.project)
78+
79+ assertThat(globalBackend.baseUrl()).isEqualTo(" https://aiplatform.googleapis.com" )
80+ }
81+
82+ @Test
83+ fun baseUrlUsRegion () {
84+ val backend1 = createBackend()
85+ val usBackend = createBackend(backend1.googleCredentials, " us" , backend1.project)
86+
87+ assertThat(usBackend.baseUrl()).isEqualTo(" https://aiplatform.us.rep.googleapis.com" )
88+ }
89+
7490 @Test
7591 fun baseUrlOtherRegion () {
7692 // Try with a *different* region to confirm that it is not hard-coded.
@@ -82,14 +98,6 @@ internal class VertexBackendTest {
8298 assertThat(backend2.baseUrl()).isEqualTo(" https://$otherRegion -aiplatform.googleapis.com" )
8399 }
84100
85- @Test
86- fun baseUrlGlobalRegion () {
87- val backend1 = createBackend()
88- val globalBackend = createBackend(backend1.googleCredentials, " global" , backend1.project)
89-
90- assertThat(globalBackend.baseUrl()).isEqualTo(" https://aiplatform.googleapis.com" )
91- }
92-
93101 @Test
94102 fun prepareRequestMissingJSON () {
95103 val backend = createBackend()
You can’t perform that action at this time.
0 commit comments