Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

Fix: lazy load Notion loader (#419)

Taranjeet Singhc96df72cd09e
diff --git a/embedchain/data_formatter/data_formatter.py b/embedchain/data_formatter/data_formatter.py
index f478ca554..f88348280 100644
--- a/embedchain/data_formatter/data_formatter.py
+++ b/embedchain/data_formatter/data_formatter.py
@@ -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}")