Bird
0
0

Given this code snippet, what will be the reformulated question after the second user input?

medium📝 component behavior Q4 of 15
LangChain - Conversational RAG
Given this code snippet, what will be the reformulated question after the second user input?
memory = ConversationBufferMemory()
chain = ConversationChain(llm=llm, memory=memory)

chain.run("Who won the world cup in 2018?")
chain.run("Where was it held?")
A"Where was the world cup held?"
B"Where was the 2018 world cup held?"
C"Who won the world cup?"
D"Tell me about the 2018 event?"
Step-by-Step Solution
Solution:
  1. Step 1: Understand conversation history usage

    The second question "Where was it held?" refers to the 2018 world cup from the first question.
  2. Step 2: Reformulate question with context

    The chain reformulates to include the year and event: "Where was the 2018 world cup held?"
  3. Final Answer:

    "Where was the 2018 world cup held?" -> Option B
  4. Quick Check:

    Reformulated question includes prior context [OK]
Quick Trick: Reformulation adds missing context from history [OK]
Common Mistakes:
  • Ignoring the year 2018 in reformulation
  • Repeating the original question
  • Using vague reformulations

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes