fix: add missing commas in LLM prompts to ensure valid JSON output#258
Open
Himanshuwagh wants to merge 1 commit intoVectifyAI:mainfrom
Open
fix: add missing commas in LLM prompts to ensure valid JSON output#258Himanshuwagh wants to merge 1 commit intoVectifyAI:mainfrom
Himanshuwagh wants to merge 1 commit intoVectifyAI: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.
Title: Fix JSON parsing errors by adding missing commas in LLM prompts
Summary
This PR fixes intermittent
KeyErrorand JSON parsing failures by ensuring all LLM prompts inpage_index.pyrequest a valid JSON structure.The Problem
Several prompts were missing a comma between the
"thinking"key and the subsequent result key. This caused the model to output invalid JSON syntax, which resulted in the following error:Changes Made
Added trailing commas to the
"thinking"lines in the following functions withinpageindex/page_index.py:check_title_appearance(Line 34)check_title_appearance_in_start(Line 62)toc_detector_single_page(Line 112)check_if_toc_extraction_is_complete(Line 132)check_if_toc_transformation_is_complete(Line 150)detect_page_index(Line 213)Testing
KeyErrorencountered when the LLM follows the provided format literally.