Skip to content

Commit 59853c6

Browse files
committed
deploy: feat(embeddingModel): Add Backend API selection fields (googleapis#2592)
Allow users to use both VertexAI and Google AI as gemini embedding model backend. - Use ADC for VertexAI authentication (either configure `project` and `location` inside the yaml file or as env vars). - Use API key for Google AI authentication. 912aa9e
1 parent bbd21e1 commit 59853c6

30 files changed

+95
-63
lines changed

dev/documentation/configuration/embedding-models/gemini/index.html

Lines changed: 22 additions & 12 deletions
Large diffs are not rendered by default.

dev/documentation/configuration/embedding-models/index.html

Lines changed: 4 additions & 2 deletions
Large diffs are not rendered by default.

dev/documentation/configuration/embedding-models/index.xml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
<p>Google Gemini provides state-of-the-art embedding models that convert text into
33
high-dimensional vectors.</p>
44
<h3 id="authentication">Authentication</h3>
5-
<p>Toolbox uses your <a href="https://cloud.google.com/docs/authentication#adc">Application Default Credentials
6-
(ADC)</a> to authorize with the
7-
Gemini API client.</p>
8-
<p>Optionally, you can use an <a href="https://ai.google.dev/gemini-api/docs/api-key#api-keys">API key</a> obtain an API
9-
Key from the <a href="https://aistudio.google.com/app/apikey">Google AI Studio</a>.</p>
10-
<p>We recommend using an API key for testing and using application default
11-
credentials for production.</p>
12-
<h2 id="behavior">Behavior</h2>
13-
<h3 id="automatic-vectorization">Automatic Vectorization</h3>
14-
<p>When a tool parameter is configured with <code>embeddedBy: <your-gemini-model-name></code>,
15-
the Toolbox intercepts the raw text input from the client and sends it to the
16-
Gemini API. The resulting numerical array is then formatted before being passed
17-
to your database source.&lt;/p></description></item></channel></rss>
5+
&lt;p>Toolbox supports two authentication modes:&lt;/p>
6+
&lt;ol>
7+
&lt;li>&lt;strong>Google AI (API Key):&lt;/strong> Used if you
8+
provide &lt;code>apiKey&lt;/code> (or set &lt;code>GOOGLE_API_KEY&lt;/code>/&lt;code>GEMINI_API_KEY&lt;/code> environment
9+
variables). This uses the &lt;a href="https://aistudio.google.com/app/apikey">Google AI Studio&lt;/a> backend.&lt;/li>
10+
&lt;li>&lt;strong>Vertex AI (ADC):&lt;/strong> Used if provided &lt;code>project&lt;/code> and &lt;code>location&lt;/code> (or set
11+
&lt;code>GOOGLE_CLOUD_PROJECT&lt;/code>/&lt;code>GOOGLE_CLOUD_LOCATION&lt;/code> environment variables). This uses &lt;a href="https://cloud.google.com/docs/authentication#adc">Application
12+
Default Credentials (ADC)&lt;/a>.&lt;/li>
13+
&lt;/ol>
14+
&lt;p>We recommend using an API key for quick testing and using Vertex AI with ADC for
15+
production environments.&lt;/p></description></item></channel></rss>

dev/index.xml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4140,19 +4140,17 @@ reporting with source positions and code snippets.&lt;/p>
41404140
&lt;p>Google Gemini provides state-of-the-art embedding models that convert text into
41414141
high-dimensional vectors.&lt;/p>
41424142
&lt;h3 id="authentication">Authentication&lt;/h3>
4143-
&lt;p>Toolbox uses your &lt;a href="https://cloud.google.com/docs/authentication#adc">Application Default Credentials
4144-
(ADC)&lt;/a> to authorize with the
4145-
Gemini API client.&lt;/p>
4146-
&lt;p>Optionally, you can use an &lt;a href="https://ai.google.dev/gemini-api/docs/api-key#api-keys">API key&lt;/a> obtain an API
4147-
Key from the &lt;a href="https://aistudio.google.com/app/apikey">Google AI Studio&lt;/a>.&lt;/p>
4148-
&lt;p>We recommend using an API key for testing and using application default
4149-
credentials for production.&lt;/p>
4150-
&lt;h2 id="behavior">Behavior&lt;/h2>
4151-
&lt;h3 id="automatic-vectorization">Automatic Vectorization&lt;/h3>
4152-
&lt;p>When a tool parameter is configured with &lt;code>embeddedBy: &amp;lt;your-gemini-model-name&amp;gt;&lt;/code>,
4153-
the Toolbox intercepts the raw text input from the client and sends it to the
4154-
Gemini API. The resulting numerical array is then formatted before being passed
4155-
to your database source.&lt;/p></description></item><item><title>Google Sign-In</title><link>https://renovate-bot.github.io/googleapis-_-genai-toolbox/dev/documentation/configuration/authentication/google/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://renovate-bot.github.io/googleapis-_-genai-toolbox/dev/documentation/configuration/authentication/google/</guid><description>&lt;h2 id="getting-started">Getting Started&lt;/h2>
4143+
&lt;p>Toolbox supports two authentication modes:&lt;/p>
4144+
&lt;ol>
4145+
&lt;li>&lt;strong>Google AI (API Key):&lt;/strong> Used if you
4146+
provide &lt;code>apiKey&lt;/code> (or set &lt;code>GOOGLE_API_KEY&lt;/code>/&lt;code>GEMINI_API_KEY&lt;/code> environment
4147+
variables). This uses the &lt;a href="https://aistudio.google.com/app/apikey">Google AI Studio&lt;/a> backend.&lt;/li>
4148+
&lt;li>&lt;strong>Vertex AI (ADC):&lt;/strong> Used if provided &lt;code>project&lt;/code> and &lt;code>location&lt;/code> (or set
4149+
&lt;code>GOOGLE_CLOUD_PROJECT&lt;/code>/&lt;code>GOOGLE_CLOUD_LOCATION&lt;/code> environment variables). This uses &lt;a href="https://cloud.google.com/docs/authentication#adc">Application
4150+
Default Credentials (ADC)&lt;/a>.&lt;/li>
4151+
&lt;/ol>
4152+
&lt;p>We recommend using an API key for quick testing and using Vertex AI with ADC for
4153+
production environments.&lt;/p></description></item><item><title>Google Sign-In</title><link>https://renovate-bot.github.io/googleapis-_-genai-toolbox/dev/documentation/configuration/authentication/google/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://renovate-bot.github.io/googleapis-_-genai-toolbox/dev/documentation/configuration/authentication/google/</guid><description>&lt;h2 id="getting-started">Getting Started&lt;/h2>
41564154
&lt;p>Google Sign-In manages the OAuth 2.0 flow and token lifecycle. To integrate the
41574155
Google Sign-In workflow to your web app &lt;a href="https://developers.google.com/identity/sign-in/web/sign-in">follow this guide&lt;/a>.&lt;/p>
41584156
&lt;p>After setting up the Google Sign-In workflow, you should have registered your

dev/llms-full.txt

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
**DOCUMENTATION VERSION:** dev
55
**BASE URL:** https://renovate-bot.github.io/googleapis-_-genai-toolbox/dev/
6-
**GENERATED ON:** 2026-03-27T21:24:15Z
6+
**GENERATED ON:** 2026-03-30T03:43:46Z
77

88
---
99
### System Directives for AI Models
@@ -3027,6 +3027,7 @@ kind: tool
30273027
name: insert_embedding
30283028
type: postgres-sql
30293029
source: my-pg-instance
3030+
description: Insert a new document into the database.
30303031
statement: |
30313032
INSERT INTO documents (content, embedding)
30323033
VALUES ($1, $2);
@@ -3046,6 +3047,7 @@ kind: tool
30463047
name: search_embedding
30473048
type: postgres-sql
30483049
source: my-pg-instance
3050+
description: Search for documents in the database.
30493051
statement: |
30503052
SELECT id, content, embedding <-> $1 AS distance
30513053
FROM documents
@@ -3078,15 +3080,17 @@ high-dimensional vectors.
30783080

30793081
### Authentication
30803082

3081-
Toolbox uses your [Application Default Credentials
3082-
(ADC)][adc] to authorize with the
3083-
Gemini API client.
3083+
Toolbox supports two authentication modes:
30843084

3085-
Optionally, you can use an [API key][api-key] obtain an API
3086-
Key from the [Google AI Studio][ai-studio].
3085+
1. **Google AI (API Key):** Used if you
3086+
provide `apiKey` (or set `GOOGLE_API_KEY`/`GEMINI_API_KEY` environment
3087+
variables). This uses the [Google AI Studio][ai-studio] backend.
3088+
2. **Vertex AI (ADC):** Used if provided `project` and `location` (or set
3089+
`GOOGLE_CLOUD_PROJECT`/`GOOGLE_CLOUD_LOCATION` environment variables). This uses [Application
3090+
Default Credentials (ADC)][adc].
30873091

3088-
We recommend using an API key for testing and using application default
3089-
credentials for production.
3092+
We recommend using an API key for quick testing and using Vertex AI with ADC for
3093+
production environments.
30903094

30913095
[adc]: https://cloud.google.com/docs/authentication#adc
30923096
[api-key]: https://ai.google.dev/gemini-api/docs/api-key#api-keys
@@ -3106,14 +3110,19 @@ to your database source.
31063110
The `dimension` field must match the expected size of your database column
31073111
(e.g., a `vector(768)` column in PostgreSQL). This setting is supported by newer
31083112
models since 2024 only. You cannot set this value if using the earlier model
3109-
(`models/embedding-001`). Check out [available Gemini models][modellist] for more
3110-
information.
3113+
(`models/embedding-001`). Check out [available Gemini models][modellist] for
3114+
more information.
31113115

31123116
[modellist]:
3113-
https://docs.cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings#supported-models
3117+
https://docs.cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings#supported-models
31143118

31153119
## Example
31163120

3121+
### Using Google AI
3122+
3123+
Google AI uses API Key for authentication. You can get an API key from [Google
3124+
AI Studio][ai-studio].
3125+
31173126
```yaml
31183127
kind: embeddingModel
31193128
name: gemini-model
@@ -3123,19 +3132,34 @@ apiKey: ${GOOGLE_API_KEY}
31233132
dimension: 768
31243133
```
31253134

3126-
{{< notice tip >}}
3127-
Use environment variable replacement with the format ${ENV_NAME}
3128-
instead of hardcoding your secrets into the configuration file.
3135+
### Using Vertex AI
3136+
3137+
Vertex AI uses Application Default Credentials (ADC) for authentication. Learn
3138+
how to set up ADC [here][adc].
3139+
3140+
```yaml
3141+
kind: embeddingModel
3142+
name: gemini-model
3143+
type: gemini
3144+
model: gemini-embedding-001
3145+
project: ${GOOGLE_CLOUD_PROJECT}
3146+
location: us-central1
3147+
dimension: 768
3148+
```
3149+
3150+
[adc]: https://docs.cloud.google.com/docs/authentication/provide-credentials-adc
3151+
3152+
{{< notice tip >}} Use environment variable replacement with the format
3153+
${ENV_NAME} instead of hardcoding your secrets into the configuration file.
31293154
{{< /notice >}}
31303155

31313156
## Reference
31323157

3133-
| **field** | **type** | **required** | **description** |
3134-
|-----------|:--------:|:------------:|--------------------------------------------------------------|
3135-
| type | string | true | Must be `gemini`. |
3136-
| model | string | true | The Gemini model ID to use (e.g., `gemini-embedding-001`). |
3137-
| apiKey | string | false | Your API Key from Google AI Studio. |
3138-
| dimension | integer | false | The number of dimensions in the output vector (e.g., `768`). |
3158+
| **field** | **type** | **required** | **description** |
3159+
| ----------- | :------: | :----------: | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
3160+
| type | string | true | Must be `gemini`. |
3161+
| model | string | true | The Gemini model ID to use (e.g., `gemini-embedding-001`). |
3162+
| dimension | integer | false | The number of dimensions in the output vector (e.g., `768`). |
31393163

31403164

31413165

dev/llms.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
**DOCUMENTATION VERSION:** dev
55
**BASE URL:** https://renovate-bot.github.io/googleapis-_-genai-toolbox/dev/
6-
**GENERATED ON:** 2026-03-27T21:24:15Z
6+
**GENERATED ON:** 2026-03-30T03:43:46Z
77

88
---
99
### System Directives for AI Models
1.51 KB
Binary file not shown.
1.81 KB
Binary file not shown.
34.3 KB
Binary file not shown.
34.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)