Find answers from the community

Updated 2 months ago

I am using two different approaches in

I am using two different approaches in advanced RAG. I want to switch to option 2 in case 1 fails. I am depending on the response string and using an if else construct to switch between the approaches. For example if "I'm sorry but..." in response.response: use_approach_2. Is there any other way to do this?
W
k
9 comments
You could validate the response using LLM itself I guess in this case:

Plain Text
validating_prompt = ("You are here to validate a response..."
"Return False if the response is not helping answering the question."
"Question: {query}"
"Response: {Bot response}"
"Feedback:"
)

feedback = llm.complete(validatng_prompt.format(ADD ALL THE PARAMS)

Based on the feedback you can suse next condition
hey thanks. I guess this should work with a query engine too right?
No this one is after you get a response from query engine, to validate and choose the if case or else case
If the bot says I'm not able to ansdwer the LLM will say False and based on that you can move to else case
Ohkay got it. Thanks
I tried this but doesn't work always
works with few queries not with all
What is the prompt that you defined? The one that i shared above is just an example it will not cover all the cases.
Okay. Let me try
Add a reply
Sign up and join the conversation on Discord