Bird
0
0

Given the code snippet:

medium📝 component behavior Q13 of 15
LangChain - Document Loading
Given the code snippet:
loader = DirectoryLoader('docs', glob='*.md')
docs = loader.load()

What will docs contain?
AA list of all markdown (.md) documents in the 'docs' folder
BA single markdown document from the 'docs' folder
CAn error because glob pattern is incorrect
DA list of all files in 'docs' regardless of extension
Step-by-Step Solution
Solution:
  1. Step 1: Analyze DirectoryLoader usage

    The DirectoryLoader is set to load files from 'docs' folder with glob '*.md', meaning markdown files only.
  2. Step 2: Understand load() output

    The load() method returns a list of documents matching the glob pattern, so docs will be a list of markdown files.
  3. Final Answer:

    A list of all markdown (.md) documents in the 'docs' folder -> Option A
  4. Quick Check:

    load() returns list of files matching glob [OK]
Quick Trick: load() returns list of files matching glob pattern [OK]
Common Mistakes:
  • Expecting a single document instead of a list
  • Assuming glob pattern is ignored
  • Thinking load() returns file paths instead of documents

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes