Skip to content

UN-2646 [FEAT] LLMWhisperer image output mode adapter#2210

Draft
pk-zipstack wants to merge 3 commits into
mainfrom
feat/llmwhisperer-image-output-adapter
Draft

UN-2646 [FEAT] LLMWhisperer image output mode adapter#2210
pk-zipstack wants to merge 3 commits into
mainfrom
feat/llmwhisperer-image-output-adapter

Conversation

@pk-zipstack

Copy link
Copy Markdown
Contributor

What

Adds an image output mode to the LLMWhisperer V2 X2Text adapter (MFBT phase llmwhisperer-image-output-mode-adapter, UN-2646). When output_mode = image, the adapter converts a PDF to per-page images via the LLMWhisperer pdf-to-images API and returns them as PageImageReference objects (persisted to Unstract FileStorage) — never smuggled into extracted_text, so text-mode consumers are unaffected.

Kept independent of the document_insights/signature feature (#1967) — this branch contains image-output only.

Modules (from MFBT)

Module Status
MUNS-193 DTO & Constants (PageImageReference, OutputModes.IMAGE, ImageOutputConfig) ✅ 13 tests
MUNS-194 Adapter helper + endpoint calls (get_page_images: submit/poll/retrieve+unzip) ✅ 23 tests
MUNS-195 Image mode in process() (_process_image_mode, PDF-only validation) ✅ 9 tests
MUNS-196 JSON schema + UI (image enum, "Image (PDF only)" label, conditional PDF-only note UNS-759) ✅ schema; ⏳ UNS-757 pending

45 unit tests pass; ruff clean.

E2E verification checklist (UNS-758)

  • UI selectability — "Image (PDF only)" option present in the adapter config dropdown (json_schema enumNames)
  • Happy path (PDF) — verified end-to-end against the deployed pdf-to-images API: submit → poll → retrieve a 20-page PDF returned 20 valid page images; page_images populated
  • Text-mode regression — all 45 adapter tests pass; layout/text modes unaffected by the schema change
  • Error path (non-PDF) via UI — runtime _validate_pdf_only raises the PDF-only error today; the earlier UI-layer check (UNS-757) is not yet wired
  • Conditional note render (UNS-759) — schema conditional added; visual render to confirm in the running UI

Remaining (draft)

  • UNS-757 — earlier UI-layer PDF-only validation. (The spec names adapter_processor_v2, but that module does adapter CRUD/test, not file extraction; correct placement TBD with the running app. Runtime correctness is already covered by _validate_pdf_only in process().)
  • UNS-759 render + UNS-757 to be finished/verified against a running local Unstract.

Recovery note

This implementation was recovered from an earlier stashed session and rebased cleanly onto main, stripping all doc-insights code (that lives in #1967).

🤖 Generated with Claude Code

pk-zipstack and others added 2 commits July 25, 2026 20:54
Adds an "image" output mode to the LLMWhisperer V2 X2Text adapter: it converts a
PDF to per-page images via the LLMWhisperer pdf-to-images API and returns them as
PageImageReference objects (persisted to FileStorage), never smuggled into
extracted_text, so text-mode consumers are unaffected.

- dto.py: PageImageReference + additive TextExtractionMetadata.page_images.
- constants.py: OutputModes.IMAGE, ImageOutputConfig (PDF-only), OUTPUT_MODE key.
- helper.py: get_page_images() — submit / poll / retrieve+unzip the pdf-to-images
  job and persist the page images.
- llm_whisperer_v2.py: _process_image_mode() + output-mode branch in process(),
  with PDF-only validation.
- json_schema.json: "image" enum + "Image (PDF only)" label + description.

Recovered from the earlier implementation (MFBT phase
llmwhisperer-image-output-mode-adapter) and rebased onto main, kept independent of
the document_insights/signature feature (PR #1967). 45 tests pass. MUNS-193/194/195
complete; MUNS-196 UI validation (UNS-757/758/759) remains.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Convert the adapter json_schema's single top-level if/then into an allOf so a
second conditional can coexist with the existing low_cost one. Adds a PDF-only
guidance note (type: null field, RJSF renders it as a labelled callout) shown
only when output_mode == "image", guarded by required:[output_mode]. Purely
UI/UX; no effect on submission, validation, or backend behaviour.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 91377bb3-22e1-45e5-8fb3-7c8f2f9fd0b7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/llmwhisperer-image-output-adapter

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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