0
0
LangChainframework~10 mins

Question reformulation with history in LangChain - Interactive Code Practice

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

Complete the code to import the necessary class for question reformulation.

LangChain
from langchain.chains import [1]
Drag options to blanks, or click blank then click option'
ARephraseQuestionChain
BStuffDocumentsChain
CConversationalRetrievalChain
DChatVectorDBChain
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a chain that only handles document stuffing.
Selecting a chain unrelated to conversation.
2fill in blank
medium

Complete the code to create a retriever from a vector store.

LangChain
retriever = vectorstore.[1]()
Drag options to blanks, or click blank then click option'
Aas_retriever
Bget_retriever
Cretrieve
Dfetch_retriever
Attempts:
3 left
💡 Hint
Common Mistakes
Using a method that does not exist on the vector store.
Confusing retrieval with fetching.
3fill in blank
hard

Fix the error in the code to create a ConversationalRetrievalChain with a language model and retriever.

LangChain
qa_chain = ConversationalRetrievalChain.from_llm(llm=[1], retriever=retriever)
Drag options to blanks, or click blank then click option'
Allm_model
Bmodel
Clanguage_model
Dllm
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect parameter names causing runtime errors.
Passing the model instance with wrong variable names.
4fill in blank
hard

Fill both blanks to reformulate a question using chat history and a new question.

LangChain
rephrased_question = qa_chain.[1](question=new_question, chat_history=[2])
Drag options to blanks, or click blank then click option'
Arephrase_question
Bgenerate_question
Cchat_history
Dhistory
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names that do not exist.
Passing chat history with wrong parameter names.
5fill in blank
hard

Fill all three blanks to create a question-answering chain that uses a language model, retriever, and returns source documents.

LangChain
qa_chain = ConversationalRetrievalChain.from_llm(llm=[1], retriever=[2], return_source_documents=[3])
Drag options to blanks, or click blank then click option'
Allm
Bretriever
CTrue
DFalse
Attempts:
3 left
💡 Hint
Common Mistakes
Passing wrong variable names for llm or retriever.
Forgetting to set return_source_documents to True.