Bird
0
0

Which of the following is the correct way to represent conversation history in Langchain for RAG?

easy📝 Syntax Q12 of 15
LangChain - Conversational RAG
Which of the following is the correct way to represent conversation history in Langchain for RAG?
AAn integer count of messages exchanged.
BA single string with all messages concatenated without structure.
CA dictionary with only the last user message.
DA structured list of message objects, each with role and content.
Step-by-Step Solution
Solution:
  1. Step 1: Identify the recommended data structure for conversation history

    Langchain uses a list of message objects, each containing role (user/assistant) and content.
  2. Step 2: Compare options to this structure

    Only structured list of message objects, each with role and content. matches this structured list format.
  3. Final Answer:

    A structured list of message objects, each with role and content. -> Option D
  4. Quick Check:

    Structured list of messages = A [OK]
Quick Trick: Look for structured list with roles and content [OK]
Common Mistakes:
  • Using unstructured strings
  • Keeping only last message
  • Using counts instead of messages

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes