Skip to main content

Generate Text

Generates text responses from Claude AI with optional vision capabilities for analyzing images alongside text prompts.

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 Claude client session identifier from Connect node (optional if API Key is provided directly).
  • System Prompt - System instructions to guide Claude's behavior and set the context for responses. This helps Claude understand its role and how to respond.
  • User Prompt - The message or question you want to send to Claude. This is the main input for generating text.
  • Image Paths - Paths to image files (PNG, JPEG, WebP, GIF, HEIC, HEIF) for Claude to analyze alongside the text prompt.
  • Custom Image Paths - Array of image paths from message scope (e.g., msg.image_paths) for batch processing.

Options

Authentication

  • API Key - Claude API key (optional if using Connection ID). You can provide the API key directly instead of using a Connect node.
  • Use Robomotion AI Credits - Use Robomotion AI credits instead of your own API key.

Model Selection

  • Model - Select which Claude model to use. Options include:
    • Claude Opus 4.5 - Most capable model for complex tasks
    • Claude Opus 4 - Highly capable model for complex reasoning
    • Claude Sonnet 4.5 - Latest balanced model
    • Claude Sonnet 4 - Balanced performance and speed (default)
    • Claude 3.7 Sonnet - Latest 3.x generation Sonnet
    • Claude 3.5 Sonnet - Previous generation Sonnet
    • Claude 3.5 Haiku - Fastest model for simple tasks
    • Custom Model - Specify your own model name
  • Custom Model - Enter custom model name when Custom Model is selected.

Generation Settings

  • Max Tokens - Maximum number of tokens in the response (default: 4096). Controls the length of Claude's response.
  • Temperature - Controls randomness (0.0-1.0). Higher values (e.g., 0.8) make output more creative and random, lower values (e.g., 0.2) make it more focused and deterministic.
  • Top P - Nucleus sampling parameter (0.0-1.0). Alternative to temperature for controlling randomness.
  • Top K - Top-k sampling parameter (1-100). Limits the number of tokens considered at each step.

Extended Thinking

  • Thinking Mode - Extended thinking allows Claude to reason through complex problems:
    • Off - No extended thinking (default)
    • Auto (Budget: 10240) - Automatic thinking with default token budget
    • Custom Budget - Specify your own thinking token budget
  • Thinking Budget - Custom thinking token budget (1024-128000). Only used when Thinking Mode is Custom.

Advanced

  • Timeout (seconds) - Request timeout in seconds (default: 120).
  • Include Raw Response - Include full API response in output (default: false).

Outputs

  • Text - Claude's text response to your prompt.
  • Thinking - Extended thinking output when thinking mode is enabled. This shows Claude's reasoning process.
  • Raw Response - Complete API response object (when Include Raw Response is enabled).

How It Works

The Generate Text node sends a prompt to Claude and receives a text response. When executed, the node:

  1. Validates the connection or creates a temporary client using provided credentials
  2. Prepares the user prompt and optional system prompt
  3. If images are provided:
    • Reads and encodes each image file to base64
    • Validates image formats (must be supported image types)
    • Adds image blocks to the content
  4. Configures the selected model and generation parameters
  5. If extended thinking is enabled, adds thinking configuration
  6. Sends the request to Claude API
  7. Extracts the text response and optional thinking output
  8. Returns the results

Requirements

  • Either a valid Connection Id from Connect node OR direct API Key credentials
  • Non-empty User Prompt
  • For vision capabilities: Valid image files in supported formats (PNG, JPEG, WebP, GIF, HEIC, HEIF)

Error Handling

The node will return specific errors in the following cases:

  • Empty or missing User Prompt
  • Invalid Connection Id (when not using direct credentials)
  • Empty Custom Model name when Custom Model is selected
  • Unsupported image format
  • Failed to read image file
  • Temperature out of range (must be 0.0-1.0)
  • Top P out of range (must be 0.0-1.0)
  • Top K less than 1
  • Thinking budget out of range (must be 1024-128000)
  • API authentication errors (401)
  • API rate limit errors (429)
  • API service errors (500, 503)

Usage Notes

Text Generation

  • The User Prompt is required and cannot be empty
  • System Prompt is optional but recommended for better control over responses
  • Max Tokens controls response length - increase for longer responses
  • Temperature affects creativity: use 0.2-0.3 for factual tasks, 0.7-0.9 for creative tasks

Vision Capabilities

  • Claude can analyze images alongside text prompts
  • Supported image formats: PNG, JPEG, WebP, GIF, HEIC, HEIF
  • You can provide multiple images in a single request
  • Images are automatically encoded to base64
  • Useful for: document analysis, screenshot understanding, visual content description

