LangChain - Conversational RAG
Given this code snippet, what will be the output after two follow-up questions?
from langchain.chains import ConversationChain
from langchain.memory import ConversationBufferMemory
memory = ConversationBufferMemory()
class MockLLM:
def invoke(self, prompt):
last_human = prompt.split('Human:')[-1].split('\n')[0].strip()
return f"Answer to: {last_human}"
llm = MockLLM()
chain = ConversationChain(llm=llm, memory=memory)
print(chain.run("What is AI?"))
print(chain.run("How does it learn?"))
