Stop Sending Gemini the Whole File (2026)

Matt Payne··Updated ·7 min read
Key Takeaway

Slicing an 80-page PDF to 6 pages cuts Gemini input costs 92%, from $0.27 to $0.02. Use PyMuPDF locally now. Add citation validation to reject unsupported claims.

Stop Sending Gemini the Whole File

> Editorial note: The supplied Google sources are dated November 2026. That date hasn't happened yet. Gemini 4 Neon and the listed native file slicing controls can't be verified today.

Most sales research agents read like interns who never learned to skim.

They consume a 90-page annual report, six web pages, and three earnings transcripts. Then they produce five vague bullets without reliable citations.

The problem is bad architecture.

Databases solved this decades ago. You don't copy every row from Salesforce before finding one account. You run a query.

AI agents need the same discipline.

Step 1: Verify the API Before Building Around It

Google's supplied announcement describes native Gemini API file slicing across Gemini 4 models.

The controls allegedly support:

  • PDF, Office, and OpenDocument page ranges
  • Spreadsheet tabs and cell ranges
  • Audio and video time ranges
  • Text, image, formula, visual, transcript, frame, and audio layers
  • Low, medium, and high-resolution processing
  • Files API uploads that can be reused across calls

The announced fields include `start_page`, `end_page`, `sheet_index`, and `visible_cells`. Media requests use `start_offset` and `end_offset`.

That would be useful. It also isn't verified today.

The supplied example has another warning sign. It opens a JavaScript block with Python code:

from google import genai

client = genai.Client()

That doesn't prove the feature is false. It does prove you shouldn't paste announcement code into a live sales agent.

Check three items inside Google AI Studio first:

1. Is `gemini-4-neon` an available model ID? 2. Does the installed Google SDK accept the listed processing fields? 3. Does Google bill only the inspected slice?

Run one file through the API. Compare the returned token count with the full file.

If those checks fail, use client-side slicing. PyMuPDF, openpyxl, and FFmpeg are free.

Your account research agent needs irrelevant material kept out of the model. It doesn't matter where the slicing happens.

Step 2: Build a Cheap Skim Before the Expensive Read

The right pattern is simple.

Skim cheap. Select evidence. Read the selected evidence. Write the brief.

Don't ask Gemini to find useful pages while it processes every page at high resolution. You're paying the model to ignore material.

Start with predictable sales signals:

  • Revenue and growth
  • Hiring plans
  • New products
  • Acquisitions
  • Geographic expansion
  • Cost reduction
  • Leadership changes
  • Sales or marketing priorities
  • Named risks
  • Technology changes

Use local text extraction for the first pass. PyMuPDF can search an 80-page PDF without a model call.

import fitz

TERMS = "revenue", "sales", "[marketing", "acquisition", "expansion", "headcount", "artificial intelligence", "cost reduction", ]

document = fitz.open("annual-report.pdf") selected_pages = []

for page_number, page in enumerate(document): text = page.get_text("text").lower() matches = [term for term in TERMS if term in text]

if matches: selected_pages.append({ "page": page_number + 1, "matches": matches, "text": text, })

This costs $0 in model fees.

Keyword matching won't catch everything. That's fine. The skim isn't the final analysis.

Add embeddings or a cheaper model when the language varies. Search for concepts such as "reducing operating expense," not only the phrase "cost reduction."

Keep the page number attached to every passage. Citations get hard when extraction removes the source location.

Websites need the same treatment. Fetch the relevant pages, remove menus, and split content by heading.

Don't send the entire company website. The careers page and investor section usually matter more than 600 product-support pages.

Step 3: Slice PDFs, Sheets, and Media Before Gemini

PDF slicing is easy with PyMuPDF.

import fitz

source = fitz.open("annual-report.pdf") sliced = fitz.open()

for page_number in [6, 14, 15, 31, 44, 62]: sliced.insert_pdf( source, from_page=page_number - 1, to_page=page_number - 1, )

sliced.save("annual-report-sliced.pdf")

Store the original page numbers separately. Page one of the new PDF may be page six of the source.

Spreadsheets should be cut by tab and range. Don't send 50,000 cells when the agent needs one regional revenue table.

from openpyxl import load_workbook import csv

workbook = load_workbook( "account-data.xlsx", data_only=False, )

sheet = workbook["Pipeline"]

with open("pipeline-slice.csv", "w", newline="") as file: writer = csv.writer(file)

for row in sheet["A2:H75"]: writer.writerow([cell.value for cell in row])

Include formulas when they matter. A displayed value tells you the result. The formula shows how the company calculated it.

FFmpeg can cut a two-hour earnings call to a five-minute segment:

ffmpeg -ss 00:31:00 -to 00:36:00 \ -i earnings-call.mp4 \ -c copy earnings-call-slice.mp4

Start with transcripts. Use frames only for charts, slides, or visual demonstrations.

The supplied Google announcement calls this "skim cheap, then zoom in." That's a sound design, even if its native controls remain unverified.

This also makes failures easier to handle. If page extraction fails, the agent can flag one source.

It doesn't need to rerun the entire account brief.

Step 4: Make Gemini Write From Evidence, Not Memory

Upload the sliced evidence after confirming your available Gemini model ID.

Don't hardcode `gemini-4-neon` until Google lists it inside your project.

