Skip to content

feat: allow setting query transformers in BaseRAGQuestionAnswerer - #274

Open
krisnaparahita wants to merge 1 commit into
pathwaycom:mainfrom
krisnaparahita:add-query-transformer-baseragqa
Open

krisnaparahita wants to merge 1 commit into
pathwaycom:mainfrom
krisnaparahita:add-query-transformer-baseragqa

Conversation

@krisnaparahita

Copy link
Copy Markdown

Fixes #67

Summary

  • Add an optional query_transformer_prompt constructor argument with no behavior change when omitted.
  • Rewrite the user query through the configured LLM before document retrieval.
  • Keep the original user prompt for final answer generation, avoiding the unsafe behavior identified in feat: add query_transformer parameter to BaseRAGQuestionAnswerer #209.
  • Accept either a callable or Pathway UDF as the transformer prompt.

Validation

  • Added four tests covering configuration, default behavior, rewritten-query retrieval, and preservation of the original answer prompt.
  • Full test_rag.py suite passes: 13 tests.

Adds a query_transformer_prompt param that rewrites the query via the
LLM (e.g. prompts.prompt_query_rewrite / prompt_query_rewrite_hyde)
before retrieval. The rewritten query is used only for document
retrieval; the final answer is still generated from the original user
prompt, per maintainer feedback on a prior attempt (pathwaycom#209).

Fixes pathwaycom#67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow setting query transformers in the BaseRAGQA

2 participants