0
0
LangChainframework~10 mins

Human-in-the-loop with LangGraph 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 the HumanLoop class from langgraph.

LangChain
from langgraph import [1]
Drag options to blanks, or click blank then click option'
APrompt
BAgent
CHumanLoop
DChain
Attempts:
3 left
💡 Hint
Common Mistakes
Importing unrelated classes like Agent or Chain.
Misspelling the class name.
2fill in blank
medium

Complete the code to create a HumanLoop instance with the name 'review_loop'.

LangChain
loop = HumanLoop(name=[1])
Drag options to blanks, or click blank then click option'
A'review_loop'
B'check_loop'
C'loop_review'
D'human_review'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different name than 'review_loop'.
Forgetting quotes around the string.
3fill in blank
hard

Fix the error in the code to add a human review step to the LangGraph chain.

LangChain
chain.add_step([1])
Drag options to blanks, or click blank then click option'
AHumanLoop
BHumanLoop('review_loop')
CHumanLoop()
DHumanLoop(name='review_loop')
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the class itself instead of an instance.
Omitting the name parameter.
4fill in blank
hard

Fill both blanks to define a LangGraph chain with a human-in-the-loop review step and run it with input 'data'.

LangChain
chain = LangGraph().add_step([1])
result = chain.[2](input_data='data')
Drag options to blanks, or click blank then click option'
AHumanLoop(name='review_loop')
Brun
Cexecute
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong method name to run the chain.
Not creating the HumanLoop instance properly.
5fill in blank
hard

Fill all three blanks to create a LangGraph chain with a human loop, set a prompt, and run it with user input.

LangChain
loop = HumanLoop(name=[1])
chain = LangGraph().add_step(loop).set_prompt([2])
output = chain.[3](input_data='user input')
Drag options to blanks, or click blank then click option'
A'human_review'
B'Please review the output:'
Crun
Dexecute
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect names or prompt strings.
Using the wrong method to run the chain.