Breadcrumbs

Gemini - Generate Response From File

Overview

To use this template, ensure you have a Gemini API key. You need to provide a file (image, audio, or PDF) and a prompt. Optionally, specify a model and an output folder for saving the response.

Variables

Name

Reference

Type

Required

Default

Options

Description

Model

GEMINI_MODEL

Select

gemini-2.5-flash

Gemini 2.5 Flash: gemini-2.5-flash

Gemini 2.5 Pro: gemini-2.5-pro

Gemini 2.0 Flash: gemini-2.0-flash

Gemini 2.0 Flash Lite: gemini-2.0-flash-lite

Optional model to use. Default is gemini-2.5-flash.

Prompt

GEMINI_PROMPT

Alphanumeric

-

-

Provide the prompt to send to the API along with the file.

Match Type

GEMINI_MATCH_TYPE

Select

exact_match

Exact Match: exact_match

Regex: regex_match

Source File Name

GEMINI_SOURCE_FILE_NAME

Alphanumeric

-

-

Source Folder Name

GEMINI_SOURCE_FOLDER_NAME

Alphanumeric

-

-

If the file that Gemini is in a subfolder

Destination File Name

GEMINI_DESTINATION_FILE_NAME

Alphanumeric

-

-

Name to save the response file locally.

Destination Folder Name

GEMINI_DESTINATION_FOLDER_NAME

Alphanumeric

-

-

Optional folder path to save the response file.

Enable Google Search

GEMINI_ENABLE_GOOGLE_SEARCH

Boolean

FALSE

-

Connects the Gemini model to real-time web content

Enable Code Execution

GEMINI_ENABLE_CODE_EXECUTION

Boolean

FALSE

-

When enabled, the model executes Python code and returns the results. Disable this option if you want the model to include the code itself in the response.

YAML

Below is the YAML template

YAML

source:
  template: Gemini - Generate Response From File
  inputs:
    GEMINI_MODEL: gemini-2.5-flash
    GEMINI_PROMPT:
    GEMINI_MATCH_TYPE: exact_match
    GEMINI_SOURCE_FILE_NAME:
    GEMINI_SOURCE_FOLDER_NAME:
    GEMINI_DESTINATION_FILE_NAME:
    GEMINI_DESTINATION_FOLDER_NAME:
    GEMINI_ENABLE_GOOGLE_SEARCH: 'FALSE'
    GEMINI_ENABLE_CODE_EXECUTION: 'FALSE'
  type: TEMPLATE
guardrails:
  retry_count: 1
  retry_wait: 0h0m0s
  runtime_cutoff: 1h0m0s
  exclude_exit_code_ranges:
    - 10
    - 11
    - 14
    - 205
    - 204