Skip to content

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

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

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

Conversation

@spencrr

@spencrr Spencer Schoenberg (spencrr) commented Aug 4, 2026

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 for multi-turn contexts, prompting callers to make the intended quantifier explicit.

The documentation includes one source-of-truth table for positive and negated attack/probe forms, explains how each built-in evaluator sees the transcript, and clarifies that scope applies to turns already present in EvalContext rather than controlling execution length or stopping.

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 pass. Lint, formatting, type checks, and strict documentation build pass.

@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
Contributor

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.

Comment thread tests/unit/evaluators/test_response_contains.py Outdated
Comment thread docs/attacks/xpia.md
Comment thread docs/attacks/xpia.md Outdated
Comment thread docs/contributing/extending-rampart.md Outdated
Comment thread docs/probes/behavioral.md Outdated
Comment thread docs/probes/behavioral.md Outdated
Comment thread docs/usage/authoring-tests.md
Comment thread docs/usage/authoring-tests.md

@nina-msft Nina Chikanov (nina-msft) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These comments are GHCP flagged & some of them I've tweaked wording slightly. Leaving these here for full coverage :-)

Comment thread rampart/evaluators/response_contains.py
Comment thread rampart/evaluators/response_contains.py
Comment thread rampart/evaluators/response_contains.py
Comment thread rampart/evaluators/__init__.py
Comment thread rampart/evaluators/response_contains.py
@spencrr
Spencer Schoenberg (spencrr) force-pushed the dev/spencrr/trace-response-scope branch from a5c18f3 to 14089aa Compare August 8, 2026 02:31
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.

3 participants