0
0
LangChainframework~10 mins

Directory loader for bulk documents in LangChain - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the DirectoryLoader class from langchain.document_loaders.

LangChain
from langchain.document_loaders import [1]
Drag options to blanks, or click blank then click option'
ATextLoader
BFileLoader
CDirectoryLoader
DBulkLoader
Attempts:
3 left
💡 Hint
Common Mistakes
Using FileLoader instead of DirectoryLoader
Trying to import a non-existing class BulkLoader
2fill in blank
medium

Complete the code to create a DirectoryLoader instance for the folder 'docs'.

LangChain
loader = DirectoryLoader([1])
Drag options to blanks, or click blank then click option'
A'docs'
B'files'
C'documents'
D'data'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong folder name
Forgetting quotes around the folder name
3fill in blank
hard

Fix the error in the code to load documents from the directory using the loader.

LangChain
documents = loader.[1]()
Drag options to blanks, or click blank then click option'
Afetch
Bload_data
Cload_documents
Dload
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'load_documents()' which does not exist
Using 'fetch()' which is incorrect
4fill in blank
hard

Fill both blanks to filter only '.txt' files and load them from the directory.

LangChain
loader = DirectoryLoader('docs', glob='[1]')
documents = loader.[2]()
Drag options to blanks, or click blank then click option'
A*.txt
B*.pdf
Cload
Dload_files
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*.pdf' to filter text files
Using 'load_files()' which is not a method
5fill in blank
hard

Fill all three blanks to create a DirectoryLoader for '.md' files in 'notes', load documents, and print the count.

LangChain
loader = DirectoryLoader('[1]', glob='[2]')
docs = loader.[3]()
print(len(docs))
Drag options to blanks, or click blank then click option'
Anotes
B*.md
Cload
Dload_all
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong folder name
Using '*.txt' instead of '*.md'
Using 'load_all()' which does not exist