Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
fix(magic_pdf): correct end page index and improve error handling
myhlolif209ddea62b5
diff --git a/magic_pdf/model/doc_analyze_by_custom_model.py b/magic_pdf/model/doc_analyze_by_custom_model.pyindex 3a916146..65851b67 100644--- a/magic_pdf/model/doc_analyze_by_custom_model.py+++ b/magic_pdf/model/doc_analyze_by_custom_model.py@@ -158,7 +158,7 @@ def doc_analyze(table_enable=None,) -> InferenceResult:- end_page_id = end_page_id if end_page_id else len(dataset)+ end_page_id = end_page_id if end_page_id else len(dataset) - 1model_manager = ModelSingleton()custom_model = model_manager.get_model(diff --git a/magic_pdf/post_proc/llm_aided.py b/magic_pdf/post_proc/llm_aided.pyindex 12c11321..c2eb3c86 100644--- a/magic_pdf/post_proc/llm_aided.py+++ b/magic_pdf/post_proc/llm_aided.py@@ -151,7 +151,7 @@ Corrected title list:logger.warning("The number of titles in the optimized result is not equal to the number of titles in the input.")retry_count += 1except Exception as e:- if e is json.JSONDecodeError:+ if isinstance(e, json.decoder.JSONDecodeError):logger.warning(f"JSON decode error on attempt {retry_count + 1}: {e}")else:logger.exception(e)