<!-- BusyBot node reference — https://busybot.net/tools/gemini-file-search/ -->

> Node: Gemini File Search (`gemini_file_search`) · Action · v1
> Category: AI · Credentials: Google AI (`googleAi`)
> Updated: 2026-08-16

# Gemini File Search

> Search through uploaded files using Gemini file references.

## Overview

Gemini File Search sends uploaded file references along with a user query to the Gemini generateContent API. Files previously uploaded via the Gemini Files API are referenced by their file URIs (e.g. "files/abc123") and included as file_data parts in the request. The model reads the file contents and generates a response based on them. Supports model selection, system prompts, generation config (temperature, maxOutputTokens), and configurable concurrency.

**Category:** AI  
**Tool Name:** `gemini_file_search`  
**Version:** 1

**Appearance:** Icon: `gemini` | Color: `#ffffff`

## Node Type

**Action** — processes input items and produces output

## Input / Output

| Direction | Port(s) |
|-----------|--------|
| Input | `Input` |
| Output | `Output`, `Error` |

## Credentials

This tool requires **Google AI** credentials.
See the [Credentials Guide](https://busybot.net/credentials/google-ai/) for setup instructions.

### Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Model | `options` | No | (current default) | The Gemini model to use for file search and response generation. Pick a specific version — labels are pinned, not aliased to "latest". |
| | | | | Options: the Gemini chat models available to your workspace — pick one from the dropdown. |
| System Prompt | `string` | No | — | Optional system instruction that guides how the model analyzes and responds about the files. Supports expressions. |
| User Message | `string` | Yes | — | The query or question about the uploaded files. Falls back to item.message or item.prompt if empty. Supports expressions like {{ $json.question }}. |
| File URIs | `string` | No | — | JSON array of Gemini file URIs (e.g. '["files/abc123"]'), or a single file URI. Can also come from item.json.fileUris. Files must be uploaded via the Gemini Files API first. Supports expressions. |
| Options | `collection` | No | `{}` | Optional generation and output settings — add only the fields you need. |
| — Temperature | `number` | No | `1` | Controls randomness. Lower values are more deterministic. Range: 0-2. |
| — Max Output Tokens | `number` | No | `8192` | Maximum number of tokens in the generated response. |
| — Response Field Name | `string` | No | `response` | The key name in the output JSON where the response text will be stored. |
| Include Input | `boolean` | No | `false` | Whether to merge the input item JSON into the output item. |
| Max Concurrency | `number` | No | `10` | Maximum number of items to process concurrently. |

## Output Data

One request per input item, and one output item per input item. Every file named in **File URIs** is attached to that single request, so one item can ask a question that spans several documents. The answer lands on the field named by **Response Field Name** (`response` by default), with `model`, `finishReason` and `usage` beside it. The rest of the input item JSON is dropped unless **Include Input** is on; binary data on the input item is forwarded unchanged.

```json
{
  "response": "The answer, read out of the attached files",
  "model": "the model that produced the answer",
  "finishReason": "the API's reason for ending generation",
  "usage": { "promptTokenCount": 2400, "candidatesTokenCount": 310 }
}
```

- An item with no usable file URI is an item error — the node needs at least one URI, from the parameter or from the item's own `fileUris` field.
- `finishReason` is the API's own reason for ending generation — the field to check when an answer looks cut off against the **Max Output Tokens** cap.
- `usage` is the token accounting the API returned for that call. It includes the tokens the attached files consumed, so large documents dominate the cost of a run.

Reference the result downstream by expression, e.g. `{{ $json.response }}`.

## Usage Examples

- Ask questions about a PDF uploaded to Gemini Files API
- Summarize documents referenced by their Gemini file URIs
- Compare multiple uploaded files using Gemini
- Extract specific information from uploaded documents
- Analyze uploaded spreadsheets or reports with Gemini

## Example Configuration

Ask one question about the file an upstream **Gemini File Upload** node just produced:

```json
{
  "type": "gemini_file_search",
  "parameters": {
    "userMessage": "Summarize the key findings in this document.",
    "fileUris": "{{ $json.fileUri }}"
  }
}
```

Compare several uploaded reports in one request:

```json
{
  "type": "gemini_file_search",
  "parameters": {
    "systemPrompt": "You are a financial analyst. Compare documents objectively and cite the report each figure came from.",
    "userMessage": "Compare the revenue figures across all three quarterly reports.",
    "fileUris": "[\"files/q1_report\", \"files/q2_report\", \"files/q3_report\"]",
    "options": {
      "temperature": 0.3,
      "responseFieldName": "comparisonSummary"
    }
  }
}
```

Batch extraction — each item carries its own file on `fileUris`:

```json
{
  "type": "gemini_file_search",
  "parameters": {
    "systemPrompt": "Extract the invoice number, date and total amount. Reply with JSON only.",
    "userMessage": "Extract structured invoice data from this file.",
    "includeInput": true,
    "maxConcurrency": 20,
    "options": {
      "temperature": 0,
      "maxOutputTokens": 512,
      "responseFieldName": "invoiceData"
    }
  }
}
```

### Error Handling

| Mode | Behavior |
|------|----------|
| **stop** | Halts workflow on first error |
| **continue** | Skips failed items, passes successful ones through |
| **errorPort** | Routes failed items to Error output port |

## Tips

Gemini File Search sends previously uploaded file references and a user query to the Gemini generateContent API, enabling the model to read and reason over file contents. Use it when files have already been uploaded via the Gemini Files API and you need to extract insights or answers from them using a natural language query. The tool outputs a generated response text on the main channel, with failures routed to the error channel.