For the complete documentation index, see llms.txt.
Skip to main content
Version: 8.8

Google Gemini connector

Use the Google Gemini connector to send text and media prompts to Gemini models from your BPMN process and use the generated content in your process.

About this connector​

The Google Gemini connector is an outbound connector that calls Gemini models from Google through Vertex AI. Gemini models are multimodal, so a prompt can combine text with media such as images, audio, and video. For example, use this connector to summarize a video, answer questions about a document, or call a function that returns structured data.

The connector supports system instructions, grounding with a Vertex AI data store, safety filter settings, generation settings such as temperature and output token limit, and function calling.

Prerequisites​

To use the Google Gemini connector, you need:

  • A Google Cloud project with access to Vertex AI. You enter the project ID and region in the connector.
  • Credentials for Google Cloud: a short-lived JWT bearer token, or an OAuth client ID, client secret, and refresh token. See Google authentication types.
  • (Optional) A Vertex AI data store, if you want to use grounding.
note

Use secrets to store credentials and avoid exposing sensitive information from the process. See managing secrets.

Create a Google Gemini connector task​

You can apply a connector to a task or event via the append menu. For example:

  • From the canvas: Select an element and click the Change element icon to change an existing element, or use the append feature to add a new element to the diagram.
  • From the properties panel: Navigate to the Template section and click Select.
  • From the side palette: Click the Create element icon.

change element

After you have applied a connector to your element, follow the configuration steps or see using connectors to learn more.

Configuration​

Authentication​

Choose an authentication type and enter the authentication details on the element.

PropertyTypeRequiredDescriptionExample
TypeDropdownYesThe authentication type: Bearer token or Refresh token. The default is Refresh token. See Google authentication types.
Bearer tokenStringYes, if Type is Bearer tokenA short-lived JWT bearer token with access to Vertex AI.{{secrets.GOOGLE_BEARER_TOKEN}}
Client IDStringYes, if Type is Refresh tokenThe client ID of your OAuth client.
Client secretStringYes, if Type is Refresh tokenThe client secret of your OAuth client.{{secrets.GOOGLE_CLIENT_SECRET}}
Refresh tokenStringYes, if Type is Refresh tokenThe refresh token of your OAuth client.{{secrets.GOOGLE_REFRESH_TOKEN}}

Google authentication types​

The Google Gemini connector supports two methods for authentication and authorization:

  • A short-lived JWT bearer token.
  • A refresh token.

Google supports multiple ways to obtain both types of token. Refer to the official Google OAuth documentation for current instructions, or see the following examples.

Example 1: Obtain a JWT bearer token with a service account​
danger

The following code snippet is for demonstration purposes only and must not be used for real production systems due to security concerns. For production usage, follow the official Google guidelines.

Assuming you have created a service account and downloaded a JSON file with keys, run the following Python 3 snippet to print the JWT token in the terminal:

import google.auth
import google.auth.transport.requests
from google.oauth2 import service_account
# Scope required to call the Vertex AI API.
SCOPES = ['https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/generative-language.retriever']
# File with keys
SERVICE_ACCOUNT_FILE = 'google-service-account-creds.json'
credentials = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES)
auth_req = google.auth.transport.requests.Request()
credentials.refresh(auth_req)
# Print token
print(credentials.token)
Example 2: Obtain a bearer and refresh token with an OAuth client​
danger

The following code snippet is for demonstration purposes only and must not be used for real production systems due to security concerns. For production usage, follow the official Google guidelines.

Assuming you have created an OAuth client, you can download key files from the Google Console. Run the following Python 3 snippet to print the refresh token in the terminal:

from google_auth_oauthlib.flow import InstalledAppFlow
import pprint

SCOPES = ['https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/generative-language.retriever']
OAUTH_KEYS = './oauth-keys.json' # path to your file with OAuth credentials

def main():
flow = InstalledAppFlow.from_client_secrets_file(OAUTH_KEYS, SCOPES)
creds = flow.run_local_server(port=54948)
pprint.pprint(vars(creds))

if __name__ == "__main__":
main()

Project and region​

PropertyTypeRequiredDescriptionExample
Project IDStringYesThe identifier of your Google Cloud project.
RegionStringYesThe region where your Google Cloud project is located.us-central1, us-west1

Operations​

Generate content​

Send a prompt to a Gemini model and return the generated content.

Input parameters​

Select the model and enter the prompt.

PropertyTypeRequiredDescriptionExample
ModelDropdownYesThe Gemini model to use: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-image, gemini-2.5-flash-lite, gemini-2.0-flash, gemini-2.0-flash-lite, or Custom.
Custom model nameStringYes, if Model is CustomThe name of the model to use. Supports FEEL expressions.
PromptsStringYesA FEEL expression that returns a list of prompts with text and media. See prompts.
System instructionsStringNoInstructions that tell the model how to respond. Use them to give the model context, get more custom responses, and follow specific guidelines. They apply each time you send a request to the model.

Learn more about Google system instructions.

Prompts​

The Prompts property is a FEEL expression that returns a list. Each entry in the list is one of the following:

  • A text prompt: an object with a single text key and the text as its value.
  • A media prompt: an object with exactly two keys, mime for the MIME type and uri for the media URI.

