0
0
LangChainframework~10 mins

Creating evaluation datasets in LangChain - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create an empty list for evaluation examples.

LangChain
evaluation_examples = [1]
Drag options to blanks, or click blank then click option'
A()
B{}
C[]
Dset()
Attempts:
3 left
💡 Hint
Common Mistakes
Using curly braces {} creates a dictionary, not a list.
Using parentheses () creates a tuple, which is immutable.
2fill in blank
medium

Complete the code to add a dictionary with input and output to the evaluation examples list.

LangChain
evaluation_examples.append([1])
Drag options to blanks, or click blank then click option'
A{'input': 'Hello', 'output': 'Hi there!'}
B('input', 'Hello', 'output', 'Hi there!')
C['input', 'Hello', 'output', 'Hi there!']
D'input: Hello, output: Hi there!'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a list or tuple instead of a dictionary.
Adding a plain string instead of a dictionary.
3fill in blank
hard

Fix the error in the code to create a list of evaluation examples with two entries.

LangChain
evaluation_examples = [[1]]
Drag options to blanks, or click blank then click option'
A{'input': 'Hi', 'output': 'Hello'} {'input': 'Bye', 'output': 'Goodbye'}
B{'input': 'Hi', 'output': 'Hello'}, {'input': 'Bye', 'output': 'Goodbye'}
C[{'input': 'Hi', 'output': 'Hello'}, {'input': 'Bye', 'output': 'Goodbye'}]
D({'input': 'Hi', 'output': 'Hello'}, {'input': 'Bye', 'output': 'Goodbye'})
Attempts:
3 left
💡 Hint
Common Mistakes
Missing commas between dictionaries.
Using extra brackets or parentheses inside the list.
4fill in blank
hard

Complete the code to create a dictionary comprehension that filters evaluation examples with input length greater than 3.

LangChain
filtered_examples = {word:len(word) for word in evaluation_examples if len(word['input']) [1] 3}
Drag options to blanks, or click blank then click option'
A:
B>
C<
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using = instead of : in dictionary comprehension.
Using wrong comparison operators like < or =.
5fill in blank
hard

Complete the code to create a list comprehension extracting outputs for inputs containing 'test'.

LangChain
test_outputs = [example['output'] for example in evaluation_examples if 'test' [1] example['input']]
Drag options to blanks, or click blank then click option'
A[
Bin
C]
Dnot in
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to open or close the list brackets.
Using not in instead of in for the condition.