UN-2646 [FEAT] LLMWhisperer image output mode adapter#2210
Conversation
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>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
for more information, see https://pre-commit.ci
|




What
Adds an image output mode to the LLMWhisperer V2 X2Text adapter (MFBT phase
llmwhisperer-image-output-mode-adapter, UN-2646). Whenoutput_mode = image, the adapter converts a PDF to per-page images via the LLMWhisperer pdf-to-images API and returns them asPageImageReferenceobjects (persisted to Unstract FileStorage) — never smuggled intoextracted_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)
PageImageReference,OutputModes.IMAGE,ImageOutputConfig)get_page_images: submit/poll/retrieve+unzip)process()(_process_image_mode, PDF-only validation)imageenum, "Image (PDF only)" label, conditional PDF-only note UNS-759)45 unit tests pass; ruff clean.
E2E verification checklist (UNS-758)
enumNames)page_imagespopulated_validate_pdf_onlyraises the PDF-only error today; the earlier UI-layer check (UNS-757) is not yet wiredRemaining (draft)
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_onlyinprocess().)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