Skip to content

feat: guardianlib intrinsics (#8)#678

Open
ink-pad wants to merge 1 commit intogenerative-computing:mainfrom
ink-pad:main
Open

feat: guardianlib intrinsics (#8)#678
ink-pad wants to merge 1 commit intogenerative-computing:mainfrom
ink-pad:main

Conversation

@ink-pad
Copy link
Contributor

@ink-pad ink-pad commented Mar 17, 2026

Component PR

  • Add policy-guardrails intrinsic for checking scenario compliance against a given policy (Yes/No/Ambiguous)
  • Add guardian-core intrinsic for safety risk detection using the protocol tag — supports harm, social bias, jailbreak, profanity, violence, groundedness, answer relevance, context relevance, and function call hallucination checks via a built-in CRITERIA_BANK
  • Add factuality-detection and factuality-correction intrinsics for detecting and correcting factually incorrect responses relative to context
  • Register all four intrinsics in the adapter catalog pointing to ibm-granite/granitelib-guardian-r1.0

Description

  • Link to Issue: Fixes

Implementation Checklist

Protocol Compliance

  • parts() returns list of constituent parts (Components or CBlocks)
  • format_for_llm() returns TemplateRepresentation or string
  • _parse(computed: ModelOutputThunk) parses model output correctly into the specified Component return type

Content Blocks

  • CBlock used appropriately for text content
  • ImageBlock used for image content (if applicable)

Integration

  • Component exported in mellea/stdlib/components/__init__.py or, if you are adding a library of components, from your sub-module

Testing

  • Tests added to tests/components/
  • New code has 100% coverage
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

* Update README.md

Added policy_guardrails intrinsic

* Update catalog.py

Added policy guardrails

* Create policy_guardrails.json

Initial checkin

* Create test_guardian.py

initial checkin

* Create policy_guardrails.py

Initial check in

* Create guardian.py

Adding policy_guardrails intrinsic

* Update guardian.py

Fixed method call (call_intrinsic instead of _call_intrinsic)

* feat: add guardian core intrinsic component

* Added factuality examples

* Added unit tests for factuality intrinsics

* Fixed the pre-commit errors

* fix guardian intrinsic names to match HF repo paths

* fix: lint fixes from pre-commit

* Removed duplicated code in correction example

* refactor: remove _call_guardian_intrinsic workaround, use call_intrinsic

* style: ruff format guardian.py

---------

Co-authored-by: Moninder Singh <39064734+monindersingh@users.noreply.github.com>
Co-authored-by: Subhajit Chaudhury <subhajit@ibm.com>
Co-authored-by: Radu Marinescu <radu.marinescu@ie.ibm.com>
@ink-pad ink-pad requested a review from a team as a code owner March 17, 2026 23:20
@github-actions
Copy link
Contributor

The PR description has been updated. Please fill out the template for your PR to be reviewed.

@mergify
Copy link

mergify bot commented Mar 17, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|release)(?:\(.+\))?:

@ink-pad ink-pad mentioned this pull request Mar 17, 2026
10 tasks
@ink-pad ink-pad changed the title Feat/guardianlib (#8) Feat: guardianlib intrinsics (#8) Mar 17, 2026
@ink-pad ink-pad changed the title Feat: guardianlib intrinsics (#8) feat: guardianlib intrinsics (#8) Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant