-
Notifications
You must be signed in to change notification settings - Fork 1.9k
GH-4232 Introduce the ValidationMode
property to RewriteQueryTransformer
#4256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… allowing users to customize the behavior of template content validation when creating an instance of the object. Signed-off-by: Sun Yuhan <[email protected]>
Signed-off-by: Sun Yuhan <[email protected]>
Signed-off-by: Sun Yuhan <[email protected]>
Hi @markpollack @sobychacko , What do you think about this? Could you please help review this PR? Thank you. |
@sunyuhan1998 thanks for raising this issue! The validation that is currently done in the The current logic only checks for the presence of words in a prompt template that match the variables expected by the component. But it doesn't really check if they are available as placeholders. Since the introduction of the modular RAG components, we introduced the Besides that, I'm curious about the use cases where it should be ok not to validate the prompt placeholders. Could you elaborate on that? For example, in this case, the prompt should include a |
Just noticed the original issue. If |
Actually, my initial idea was: it would be ideal if we could ensure that all variables corresponding to the placeholders in the prompt have been provided by the user. However, currently |
As described in the issue, the current
RewriteQueryTransformer
allows users to customize templates via the constructor, but enforces strict validation of placeholders in the template—this can be overly restrictive in certain scenarios. This PR introduces a newValidationMode
property toRewriteQueryTransformer
, supporting three modes:THROW
,WARN
, andNONE
. The default mode isTHROW
, which preserves the original behavior. If set toWARN
, the system will perform validation as usual, but when a required variable is missing from the template, it will only log a warning instead of throwing an exception. If set toNONE
, validation is completely skipped.Changes included in this PR:
ValidationMode
property toRewriteQueryTransformer
to enable flexible control over placeholder validation;Fixes #4232