Add one-shot prompt generator for external LLM figure analysis#17
Open
amahpour wants to merge 2 commits into
Open
Add one-shot prompt generator for external LLM figure analysis#17amahpour wants to merge 2 commits into
amahpour wants to merge 2 commits into
Conversation
…prompts Remove SIMPLE_TYPES/COMPLEX_TYPES tier logic from local_processor.py in favor of a single confidence threshold. Add prompt_generator.py that collects low-confidence figures after Moondream processing and generates a one-shot markdown prompt with absolute image paths, batched in groups of 20, with instructions for status updates and parallel subagent usage. The generated prompt is written to out/<pdf>/external_analysis_prompt.md and can be handed directly to Claude or Codex. https://claude.ai/code/session_0139BXTEb42aXeukRzsaxyEQ
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.
Summary
This PR introduces an automated prompt generation system that creates self-contained markdown files for external LLM analysis of low-confidence figures. The system collects figures flagged by the local processor and organizes them into batches with explicit instructions for parallel processing and status reporting.
Key Changes
New module
src/prompt_generator.py: Generates one-shot markdown prompts containing:Refactored confidence scoring in
src/local_processor.py:SIMPLE_TYPES/COMPLEX_TYPESclassification logic with a continuous_compute_confidence()functionCONFIDENCE_THRESHOLD(0.7) to determine which figures need external analysisIntegrated prompt generation into pipeline (
src/pipeline.py):write_prompt()after local figure processing completesexternal_analysis_prompt.mdin the PDF output directoryUpdated documentation (
prompts/figure_analysis.md):Comprehensive test coverage (
tests/test_prompt_generator.py):Implementation Details
processing/fig_*.jsonstatus files and filtered bystatus == "needs_external"None)https://claude.ai/code/session_0139BXTEb42aXeukRzsaxyEQ