Case study

Local Document AI Extraction

Local PDF extraction workflow that keeps document parsing, chunking, prompting, and review close to the analyst.

Document AI / local LLM extractionpolished demo

Primary evidence: Local/private inference path

System thesis

Local PDF extraction workflow that keeps document parsing, chunking, prompting, and review close to the analyst.

TypePrivate document AI patternUsersAnalysts, document reviewers, regulated-workflow engineersMaturityLocal-first extraction pattern

At a glance

Input
Local PDF upload
Processing
PDFPlumber, chunking, prompt assembly
Inference
Ollama via LangChain
Responsible useLocal/private inference path
UIStreamlit review surface
PatternPDF -> chunks -> prompt -> result

System problem

Why this system exists.

Regulated document workflows need extraction assistance without automatically sending sensitive files to remote services.

Implementation surface

What was built.

  • Streamlit UI.
  • PDF extraction and chunking path.
  • Ollama client integration.
  • Privacy-preserving document AI framing.

Architecture

A system map for the project.

PDF upload -> PDFPlumber extraction -> chunking -> prompt assembly -> local Ollama/LangChain call -> structured answer -> Streamlit review surface.

Custom architectureLocal document intelligence boundary

A privacy-oriented pipeline that keeps parsing, chunking, prompt assembly, local inference, and review inside the local workflow.

Document Zone

local PDFPDFPlumbertext extraction

Context Zone

chunkingcriteria promptscontext windows

Inference Zone

LangChainOllamalocal model

Review Zone

Streamlit UIextracted answeranalyst review

How it works

Input, transformation, model or agent logic, and reviewable output.

01

PDF parse

Documents are parsed locally before any prompt is assembled.

02

Chunking

Extracted text is chunked so criteria-driven prompts remain inspectable.

03

Local model call

LangChain coordinates calls to a local Ollama model rather than an automatic remote service.

04

Reviewable output

Streamlit keeps extraction results in front of a human reviewer.

Evidence

Screenshots, responses, diagrams, tests, and model tables from the source repos.

Artifacts are included only where the public repo has enough context to show them safely.

Engineering Decisions

01

Privacy-first shape

The architecture is useful in regulated contexts where document residency matters.

02

Workflow controls over magic

The value is the parse/chunk/prompt/review loop, not a claim that the model is always correct.

03

Portable prototype

Streamlit and Ollama keep the workflow easy to run locally.

Validation / reliability

How the system is made reviewable.

  • Prompt and memory smoke tests passed locally.
  • Python compile checks pass.
  • Full extraction requires Docker, Ollama, and a local model.
  • Streamlit analyst interface.
  • Docker/Ollama local execution.
  • Runtime setup keeps private files outside version control.

Limits / responsible use

Use synthetic/sample documents only. Uploaded private documents should never be committed.

  • The local path keeps PDF parsing, chunking, prompt assembly, and model calls close to the analyst workflow.
  • Human review stays part of the output boundary.
  • Private documents should never be committed or routed through uncontrolled services.

Repository

Open the source repo and inspect the implementation boundary.

All public examples are synthetic, sanitized, historical, or research/demo implementations. No PHI, PII, employer-confidential data, proprietary claims data, private keys, production credentials, or sensitive datasets are included.