Challenge - 5 Problems
LangChain Evaluation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What is the output of this LangChain evaluation dataset creation code?
Consider this Python code snippet using LangChain to create an evaluation dataset. What will be the content of
eval_dataset after running this?LangChain
from langchain.evaluation.loading import load_evaluation_dataset # Load a dataset with 3 examples eval_dataset = load_evaluation_dataset( name="custom_dataset", data=[ {"input": "Hello", "output": "Hi"}, {"input": "Bye", "output": "Goodbye"}, {"input": "Thanks", "output": "You are welcome"} ] ) print(len(eval_dataset))
Attempts:
2 left
💡 Hint
Think about how many items are in the data list passed to load_evaluation_dataset.
✗ Incorrect
The function load_evaluation_dataset loads the dataset from the provided list of dictionaries. Since the list has 3 items, the resulting dataset length is 3.
📝 Syntax
intermediate2:00remaining
Which option correctly creates an evaluation dataset with LangChain from a JSON file?
You want to create an evaluation dataset by loading data from a JSON file named
data.json. Which code snippet correctly does this using LangChain?Attempts:
2 left
💡 Hint
The function requires the dataset type name and the path to the file.
✗ Incorrect
The load_evaluation_dataset function requires the 'name' parameter to specify the dataset type (here 'json') and the 'path' parameter for the file location. Omitting either or using wrong parameter names causes errors.
❓ state_output
advanced2:00remaining
What is the value of
dataset[1]['output'] after this code runs?Given this code creating an evaluation dataset, what is the value of
dataset[1]['output']?LangChain
from langchain.evaluation.loading import load_evaluation_dataset dataset = load_evaluation_dataset( name="custom_dataset", data=[ {"input": "Q1", "output": "A1"}, {"input": "Q2", "output": "A2"}, {"input": "Q3", "output": "A3"} ] ) result = dataset[1]['output']
Attempts:
2 left
💡 Hint
Remember Python lists are zero-indexed.
✗ Incorrect
The dataset is a list of dictionaries. The second item (index 1) has 'output' key with value 'A2'.
🔧 Debug
advanced2:00remaining
Why does this code raise a TypeError when creating an evaluation dataset?
This code snippet raises a TypeError. What is the cause?
LangChain
from langchain.evaluation.loading import load_evaluation_dataset data = {"input": "Hello", "output": "Hi"} eval_dataset = load_evaluation_dataset(name="custom_dataset", data=data)
Attempts:
2 left
💡 Hint
Check the type of the data argument passed.
✗ Incorrect
The function expects a list of examples, but a single dictionary was passed, causing a TypeError.
🧠 Conceptual
expert2:00remaining
Which option best describes the purpose of creating evaluation datasets in LangChain?
Why do developers create evaluation datasets when working with LangChain?
Attempts:
2 left
💡 Hint
Evaluation datasets help check how well something works.
✗ Incorrect
Evaluation datasets contain examples used to assess how accurately language models perform on tasks, helping developers improve and compare models.