Thuta Learning
LangChain
AdvancedAIAdvanced

Document Loaders

LangChainLesson 10

Document Loaders load data from external sources (text files, PDFs, websites) into documents.

python
from langchain_community.document_loaders import TextLoader

loader = TextLoader("my_document.txt")
documents = loader.load()

print(documents[0].page_content[:100]) # Print first 100 chars
You should see
(This loads the text inside my_document.txt as a LangChain Document object.)

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

Document Loaders | Thuta Learning