Bird
0
0

Which of the following is the correct way to start defining a custom document loader class in Langchain?

easy📝 Syntax Q12 of 15
LangChain - Document Loading
Which of the following is the correct way to start defining a custom document loader class in Langchain?
Aclass MyLoader():\n def load(self):\n pass
Bdef MyLoader():\n return BaseLoader.load()
Cclass MyLoader(BaseLoader):\n def load(self):\n pass
Dclass MyLoader(BaseLoader):\n def read(self):\n pass
Step-by-Step Solution
Solution:
  1. Step 1: Check inheritance from BaseLoader

    Custom loaders must inherit from BaseLoader to fit Langchain's pattern.
  2. Step 2: Confirm the method name is load

    The required method to implement is load(), not read().
  3. Final Answer:

    class MyLoader(BaseLoader):\n def load(self):\n pass -> Option C
  4. Quick Check:

    Inherit BaseLoader + define load() method [OK]
Quick Trick: Inherit BaseLoader and implement load() method [OK]
Common Mistakes:
  • Not inheriting from BaseLoader
  • Using wrong method name like read()
  • Defining function instead of class

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes