Skip to content

fix(mineru): honor dataset language in figure prompts - #18188

Merged
JinHai-CN merged 1 commit into
infiniflow:mainfrom
ting-hong-shieh:codex/issue-17885-mineru-language
Aug 13, 2026
Merged

JinHai-CN merged 1 commit into
infiniflow:mainfrom
ting-hong-shieh:codex/issue-17885-mineru-language

Conversation

@ting-hong-shieh

Copy link
Copy Markdown
Contributor

Summary

Closes #17885.

MinerU figure enrichment now passes the resolved dataset language to vision_llm_figure_describe_prompt. Missing and empty language values use English, matching the other figure-description paths.

This change is limited to MinerU. PR #18021 already fixed the Mistral path.

Root cause

by_mineru passed lang to MinerUParser.parse_pdf, but the parser did not pass it to _enhance_images_with_vlm. The helper then called the prompt factory without a language, so figure descriptions used the English prompt for non-English datasets.

Tests

  • New MinerU language regressions failed before the production change: 6 failed, 11 deselected.
  • pytest -q test/unit_test/deepdoc/parser/test_mineru_parser.py: 17 passed.
  • pytest -q --confcutdir=test/unit_test/rag/app test/unit_test/rag/app/test_vision_language_callers.py: 9 passed.
  • pytest -q test/unit_test/deepdoc/parser/test_mistral_parser.py: 38 passed.
  • ruff format --check passed for all three changed files.
  • ruff check reports the same 29 pre-existing findings as the base revision; this patch adds none.
  • git diff --check passed.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1597d011-a02b-40e9-9649-1467ebf851f9

📥 Commits

Reviewing files that changed from the base of the PR and between 6677f14 and 968b0fd.

📒 Files selected for processing (3)
  • deepdoc/parser/mineru_parser.py
  • test/unit_test/deepdoc/parser/test_mineru_parser.py
  • test/unit_test/rag/app/test_vision_language_callers.py

📝 Walkthrough

Walkthrough

MinerU now normalizes missing dataset languages to English and forwards explicit languages to VLM image-description prompts. Tests cover parser behavior and propagation from naive.by_mineru.

Changes

MinerU language-aware image descriptions

Layer / File(s) Summary
Thread language through MinerU image enhancement
deepdoc/parser/mineru_parser.py
parse_pdf normalizes falsy language values to English and passes the resolved language to _enhance_images_with_vlm, which forwards it to the VLM prompt generator.
Validate language propagation
test/unit_test/deepdoc/parser/test_mineru_parser.py, test/unit_test/rag/app/test_vision_language_callers.py
Tests cover explicit languages, missing and empty language fallbacks, prompt storage, and forwarding from naive.by_mineru.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

A rabbit hops through prompts so bright,
Japanese words now guide the light.
When language hides, English leads,
MinerU enriches image reads.
Thump, thump—the tests agree!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the MinerU fix for honoring dataset language in figure prompts.
Description check ✅ Passed The description includes the required Summary section and provides clear root cause, scope, and test details.
Linked Issues check ✅ Passed The PR satisfies the MinerU requirements in [#17885], including language forwarding and English fallback; the description states Mistral was fixed separately.
Out of Scope Changes check ✅ Passed The production and test changes are limited to MinerU language propagation and related regression coverage.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ting-hong-shieh
ting-hong-shieh marked this pull request as ready for review August 12, 2026 20:06
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🌈 python Pull requests that update Python code 🐞 bug Something isn't working, pull request that fix bug. 🧪 test Pull requests that update test cases. labels Aug 12, 2026
@JinHai-CN JinHai-CN added the ci Continue Integration label Aug 13, 2026
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.65%. Comparing base (6677f14) to head (968b0fd).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18188      +/-   ##
==========================================
- Coverage   94.56%   90.65%   -3.91%     
==========================================
  Files          10       10              
  Lines         717      717              
  Branches      118      118              
==========================================
- Hits          678      650      -28     
- Misses         25       39      +14     
- Partials       14       28      +14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JinHai-CN
JinHai-CN merged commit 9784814 into infiniflow:main Aug 13, 2026
15 checks passed
@ting-hong-shieh
ting-hong-shieh deleted the codex/issue-17885-mineru-language branch October 23, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration 🌈 python Pull requests that update Python code size:XS This PR changes 0-9 lines, ignoring generated files. 🧪 test Pull requests that update test cases.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Follow-up to #17227: MinerU and Mistral figure-description paths ignore dataset language

2 participants