Overview
The node integrates with Google Gemini AI to perform three main operations: generating text, uploading files, and analyzing uploaded files using AI models. Specifically for the Analyze File operation, it allows users to send a previously uploaded file (identified by its URI) along with a textual prompt to the Gemini AI service. The AI then processes the file content in context of the prompt and returns an analysis or description.
This operation is useful when you want to extract insights, transcriptions, descriptions, or other contextual information from multimedia files such as images, audio, video, or documents. For example:
- Transcribing speech from an audio recording.
- Describing the contents of an image.
- Summarizing the text inside a PDF document.
- Extracting metadata or understanding video content.
Properties
Name | Meaning |
---|---|
File URI | URI of the uploaded file to analyze (obtained from a prior Upload File operation). Required. |
File MIME Type | MIME type of the file. Options include: Audio MP3, Audio OGA, Audio OGG, Audio WAV, Image JPEG, Image PNG, Other (application/octet-stream), PDF Document, Video MOV, Video MP4. Default is Audio MP3. |
Prompt | Text prompt describing what you want to ask about the file (e.g., "Describe this file", "Transcribe this audio..."). Required. |
Model | The Gemini AI model to use for file analysis. Options are: Gemini 2.0 Flash (Experimental, best for multimodal tasks), Gemini 1.5 Flash (fast and efficient), Gemini 1.5 Pro (most capable). Default is Gemini 2.0 Flash (Experimental). |
Output
The node outputs a JSON object containing:
response
: The textual response generated by the Gemini AI based on the file content and prompt.model
: The name of the Gemini model used for analysis.prompt
: The prompt text sent to the AI.fileUri
: The URI of the analyzed file.fileMimeType
: The MIME type of the analyzed file.- Additional fields from the input item’s JSON data are preserved and merged into the output.
The node does not output binary data for this operation; it only returns the AI-generated textual analysis.
Dependencies
- Requires an API key credential for authenticating requests to the Google Gemini AI service.
- The node makes HTTP POST requests to the Gemini API endpoints for file analysis.
- Proper configuration of the Gemini API credentials in n8n is necessary.
- The file to be analyzed must have been previously uploaded via the Upload File operation to obtain a valid file URI.
Troubleshooting
- No valid response received from Gemini API: This error indicates that the AI did not return any usable content. Check that the file URI and MIME type are correct and that the prompt is meaningful.
- Gemini API Error: General errors returned from the Gemini API, possibly due to invalid credentials, network issues, or exceeding usage limits. Verify API key validity and network connectivity.
- Missing or invalid file URI: Ensure the file URI provided corresponds to a successfully uploaded file.
- Unsupported MIME type: If the file MIME type does not match the actual file content, the AI may fail to analyze properly. Use one of the supported MIME types listed.
- Prompt too vague or empty: The prompt should clearly specify what kind of analysis or description is expected.