kotaemon/libs/kotaemon/tests/_test_multimodal_reader.py
ian_Cin e67a25c0bd
Feat/add multimodal loader (#5)
* Add Adobe reader as the multimodal loader

* Allow FullQAPipeline to reasoning on figures

* fix: move the adobe import to avoid ImportError, notify users whenever they run the AdobeReader

---------

Co-authored-by: cin-albert <albert@cinnamon.is>
2024-04-03 14:52:40 +07:00

22 lines
580 B
Python

# TODO: This test is broken and should be rewritten
from pathlib import Path
from kotaemon.loaders import AdobeReader
# from dotenv import load_dotenv
input_file = Path(__file__).parent / "resources" / "multimodal.pdf"
# load_dotenv()
def test_adobe_reader():
reader = AdobeReader()
documents = reader.load_data(input_file)
table_docs = [doc for doc in documents if doc.metadata.get("type", "") == "table"]
assert len(table_docs) == 2
figure_docs = [doc for doc in documents if doc.metadata.get("type", "") == "image"]
assert len(figure_docs) == 2