VertexAIGeminiGenerator
Generate text using Google Gemini models.
Basic Information
- Pipeline type: Query
- Components that can precede it in a pipeline:
- Components that can follow it in a pipeline: PromptBuilder
- Required inputs:
- "parts": A variadic list containing a mix of images, audio, video, and text to prompt the Gemini model.
- Outputs:
A dictionary with the following keys:- "replies": A list of generated texts.
Overview
VertexAIGeminiGenerator uses the gemini-pro-vision model by default, but you can replace it with any other supported model. Supported models are:
- gemini-pro
- gemini-pro-vision
To prompt with images, set the model to gemini-pro-vision. For function calling, use gemini-pro.
Authentication
VertexAIGeminiGenerator authenticates using Google Cloud Application Default Credentials (ADCs). For more information, see Google documentation. Use an account that can access projects authorized to use Google Vertex AI endpoints.
Usage Example
Parameters
Parameter | Type | Possible values | Description |
---|---|---|---|
model | String | Default: gemini-pro-vision | Name of the model to use. Required. |
project_id | String | ID of the GCP project to use. You can find your project ID in the GCP resource manager, or locally by running gcloud projects list in your terminal. For information on using gcloud CLI, see the official documentation.Required. | |
location | String | Default: None | The default location to use when making API calls. Optional. |
generation_config | Union of GenerationConfig and a dictionary of string and any | Default: None | The generation configuraiton to use. Can be a [GenerationConfig](https://cloud.google.com/python/docs/reference/aiplatform/latest/vertexai.preview.generative_models.GenerationConfig) object or a dictionary of parameters. Accepted fields include: temperature , top_p , top_k , candidate_count , max_output_tokens , stop_sequences .Optional. |
safety_settings | Dictionary of HarmCategory and HarmBlockThreshold | Default: None | The safety settings to use. For details, see the documentation for HarmBlockThreshold and HarmCategory. Optional. |
tools | List of tools | Default: None | List of tools to use when generating content. See the Tool documentation for details. Optional. |
Updated 6 months ago
Related Links