0
0
LangChainframework~10 mins

Loading PDFs with PyPDFLoader 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 PyPDFLoader from langchain.document_loaders.

LangChain
from langchain.document_loaders import [1]
Drag options to blanks, or click blank then click option'
APyPDFLoader
BPDFLoader
CTextLoader
DCSVLoader
Attempts:
3 left
💡 Hint
Common Mistakes
Importing PDFLoader instead of PyPDFLoader
Using TextLoader for PDFs
Forgetting to import the loader
2fill in blank
medium

Complete the code to create a PyPDFLoader instance for the file 'sample.pdf'.

LangChain
loader = PyPDFLoader([1])
Drag options to blanks, or click blank then click option'
A'sample.txt'
B'data.csv'
C'document.docx'
D'sample.pdf'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-PDF file name
Forgetting quotes around the filename
Using a wrong file extension
3fill in blank
hard

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

LangChain
documents = loader.[1]()
Drag options to blanks, or click blank then click option'
Aload_data
Bload
Cload_and_split
Dload_documents
Attempts:
3 left
💡 Hint
Common Mistakes
Using load_and_split() which does not exist on PyPDFLoader
Using load_data() which does not exist
Using load_documents() which is invalid
4fill in blank
hard

Fill both blanks to create a PyPDFLoader and load documents from 'report.pdf'.

LangChain
loader = [1]([2])
documents = loader.load()
Drag options to blanks, or click blank then click option'
APyPDFLoader
B'report.pdf'
C'data.txt'
DPDFLoader
Attempts:
3 left
💡 Hint
Common Mistakes
Using PDFLoader instead of PyPDFLoader
Passing a non-PDF filename
Forgetting quotes around filename
5fill in blank
hard

Fill all three blanks to import PyPDFLoader, create a loader for 'file.pdf', and load documents.

LangChain
from langchain.document_loaders import [1]
loader = [2]([3])
docs = loader.load()
Drag options to blanks, or click blank then click option'
APyPDFLoader
B'file.pdf'
CPDFLoader
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up import and instance names
Using wrong loader class
Passing wrong filename