Follow-up questions handling in Langchain

I am using Langchain.
I have a txt file from which I am getting all the data. I am loading it using

loader = TextLoader('descriptions.txt')
index = VectorstoreIndexCreator().from_loaders([loader])

What I want to do is to keep the context:
For example:

HumanMessage: Where is France?
AIResponse: In Europe
Human Message: What is its best monuments?
The chatbot understands that the "its" refers to France.

I saw the documentation and they are using agents for this but I think it is unnecessary in my case, how to do it please?


The way you describe it looks to me like you will have to include at least one previous question and answer in your prompt for your chatbot (assuming you are working on a chatbot of sorts).

Can’t really say more based on the info you gave, but I think putting the last few exchanges into your prompt should give enough context.

Hope this helps.