Fix: lazy load Notion loader (#419)

This commit is contained in:
Taranjeet Singh
2023-08-09 16:14:02 -07:00
committed by GitHub
parent ce6eb39009
commit c96df72cd0

View File

@@ -11,7 +11,6 @@ from embedchain.loaders.docs_site_loader import DocsSiteLoader
from embedchain.loaders.docx_file import DocxFileLoader
from embedchain.loaders.local_qna_pair import LocalQnaPairLoader
from embedchain.loaders.local_text import LocalTextLoader
from embedchain.loaders.notion import NotionLoader
from embedchain.loaders.pdf_file import PdfFileLoader
from embedchain.loaders.sitemap import SitemapLoader
from embedchain.loaders.web_page import WebPageLoader
@@ -46,10 +45,16 @@ class DataFormatter:
"docx": DocxFileLoader(),
"sitemap": SitemapLoader(),
"docs_site": DocsSiteLoader(),
"notion": NotionLoader(),
}
lazy_loaders = ("notion", )
if data_type in loaders:
return loaders[data_type]
elif data_type in lazy_loaders:
if data_type == "notion":
from embedchain.loaders.notion import NotionLoader
return NotionLoader()
else:
raise ValueError(f"Unsupported data type: {data_type}")
else:
raise ValueError(f"Unsupported data type: {data_type}")