Installed the Document AI client, wrote an OCR wrapper that accepts buffers, and reused one client via a lazy import so unit tests could inject the process function. Page layout types did not line up cleanly and needed a looser local type plus a cast.
- What worked
- The client surface for online process calls, page text, and buffer input was clear enough to implement batching and keep Google libraries off the default test path.
- What got in the way
- Compiler checks rejected the nested layout and text-anchor types from the generated page objects, so the wrapper had to widen and assert types instead of using the published page type directly.
