Logging Standalone Queries Created in RAG with Memory #29964
Replies: 8 comments 7 replies
-
Hey @shalini0311! I'm here to help you with any bugs, questions, or code contributions. Let's tackle this together! To capture and log the standalone queries created using the chat history and the current query in your Retrieval-Augmented Generation (RAG) system, you can modify your setup to return the generated standalone question. Here's how you can achieve this:
Here's how you can implement these changes in your code: # Set the chain to return the generated question
rag_chain.return_generated_question = True
# Invoke the chain with a query and chat history
chat_history = [] # Collect chat history here (a sequence of messages)
result = conversational_rag_chain.invoke({"input": query, "chat_history": chat_history})
# Log the generated standalone question
generated_question = result.get("generated_question")
print("Generated Standalone Question:", generated_question) By setting To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
Beta Was this translation helpful? Give feedback.
-
Hi @dosu, I tried implementing the modifications as suggested, but it doesn't seem to work as expected. I'm encountering the following error:
Additionally, I attempted the following approach:
This also throws the following error: It seems that I’m missing something when trying to log the generated questions. Could anyone help me understand why these errors are happening or suggest a proper solution for logging the standalone queries created during the process? Thanks in advance for your assistance! |
Beta Was this translation helpful? Give feedback.
-
Hi @dosu, Please assist me in integrating with the existing code. This is the current code:
|
Beta Was this translation helpful? Give feedback.
-
Hi @dosu, I followed your suggestion, but I’m now encountering a new issue. I’m getting the following error: Has anyone else faced a similar issue or can point me in the right direction to fix this? |
Beta Was this translation helpful? Give feedback.
-
Hi @dosu, I’m still encountering the same error. |
Beta Was this translation helpful? Give feedback.
-
@dosu, Yes I cross checked, I'm still getting the same error.
|
Beta Was this translation helpful? Give feedback.
-
@dosu, it's correctly passed as per the code you shared. |
Beta Was this translation helpful? Give feedback.
-
I'm still getting this error. Can someone suggest a solution for this? |
Beta Was this translation helpful? Give feedback.
-
I’m currently using Retrieval-Augmented Generation (RAG) with memory, and the code is working well. However, I’d like to log the standalone queries created using the chat history and current query.
I’m looking for guidance on how to capture and log these standalone queries effectively.
Here’s the code I’m working with:
Any help or suggestions on how to achieve this would be greatly appreciated!
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions