feat: add query clarification RAG intrinsic support #391
+215
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Component PR
Description
Add support for the
query_clarificationRAG intrinsic, which detects ambiguous user queries and generates clarifying questions to help narrow down the user's intent.Changes
clarify_query()function torag.pythat wraps the query_clarification intrinsicquery_clarificationintrinsic in the adapter catalog (LoRA only)docs/examples/intrinsics/query_clarification.py) demonstrating usage with positive and negative test casestest_query_clarification_positiveandtest_query_clarification_negative)Behavior
"CLEAR"when no clarification is neededTesting
Both tests verified passing on granite-4.0-micro with query_clarification LoRA adapter from
ibm-granite/granite-lib-rag-r1.0:test_query_clarification_positive: ✅ 1 passed in 284.80stest_query_clarification_negative: ✅ 1 passed in 29.89s