For example:

= [{"text": "Who is this video about?"},
{"mime": "video/*", "uri": "https://youtu.be/..."}]

Grounding​

Grounding connects the model output to verifiable sources of information. This is useful when accuracy and reliability are important.

PropertyTypeRequiredDescriptionExample
GroundingBooleanNoSelect this to connect the model output to your data. It is cleared by default.
Vertex AI data store pathStringNoThe path of the Vertex AI data store. Shown when Grounding is selected. The value must match projects/{}/locations/{}/collections/{}/dataStores/{}.

Learn more about Google grounding.

Safety filter settings​

Adjust the likelihood of receiving a model response that might contain harmful content. Content is blocked based on the probability that it's harmful.

PropertyTypeRequiredDescriptionExample
Safety Filter SettingsBooleanNoSelect this to configure the filters below. It is cleared by default.
Hate speechDropdownNoThe blocking level for hate speech. Shown when Safety Filter Settings is selected. The default is OFF.
Dangerous contentDropdownNoThe blocking level for dangerous content. Shown when Safety Filter Settings is selected. The default is OFF.
Sexually explicit contentDropdownNoThe blocking level for sexually explicit content. Shown when Safety Filter Settings is selected. The default is OFF.
Harassment contentDropdownNoThe blocking level for harassment content. Shown when Safety Filter Settings is selected. The default is OFF.

Each filter has the following levels:

LevelBehavior
OFFBlocks nothing.
Block fewBlocks only high-probability content.
Block someBlocks medium-probability content and above.
Block mostBlocks low-probability content and above.

Learn more about Google safety filters and attributes.

Generation settings​

PropertyTypeRequiredDescriptionExample
Add stop sequenceStringNoA FEEL expression that returns a list of strings. A stop sequence is a series of characters, including spaces, that stops response generation when the model encounters it. The sequence isn't included in the response. You can add up to five stop sequences.= ["text 1", "text 2"]
TemperatureNumberNoControls the randomness in token selection. A lower temperature is good when you expect a true or correct response, and 0 means the highest probability token is usually selected. A higher temperature can lead to diverse or unexpected results. Enter a value from 0 to 2 in increments of 0.1.
Output token limit from 1 to 8192NumberYesThe maximum amount of text output from one prompt. A token is approximately four characters. Enter a whole number from 1 to 8192.
SeedNumberNoUse a seed value if you make repeated requests and want the same model response. A deterministic outcome isn't guaranteed. Changing the model or other settings can cause variations in the response, even with the same seed value. Enter a whole number from -2,147,483,647 to 2,147,483,647.
Top-KNumberNoThe number of candidate tokens when the model selects an output token. Use a lower value for less random responses and a higher value for more random responses. Enter an integer from 1 to 40.
Top-PNumberNoChanges how the model selects tokens for output. Tokens are selected from most probable to least probable until the sum of their probabilities equals the Top-P value. For example, if tokens A, B, and C have a probability of 0.3, 0.2, and 0.1 and the Top-P value is 0.5, the model selects either A or B as the next token (using temperature). For the least variable results, set Top-P to 0. Enter a value from 0 to 1 in increments of 0.1.

Function calling​

Function calling is a feature of Gemini models that makes it easier to get structured data outputs from generative models.

PropertyTypeRequiredDescriptionExample
Function call descriptionStringNoA FEEL expression that returns a list of function declarations. Register all types in uppercase, for example OBJECT and STRING.

For example:

= [
{
"name": "get_exchange_rate",
"description": "Get the exchange rate for currencies between countries",
"parameters": {
"type": "OBJECT",
"properties": {
"currency_date": {
"type": "STRING",
"description": "A date that must always be in YYYY-MM-DD format or the value 'latest' if a time period is not specified"
},
"currency_from": {
"type": "STRING",
"description": "The currency to convert from in ISO 4217 format"
},
"currency_to": {
"type": "STRING",
"description": "The currency to convert to in ISO 4217 format"
}
},
"required": [
"currency_date",
"currency_from",
"currency_to"
]
}
}
]

Learn more about Google function calling.

Output​

The connector returns the content generated by the model as a JSON object. The object contains the role and a list of parts, such as the generated text:

{
"role": "model",
"parts": [
{
"text": "The video is about ..."
}
]
}

To use the generated text in your process, store the response with Result variable, or map it with Result expression. For example, the following expression stores the text of the first part in the generatedText process variable:

= {
"generatedText": response.parts[1].text
}

Troubleshooting​

To learn about general error handling in Camunda, see BPMN errors and failing jobs.

Invalid prompt format​

Error: Invalid prompt format: <prompt>

A prompt entry doesn't match the supported format. Each entry must be an object with only a text key, or only the mime and uri keys, and the values can't be blank. An empty object ({}) also causes this error. Correct the entry in Prompts. See prompts.

Prompt can not be empty​

Error: Prompt can not be empty

The Prompts list contains a null entry. Remove the null entry from the list.

Function call deserialization​

Error: Exception during function call deserialization

The Function call description can't be read as a function declaration. Check that the expression returns a list of valid function declarations, and that all types are in uppercase. See function calling.

Further resources​