A developer needs to build an AI chatbot for customer service, using LangChain in a Databricks setting. The bot must adhere to these requirements: (1) restrict its responses to information from a private company knowledge base stored in Databricks Vector Search, (2) maintain the context of ongoing conversations, enabling users to pose subsequent queries like 'Could you elaborate on that last statement?', and (3) provide answers in concise, unformatted text. Which combination of LangChain modules is CRUCIAL to meet these three requirements?
Answer & explanation
Correct answer: E
WHY E is correct: Each requirement maps to a component. The VectorStoreRetriever queries the Databricks Vector Search index and returns relevant chunks, which grounds the answers. The ChatPromptTemplate with a MessagesPlaceholder injects prior turns into the prompt, which gives multi-turn awareness. StrOutputParser returns plain text, and a ChatModel fits conversational use because it accepts system, human and AI messages.
WHY NOT A: This chain has no retriever, so it cannot ground answers in the company knowledge base, and LangChain LLMs do not keep state between calls unless history is passed in explicitly. It fails the grounding and the multi-turn requirements.
WHY NOT C: MapReduceDocumentsChain maps over a large set of document chunks and reduces them to a summary. It is a summarization pattern, not a conversational chain, and it does not manage multi-turn history.
WHY NOT D: Memory accumulates the conversation but gives no access to the knowledge base in Vector Search. A question about a policy not yet discussed cannot be answered from memory, so the grounding requirement fails.
WHY NOT B: Without history handling, a follow-up such as a request to elaborate on the last statement has no referent: the model treats each turn as a fresh, independent question. The multi-turn requirement fails.