Chagpt replying same answers again and again with small word changes

Hello Community,

I am using LangChain based ConversationChain for my task. I have done prompt engineering using PromptTemplate where I have to input_varibale 1) input 2) histroy. I have also added format_instructions and output parser in prompt template to get structure output.

Now before adding format_instructions and output_parser the whole conversation flow was working fine and chatgpt was working as intruscted in prompt. But when I added format_instructions and output parser it is replying same answer again and again with small changes.

I have checked how history is append at the end of the prompt as I have format_instructions I think that is causing the issue.

Example with format_instructions:

Human: Hello 
AI : '''json
{
        "AI": "How can I help",
        "flag": "Responsive",
}'''

Instead if I have correct history like

Human: Hello 
AI : "How can I help",

Now How to fix this issue ?