Skip to content

Commit 6f392c8

Browse files
refactor(platform): Add support for Google vertex AI
- Removes the location from the start of the request url
1 parent 71e7cbe commit 6f392c8

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/platform/src/Bridge/VertexAi/Embeddings/ModelClient.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ public function supports(BaseModel $model): bool
4040
public function request(BaseModel $model, array|string $payload, array $options = []): RawHttpResult
4141
{
4242
$url = \sprintf(
43-
'https://%s-aiplatform.googleapis.com/v1/projects/%s/locations/%s/publishers/google/models/%s:%s',
44-
$this->location,
43+
'https://aiplatform.googleapis.com/v1/projects/%s/locations/%s/publishers/google/models/%s:%s',
4544
$this->projectId,
4645
$this->location,
4746
$model->getName(),

src/platform/src/Bridge/VertexAi/Gemini/ModelClient.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ public function supports(BaseModel $model): bool
3939
}
4040

4141
/**
42-
* @throws TransportExceptionInterface When the HTTP request fails due to network issues
42+
* @throws TransportExceptionInterface
4343
*/
4444
public function request(BaseModel $model, array|string $payload, array $options = []): RawHttpResult
4545
{
4646
$url = \sprintf(
47-
'https://%s-aiplatform.googleapis.com/v1/projects/%s/locations/%s/publishers/google/models/%s:%s',
48-
$this->location,
47+
'https://aiplatform.googleapis.com/v1/projects/%s/locations/%s/publishers/google/models/%s:%s',
4948
$this->projectId,
5049
$this->location,
5150
$model->getName(),

src/platform/tests/Bridge/VertexAi/Gemini/ModelClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testItInvokesTheTextModelsSuccessfully()
5252
$this->assertNotEmpty($info);
5353
$this->assertSame('POST', $info['http_method']);
5454
$this->assertSame(
55-
'https://global-aiplatform.googleapis.com/v1/projects/test/locations/global/publishers/google/models/gemini-2.0-flash:generateContent',
55+
'https://aiplatform.googleapis.com/v1/projects/test/locations/global/publishers/google/models/gemini-2.0-flash:generateContent',
5656
$info['url'],
5757
);
5858
$this->assertSame($expectedResponse, $data);

0 commit comments

Comments
 (0)