Skip to main content

Generate Content

Generates text content using Google's Gemini API with support for multimodal inputs including text, images, and files.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Connection Id - The connection ID obtained from the Connect node.
  • System Prompt - Optional system-level instructions that guide the model's behavior.
  • User Prompt - The main text prompt for the model to respond to.
  • Local File Paths - Array of local file paths to include as input (images, documents, etc.).
  • Custom Local File Paths - Alternative way to provide file paths as an array.
  • Uploaded Files - Previously uploaded files from the File Upload node.

Options

  • Model - The Gemini model to use for content generation. Options include:
    • Gemini 2.5 Pro
    • Gemini 2.5 Flash
    • Gemini 2.5 Flash Lite
    • Gemini 2.0 Flash
    • Gemini 2.0 Flash Lite
    • Gemini Live 2.5 Flash Preview
    • Gemini 2.0 Flash Image Generation
    • Custom Model
  • Custom Model - Custom model name when "Custom Model" is selected.
  • Stream - Whether to stream the response as it's generated. Default is false.
  • JSON Mode - Force JSON response format. Default is false.
  • Temperature - Controls randomness (0.0-2.0).
  • TopP - Nucleus sampling (0.0-1.0).
  • TopK - Top-k sampling (1-100).
  • Max Output Tokens - Maximum number of tokens in the response.
  • Safety Settings - Controls for various content categories:
    • Harassment
    • Hate Speech
    • Sexually Explicit
    • Dangerous Content
    • Civic Integrity
  • Response MIME Type - Format for the response: application/json or text/plain.
  • Response Schema - JSON schema for structured output.
  • Presence Penalty - Penalty for new tokens (-2.0 to 2.0).
  • Frequency Penalty - Penalty for repeated tokens (-2.0 to 2.0).
  • Stop Sequences - Comma-separated stop sequences.
  • Enable Code Execution - Allow model to execute code. Default is false.
  • Enable Google Search - Allow model to search Google. Default is false.
  • Timeout (seconds) - Request timeout in seconds (default: 60).

Output

  • Response - The generated content response from the model.

How It Works

The Generate Content node creates text content using Google's Gemini API with support for multimodal inputs. When executed, the node:

  1. Validates the provided connection ID and user prompt
  2. Configures the selected model with all specified parameters
  3. Processes any local files or uploaded files to include as input
  4. Sets up safety settings and generation parameters
  5. Sends a content generation request to the Gemini API
  6. Handles the response either as a complete result or as a stream
  7. Returns the generated content in the specified format

Requirements

  • A valid Google Gemini API key
  • Connection ID from a successful Connect node execution
  • Valid text prompt for the model to respond to

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid Connection ID
  • Empty User Prompt
  • Invalid custom model name
  • File not found at specified path
  • File size exceeds 20MB limit for inline data
  • Invalid parameter values (temperature, top_p, top_k, etc.)
  • Invalid response schema JSON
  • Content generation blocked due to safety settings
  • API errors from Google's Gemini service

Usage Notes

  • Local files are limited to 20MB for inline data; larger files should be uploaded first
  • File input is supported only with Gemini Flash and Pro models
  • JSON mode can be used to enforce structured output
  • Safety settings can be adjusted to control content filtering
  • Streaming responses are useful for long-generation tasks
  • System prompts can guide the model's overall behavior
  • Response schemas enable structured output validation
  • Code execution and Google Search tools must be explicitly enabled
  • The default timeout is 60 seconds, which can be adjusted for complex requests