Allow setting query transformers in BaseRAGQuestionAnswerer#174
Allow setting query transformers in BaseRAGQuestionAnswerer#174Ch-Abhinav-Chowdary wants to merge 2 commits intopathwaycom:mainfrom
Conversation
|
I liked the changes in the previous PR better
|
|
Okay i Will do it |
|
Status of Changes:
|
|
@Ch-Abhinav-Chowdary You're still using the rewritten prompt both for retrieval and answering. Please change this so that the new prompt is used only for retrieval. Also, the test you've written doesn't pass.
Do you have more details what wasn't working for you? I tried that in a clean environment and managed to build Pathway based purely on this repository |
|
Okay i will work on it |
Summary
Added a new optional parameter query_transformer_prompt: pw.UDF | None to BaseRAGQuestionAnswerer (and AdaptiveRAGQuestionAnswerer) to enable query rewriting/normalization before retrieval and prompt construction.
What changed
BaseRAGQuestionAnswerer.init: accepts and stores query_transformer_prompt.
BaseRAGQuestionAnswerer.answer_query: if provided, applies query_transformer_prompt to prompt before calling retriever and before generating the RAG prompt.
AdaptiveRAGQuestionAnswerer.init: accepts and forwards query_transformer_prompt.
Updated docstrings to document the new parameter.
Why
Enables custom query transformers (rewrite/expand/normalize) without changing server schemas or external request formats.