LCORE-1099: Feature/upgrade ogx to 1.0.2 - #2293
Conversation
Eliminates redundant stored state by deriving refusal_response from message at access time, removing the now-unnecessary create_refusal_response helper and all constructor-site arguments.
Introduce AbstractSafetyCapability(AbstractCapability[T]) in capabilities/base.py, requiring subclasses to implement a run() method that accepts raw text and returns ShieldModerationResult. This enables safety capabilities to be invoked outside the pydantic-ai agent lifecycle. Migrate QuestionValidity and PiiRedactionCapability to extend the new base class and implement run(): - QuestionValidity.run() delegates to model_request and maps ALLOWED/REJECTED to ShieldModerationPassed/Blocked - PiiRedactionCapability.run() applies regex redaction and returns Blocked when PII is detected Add unit tests for both run() implementations.
Rename shield config fields to identifier/provider_id, reshape CatalogShield to type=shield with params, and align listing/tests with the new shape. Co-authored-by: Cursor <cursoragent@cursor.com>
Add run_shield_moderation_v2 and build_shield to utils/shields.py to run shield moderation through AbstractSafetyCapability instances instead of the Llama Stack client. Update the responses endpoint to call the new function with shield configs directly. Include unit tests covering pass, block, filtering, and error handling paths.
Move append_turn_to_conversation into utils.conversations so capabilities no longer depend on utils.shields at import time. Co-authored-by: Cursor <cursoragent@cursor.com>
3b4c686 to
5ec0bc9
Compare
|
Important Review skippedToo many files! This PR contains 204 files, which is 104 over the limit of 100. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (204)
You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Merge feature branch to main
Type of change
Tools used to create PR
Identify any AI code assistants used in this PR (for transparency and review context)
Related Tickets & Documents
Checklist before requesting a review
Testing