Skip to content

[Platform] Add support for Google vertex AI #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

junaidbinfarooq
Copy link
Contributor

@junaidbinfarooq junaidbinfarooq commented Aug 10, 2025

Q A
Bug fix? no
New feature? yes
Docs? yes
Issues #272
License MIT

Changes proposed:

  • Status: WIP
  • The pr aims to add support for Google's Vertex AI
  • Support is added for text generation and embeddings
  • I created a separate directory inside the Bridge directory for the said bridge. Moving forward, we could either create a new namespace named Google and add two namespaces inside it, one each for Gemini and VertexAi, or we could simply keep VertexAi and remove the other, as this api already supports Gemini and more. Either way, Normalize Gemini vs Google #146 would be addressed.
  • I exempted the use of api key from the implementation so far as VertexAi supports two auth mechanisms, Api keys and ADC ie., Application Default Credentials, but the former is recommended for testing while the latter is recommended for production, IIRC though it does need to install gCloud on the server and locally too (if verifying the behavior without an api key). Though I am yet to check it out programmatically, a curl request from the CLI does work with ADC.
  • More information can be found at https://cloud.google.com/vertex-ai/generative-ai/docs

- Adds initial support to integrate text generation using vertex AI
@junaidbinfarooq junaidbinfarooq changed the title feat(platform): Add support for Google vertex AI [Platform] Add support for Google vertex AI Aug 11, 2025
@junaidbinfarooq junaidbinfarooq marked this pull request as ready for review August 11, 2025 14:37
@carsonbot carsonbot added Feature New feature Platform Issues & PRs about the AI Platform component Status: Needs Review labels Aug 11, 2025
- Adds tests to verify the behavior
@junaidbinfarooq junaidbinfarooq force-pushed the feat/platform-support-for-vertex-ai branch 2 times, most recently from 14ae923 to 35d9a8b Compare August 11, 2025 21:53
@@ -22,6 +22,7 @@
"require": {
"php": ">=8.2",
"ext-fileinfo": "*",
"google/auth": "^1.47",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move it to require-dev and add a check for the class existence to the implementation, like in the Bedrock one for example:

if (!class_exists(BedrockRuntimeClient::class)) {
throw new RuntimeException('For using the Bedrock platform, the async-aws/bedrock-runtime package is required. Try running "composer require async-aws/bedrock-runtime".');
}

@junaidbinfarooq junaidbinfarooq force-pushed the feat/platform-support-for-vertex-ai branch from 35d9a8b to 9124195 Compare August 12, 2025 07:52
?Contract $contract = null,
): Platform {
if (!class_exists(ApplicationDefaultCredentials::class)) {
throw new RuntimeException('For using the Bedrock platform, the google/auth package is required. Try running "composer require google/auth".');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new RuntimeException('For using the Bedrock platform, the google/auth package is required. Try running "composer require google/auth".');
throw new RuntimeException('For using the Vertex AI platform, google/auth package is required for authentication via application default credentials. Try running "composer require google/auth".');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it already.
Pushing the change in a few moments.

Copy link

@faizanakram99 faizanakram99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, ship it

- Adds examples to interact with vertex ai
@junaidbinfarooq junaidbinfarooq force-pushed the feat/platform-support-for-vertex-ai branch from 9124195 to cd83b3b Compare August 12, 2025 09:13
@junaidbinfarooq
Copy link
Contributor Author

junaidbinfarooq commented Aug 12, 2025

lgtm, ship it

Docs and AI bundle integration need to be added first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature Platform Issues & PRs about the AI Platform component Status: Reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants