How to use RunnableWithMessageHistory and ConversationalRetrievalChain together? #18087
Replies: 2 comments 2 replies
-
🤖 Hey @adityabhattad2021! Great to see you diving into another challenge with LangChain. How's everything going on your end? Based on the code you've shared and the issues you're facing, it seems like you're on the right track with integrating
Here's an example of how you might modify your def get_retrival_qa_chain(self):
prompt = self.get_custom_prompt()
retriever = self.get_retriever()
llm = ChatGoogleGenerativeAI(model="gemini-pro", temperature=0.5, convert_system_message_to_human=True)
qa_chain = ConversationalRetrievalChain.from_llm(llm=llm, verbose=True, retriever=retriever, output_key='output')
return qa_chain In this example, I've added I hope this helps! If you're still encountering issues, could you please provide more details about the exact error messages you're seeing and the context in which they occur? This will help me provide more targeted assistance. Sources
|
Beta Was this translation helpful? Give feedback.
-
were you able to solve this issue? I am currently getting the same error "Error in RootListenersTracer.on_chain_end callback: KeyError('output')" @adityabhattad2021 |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
I am attempting to integrate
RunnableWithMessageHistory
andConversationalRetrievalChain
, but I'm encountering issues.RunnableWithMessageHistory
successfully passes the question and chat history toConversationalRetrievalChain
, which performs the following tasks:However, I'm facing two main problems:
. I want to provide a custom prompt to the
LLMChain
that includes both the context and the user's question.StuffDocumentChain
is generating an error message:Error in RootListenersTracer.on_chain_end callback: KeyError('output')
.System Info
langchain==0.1.8
langchain-community==0.0.21
langchain-core==0.1.24
langchain-google-genai==0.0.9
platform windows ubuntu
python version 3.10.13
Beta Was this translation helpful? Give feedback.
All reactions