You鈥檙e Wasting Tokens: Stop Giving Raw PDFs to Your LLM

https://hackernoon.imgix.net/images/6zJPRmR333g0ARa224GJnR4FrBo1-od03bpi.png

The most expensive part of asking an LLM about a PDF is usually the PDF. Ask 20 questions about a 100-page PDF in 20 separate API calls, and you've sent 2,000 pages of input. At Anthropic's estimate of 1,500 to 3,000 text tokens per page, that's 3 to 6 million input tokens before you even count a single page image. While prompt caching can help reduce the bill, you're still sending the whole file every time. That means each new question still has the model working out table structure from a text layer that doesn't even know what a table is.

The better pattern is to separate ingestion from answering questions. Parse the document once, store the result, and send the model the sections or fields it needs, with page references so every answer can be checked.聽

That's the job the Nutrient Data Extraction APIis built for: it turns...

Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE

Read more