Topic 2 of 4 · 3 min read
Prompting over attached documents
Goal: Write a prompt over an attached long document that targets the right sections and asks for page-referenced quotes.
With a long document, tell the model which file and which parts to use, and ask it to quote the page for every claim so you can check each one.
Check yourself · 1 of 3
You attach a 120-page report and want to know its refund policy. Which prompt is best?
Why it matters
You can attach a 90-page contract, a report or a spreadsheet to most assistants. They will then answer as if they had read every line. In practice the model may skim, lean on the start and the end, and fill gaps with what a document like this usually says. A confident answer with no page number is hard to trust and hard to check.
How to do it
- Name the file. When you attach more than one, say which: "In the file named lease-2026.pdf".
- Name the part. Give a page range, a section title or a sheet name: "pages 14 to 19", "the section called Termination", "the tab named Q3". This narrows the search and cuts mistakes.
- Ask for page-referenced quotes. Ask for the exact words and the page for each point: "Quote the sentence and give the page number." A quote can be checked in seconds. A summary cannot.
- Allow a gap. Add: "If the document does not say, write 'not stated' rather than guessing." Without this, the model tends to fill in a plausible clause.
- Ask one thing at a time for long files. Three narrow questions beat one broad one.
- For spreadsheets, name the columns and rows you mean, and say what to compute or compare. Ask the model to show the cells it used.
Before and after
Before: Summarise the attached lease.
You get a smooth summary. You cannot tell what it left out.
After: In the attached file lease-2026.pdf, read the section called Termination (around pages 12 to 14). List every condition under which the tenant can end the lease early. For each one, quote the sentence and give the page number. If a condition is unclear, say so. Do not use anything outside this section.
What goes wrong
- Page numbers do not match. The page in the file viewer and the number printed on the page often differ. Say which you mean, and check one quote by hand.
- Invented quotes. A model can produce a quote that sounds right but is not in the file. Search for the exact words in the document before you rely on one.
- Scanned pages. If a PDF is a photo of paper, text may be read poorly or not at all. Check that the model can quote a line you know is there.
- Charts and tables inside the PDF may be read less well than the body text.
Examples
A contract question
Before: Is there anything risky in this contract?
After: In the attached supplier-agreement.pdf, read the sections called Payment and Liability. List any clause that makes us pay more than the agreed price or limits what the supplier owes us. Quote each clause and give its page. If you are not sure it is risky, say so.
A spreadsheet question
Before: Analyse this sheet.
After: In the tab named Q3 of the attached budget workbook, compare the Actual and Planned columns for the Marketing rows. List each row where Actual is more than 10 percent over Planned, and show the two cell values you used.
Key points
- Name the file and the pages, sections or sheets the model should use.
- Ask for the exact quote and page number for each claim so you can check it.
- Tell the model to write not stated when the document does not say, rather than guess.
- Ask one narrow question at a time for long files.
- Check at least one quote by searching the document, because quotes can be invented.
Common mistakes
- Asking for a summary of a whole long file when you only need one section.
- Accepting an answer with no quotes or page numbers.
- Not telling the model it may say the document does not cover something.
- Trusting a quote without searching the file for the exact words.
Check yourself · 2 of 3
Why add the line "If the document does not say, write not stated"?
Check yourself · 3 of 3
The model gives you a quote and page 14. You cannot find the quote on the page you opened. What is the best next step?
Practice items, not counted towards your mastery.
Start here
- Vision (Claude docs) (opens in a new tab)DocsFree
Anthropic's guide to image input, with tips on image placement, size and the limits of reading small or rotated detail.
- Image understanding (Gemini API) (opens in a new tab)DocsFree
Google's guide to prompting with images, including advice to put the question clearly and to expect limits on spatial detail.
- Images and vision (OpenAI docs) (opens in a new tab)DocsFree
OpenAI's guide to image input and a plain list of what vision models do badly.
More for this topic
- PDF support (Claude docs) (opens in a new tab)DocsFree
Explains how a PDF is read as text plus page images, which is why charts and tables need care.
- Document understanding (Gemini API) (opens in a new tab)DocsFree
Google's guide to prompting over long PDFs, including how pages are read and how to ask about them.