Model Selection

  • Claude Opus 4.5 - Best for complex analysis, coding, and reasoning tasks
  • Claude Sonnet 4 - Balanced choice for most use cases (recommended default)
  • Claude 3.5 Haiku - Fast and cost-effective for simple tasks

Extended Thinking

  • Extended thinking helps Claude reason through complex problems
  • Use Auto mode for standard complex tasks
  • Use Custom Budget mode when you need fine control over thinking depth
  • The thinking output shows Claude's reasoning process
  • Useful for: math problems, logic puzzles, complex analysis

Direct API Key vs Connect Node

  • You can use this node in two ways:
    1. With Connect node: More efficient for multiple operations
    2. With direct API key: Simpler for single operations

Examples

Example 1: Simple Text Generation

Inputs:

  • Connection Id: (from Connect node)
  • User Prompt: "Explain what RPA is in simple terms"
  • System Prompt: "You are a helpful assistant that explains technical concepts clearly"

Configuration:

  • Model: Claude Sonnet 4
  • Max Tokens: 500
  • Temperature: 0.3

Output: Claude will provide a clear, focused explanation of RPA suitable for non-technical users.


Example 2: Image Analysis

Inputs:

  • Connection Id: (from Connect node)
  • User Prompt: "What is shown in this screenshot? Extract any text you see and describe the UI elements"
  • Image Paths: ["/path/to/screenshot.png"]

Configuration:

  • Model: Claude Sonnet 4
  • Max Tokens: 1000

Output: Claude will analyze the screenshot, extract visible text, and describe the UI elements present.


Example 3: Creative Writing with High Temperature

Inputs:

  • Connection Id: (from Connect node)
  • User Prompt: "Write a short story about a robot learning to paint"
  • System Prompt: "You are a creative writer who writes engaging short stories"

Configuration:

  • Model: Claude Opus 4.5
  • Max Tokens: 2000
  • Temperature: 0.8

Output: Claude will generate a creative, original short story with varied narrative elements.


Example 4: Complex Problem Solving with Extended Thinking

Inputs:

  • Connection Id: (from Connect node)
  • User Prompt: "A company has 3 warehouses and 5 stores. Each warehouse can supply up to 1000 units per day. Each store needs at least 400 units per day. What's the optimal distribution strategy to minimize transportation costs if costs vary by distance?"
  • System Prompt: "You are an operations research expert"

Configuration:

  • Model: Claude Opus 4.5
  • Max Tokens: 4096
  • Thinking Mode: Auto (Budget: 10240)

Outputs:

  • Text: The solution and recommendations
  • Thinking: Shows Claude's step-by-step reasoning process

Example 5: Document Analysis with Multiple Images

Inputs:

  • Connection Id: (from Connect node)
  • User Prompt: "Compare these invoices and identify any discrepancies"
  • Custom Image Paths: msg.invoice_images (array of invoice image paths)

Configuration:

  • Model: Claude Sonnet 4
  • Max Tokens: 3000

Output: Claude will analyze all invoices and provide a comparison with identified discrepancies.


Example 6: Using Direct API Key (No Connect Node)

Inputs:

  • User Prompt: "What is the capital of France?"

Options:

  • API Key: (your credential)
  • Model: Claude 3.5 Haiku

Configuration:

  • Max Tokens: 100
  • Temperature: 0.1

Output: A quick, factual answer without needing to use a Connect node first.

Best Practices

  1. Prompt Engineering:

    • Be specific and clear in your prompts
    • Use System Prompt to set context and behavior
    • Break complex tasks into steps in your prompt
  2. Model Selection:

    • Use Haiku for simple, fast tasks
    • Use Sonnet for balanced performance
    • Use Opus for complex reasoning and analysis
  3. Parameter Tuning:

    • Lower temperature (0.1-0.3) for factual, consistent outputs
    • Higher temperature (0.7-0.9) for creative, varied outputs
    • Adjust Max Tokens based on expected response length
  4. Image Analysis:

    • Ensure images are clear and readable
    • Provide context in your prompt about what to look for
    • Use high-quality images for better analysis
  5. Extended Thinking:

    • Enable for complex problems requiring multi-step reasoning
    • Review the thinking output to understand Claude's approach
    • Useful for debugging complex logic or validating solutions
  6. Error Handling:

    • Always handle potential errors (rate limits, timeouts)
    • Use appropriate timeout values for your use case
    • Consider using Continue On Error for non-critical operations
  7. Resource Management:

    • Use Connect/Disconnect pattern for multiple operations
    • Monitor token usage to manage costs
    • Use appropriate models for the task complexity