fix: added RAI check in user clarification endpoint #348
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.
Purpose
This pull request introduces updates to the
rai_successfunction and its usage across the codebase to enhance Responsible AI (RAI) checks. Key changes include adding a new parameter to distinguish between task creation and other contexts, refining the RAI evaluation logic, and updating endpoints to handle RAI failures more robustly.Enhancements to RAI functionality:
src/backend/utils_kernel.py: Updatedrai_successto accept a newis_task_creationparameter, allowing for context-specific evaluation. The function now uses a dynamiccontent_prompttailored to either general input validation or task creation. [1] [2] [3]Updates to endpoints for RAI integration:
src/backend/app_kernel.py: Modifiedinput_task_endpointto passTruefor theis_task_creationparameter when callingrai_success.src/backend/app_kernel.py: Enhancedhuman_clarification_endpointto invokerai_successwithFalsefor non-task-related clarification. Added robust error handling and event tracking for RAI failures.Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
Other Information