0
0
LangChainframework~20 mins

LangChain architecture overview - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
LangChain Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Core components of LangChain architecture
Which of the following is NOT a core component of LangChain's architecture?
ADatabases that store user interface layouts
BChains that link multiple calls to language models
CAgents that decide which actions to take based on inputs
DMemory modules that keep track of conversation history
Attempts:
2 left
💡 Hint
Think about what LangChain focuses on: language models, decision making, and memory.
component_behavior
intermediate
2:00remaining
Behavior of memory in LangChain
What is the main role of the memory component in LangChain's architecture?
ATo visualize the output of language models in a dashboard
BTo execute external API calls during chain execution
CTo store and retrieve past interactions to provide context
DTo generate new language model prompts automatically
Attempts:
2 left
💡 Hint
Memory helps keep track of what happened before.
📝 Syntax
advanced
2:00remaining
Correct way to define a simple LangChain chain
Which code snippet correctly creates a simple chain that calls a language model with a prompt?
A
from langchain import LLMChain, OpenAI
chain = LLMChain(llm=OpenAI(), prompt="Hello")
B
from langchain import LLMChain, OpenAI, PromptTemplate
chain = LLMChain(llm=OpenAI(), prompt=PromptTemplate(template="Hello"))
C
from langchain import Chain, OpenAI
chain = Chain(llm=OpenAI(), prompt="Hello")
D
from langchain import LLMChain
chain = LLMChain(llm=OpenAI, prompt="Hello")
Attempts:
2 left
💡 Hint
Prompt must be a PromptTemplate object, not a plain string.
lifecycle
advanced
2:00remaining
Agent decision-making process in LangChain
During execution, how does a LangChain agent decide which action to take next?
AIt uses the language model output to interpret the input and select an action
BIt randomly selects an action from a predefined list
CIt always executes all actions in sequence regardless of input
DIt waits for user input before deciding any action
Attempts:
2 left
💡 Hint
Agents use language models to understand and decide.
🔧 Debug
expert
2:00remaining
Identifying error in LangChain memory usage
What error will this code raise? from langchain.memory import ConversationBufferMemory memory = ConversationBufferMemory() print(memory.load_memory_variables({}))
LangChain
from langchain.memory import ConversationBufferMemory
memory = ConversationBufferMemory()
print(memory.load_memory_variables({}))
AAttributeError: 'ConversationBufferMemory' object has no attribute 'load_memory_variables'
BTypeError: load_memory_variables() missing 1 required positional argument
CKeyError: 'history' not found in memory variables
DReturns an empty dictionary {} without error
Attempts:
2 left
💡 Hint
Check the method signature and default behavior of load_memory_variables.