Skip to content

[FEAT]: Add explicit response evaluation scopes - #145

Open
Spencer Schoenberg (spencrr) wants to merge 1 commit into
microsoft:mainfrom
spencrr:dev/spencrr/trace-response-scope
Open

[FEAT]: Add explicit response evaluation scopes#145
Spencer Schoenberg (spencrr) wants to merge 1 commit into
microsoft:mainfrom
spencrr:dev/spencrr/trace-response-scope

Conversation

@spencrr

Copy link
Copy Markdown
Contributor

Description

Adds ResponseScope.ANY_TURN, ALL_TURNS, and CURRENT_TURN to ResponseContains. Omitting scope preserves current-response behavior and emits a FutureWarning when the evaluator receives a multi-turn context, giving callers time to make the intended quantifier explicit before final-trace verdict evaluation lands.

The documentation includes the attack/probe migration table, explains the current prefix-evaluation limitation, and updates guidance for LLMJudge and custom evaluators.

Breaking changes

None. The API is additive and omitted scope retains existing behavior. Multi-turn calls without an explicit scope now emit a FutureWarning.

Checklist

  • pre-commit run --all-files passes
  • Tests added for all response scopes, warnings, empty contexts, and negation
  • Documentation updated

Validation: 31 focused evaluator tests and 652 broad unit tests pass. The full unit command also exposes four unrelated baseline failures in generated pytest fixtures, so the broad validation excluded only those known cases.

@spencrr
Spencer Schoenberg (spencrr) requested a review from a team August 4, 2026 00:07
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds explicit temporal scopes to ResponseContains while preserving current-turn defaults with migration warnings.

Changes:

  • Introduces ANY_TURN, ALL_TURNS, and CURRENT_TURN.
  • Adds scope, warning, negation, and edge-case tests.
  • Documents migration semantics across APIs, probes, attacks, and custom evaluators.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
rampart/evaluators/response_contains.py Implements response scopes and warnings.
rampart/evaluators/__init__.py Exports ResponseScope.
tests/unit/evaluators/test_response_contains.py Tests scoped evaluation behavior.
docs/usage/authoring-tests.md Documents scope selection and migration.
docs/probes/behavioral.md Updates multi-turn probe guidance.
docs/contributing/extending-rampart.md Updates custom evaluator guidance.
docs/attacks/xpia.md Adds explicit attack evaluator scopes.
docs/api/index.md Lists the new enum.
docs/api/evaluators.md Adds API reference generation.



class TestResponseScopeAnyTurn:
async def test_earlier_match_then_benign_final_response(self) -> None:
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.

2 participants