Challenge - 5 Problems
WebBaseLoader Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What does WebBaseLoader return after loading a web page?
Using WebBaseLoader from LangChain, what is the type of the object returned after calling the
load() method on a valid URL?LangChain
from langchain.document_loaders import WebBaseLoader loader = WebBaseLoader('https://example.com') docs = loader.load()
Attempts:
2 left
💡 Hint
Think about how LangChain organizes loaded data for further processing.
✗ Incorrect
WebBaseLoader.load() returns a list of Document objects, each holding the text content and metadata like URL. It does not return raw HTML or status codes directly.
📝 Syntax
intermediate2:00remaining
Which code snippet correctly initializes WebBaseLoader for multiple URLs?
You want to load content from two web pages using WebBaseLoader. Which code correctly initializes the loader for both URLs at once?
Attempts:
2 left
💡 Hint
Check the expected argument type for WebBaseLoader constructor.
✗ Incorrect
WebBaseLoader accepts a list of URLs as a single argument to load multiple pages. Passing multiple string arguments or a single string with separators is invalid.
🔧 Debug
advanced2:00remaining
Why does this WebBaseLoader code raise a TypeError?
Consider this code snippet:
loader = WebBaseLoader(12345) docs = loader.load()Why does it raise a TypeError?
LangChain
loader = WebBaseLoader(12345)
docs = loader.load()Attempts:
2 left
💡 Hint
Check the expected type for the URL parameter in WebBaseLoader.
✗ Incorrect
WebBaseLoader expects a string or list of strings representing URLs. Passing an integer causes a TypeError during initialization or loading.
❓ state_output
advanced2:00remaining
What is the length of the list returned by WebBaseLoader.load() for multiple URLs?
If you initialize WebBaseLoader with three valid URLs and call
load(), how many Document objects will the returned list contain?LangChain
loader = WebBaseLoader(['https://a.com', 'https://b.com', 'https://c.com']) docs = loader.load() print(len(docs))
Attempts:
2 left
💡 Hint
Each URL corresponds to one Document object in the output list.
✗ Incorrect
WebBaseLoader.load() returns one Document per URL provided, so the list length matches the number of URLs.
🧠 Conceptual
expert2:00remaining
What happens if WebBaseLoader tries to load a non-existent web page?
When WebBaseLoader.load() is called with a URL that returns a 404 error, what is the expected behavior?
LangChain
loader = WebBaseLoader('https://nonexistent.example.com')
docs = loader.load()Attempts:
2 left
💡 Hint
Consider how HTTP errors are handled by default in web requests.
✗ Incorrect
WebBaseLoader uses requests under the hood which raises HTTPError on 4xx/5xx status codes unless caught. So a 404 causes an exception.