Conversation history is not being updated in use_langchain case
asehmi opened this issue · 2 comments
After the conversation history is initialized, the user's query is appended to the conversation history in both branches:
st.session_state.conversation_history.append({"role": "user", "content": user_input})
This line of code adds the user's input to the conversation history, ensuring that it includes both user and assistant messages for context. Depending on whether use_langchain is True or False, the assistant's reply is obtained and appended to the conversation history in the respective branches:
In the use_langchain branch, the LangChain OpenAI wrapper generates the assistant's reply, and it's appended to the conversation history.
In the non-use_langchain branch, the direct OpenAI API call generates the assistant's reply, which is also appended to the conversation history.
Thanks, so it is intentional. I'll trace the LangChain branch to validate that for myself.