Options

Every option has a default; set only those you need.

Tier

standard ($0.03 a page, the default) suits most documents. pro ($0.05 a page) uses a stronger model, for the hardest: values worked out across many pages, diagrams, dense charts and long single-sheet drawings.

job = client.extract("report.pdf", schema, tier="pro")

Some pages only

Extract from one page or a range of pages; only they are read, and only they are charged. All pages when left out.

job = client.extract("report.pdf", schema, pages="30-60")   # or (30, 60), or 30 for one page
print(job.usage.pages)   # 31: only these are charged

The page each row came from

With cite_sources, the result also gives the page each list item is on, keyed by the item's path in the result (a JSON Pointer), to check a value against the page it came from.

job = client.extract("report.pdf", schema, cite_sources=True)
print(job.sources)   # {"/segments/0": {"page": 34}, "/segments/1": {"page": 34}, ...}

Instructions

Anything to know about the whole document, not one field: the units it uses, which of two versions of a table to take, what to leave out. Up to 4,000 characters. What is about one field belongs in that field's description (see Writing a schema).

job = client.extract("report.pdf", schema,
                     system_prompt="Amounts are in thousands of dollars. Ignore the restated 2023 figures.")