The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[minor]: Implement lazy_load() for OutlookMessageLoader (#18668)
Christophe Bornet2d96803ddda9
diff --git a/libs/community/langchain_community/document_loaders/email.py b/libs/community/langchain_community/document_loaders/email.pyindex 277fdcc640..66b460e95a 100644--- a/libs/community/langchain_community/document_loaders/email.py+++ b/libs/community/langchain_community/document_loaders/email.py@@ -1,5 +1,5 @@import os-from typing import Any, List+from typing import Any, Iterator, Listfrom langchain_core.documents import Document@@ -99,19 +99,16 @@ class OutlookMessageLoader(BaseLoader):"`pip install extract_msg`")- def load(self) -> List[Document]:- """Load data into document objects."""+ def lazy_load(self) -> Iterator[Document]:import extract_msgmsg = extract_msg.Message(self.file_path)- return [- Document(- page_content=msg.body,- metadata={- "source": self.file_path,- "subject": msg.subject,- "sender": msg.sender,- "date": msg.date,- },- )- ]+ yield Document(+ page_content=msg.body,+ metadata={+ "source": self.file_path,+ "subject": msg.subject,+ "sender": msg.sender,+ "date": msg.date,+ },+ )