How to Add Conversational Memory to Open Source LLMs?

Iā€™m working with open-source Large Language Models and need advice on adding conversational memory to them. I want the model to remember past conversations better.

I followed this document but it only works for OpenAI models.