Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

feat: refactor Flash model to separate PDF and Office document handling with new model classes

myhloli2af1b66ca0f8
diff --git a/mineru/backend/flash/pdf_extractor.py b/mineru/backend/flash/pdf_extractor.py
index 39911e5b..5607313e 100644
--- a/mineru/backend/flash/pdf_extractor.py
+++ b/mineru/backend/flash/pdf_extractor.py
@@ -2,7 +2,7 @@
"""Flash PDF 公共提取入口。
-原生文本处理由 FlashModel 提供;需要 OCR 时统一委托 Hybrid low。
+原生文本处理由 PdfModel 提供;需要 OCR 时统一委托 Hybrid low。
"""
from __future__ import annotations
@@ -59,10 +59,10 @@ def doc_analyze(
resolved_mode = parse_mode
if resolved_mode == "txt":
- # 延迟加载 FlashModel,使逐页纯文本和 OCR 路径保持轻量。
- from mineru.model.flash import FlashModel
+ # 延迟加载 PdfModel,使逐页纯文本和 OCR 路径保持轻量。
+ from mineru.model.flash import PdfModel
- return FlashModel().predict(pdf_doc)
+ return PdfModel().predict(pdf_doc)
# OCR 路径延迟加载 Hybrid,保证原生 Flash 不引入本地视觉模型运行时。
from mineru.backend.hybrid.analyze import doc_analyze as hybrid_doc_analyze
diff --git a/mineru/backend/office/docx_analyze.py b/mineru/backend/office/docx_analyze.py
index 1e2ba252..f94a0259 100644
--- a/mineru/backend/office/docx_analyze.py
+++ b/mineru/backend/office/docx_analyze.py
@@ -5,7 +5,7 @@ from typing import Any
from loguru import logger
-from ...model.flash.docx.main import convert_binary
+from ...model.flash import DocxModel
from ...types import PageInfo
from ...utils.image_payload import ImagePayloadCache
from .model_output_to_middle_json import result_to_middle_json
@@ -15,7 +15,7 @@ def office_docx_analyze(file_bytes: bytes, image_cache: ImagePayloadCache | None
infer_start = time.time()
file_stream = BytesIO(file_bytes)
- results = convert_binary(file_stream)
+ results = DocxModel().predict(file_stream)
infer_time = round(time.time() - infer_start, 2)
safe_time = max(infer_time, 0.01)
diff --git a/mineru/backend/office/pptx_analyze.py b/mineru/backend/office/pptx_analyze.py
index bbc61ff4..977590a5 100644
--- a/mineru/backend/office/pptx_analyze.py
+++ b/mineru/backend/office/pptx_analyze.py
@@ -7,7 +7,7 @@ from typing import Any
from loguru import logger
-from ...model.flash.pptx.main import convert_binary
+from ...model.flash import PptxModel
from ...types import PageInfo
from ...utils.image_payload import ImagePayloadCache
from .model_output_to_middle_json import result_to_middle_json
@@ -17,7 +17,7 @@ def office_pptx_analyze(file_bytes: bytes, image_cache: ImagePayloadCache | None
infer_start = time.time()
file_stream = BytesIO(file_bytes)
- results = convert_binary(file_stream)
+ results = PptxModel().predict(file_stream)
infer_time = round(time.time() - infer_start, 2)
safe_time = max(infer_time, 0.01)
diff --git a/mineru/backend/office/xlsx_analyze.py b/mineru/backend/office/xlsx_analyze.py
index e1705d95..eb9ac450 100644
--- a/mineru/backend/office/xlsx_analyze.py
+++ b/mineru/backend/office/xlsx_analyze.py
@@ -7,7 +7,7 @@ from typing import Any
from loguru import logger
-from ...model.flash.xlsx.main import convert_binary
+from ...model.flash import XlsxModel
from ...types import PageInfo
from ...utils.image_payload import ImagePayloadCache
from .model_output_to_middle_json import result_to_middle_json
@@ -17,7 +17,7 @@ def office_xlsx_analyze(file_bytes: bytes, image_cache: ImagePayloadCache | None
infer_start = time.time()
file_stream = BytesIO(file_bytes)
- results = convert_binary(file_stream)
+ results = XlsxModel().predict(file_stream)
infer_time = round(time.time() - infer_start, 2)
safe_time = max(infer_time, 0.01)
diff --git a/mineru/model/flash/__init__.py b/mineru/model/flash/__init__.py
index 3126d171..f3e20574 100644
--- a/mineru/model/flash/__init__.py
+++ b/mineru/model/flash/__init__.py
@@ -1,7 +1,7 @@
# Copyright (c) Opendatalab. All rights reserved.
-"""Flash 原生 PDF 模型入口。"""
+"""Flash PDF 与 Office 模型公开入口。"""
-from .model import FlashModel
+from .model import DocxModel, PdfModel, PptxModel, XlsxModel
-__all__ = ["FlashModel"]
+__all__ = ["PdfModel", "DocxModel", "PptxModel", "XlsxModel"]
diff --git a/mineru/model/flash/docx/__init__.py b/mineru/model/flash/docx/__init__.py
index 1e17167c..e0a59fbf 100644
--- a/mineru/model/flash/docx/__init__.py
+++ b/mineru/model/flash/docx/__init__.py
@@ -1 +1,3 @@
# Copyright (c) Opendatalab. All rights reserved.
+
+"""Flash DOCX 转换实现。"""
diff --git a/mineru/model/flash/docx/main.py b/mineru/model/flash/docx/main.py
index 16905185..9fff99a4 100644
--- a/mineru/model/flash/docx/main.py
+++ b/mineru/model/flash/docx/main.py
@@ -1,18 +1,20 @@
# Copyright (c) Opendatalab. All rights reserved.
-from typing import BinaryIO
+from typing import Any, BinaryIO
-from mineru.model.flash.docx.docx_converter import DocxConverter
+from mineru.model.flash import DocxModel
-def convert_path(file_path: str):
+def convert_path(file_path: str) -> list[list[dict[str, Any]]]:
+ """从 DOCX 文件路径调用统一模型入口。"""
+
with open(file_path, "rb") as fh:
return convert_binary(fh)
-def convert_binary(file_binary: BinaryIO):
- converter = DocxConverter()
- converter.convert(file_binary)
- return converter.pages
+def convert_binary(file_binary: BinaryIO) -> list[list[dict[str, Any]]]:
+ """兼容旧二进制转换函数,并转发给 DocxModel。"""
+
+ return DocxModel().predict(file_binary)
if __name__ == "__main__":
diff --git a/mineru/model/flash/model.py b/mineru/model/flash/model.py
index f8bd204b..6cb9ef12 100644
--- a/mineru/model/flash/model.py
+++ b/mineru/model/flash/model.py
@@ -1,20 +1,62 @@
# Copyright (c) Opendatalab. All rights reserved.
-"""Flash 原生 PDF 提取模型。"""
+"""Flash PDF 与 Office 文档模型。"""
from __future__ import annotations
-from typing import Any
+from typing import Any, BinaryIO
from mineru.utils.pdf_document import PDFDocument
from .native_pdf import pipeline
-class FlashModel:
+class PdfModel:
"""将 Flash 原生 PDF 流水线包装为无状态模型。"""
def predict(self, pdf_doc: PDFDocument) -> list[list[dict[str, Any]]]:
"""分析调用方持有的 PDFDocument,并原样返回分页 model_list。"""
return pipeline._analyze_native_document(pdf_doc)
+
+
+class DocxModel:
+ """将 DOCX Converter 包装为无状态模型。"""
+
+ def predict(self, file_binary: BinaryIO) -> list[list[dict[str, Any]]]:
+ """转换调用方持有的 DOCX 二进制流,并返回分页 model_list。"""
+
+ # 延迟加载 Converter,避免纯 PDF 路径提前加载 Office 依赖。
+ from .docx.docx_converter import DocxConverter
+
+ converter = DocxConverter()
+ converter.convert(file_binary)
+ return converter.pages
+
+
+class PptxModel:
+ """将 PPTX Converter 包装为无状态模型。"""
+
+ def predict(self, file_binary: BinaryIO) -> list[list[dict[str, Any]]]:
+ """转换调用方持有的 PPTX 二进制流,并返回分页 model_list。"""
+
+ # 延迟加载 Converter,避免纯 PDF 路径提前加载 Office 依赖。
+ from .pptx.pptx_converter import PptxConverter
+
+ converter = PptxConverter()
+ converter.convert(file_binary)
+ return converter.pages
+
+
+class XlsxModel:
+ """将 XLSX Converter 包装为无状态模型。"""
+
+ def predict(self, file_binary: BinaryIO) -> list[list[dict[str, Any]]]:
+ """转换调用方持有的 XLSX 二进制流,并返回分页 model_list。"""
+
+ # 延迟加载 Converter,避免纯 PDF 路径提前加载 Office 依赖。
+ from .xlsx.xlsx_converter import XlsxConverter
+
+ converter = XlsxConverter()
+ converter.convert(file_binary)
+ return converter.pages
diff --git a/mineru/model/flash/pptx/__init__.py b/mineru/model/flash/pptx/__init__.py
index 1e17167c..23020b12 100644
--- a/mineru/model/flash/pptx/__init__.py
+++ b/mineru/model/flash/pptx/__init__.py
@@ -1 +1,3 @@
# Copyright (c) Opendatalab. All rights reserved.
+
+"""Flash PPTX 转换实现。"""
diff --git a/mineru/model/flash/pptx/main.py b/mineru/model/flash/pptx/main.py
index 05474b59..125c0405 100644
--- a/mineru/model/flash/pptx/main.py
+++ b/mineru/model/flash/pptx/main.py
@@ -1,18 +1,20 @@
# Copyright (c) Opendatalab. All rights reserved.
-from typing import BinaryIO
+from typing import Any, BinaryIO
-from mineru.model.flash.pptx.pptx_converter import PptxConverter
+from mineru.model.flash import PptxModel
-def convert_path(file_path: str):
+def convert_path(file_path: str) -> list[list[dict[str, Any]]]:
+ """从 PPTX 文件路径调用统一模型入口。"""
+
with open(file_path, "rb") as fh:
return convert_binary(fh)
-def convert_binary(file_binary: BinaryIO):
- converter = PptxConverter()
- converter.convert(file_binary)
- return converter.pages
+def convert_binary(file_binary: BinaryIO) -> list[list[dict[str, Any]]]:
+ """兼容旧二进制转换函数,并转发给 PptxModel。"""
+
+ return PptxModel().predict(file_binary)
if __name__ == "__main__":
diff --git a/mineru/model/flash/xlsx/__init__.py b/mineru/model/flash/xlsx/__init__.py
index 1e17167c..ab4748ff 100644
--- a/mineru/model/flash/xlsx/__init__.py
+++ b/mineru/model/flash/xlsx/__init__.py
@@ -1 +1,3 @@
# Copyright (c) Opendatalab. All rights reserved.
+
+"""Flash XLSX 转换实现。"""
diff --git a/mineru/model/flash/xlsx/main.py b/mineru/model/flash/xlsx/main.py
index e9b4bded..7efd1721 100644
--- a/mineru/model/flash/xlsx/main.py
+++ b/mineru/model/flash/xlsx/main.py
@@ -1,18 +1,21 @@
# Copyright (c) Opendatalab. All rights reserved.
-from typing import BinaryIO
+from typing import Any, BinaryIO
-from mineru.model.flash.xlsx.xlsx_converter import XlsxConverter
+from mineru.model.flash import XlsxModel
-def convert_path(file_path: str):
+def convert_path(file_path: str) -> list[list[dict[str, Any]]]:
+ """从 XLSX 文件路径调用统一模型入口。"""
+
with open(file_path, "rb") as fh:
return convert_binary(fh)
-def convert_binary(file_binary: BinaryIO):
- converter = XlsxConverter()
- converter.convert(file_binary)
- return converter.pages
+def convert_binary(file_binary: BinaryIO) -> list[list[dict[str, Any]]]:
+ """兼容旧二进制转换函数,并转发给 XlsxModel。"""
+
+ return XlsxModel().predict(file_binary)
+
if __name__ == "__main__":
print(convert_path("test_xlsx/xlsx_01.xlsx"))
diff --git a/tests/unittest/test_flash_model.py b/tests/unittest/test_flash_model.py
index 2c8dfc75..7591250d 100644
--- a/tests/unittest/test_flash_model.py
+++ b/tests/unittest/test_flash_model.py
@@ -5,12 +5,12 @@ from unittest.mock import MagicMock
import pytest
-from mineru.model.flash import FlashModel
+from mineru.model.flash import PdfModel
from mineru.model.flash.native_pdf import pipeline
from mineru.utils.pdf_document import PDFDocument
-def test_flash_model_predict_returns_native_model_list_without_owning_document(
+def test_pdf_model_predict_returns_native_model_list_without_owning_document(
monkeypatch: pytest.MonkeyPatch,
) -> None:
"""验证模型传递同一 PDFDocument,且不负责分类或关闭调用方文档。"""
@@ -20,7 +20,7 @@ def test_flash_model_predict_returns_native_model_list_without_owning_document(
native_analyze = MagicMock(return_value=expected_model_list)
monkeypatch.setattr(pipeline, "_analyze_native_document", native_analyze)
- result = FlashModel().predict(pdf_doc)
+ result = PdfModel().predict(pdf_doc)
assert result is expected_model_list
native_analyze.assert_called_once_with(pdf_doc)
@@ -28,9 +28,16 @@ def test_flash_model_predict_returns_native_model_list_without_owning_document(
pdf_doc.close.assert_not_called()
-def test_flash_model_is_public_and_old_native_pdf_import_is_removed() -> None:
- """验证新模型入口公开可用,旧 backend native_pdf 路径不再兼容。"""
+def test_pdf_model_is_public_and_old_flash_model_is_removed() -> None:
+ """验证 PdfModel 公开可用,旧 FlashModel 名称不再兼容。"""
+
+ flash_module = importlib.import_module("mineru.model.flash")
+ assert flash_module.PdfModel is PdfModel
+ assert not hasattr(flash_module, "FlashModel")
+
+
+def test_old_backend_native_pdf_import_is_removed() -> None:
+ """验证旧 backend native_pdf 路径不再兼容。"""
- assert importlib.import_module("mineru.model.flash").FlashModel is FlashModel
with pytest.raises(ModuleNotFoundError):
importlib.import_module("mineru.backend.flash.native_pdf")
diff --git a/tests/unittest/test_flash_office_models.py b/tests/unittest/test_flash_office_models.py
index b3e8da59..602aa302 100644
--- a/tests/unittest/test_flash_office_models.py
+++ b/tests/unittest/test_flash_office_models.py
@@ -1,44 +1,241 @@
import importlib.util
+import subprocess
+import sys
from collections.abc import Callable
+from io import BytesIO
from pathlib import Path
+from types import ModuleType
from typing import Any, BinaryIO
+from unittest.mock import MagicMock
import pytest
+import mineru.model.flash as flash_models
+import mineru.model.flash.model as flat_model_module
+from mineru.backend.office import docx_analyze as docx_backend
+from mineru.backend.office import pptx_analyze as pptx_backend
+from mineru.backend.office import xlsx_analyze as xlsx_backend
from mineru.backend.office.docx_analyze import office_docx_analyze
from mineru.backend.office.pptx_analyze import office_pptx_analyze
from mineru.backend.office.xlsx_analyze import office_xlsx_analyze
-from mineru.model.flash.docx.main import convert_binary as convert_docx
-from mineru.model.flash.pptx.main import convert_binary as convert_pptx
-from mineru.model.flash.xlsx.main import convert_binary as convert_xlsx
+from mineru.model.flash import DocxModel, PdfModel, PptxModel, XlsxModel
+from mineru.model.flash.docx import docx_converter as docx_converter_module
+from mineru.model.flash.docx import main as docx_main
+from mineru.model.flash.pptx import main as pptx_main
+from mineru.model.flash.pptx import pptx_converter as pptx_converter_module
+from mineru.model.flash.xlsx import main as xlsx_main
+from mineru.model.flash.xlsx import xlsx_converter as xlsx_converter_module
from mineru.parser.office import DocxParser, PptxParser, XlsxParser
-_OFFICE_SAMPLE_DIR = Path(__file__).resolve().parents[2] / "demo" / "office_docs"
+_PROJECT_ROOT = Path(__file__).resolve().parents[2]
+_OFFICE_SAMPLE_DIR = _PROJECT_ROOT / "demo" / "office_docs"
@pytest.mark.parametrize(
- ("suffix", "converter", "expected_pages", "expected_module"),
+ ("suffix", "model_class", "convert_binary", "expected_pages"),
[
- ("docx", convert_docx, 3, "mineru.model.flash.docx.main"),
- ("pptx", convert_pptx, 6, "mineru.model.flash.pptx.main"),
- ("xlsx", convert_xlsx, 3, "mineru.model.flash.xlsx.main"),
+ ("docx", DocxModel, docx_main.convert_binary, 3),
+ ("pptx", PptxModel, pptx_main.convert_binary, 6),
+ ("xlsx", XlsxModel, xlsx_main.convert_binary, 3),
],
)
def test_flash_office_model_conversion(
suffix: str,
- converter: Callable[[BinaryIO], list[dict[str, Any]]],
+ model_class: type[Any],
+ convert_binary: Callable[[BinaryIO], list[list[dict[str, Any]]]],
expected_pages: int,
- expected_module: str,
) -> None:
- """验证迁移后的 Office 模型入口与真实样例转换结果保持不变。"""
+ """验证独立 Office 模型与兼容函数的真实样例结果保持不变。"""
sample_path = _OFFICE_SAMPLE_DIR / f"{suffix}_01.{suffix}"
with sample_path.open("rb") as stream:
- pages = converter(stream)
+ model_pages = model_class().predict(stream)
+ assert not stream.closed
- assert converter.__module__ == expected_module
- assert len(pages) == expected_pages
+ with sample_path.open("rb") as stream:
+ compatible_pages = convert_binary(stream)
+ assert not stream.closed
+
+ assert len(model_pages) == expected_pages
+ assert len(compatible_pages) == expected_pages
+
+
+ ("model_class", "converter_module", "converter_name"),
+ [
+ (DocxModel, docx_converter_module, "DocxConverter"),
+ (PptxModel, pptx_converter_module, "PptxConverter"),
+ (XlsxModel, xlsx_converter_module, "XlsxConverter"),
+ ],
+)
+def test_office_model_creates_converter_per_prediction(
+ monkeypatch: pytest.MonkeyPatch,
+ model_class: type[Any],
+ converter_module: ModuleType,
+ converter_name: str,
+) -> None:
+ """验证 Office 模型每次预测使用独立 Converter,且不关闭输入流。"""
+
+ first_converter = MagicMock()
+ first_converter.pages = [[{"content": "first"}]]
+ second_converter = MagicMock()
+ second_converter.pages = [[{"content": "second"}]]
+ converter_factory = MagicMock(side_effect=[first_converter, second_converter])
+ monkeypatch.setattr(converter_module, converter_name, converter_factory)
+
+ model = model_class()
+ first_stream = BytesIO(b"first")
+ second_stream = BytesIO(b"second")
+
+ assert model.predict(first_stream) is first_converter.pages
+ assert model.predict(second_stream) is second_converter.pages
+ assert converter_factory.call_count == 2
+ first_converter.convert.assert_called_once_with(first_stream)
+ second_converter.convert.assert_called_once_with(second_stream)
+ assert not first_stream.closed
+ assert not second_stream.closed
+
+
+ ("main_module", "model_name"),
+ [
+ (docx_main, "DocxModel"),
+ (pptx_main, "PptxModel"),
+ (xlsx_main, "XlsxModel"),
+ ],
+)
+def test_convert_binary_delegates_to_document_model(
+ monkeypatch: pytest.MonkeyPatch,
+ main_module: ModuleType,
+ model_name: str,
+) -> None:
+ """验证旧 convert_binary 函数仅负责转发给对应文档模型。"""
+
+ expected_pages = [[{"content": "model"}]]
+ model = MagicMock()
+ model.predict.return_value = expected_pages
+ model_factory = MagicMock(return_value=model)
+ monkeypatch.setattr(main_module, model_name, model_factory)
+ stream = BytesIO(b"office")
+
+ assert main_module.convert_binary(stream) is expected_pages
+ model_factory.assert_called_once_with()
+ model.predict.assert_called_once_with(stream)
+
+
+ ("main_module", "suffix"),
+ [
+ (docx_main, "docx"),
+ (pptx_main, "pptx"),
+ (xlsx_main, "xlsx"),
+ ],
+)
+def test_convert_path_delegates_to_binary_helper(
+ monkeypatch: pytest.MonkeyPatch,
+ tmp_path: Path,
+ main_module: ModuleType,
+ suffix: str,
+) -> None:
+ """验证旧 convert_path 函数打开文件后转发给二进制兼容入口。"""
+
+ sample_path = tmp_path / f"sample.{suffix}"
+ sample_path.write_bytes(b"office")
+ expected_pages = [[{"content": "model"}]]
+ binary_helper = MagicMock(return_value=expected_pages)
+ monkeypatch.setattr(main_module, "convert_binary", binary_helper)
+
+ assert main_module.convert_path(str(sample_path)) is expected_pages
+ file_stream = binary_helper.call_args.args[0]
+ assert file_stream.closed
+
+
+ ("backend_module", "analyze_name", "model_name"),
+ [
+ (docx_backend, "office_docx_analyze", "DocxModel"),
+ (pptx_backend, "office_pptx_analyze", "PptxModel"),
+ (xlsx_backend, "office_xlsx_analyze", "XlsxModel"),
+ ],
+)
+def test_office_backend_uses_document_model(
+ monkeypatch: pytest.MonkeyPatch,
+ backend_module: ModuleType,
+ analyze_name: str,
+ model_name: str,
+) -> None:
+ """验证 Office 后端调用对应模型,并保留中间结果转换边界。"""
+
+ model_output = [[{"content": "model"}]]
+ middle_json = [MagicMock()]
+ image_cache = MagicMock()
+ model = MagicMock()
+ model.predict.return_value = model_output
+ model_factory = MagicMock(return_value=model)
+ middle_json_builder = MagicMock(return_value=middle_json)
+ monkeypatch.setattr(backend_module, model_name, model_factory)
+ monkeypatch.setattr(backend_module, "result_to_middle_json", middle_json_builder)
+
+ result = getattr(backend_module, analyze_name)(b"office", image_cache=image_cache)
+
+ assert result == (middle_json, model_output)
+ model_factory.assert_called_once_with()
+ file_stream = model.predict.call_args.args[0]
+ assert isinstance(file_stream, BytesIO)
+ assert file_stream.getvalue() == b"office"
+ assert not file_stream.closed
+ middle_json_builder.assert_called_once_with(model_output, image_cache=image_cache)
+
+
+def test_models_are_exported_from_flash_root() -> None:
+ """验证四个模型统一由 Flash 根包公开。"""
+
+ assert flash_models.__all__ == ["PdfModel", "DocxModel", "PptxModel", "XlsxModel"]
+ assert PdfModel is flat_model_module.PdfModel
+ assert DocxModel is flat_model_module.DocxModel
+ assert PptxModel is flat_model_module.PptxModel
+ assert XlsxModel is flat_model_module.XlsxModel
+
+
+ ("package_name", "model_name"),
+ [
+ ("mineru.model.flash.docx", "DocxModel"),
+ ("mineru.model.flash.pptx", "PptxModel"),
+ ("mineru.model.flash.xlsx", "XlsxModel"),
+ ],
+)
+def test_office_subpackages_do_not_export_models(package_name: str, model_name: str) -> None:
+ """验证 Office 子包不再导出模型类或保留独立 model 模块。"""
+
+ package = importlib.import_module(package_name)
+ assert not hasattr(package, model_name)
+ assert importlib.util.find_spec(f"{package_name}.model") is None
+
+
+def test_importing_pdf_model_does_not_load_office_converters() -> None:
+ """验证纯 PDF 模型导入不会提前加载任何 Office Converter。"""
+
+ script = "\n".join(
+ [
+ "import sys",
+ "from mineru.model.flash import PdfModel",
+ "assert PdfModel.__name__ == 'PdfModel'",
+ "assert 'mineru.model.flash.docx.docx_converter' not in sys.modules",
+ "assert 'mineru.model.flash.pptx.pptx_converter' not in sys.modules",
+ "assert 'mineru.model.flash.xlsx.xlsx_converter' not in sys.modules",
+ ]
+ )
+ result = subprocess.run(
+ [sys.executable, "-c", script],
+ cwd=_PROJECT_ROOT,
+ capture_output=True,
+ text=True,
+ check=False,
+ )
+
+ assert result.returncode == 0, result.stderr
def test_office_parsers_bind_existing_analyzers() -> None:
diff --git a/tests/unittest/test_flash_pdf_extractor.py b/tests/unittest/test_flash_pdf_extractor.py
index 934e3896..dfde2974 100644
--- a/tests/unittest/test_flash_pdf_extractor.py
+++ b/tests/unittest/test_flash_pdf_extractor.py
@@ -8,7 +8,7 @@ from unittest.mock import MagicMock
import pytest
from mineru.backend.flash import pdf_extractor
-from mineru.model.flash import FlashModel
+from mineru.model.flash import PdfModel
from mineru.model.flash.native_pdf import (
pipeline,
)
@@ -109,7 +109,7 @@ def test_txt_mode_keeps_native_flash_path(
classified_mode="txt",
)
native_predict = MagicMock(return_value=expected_model_list)
- monkeypatch.setattr(FlashModel, "predict", native_predict)
+ monkeypatch.setattr(PdfModel, "predict", native_predict)
hybrid_doc_analyze = _install_hybrid_analyze(
monkeypatch,
model_list=[[{"type": "text", "content": "unexpected"}]],
diff --git a/tests/unittest/test_flash_pdf_pipeline.py b/tests/unittest/test_flash_pdf_pipeline.py
index ac7b8130..0e162f5a 100644
--- a/tests/unittest/test_flash_pdf_pipeline.py
+++ b/tests/unittest/test_flash_pdf_pipeline.py
@@ -6,7 +6,7 @@ import inspect
import pytest
from mineru.backend.flash import pdf_extractor
-from mineru.model.flash import FlashModel
+from mineru.model.flash import PdfModel
from mineru.model.flash.native_pdf import (
auxiliary_text,
formulas,
@@ -188,7 +188,7 @@ def test_flash_extractor_has_no_local_ocr_runtime_logic() -> None:
inspect.getsource(module)
for module in (
pdf_extractor,
- FlashModel,
+ PdfModel,
auxiliary_text,
formulas,
geometry,