0
0
LangChainframework~5 mins

RunnablePassthrough and RunnableLambda in LangChain - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is RunnablePassthrough in Langchain?
RunnablePassthrough is a simple component that returns the input it receives without any changes. Think of it like a mirror that just reflects what you give it.
Click to reveal answer
beginner
How does RunnableLambda differ from RunnablePassthrough?
RunnableLambda lets you run any custom function you write on the input. Unlike RunnablePassthrough, it can change or process the input before giving back a result.
Click to reveal answer
intermediate
Show a simple example of RunnableLambda usage.
You can create a RunnableLambda that adds 1 to a number: <br> runnable = RunnableLambda(lambda x: x + 1) <br> runnable.invoke(5) returns 6.
Click to reveal answer
intermediate
Why use RunnablePassthrough in a chain?
RunnablePassthrough is useful when you want to pass data through a chain step without changing it. It helps keep the flow simple and clear.
Click to reveal answer
beginner
What method do you call to run the logic inside RunnableLambda or RunnablePassthrough?
You call the 'invoke' method with your input to run the logic and get the output.
Click to reveal answer
What does RunnablePassthrough do with the input it receives?
ADeletes the input
BTransforms the input using a function
CReturns the input unchanged
DSaves the input to a file
Which Runnable lets you run a custom function on the input?
ARunnableLambda
BRunnableOutput
CRunnableChain
DRunnablePassthrough
How do you execute the logic inside a RunnableLambda?
Acall invoke()
Bcall execute()
Ccall run()
Dcall start()
If you want to pass data through a chain without changing it, which Runnable should you use?
ARunnableModify
BRunnableLambda
CRunnableTransform
DRunnablePassthrough
What is a real-life analogy for RunnablePassthrough?
AA blender mixing ingredients
BA mirror reflecting your image
CA chef cooking food
DA printer printing a document
Explain the difference between RunnablePassthrough and RunnableLambda in Langchain.
Think about whether the input changes or not.
You got /4 concepts.
    Describe a scenario where you would use RunnablePassthrough in a chain.
    Imagine passing a message along without editing it.
    You got /3 concepts.