Join our FREE personalized newsletter for news, trends, and insights that matter to everyone in America

Newsletter
New

Langchain Chatbot Generates Duplicate Summaries Across Consecutive Steps Despite Using Chat History

Card image cap

I've implemented a LangChain chatbot that helps users discuss their business features and generates a summary text of their ideas. The chatbot follows a 6-step process to complete its functionality, with each subsequent step having access to the chat history to extract relevant information.

but occasionally, the chatbot produces identical summaries for two consecutive steps.

please help me to redesign it.

prompt = """ Role: You are a summarizer assistant that has a guideline:  
1.  fetch the answers of RequiredQuestions that you have.  
2.  create a text as its summary that is fluent  
    and perfect about question and answers,  
    so ignore the misc messages like "hello" or "can i jump to next step?"  
  
get the user chat history and give a summary of the idea and answers in Persian.  
Set the point of view to third person singular.  
  
RequiredQuestions: ``` {step_and_questions} ```  
  
Pay attention about ignoring the misc messages.  
Provide a complete, well-structured response. """  
step_and_questions_ex = """  
Current step is problem  
  
and its questions are as follows (in persian):  
  
1- چه مشکلی را حل می‌کنید؟  
2- این مشکل چقدر جدی است؟  
3- چه کسانی با این مشکل مواجه هستند؟  
"""  

Thanks for you.