Google LangExtract with Ollama: local PDF extraction setup

Learn a Python extraction workflow with Ollama, source character spans and Markdown output, using five questions about an Nvidia financial report.

Player not loading? Watch on YouTube

This tutorial walks through a local document extraction pipeline using Google LangExtract and Ollama. The presenter creates a Python virtual environment, installs dependencies and configures a model in main.py. Five questions about an Nvidia financial report drive the example, which writes answers, source character spans and processing times to outputs.md.

The explanation covers document chunking, repeated extraction passes and exact source character mapping. The presenter describes grounding as a check against invented or paraphrased text and claims it guarantees zero hallucination. The demonstration does not establish that guarantee for other documents or models. It reports an 11-second total runtime, with individual answers taking about two to three seconds.

The speaker identifies the release as 1.6.0 and discusses Ollama alongside Gemini and OpenAI API options. The local LLM configuration names Qwen1.5-34B, although the results commentary later calls it a four-billion-parameter model. That inconsistency leaves the tested model size unclear.

The tutorial also covers a browser visualizer, JSON annotation export and parallel workers. For production use, the presenter suggests models with 4 to 70 billion parameters and 4 to 24 GB of GPU memory; these are the speaker's recommendations. Messy scans need cleanup, and additional passes can increase processing time. Cloud API options send document data to remote servers.