Actions2
Overview
The Gemini Search node's "Generate Content" operation allows you to generate text content using Google's Gemini large language models. You provide a prompt and optional system instructions, and the node returns generated text based on your input and selected model. This is useful for tasks such as drafting emails, writing articles, summarizing information, or generating creative content within n8n workflows.
Practical examples:
- Automatically generate product descriptions from bullet points.
- Summarize meeting notes into concise action items.
- Create social media posts from structured data.
Properties
Display Name | Type | Description |
---|---|---|
Model | options | The Gemini model to use (e.g., Gemini 1.0 Pro, Gemini 2.5 Pro). |
Prompt | string | The prompt to send to Gemini. This is the main instruction or question for content creation. |
System Instruction | string | Optional system instruction to guide the model behavior (e.g., style, tone, constraints). |
Options | collection | Additional generation parameters (see below). |
Options (within "Options" property):
- Temperature (number, 0–1): Controls randomness in the response. Lower values = more deterministic.
- Max Output Tokens (number): Maximum number of tokens to generate in the output.
- Top P (number): Nucleus sampling parameter; controls diversity.
- Top K (number): Top K sampling parameter; limits possible next tokens.
- Extract Source URL (boolean): Whether to extract a source URL from the response (not typically relevant for "Generate Content").
Output
The node outputs an object with the following structure in the json
field:
{
"response": "<Generated text content>",
"fullResponse": { /* Full Gemini API response object */ }
}
- response: The generated text content from Gemini.
- fullResponse: The complete raw response from the Gemini API, which may include additional metadata.
If "Extract Source URL" is enabled (though not typical for "Generate Content"), the output may also include:
- sourceUrl: Extracted source URL (if present).
- redirectedSourceUrl: Final URL after redirects (if applicable).
- restrictedUrls: Any URLs used to restrict search (not relevant for "Generate Content").
If an error occurs and "Continue On Fail" is enabled, the output will be:
{
"error": "<Error message>"
}
Dependencies
- External Service: Requires access to the Google Gemini API.
- Credentials: You must configure the
geminiSearchApi
credential in n8n. - Dependencies: Uses the
axios
library for HTTP requests (bundled).
Troubleshooting
Common Issues:
- Missing Credentials: If the
geminiSearchApi
credential is not set up, the node will fail. - Invalid Model Selection: Using an unsupported model value will result in an error.
- Prompt Required: The "Prompt" field is mandatory; leaving it empty will cause an error.
- API Quotas/Errors: Exceeding Gemini API quotas or sending malformed requests can lead to errors.
Error Messages:
"error": "<Error message>"
: Indicates what went wrong (e.g., authentication failure, invalid parameters).- Network or timeout errors if the Gemini API is unreachable.
How to resolve:
- Ensure credentials are correctly configured.
- Double-check required fields (especially "Prompt").
- Verify that the selected model is available in your Gemini account.
- Review the full error message for hints about misconfiguration or API issues.