feat: add query clarification RAG intrinsic support#391
Open
LucianPopaIBM wants to merge 3 commits intogenerative-computing:mainfrom
Open
feat: add query clarification RAG intrinsic support#391LucianPopaIBM wants to merge 3 commits intogenerative-computing:mainfrom
LucianPopaIBM wants to merge 3 commits intogenerative-computing:mainfrom
Conversation
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Contributor
|
The PR description has been updated. Please fill out the template for your PR to be reviewed. |
1c172db to
993b994
Compare
Add support for the query_clarification RAG intrinsic, which detects ambiguous queries and generates clarification questions. Changes: - Add clarify_query() function to rag.py - Register query_clarification intrinsic in catalog - Add example script demonstrating usage - Add comprehensive tests for positive and negative cases - Add test data JSON files for both test scenarios - Add "Wight" to codespell ignore list (Isle of Wight is a place name) The intrinsic returns a clarification question for ambiguous queries or the string "CLEAR" when no clarification is needed. Tests verified passing on granite-4.0-micro with query_clarification LoRA adapter from ibm-granite/granite-lib-rag-r1.0. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
993b994 to
a1e1b18
Compare
jakelorocco
approved these changes
Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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