fix: update DocIntel default and surface OCR failures#1642
Open
imadreamerboy wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: update DocIntel default and surface OCR failures#1642imadreamerboy wants to merge 1 commit intomicrosoft:mainfrom
imadreamerboy wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Author
|
@microsoft-github-policy-service agree |
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.
This PR fixes Azure Document Intelligence handling for image OCR in
markitdown.There were two separate problems:
DocumentIntelligenceConverterstill defaulted toapi_version="2024-07-31-preview", which can fail on valid Azure resources with404 Resource not foundduringbegin_analyze_document(...).MarkItDown._convert(): after the DocIntel converter failed,ImageConvertercould return an emptyDocumentConverterResult(markdown=""), and markitdown treated that as a successful conversion. The caller then sawresult.text_content == ""instead of the real Azure error.Changes
2024-07-31-previewto2024-11-30docintel_api_version=...override behavior intactWhy
This matches current Azure behavior more reliably for OCR/image analysis and fixes a misleading failure mode where real Azure/DocIntel errors were swallowed and surfaced as “no OCR text extracted”.
Validation
Tested with focused pytest coverage for DocIntel and fallback behavior:
test_docintel_default_api_versiontest_docintel_explicit_api_versiontest_empty_image_fallback_does_not_mask_prior_failureThese pass with the local package under test.