AI / LangGraph LangChain Interview questions II
What are document loaders and splitters?
Document loaders ingest content from various sources and return a list of Document objects (each containing page_content and metadata). Text splitters then divide those documents into smaller chunks suitable for embedding and retrieval.
Common document loaders:
PyPDFLoader— extracts text from PDF files, one page per DocumentWebBaseLoader— scrapes a web page, returns its text contentCSVLoader— each row becomes a DocumentDirectoryLoader— recursively loads all files in a directoryUnstructuredFileLoader— handles Word, PowerPoint, HTML, email, and moreGitHubLoader— loads files from a GitHub repository
Common text splitters:
RecursiveCharacterTextSplitter— splits on paragraphs, then sentences, then words until chunks fit the target size. Most commonly used.CharacterTextSplitter— splits on a single character separatorTokenTextSplitter— splits by token count, precise for context window budgetingMarkdownHeaderTextSplitter— splits Markdown by header sections, preserving structure
from langchain.text_splitter import RecursiveCharacterTextSplitter
splitter = RecursiveCharacterTextSplitter(
chunk_size=1000, # max chars per chunk
chunk_overlap=200, # overlap to preserve context at boundaries
length_function=len,
)
chunks = splitter.split_documents(documents)
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
