mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-19 19:11:33 +00:00
parent
aa7ac57b67
commit
b9c0cf9025
@ -1,4 +1,4 @@
|
|||||||
from typing import List, Optional
|
from typing import Iterator, Optional
|
||||||
|
|
||||||
from langchain_core.documents import Document
|
from langchain_core.documents import Document
|
||||||
|
|
||||||
@ -29,16 +29,12 @@ class PsychicLoader(BaseLoader):
|
|||||||
self.connector_id = ConnectorId(connector_id)
|
self.connector_id = ConnectorId(connector_id)
|
||||||
self.account_id = account_id
|
self.account_id = account_id
|
||||||
|
|
||||||
def load(self) -> List[Document]:
|
def lazy_load(self) -> Iterator[Document]:
|
||||||
"""Load documents."""
|
|
||||||
|
|
||||||
psychic_docs = self.psychic.get_documents(
|
psychic_docs = self.psychic.get_documents(
|
||||||
connector_id=self.connector_id, account_id=self.account_id
|
connector_id=self.connector_id, account_id=self.account_id
|
||||||
)
|
)
|
||||||
return [
|
for doc in psychic_docs.documents:
|
||||||
Document(
|
yield Document(
|
||||||
page_content=doc["content"],
|
page_content=doc["content"],
|
||||||
metadata={"title": doc["title"], "source": doc["uri"]},
|
metadata={"title": doc["title"], "source": doc["uri"]},
|
||||||
)
|
)
|
||||||
for doc in psychic_docs.documents
|
|
||||||
]
|
|
||||||
|
Loading…
Reference in New Issue
Block a user