import os from google import genai

client = genai.Client( api_key=os.environ["GEMINI_API_KEY"] )

model_id = os.environ["GEMINI_MODEL"]

pdf_file = client.files.upload( file="annual-report-sliced.pdf" )

response = client.models.generate_content( model=model_id, contents=[ pdf_file, """ Create an account brief using only the supplied evidence.

Every factual claim must include: - source_id - original page or range - exact supporting quote

If the evidence doesn't support a field, return: "Not found in supplied evidence."

Return valid JSON. """ ], )

The prompt isn't enough. Validate the output.

Every claim should have four fields:

  • `claim`
  • `source_id`
  • `location`
  • `supporting_quote`

Then compare each quote against the extracted source text. Reject claims without a match.

That validation layer matters more than another clever prompt.

Calling a false statement a hallucination gives the model too much personality. Your system accepted an unsupported claim because nobody checked it.

Use this evidence-first account brief format:

Account snapshot

  • Company name
  • Revenue or size
  • Main products
  • Key markets

Verified sales signals

  • Signal
  • Why it matters
  • Source
  • Page or range
  • Supporting quote

Likely business priorities

  • Priority
  • Evidence
  • Confidence level
  • Missing information

Outreach angle

  • Buyer role
  • Relevant problem
  • Proof point
  • Question to ask

Research gaps

  • Missing fact
  • Best next source
  • Required human review

A good brief says "not found" without embarrassment. A bad brief fills empty fields with polished guesses.

Step 5: Measure Cost and Unsupported Claims

The supplied Gemini 4 Neon announcement lists these prices:

  • $3 per million input tokens
  • $0.15 per million cached input tokens
  • $15 per million output tokens
  • One million tokens of context

Those rates remain unverified because the announcement is future-dated.

Still, the cost math shows why slicing matters.

The source packet estimates 1,120 tokens per high-resolution PDF page. An 80-page report would consume about 89,600 input tokens.

At the listed Neon rate, that input costs about $0.27.

Six selected pages consume about 6,720 input tokens. That costs about $0.02.

Add 1,500 output tokens for the brief. That costs about $0.0225.

WorkflowInput costOutput costEstimated total
Full 80-page PDF$0.269$0.023$0.292
Six-page slice$0.020$0.023$0.043

That's an estimated 85% total cost reduction. Input token usage falls about 92%.

Don't claim fewer unsupported statements without measuring them.

Create a 50-account test set. Have a person verify each factual claim against its cited source.

Track these numbers:

  • Supported claims divided by total claims
  • Correct citations divided by total citations
  • Briefs requiring human correction
  • Input tokens per brief
  • Cost per accepted brief
  • Processing time per account

Production systems need exceptions.

Oldcastle APG shows the right pattern, though its supplied AWS case study is also future-dated. The case claims 95% automation, with the remaining 5% sent for review.

Unilever's supplied Microsoft case uses the same setup. Four agents read orders, a fifth checks them, and people handle missing information.

Let agents process routine evidence. Send uncertain claims to a person with the source already attached.

The Model Isn't the Big Idea

Gemini 4 Neon may become an excellent research model. Native Gemini API file slicing may remove plenty of local code.

The core job stays the same.

A sales research agent must find relevant evidence, preserve its location, and reject unsupported claims. The final brief is only the last step.

We've built more than 100 AI automations at StoryPros. Strategy still matters more than the model dropdown.

The model does the work. Your evidence architecture decides whether anyone should trust it.

FAQ

What is the File Search tool in the Gemini API?

File Search retrieves relevant passages from uploaded files before generating an answer. File slicing limits the exact pages, cells, or media intervals sent for processing.

Can I upload PDF files using the Gemini API?

Yes, Gemini's Files API supports PDF uploads for later model calls. Check Google's current size, retention, page, and regional limits before shipping the workflow.

How can I send selected PDF pages to Gemini?

Extract the required pages with PyMuPDF, save a smaller PDF, and upload that file. If Google releases verified native page controls, use `start_page` and `end_page` against the uploaded file URI.

How do spreadsheet ranges reduce token costs?

A spreadsheet range limits processing to selected cells, such as `A2:H75`. This avoids paying for unrelated tabs, formulas, charts, and empty rows.

Does file slicing stop unsupported AI claims?

No. File slicing removes irrelevant context, but it doesn't validate the answer. Require citations, verify supporting quotes, and reject claims that lack source evidence.

Related Reading

AI Answer

How much can I save by slicing a PDF before sending it to Gemini?

Sending six pages instead of an 80-page PDF cuts input tokens by about 92%. At current Gemini rates, that drops input cost from roughly $0.27 to $0.02 per brief. Total cost per brief falls about 85%, from $0.29 to $0.04.

AI Answer

How do I send only specific pages of a PDF to the Gemini API?

Extract the pages you need with PyMuPDF, save them as a smaller PDF, and upload that file. Use fitz.open() to select pages by number and insert_pdf() to build the sliced file. This works today with the current Gemini Files API.

AI Answer

Does sending less context to Gemini reduce hallucinations?

File slicing removes irrelevant context, but it does not validate the output on its own. Every claim still needs a source ID, page number, and exact supporting quote. Reject any claim that lacks a matching quote in the extracted source text.