Container occupancy audit with a multimodal LLM
The logistics chain that supplies offshore operations ships materials in containers. There were signs that contractors were underfilling containers to increase the number of trips. The only control was photos taken at loading, which auditors reviewed by eye.
I designed and built from scratch, from architecture to production, a service that automates this review:
- Reads the photos from SharePoint folders through Microsoft Graph (OAuth2 client credentials).
- A multimodal LLM classifies each image: estimated occupancy, confidence in the estimate, stacking quality, and visual evidence.
- Structured output validated by a Pydantic schema (structured output via tool calling), with no manual text parsing.
- Versioned prompts and an inference cache keyed by file, photo version and prompt version: photos already analyzed are not reprocessed, which cuts cost, and a prompt change forces a new analysis.
- A FastAPI + Jinja2 web dashboard to run audits by folder and browse thumbnails, details and cache status.
- Architecture rules documented for the team and for coding assistants (layers, YAGNI, docstrings), and 71 automated tests.