techleadhd / chatgpt-retrieval

1.65k stars 786 forks source link

chat history makes the system deadlock. #46

Open dk-teknologisk-mlnn opened 7 months ago

dk-teknologisk-mlnn commented 7 months ago

I have to comment out the chat_history append for it to work. if the conversation is added to the history, only the first question I ask will receive an answer.

With this #:

chat_history.append((query, result['answer']))

I can keep asking questions, but lose the functionality that it knows what the last question was. I see the langchain docs that we need to allocate chat history memory objects. but doing this does not help.

memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True) chain = ConversationalRetrievalChain.from_llm( llm=ChatOpenAI(model="gpt-3.5-turbo"), retriever=index.vectorstore.as_retriever(search_kwargs={"k": 1}), memory=memory )

with this, it still deadlocks.