Gemini MultimodalCompletion

Gemini MultimodalCompletion

Certified

Generate multimodal responses with Gemini

Sends mixed text and binary parts to a Gemini model (including image-aware variants) and returns text plus any generated images. Images are saved to Kestra storage; token metrics are emitted. See Gemini API about multimodal input for more information.

yaml
type: io.kestra.plugin.gemini.MultimodalCompletion

Multimodal completion using the Gemini Client

yaml
id: gemini_multimodal_completion
namespace: company.team

inputs:
  - id: image
    type: FILE

tasks:
  - id: multimodal_completion
    type: io.kestra.plugin.gemini.MultimodalCompletion
    apiKey: "{{ secret('GEMINI_API_KEY') }}"
    model: "gemini-2.5-flash"
    contents:
      - content: Can you describe this image?
      - mimeType: image/jpeg
        content: "{{ inputs.image }}"

Generate, edit and analyze an image

yaml
id: gemini_multimodal_generate_edit_analyze
namespace: company.team

inputs:
  - id: gen_prompt
    type: STRING
    defaults: "a giant library floating in the clouds with glowing bookshelves"
  - id: edit_prompt
    type: STRING
    defaults: "transform the background into a cyberpunk cityscape at night"

tasks:
  - id: generate
    type: io.kestra.plugin.gemini.MultimodalCompletion
    contents:
      - content: "{{ inputs.gen_prompt }}"
    apiKey: "{{ secret('GEMINI_API_KEY') }}"
    model: "gemini-2.5-flash-image-preview"

  - id: edit
    type: io.kestra.plugin.gemini.MultimodalCompletion
    contents:
      - content: "{{ inputs.edit_prompt }}"
      - mimeType: "{{ outputs.generate.images[0].mimeType }}"
        content: "{{ outputs.generate.images[0].uri }}"
    apiKey: "{{ secret('GEMINI_API_KEY') }}"
    model: "gemini-2.5-flash-image-preview"

  - id: analyze
    type: io.kestra.plugin.gemini.MultimodalCompletion
    contents:
      - content: "Describe the mood and style of this image."
      - mimeType: "{{ outputs.edit.images[0].mimeType }}"
        content: "{{ outputs.edit.images[0].uri }}"
    apiKey: "{{ secret('GEMINI_API_KEY') }}"
    model: "gemini-2.5-flash-image-preview"
Properties

Gemini API key

Secret used for direct Gemini API calls; render from a secure variable.

Multimodal content parts

Ordered list of text or file parts; set mimeType when sending file URIs from Kestra storage. Defaults to role user if not provided.

Definitions
content*string
mimeTypestring
rolestring
Defaultuser

Generative model

Gemini model identifier to call (e.g., gemini-2.5-flash, gemini-1.5-pro). Must support the requested input type.

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
Defaultfalse

Whether the response has been blocked for safety reasons

The reason the generation has finished

Generated images stored in Kestra and exposed as URIs

When using image-generating/editing models like gemini-2.5-flash-image-preview, this field contains one or more Kestra storage URIs.

Definitions
mimeTypestring

IANA mime type of the image, e.g. image/jpeg

uristring
Formaturi

Kestra storage URI of the image

The response safety ratings

Definitions
blockedboolean
categorystring
probabilitystring

Generated response text

The number of candidate tokens generated by the Gemini model.

The number of tokens used in the input prompt.

The total number of tokens processed by the Gemini model (prompt + generated).