Skip to content

LLM logging, model upgrade, image serving#12

Merged
nicpottier merged 5 commits intomainfrom
llm-updates
Feb 10, 2026
Merged

LLM logging, model upgrade, image serving#12
nicpottier merged 5 commits intomainfrom
llm-updates

Conversation

@nicpottier
Copy link
Contributor

@nicpottier nicpottier commented Feb 10, 2026

Summary

  • Per-attempt LLM logging: Each retry attempt is now logged individually with a shared requestId UUID, enabling tracing of retry sequences
  • Model upgrade: Default model switched from gpt-4o to gpt-5.2 across all pipeline steps
  • Web rendering retries: Increased max retries from 8 to 25 for more resilient rendering
  • Simplified schema management: Removed DB migration code — mismatched schema versions now throw instead of migrating
  • Image src rewriting: HTML validation now rewrites image src attributes to server-resolvable URLs (/api/books/{label}/images/{imageId})
  • Image serving route: Added GET /api/books/:label/images/:imageId to serve extracted images as PNG binaries
  • Relaxed HTML validation: Removed duplicate data-id enforcement (LLMs may reuse IDs legitimately)

Test plan

  • All 225 tests pass (pnpm test)
  • TypeScript compiles cleanly (pnpm build)
  • Manual: run pipeline on a book and verify image URLs resolve in rendered HTML
  • Manual: verify GET /api/books/{label}/images/{imageId} returns PNG data

…d context-based validators

- Add token-bucket rate limiter for global LLM call throttling
- Make per-call timeout configurable via config.yaml (default 180s for web rendering)
- Move concurrency from per-step to global config setting (default 32)
- Use z.string() instead of z.enum() in LLM schemas with conversational validation feedback
- Extract <section> tag in HTML validation, return cleaned output via ValidationResult.cleaned
- Pull context out of prompt as top-level field on GenerateObjectOptions
- Pass context to validate callbacks, replacing closure-based validators with standalone functions
…g, and image serving route

- Add per-attempt LLM logging with requestId UUID grouping retry attempts
- Switch default model from gpt-4o to gpt-5.2 across all pipeline steps
- Increase web rendering max retries from 8 to 25
- Remove DB migration code (throw on schema mismatch instead)
- Remove duplicate data-id validation in HTML validation
- Rewrite image src attributes to server URLs during HTML validation
- Add GET /books/:label/images/:imageId route to serve extracted images as PNG
- Thread book label through render pipeline for image URL construction
@nicpottier nicpottier merged commit 98b8504 into main Feb 10, 2026
1 check passed
amoghbanta added a commit that referenced this pull request Feb 10, 2026
Integrates pipeline team changes (PR #12 llm-updates):
- Rate limiting, per-attempt LLM logging, single-arg appendLlmLog API
- Schema version mismatch detection (needsRebuild/rebuildReason)
- Image src rewriting, configurable timeouts, validation improvements

Conflict resolutions:
- book-service.ts: main's error handling + our publisher/languageCode fields
- pipeline-runner.ts: main's rateLimiter + single-arg API + our SSE llm-log emit
- BookCard.tsx: kept deleted (inlined in index.tsx BookRow)
- books.$label.index.tsx: our 2-column layout + main's needsRebuild UI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant