Complete the code to import the DirectoryLoader class from langchain.document_loaders.
from langchain.document_loaders import [1]
The DirectoryLoader class is used to load multiple documents from a directory in Langchain.
Complete the code to create a DirectoryLoader instance for the folder 'docs'.
loader = DirectoryLoader([1])The DirectoryLoader needs the path to the directory containing documents. Here, the folder is named 'docs'.
Fix the error in the code to load documents from the directory using the loader.
documents = loader.[1]()The correct method to load documents from DirectoryLoader is load().
Fill both blanks to filter only '.txt' files and load them from the directory.
loader = DirectoryLoader('docs', glob='[1]') documents = loader.[2]()
To load only text files, use the glob pattern '*.txt'. The method to load documents is 'load()'.
Fill all three blanks to create a DirectoryLoader for '.md' files in 'notes', load documents, and print the count.
loader = DirectoryLoader('[1]', glob='[2]') docs = loader.[3]() print(len(docs))
The directory is 'notes', the glob pattern for markdown files is '*.md', and the method to load documents is 'load()'.