-
Notifications
You must be signed in to change notification settings - Fork 24
feat: add Google Vertex AI connector implementation #493
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
Merged
tae0y
merged 27 commits into
aliencube:main
from
hxcva1:feature/237-connector-impl-google-vertex-ai
Oct 29, 2025
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
448aa7f
feat: Add GoogleVertexAIConnector with settings validation and stubbe…
hxcva1 389481a
feat: Add GoogleVertexAIConnector to LanguageModelConnector factory
hxcva1 12d2bd6
feat: Add Google Vertex AI parameters and environment variables to in…
hxcva1 0be2a59
feat: Implement GoogleVertexAIConnector using GeminiChatClient
hxcva1 4c28c4c
test: Add unit tests for GoogleVertexAIConnector
hxcva1 319f6be
test: Fix failing tests for GoogleVertexAIConnector when model is mis…
hxcva1 4d05176
chore: Resolve conflicts between main.bicep and main.parameters.json
hxcva1 2dff61a
refactor: Replace magic strings with private const string in GoogleVe…
hxcva1 274a22a
Merge branch 'main' into feature/237-connector-impl-google-vertex-ai
hxcva1 d2e7f6d
test: Add new test cases to GoogleVertexAIConnectorTests
hxcva1 148ba33
test: Enable GoogleVertexAIConnector inheritance check in LanguageMod…
hxcva1 282cc6f
refactor: Remove unnecessary function parameter
hxcva1 e87a218
docs: Add Google Vertex AI (draft)
hxcva1 1c620b4
Merge branch 'main' into feature/237-connector-impl-google-vertex-ai
hxcva1 0c4314f
test: Add unit tests for GoogleVertexAIConnector (validation and clie…
hxcva1 4b57d77
fix: Resolve conflicts and add GoogleVertexAI parameters
hxcva1 a024cb7
test: Remove GoogleVertexAI from unsupported connector tests
hxcva1 97b8a06
Update google-vertex-ai.md
tae0y 0c2dc78
Update google-vertex-ai.md
tae0y f6cb575
Update README.md
tae0y 6159b2e
Update GoogleVertexAIConnectorType.cs
tae0y 5f8fe32
Update GoogleVertexAIConnector.cs
tae0y e73b518
Update GoogleVertexAIConnector.cs
tae0y 757ca03
Update GoogleVertexAIConnectorTests.cs
tae0y 09c8eb5
Merge branch 'main' into feature/237-connector-impl-google-vertex-ai
tae0y 12a78cb
Update resources.bicep
tae0y 9af34a4
Update resources.bicep
tae0y File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,241 @@ | ||
| # OpenChat Playground with Google Vertex AI | ||
|
|
||
| This page describes how to run OpenChat Playground (OCP) with Google Vertex AI integration. | ||
|
|
||
| ## Get the repository root | ||
|
|
||
| 1. Get the repository root. | ||
|
|
||
| ```bash | ||
| # bash/zsh | ||
| REPOSITORY_ROOT=$(git rev-parse --show-toplevel) | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell | ||
| $REPOSITORY_ROOT = git rev-parse --show-toplevel | ||
| ``` | ||
|
|
||
| ## Run on local machine | ||
|
|
||
| 1. Make sure you are at the repository root. | ||
|
|
||
| ```bash | ||
| cd $REPOSITORY_ROOT | ||
| ``` | ||
|
|
||
| 1. Add Google Vertex AI API Key. Replace `{{GOOGLE_VERTEX_AI_API_KEY}}` with your key. | ||
|
|
||
| ```bash | ||
| # bash/zsh | ||
| dotnet user-secrets --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp \ | ||
| set GoogleVertexAI:ApiKey "{{GOOGLE_VERTEX_AI_API_KEY}}" | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell | ||
| dotnet user-secrets --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp ` | ||
| set GoogleVertexAI:ApiKey "{{GOOGLE_VERTEX_AI_API_KEY}}" | ||
| ``` | ||
|
|
||
| > To get an API Key, refer to the doc [Using Gemini API keys](https://ai.google.dev/gemini-api/docs/api-key#api-keys). | ||
|
|
||
| 1. Run the app. The default model OCP uses is [Gemini 2.5 Flash Lite](https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-lite). | ||
|
|
||
| ```bash | ||
| # bash/zsh | ||
| dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- \ | ||
| --connector-type GoogleVertexAI | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell | ||
| dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- ` | ||
| --connector-type GoogleVertexAI | ||
| ``` | ||
|
|
||
| Alternatively, if you want to run with a different deployment, say [`gemini-2.5-pro`](https://ai.google.dev/gemini-api/docs/models#gemini-2.5-pro), other than the default one, you can specify it as an argument. | ||
|
|
||
| ```bash | ||
| # bash/zsh | ||
| dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- \ | ||
| --connector-type GoogleVertexAI \ | ||
| --model gemini-2.5-pro | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell | ||
| dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- ` | ||
| --connector-type GoogleVertexAI ` | ||
| --model gemini-2.5-pro | ||
| ``` | ||
|
|
||
| 1. Open your web browser at `http://localhost:5280` and start entering prompts. | ||
|
|
||
| ## Run in local container | ||
|
|
||
| 1. Make sure you are at the repository root. | ||
|
|
||
| ```bash | ||
| cd $REPOSITORY_ROOT | ||
| ``` | ||
|
|
||
| 1. Build a container. | ||
|
|
||
| ```bash | ||
| docker build -f Dockerfile -t openchat-playground:latest . | ||
| ``` | ||
|
|
||
| 1. Get the Google Vertex AI key. | ||
|
|
||
| ```bash | ||
| API_KEY=$(dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | \ | ||
| sed -n '/^\/\//d; p' | jq -r '."GoogleVertexAI:ApiKey"') | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell | ||
| $API_KEY = (dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | ` | ||
| Select-String -NotMatch '^//(BEGIN|END)' | ConvertFrom-Json).'GoogleVertexAI:ApiKey' | ||
| ``` | ||
|
|
||
| 1. Run the app. The default model OCP uses is [Gemini 2.5 Flash Lite](https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-lite). | ||
|
|
||
| ```bash | ||
| # bash/zsh - from locally built container | ||
| docker run -i --rm -p 8080:8080 openchat-playground:latest \ | ||
| --connector-type GoogleVertexAI \ | ||
| --api-key $API_KEY | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell - from locally built container | ||
| docker run -i --rm -p 8080:8080 openchat-playground:latest --connector-type GoogleVertexAI ` | ||
| --api-key $API_KEY | ||
| ``` | ||
|
|
||
| ```bash | ||
| # bash/zsh - from GitHub Container Registry | ||
| docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest \ | ||
| --connector-type GoogleVertexAI \ | ||
| --api-key $API_KEY | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell - from GitHub Container Registry | ||
| docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest ` | ||
| --connector-type GoogleVertexAI ` | ||
| --api-key $API_KEY ` | ||
| ``` | ||
|
|
||
| Alternatively, if you want to run with a different deployment, say [`gemini-2.5-pro`](https://ai.google.dev/gemini-api/docs/models#gemini-2.5-pro), other than the default one, you can specify it as an argument. | ||
|
|
||
| ```bash | ||
| # bash/zsh - from locally built container | ||
| docker run -i --rm -p 8080:8080 openchat-playground:latest \ | ||
| --connector-type GoogleVertexAI \ | ||
| --api-key $API_KEY \ | ||
| --model gemini-2.5-pro | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell - from locally built container | ||
| docker run -i --rm -p 8080:8080 openchat-playground:latest --connector-type GoogleVertexAI ` | ||
| --api-key $API_KEY ` | ||
| --model gemini-2.5-pro | ||
| ``` | ||
|
|
||
| ```bash | ||
| # bash/zsh - from GitHub Container Registry | ||
| docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest \ | ||
| --connector-type GoogleVertexAI \ | ||
| --api-key $API_KEY \ | ||
| --model gemini-2.5-pro | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell - from GitHub Container Registry | ||
| docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest ` | ||
| --connector-type GoogleVertexAI ` | ||
| --api-key $API_KEY ` | ||
| --model gemini-2.5-pro | ||
| ``` | ||
|
|
||
| 1. Open your web browser, navigate to `http://localhost:8080`, and enter prompts. | ||
|
|
||
| ## Run on Azure | ||
|
|
||
| 1. Make sure you are at the repository root. | ||
|
|
||
| ```bash | ||
| cd $REPOSITORY_ROOT | ||
| ``` | ||
|
|
||
| 1. Login to Azure: | ||
|
|
||
| ```bash | ||
| azd auth login | ||
| ``` | ||
|
|
||
| 1. Check login status. | ||
|
|
||
| ```bash | ||
| azd auth login --check-status | ||
| ``` | ||
|
|
||
| 1. Initialize `azd` template. | ||
|
|
||
| ```bash | ||
| azd init | ||
| ``` | ||
|
|
||
| > **NOTE**: You will be asked to provide environment name for provisioning. | ||
|
|
||
| 1. Get Google Vertex AI API Key. | ||
|
|
||
| ```bash | ||
| API_KEY=$(dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | \ | ||
| sed -n '/^\/\//d; p' | jq -r '."GoogleVertexAI:ApiKey"') | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell | ||
| $API_KEY = (dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | ` | ||
| Select-String -NotMatch '^//(BEGIN|END)' | ConvertFrom-Json).'GoogleVertexAI:ApiKey' | ||
| ``` | ||
|
|
||
| 1. Set Google Vertex AI configuration to azd environment variables. | ||
|
|
||
| ```bash | ||
| azd env set GOOGLE_VERTEX_AI_API_KEY $API_KEY | ||
| ``` | ||
|
|
||
| The default model OCP uses is [Gemini 2.5 Flash Lite](https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-lite). If you want to run with a different deployment, say [`gemini-2.5-pro`](https://ai.google.dev/gemini-api/docs/models#gemini-2.5-pro), other than the default one, add it to azd environment variables. | ||
|
|
||
| ```bash | ||
| azd env set GOOGLE_VERTEX_AI_MODEL gemini-2.5-pro | ||
| ``` | ||
|
|
||
| 1. Set the connector type to `GoogleVertexAI` | ||
|
|
||
| ```bash | ||
| azd env set CONNECTOR_TYPE GoogleVertexAI | ||
| ``` | ||
|
|
||
| 1. Provision and deploy: | ||
|
|
||
| ```bash | ||
| azd up | ||
| ``` | ||
|
|
||
| > **NOTE**: You will be asked to provide Azure subscription and location for deployment. | ||
|
|
||
| Once deployed, you will be able to see the deployed OCP app URL. | ||
|
|
||
| 1. Open your web browser, navigate to the OCP app URL, and enter prompts. | ||
|
|
||
| 1. Clean up: | ||
|
|
||
| ```bash | ||
| azd down --force --purge | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.