Skip to content

Add unregister_benchmark method to RagasEvaluatorBase for dynamic benchmark management#58

Merged
dmaniloff merged 2 commits intotrustyai-explainability:mainfrom
dmaniloff:unregister_benchmark
Feb 26, 2026
Merged

Add unregister_benchmark method to RagasEvaluatorBase for dynamic benchmark management#58
dmaniloff merged 2 commits intotrustyai-explainability:mainfrom
dmaniloff:unregister_benchmark

Conversation

@dmaniloff
Copy link
Copy Markdown
Collaborator

@dmaniloff dmaniloff commented Feb 24, 2026

Summary by Sourcery

New Features:

  • Introduce an unregister_benchmark method on RagasEvaluatorBase to remove previously registered benchmarks by identifier.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Feb 24, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds support for dynamically unregistering benchmarks from RagasEvaluatorBase by introducing an async unregister_benchmark method that safely removes a benchmark from the internal registry and logs the operation.

Sequence diagram for unregister_benchmark benchmark removal flow

sequenceDiagram
    participant Caller
    participant RagasEvaluatorBase
    participant BenchmarksDict as benchmarks
    participant Logger as logger

    Caller->>RagasEvaluatorBase: unregister_benchmark(benchmark_id)
    activate RagasEvaluatorBase
    RagasEvaluatorBase->>BenchmarksDict: pop(benchmark_id, None)
    BenchmarksDict-->>RagasEvaluatorBase: Benchmark or None
    RagasEvaluatorBase->>Logger: info(Unregistered benchmark: benchmark_id)
    deactivate RagasEvaluatorBase
    RagasEvaluatorBase-->>Caller: return
Loading

Class diagram for updated RagasEvaluatorBase benchmark management

classDiagram
    class RagasEvaluatorBase {
        Dict~str,Benchmark~ benchmarks
        +async register_benchmark(task_def Benchmark) None
        +async unregister_benchmark(benchmark_id str) None
    }

    class Benchmark {
        str identifier
    }

    RagasEvaluatorBase "1" o-- "*" Benchmark : manages
Loading

File-Level Changes

Change Details Files
Introduce an async benchmark unregistration method to the evaluator base class.
  • Add unregister_benchmark coroutine accepting a benchmark_id string parameter
  • Safely remove the benchmark from the internal benchmarks dictionary using pop with a default of None
  • Log a message whenever a benchmark is unregistered to mirror the existing registration logging behavior
src/llama_stack_provider_ragas/base.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

sourcery-ai[bot]

This comment was marked as resolved.

… a benchmark is not found, improving feedback during benchmark management.
Copy link
Copy Markdown
Collaborator

@Bobbins228 Bobbins228 left a comment

Choose a reason for hiding this comment

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

lgtm

@dmaniloff dmaniloff merged commit 749e590 into trustyai-explainability:main Feb 26, 2026
4 checks passed
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