0
0
LangChainframework~10 mins

What is LangChain - Interactive Quiz & Practice

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

Complete the code to import the PromptTemplate class from LangChain.

LangChain
from langchain.prompts import [1]
Drag options to blanks, or click blank then click option'
ALangChain
BChain
CPromptTemplate
DPrompt
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing it with 'Prompt' or 'Chain'.
Wrong module path.
2fill in blank
medium

Complete the code to create a simple PromptTemplate instance.

LangChain
prompt = [1].from_template('Tell me a joke about {topic}')
Drag options to blanks, or click blank then click option'
APromptTemplate
BLLMChain
CChatOpenAI
DChain
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting '.from_template'.
Using the wrong class.
3fill in blank
hard

Complete the code to import LLMChain.

LangChain
from langchain.chains import [1]
Drag options to blanks, or click blank then click option'
ASimpleChain
BPromptChain
CLangChain
DLLMChain
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Chain' instead of 'LLMChain'.
Wrong import path.
4fill in blank
hard

Fill both blanks to create an LLMChain (assume llm is defined).

LangChain
chain = [1](llm=llm, prompt=prompt)
response = chain.[2]('cats')
Drag options to blanks, or click blank then click option'
ALLMChain
Brun
CPromptTemplate
Dinvoke
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'invoke' (newer API) instead of 'run'.
Wrong parameters for LLMChain.
5fill in blank
hard

Fill all three blanks for a complete simple LangChain example (assume imports and llm done).

LangChain
prompt = PromptTemplate.from_template('[1] {topic}')
chain = LLMChain(llm=llm, prompt=prompt)
print(chain.[2]('[3]'))
Drag options to blanks, or click blank then click option'
ATell me about
Brun
Ccats
Dexecute
Attempts:
3 left
💡 Hint
Common Mistakes
Wrong run method.
Mismatched input variable.
Incomplete template.