from langchain.memory import ChatMessageHistory
history = ChatMessageHistory()
`
question = “How many cutomers with order count more than 5”
response = chain.invoke({“question”:question,“messages”:history.messages})
history.add_user_message(question)
history.add_ai_message(response)
history.messages
response = chain.invoke({“question”: “Can you list there names?”,“messages”:history.messages})
response
but this code is not working when i implement using our custom database tables?
Is there any other alternative method is availabe to implement follow-up questions based on history using langchain and Open AI model