0
0
LangChainframework~10 mins

Pipe operator for chain composition 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 chain two LangChain chains using the pipe operator.

LangChain
final_chain = chain1 [1] chain2
Drag options to blanks, or click blank then click option'
A|
B+
C|>
D||
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' or '||' which are not valid chain operators.
Using '|>' which is not the LangChain pipe operator.
2fill in blank
medium

Complete the code to chain three chains using the pipe operator.

LangChain
combined_chain = chainA [1] chainB [1] chainC
Drag options to blanks, or click blank then click option'
A+
B||
C|>
D|
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing different operators between chains.
Using '+' which concatenates but does not chain.
3fill in blank
hard

Fix the error in the chain composition by choosing the correct operator.

LangChain
result_chain = chainX [1] chainY
Drag options to blanks, or click blank then click option'
A+
B||
C|
D|>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' which concatenates but does not chain.
Using '||' which is not a valid operator here.
4fill in blank
hard

Fill both blanks to chain two chains and then call the combined chain.

LangChain
combined = chain1 [1] chain2
output = combined.[2](input_data)
Drag options to blanks, or click blank then click option'
A|
Binvoke
Cexecute
Dcall
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'execute' or 'call' which are not LangChain chain methods.
Using '+' instead of the pipe operator.
5fill in blank
hard

Fill all three blanks to chain three chains, run the combined chain, and print the output.

LangChain
combined_chain = chainA [1] chainB [1] chainC
result = combined_chain.[2](input_text)
print([3])
Drag options to blanks, or click blank then click option'
A|
Binvoke
Cresult
Dexecute
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'execute' instead of 'invoke'.
Printing the wrong variable name.
Using '+' instead of the pipe operator.