A few months ago I implemented a Rag in one of our applications that used the NewRetrievalQA and it was working wonders! This week I am in charge of implementating the Rag but with access to memory in the chat so I decided to change to the NewConversationalRetrievalQA.
Steps to Reproduce:
Implement NewConversationalRetrievalQA using memory access in the chat.
Use the provided implementation code.
Attempt to run the application.
Expected Behavior:
The NewConversationalRetrievalQA should work without errors, utilizing the memory access in the chat.
Actual Behavior:
Encountered the following error: missing memory key in input values: memory key is of wrong type
Code used and additional information:
Langchain Version: v0.1.8
Golang Version: 1.22.0
mem := memory.NewConversationBuffer(memory.WithChatHistory(memory.NewChatMessageHistory(
memory.WithPreviousMessages([]schema.ChatMessage{
schema.HumanChatMessage{Content: "Hello"},
schema.AIChatMessage{Content: "Hello, How Are your?"},
}),
)), memory.WithMemoryKey("chat_history"))
var s Schemas
llmchain := chains.NewLLMChain(llm, s.FormatPrompt())
chain := chains.NewStuffDocuments(llmchain)
// rchain := chains.NewRetrievalQA(chain, qdrant)
condeseChain := chains.LoadCondenseQuestionGenerator(llm)
rchain := chains.NewConversationalRetrievalQA(chain, condeseChain, qdrant, mem)
log.Println(rchain.GetMemory(), rchain.GetInputKeys())
rchain.ReturnSourceDocuments = true
rchain.InputKey = "question"
I have also tried with the default history variable and also adding the memory as inputKey but nothing seemed to work... Is that a bug or am I missing something here?
Hey everyone,
A few months ago I implemented a Rag in one of our applications that used the NewRetrievalQA and it was working wonders! This week I am in charge of implementating the Rag but with access to memory in the chat so I decided to change to the NewConversationalRetrievalQA.
Steps to Reproduce:
Expected Behavior: The NewConversationalRetrievalQA should work without errors, utilizing the memory access in the chat.
Actual Behavior: Encountered the following error: missing memory key in input values: memory key is of wrong type
Code used and additional information:
Langchain Version: v0.1.8 Golang Version: 1.22.0
s.FormatPrompt() Function:
I have also tried with the default history variable and also adding the memory as inputKey but nothing seemed to work... Is that a bug or am I missing something here?
Thanks a lot