Improve slide content extraction: better prompt, higher DPI, text fallback, retry#18
Open
BrandonS7 wants to merge 1 commit intoBirmingham-AI:mainfrom
Open
Improve slide content extraction: better prompt, higher DPI, text fallback, retry#18BrandonS7 wants to merge 1 commit intoBirmingham-AI:mainfrom
BrandonS7 wants to merge 1 commit intoBirmingham-AI:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Addresses slide content capture gaps where information was being lost during PDF processing.
1. Higher resolution rendering (150 → 250 DPI)
Dense slides with small text, chart labels, and fine details were hard for the vision model to read at 150 DPI. Bumped to 250 for significantly better legibility.
2. Enhanced vision prompt
The old prompt asked for just title + key_points. The new prompt explicitly asks for:
raw_textfield for anything not captured in key_pointsCompleteness now prioritized over brevity.
3. Text extraction fallback
Previously, if vision analysis failed or returned minimal content (<20 chars), the slide was silently skipped. Now falls back to direct PDF text extraction via pypdf. If vision got partial content, combines both. This means slides are never silently lost.
4. Retry on vision API failures
Vision API calls now retry once with a 1-second backoff before giving up. Transient API errors no longer cause permanent slide loss.
5. More robust JSON parsing
Replaced brittle markdown fence splitting with regex extraction (
re.search) that handles any wrapper format the model returns.Net effect: more information captured per slide, fewer silent skips, more resilient to API hiccups. No changes to upload routes, embedding storage format, or CLI interface.