0
0
LangChainframework~10 mins

LangChain Expression Language (LCEL) basics - Interactive Code Practice

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

Complete the code to create a simple LCEL chain that chains a prompt with an LLM.

LangChain
chain = [1] | llm
Drag options to blanks, or click blank then click option'
A"prompt"
Bx
Cadd
Dprompt
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name like 'x' instead of 'prompt'.
Putting quotes around the variable name.
2fill in blank
medium

Complete the code to create an LCEL chain that includes an output parser.

LangChain
chain = prompt | llm | [1]
Drag options to blanks, or click blank then click option'
A"parser"
Bmultiply
Cparser
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number instead of a variable.
Putting quotes around the variable name.
3fill in blank
hard

Fix the code in the LCEL chain to correctly chain the prompt and llm using the pipe operator.

LangChain
chain = prompt [1] llm
Drag options to blanks, or click blank then click option'
A<=
B|
C==
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using mathematical comparison operators.
Using equality operator instead of the pipe.
4fill in blank
hard

Fill both blanks to create an LCEL chain with prompt, llm, and parser using pipe operators.

LangChain
chain = [1] | llm [2] parser
Drag options to blanks, or click blank then click option'
Aprompt
B|
C<
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using equality or other operators instead of pipe.
Wrong variable name.
5fill in blank
hard

Fill all three blanks to create an LCEL chain: prompt piped to llm, piped to parser, with correct operators and names.

LangChain
[1] [2] llm [3] parser
Drag options to blanks, or click blank then click option'
Aprompt
B|
C==
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong operators like == or !=.
Incorrect variable names.