Skip to content

refactor: get instructions from upstream guardian adapters#1037

Merged
psschwei merged 11 commits into
generative-computing:mainfrom
psschwei:guardian-formatters
May 18, 2026
Merged

refactor: get instructions from upstream guardian adapters#1037
psschwei merged 11 commits into
generative-computing:mainfrom
psschwei:guardian-formatters

Conversation

@psschwei
Copy link
Copy Markdown
Member

@psschwei psschwei commented May 7, 2026

Misc PR

Type of PR

  • Bug Fix
  • New Feature
  • Documentation
  • Other

Description

The goal is to move the instruction logic out of the guardian helper function and into the upstream io.yaml files for each adapter/intrinsic.

I've included a mellea/backends/adapters/_overlays/ directory with the updated io.yaml files as a temp fix until the actual files are available on Hugging Face. There's an envvar for disabling the overlays.

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code as added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Attribution

  • AI coding assistants used

Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>
@psschwei psschwei requested a review from jakelorocco May 7, 2026 14:34
@psschwei psschwei added the do-not-merge/hold Block merging this PR label May 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

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

@github-actions github-actions Bot added the bug Something isn't working label May 7, 2026
@psschwei
Copy link
Copy Markdown
Member Author

psschwei commented May 7, 2026

cc @pronics2004

@psschwei
Copy link
Copy Markdown
Member Author

psschwei commented May 7, 2026

Also note: there's updated io.yaml files for every version of the models. It was very little overhead to generate them all so I included them, but we may ultimately want to do a subset of them.

psschwei added 2 commits May 7, 2026 11:00
Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>
Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>
@psschwei
Copy link
Copy Markdown
Member Author

psschwei commented May 7, 2026

Latest commit uses pre-existing config file override

Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>
@psschwei psschwei force-pushed the guardian-formatters branch from b76390a to b8d180d Compare May 7, 2026 21:49
@psschwei psschwei changed the title fix: get instructions from upstream guardian adapters refactor: get instructions from upstream guardian adapters May 12, 2026
@psschwei psschwei marked this pull request as ready for review May 12, 2026 12:25
@psschwei psschwei requested a review from a team as a code owner May 12, 2026 12:25
@psschwei psschwei requested a review from markstur May 12, 2026 12:25
@github-actions github-actions Bot added the enhancement New feature or request label May 12, 2026
@psschwei psschwei removed the bug Something isn't working label May 12, 2026
psschwei added 4 commits May 12, 2026 17:51
Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>
Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>
Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>
Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>
@psschwei psschwei removed the do-not-merge/hold Block merging this PR label May 15, 2026
psschwei added 2 commits May 18, 2026 09:39
This reverts commit d61879a.
Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>
Copy link
Copy Markdown
Contributor

@jakelorocco jakelorocco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the work; one small change. I feel strongly about making the defaults "just" work to cut down on complexity.

Comment thread mellea/backends/adapters/adapter.py Outdated
Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>
Copy link
Copy Markdown
Contributor

@jakelorocco jakelorocco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm; thank you

@psschwei psschwei enabled auto-merge May 18, 2026 15:22
@psschwei psschwei added this pull request to the merge queue May 18, 2026
Merged via the queue into generative-computing:main with commit 51569ea May 18, 2026
10 checks passed
@psschwei psschwei deleted the guardian-formatters branch May 18, 2026 16:22
planetf1 added a commit to planetf1/mellea that referenced this pull request May 19, 2026
…omputing#1037

PR generative-computing#1037 expanded `guardian_check()` with a new `scoring_schema`
parameter and deprecated `target_role` (still works, emits
DeprecationWarning). Update docs to teach the new API:

- safety-guardrails.md: replace `target_role="user"` with
  `scoring_schema="user_prompt"` in the input-gate and PII examples;
  document SCORING_SCHEMA_BANK keys; add a deprecation note
- use-context-and-sessions.md: same sweep in the SafeChatSession example
- glossary.md: add SCORING_SCHEMA_BANK entry mirroring CRITERIA_BANK

No API surface changes in this PR — guardian.py taken from upstream/main
during rebase (the PR's earlier `-> str` annotation fix is now redundant
because generative-computing#1037 landed it independently).

Assisted-by: Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

investigate top-level guardian intrinsic functions to remove prompt formatting

2 participants