Skip to content

feat: Add Opik governance evaluation metrics#19

Merged
nagasatish007 merged 1 commit into
mainfrom
feat/opik-governance-metrics
Jul 16, 2026
Merged

feat: Add Opik governance evaluation metrics#19
nagasatish007 merged 1 commit into
mainfrom
feat/opik-governance-metrics

Conversation

@nagasatish007

Copy link
Copy Markdown
Contributor

Adds tealtiger.integrations.opik module with custom Opik BaseMetric subclasses for evaluating governance policy correctness:

  • GovernanceAccuracyMetric: did governance make the right ALLOW/DENY decision?
  • PIIDetectionMetric: true/false positive/negative scoring for PII detection
  • FalsePositiveRateMetric: specifically measures legitimate inputs incorrectly denied
  • GovernanceLatencyMetric: evaluation completed within threshold (<5ms)
  • GovernanceMultiMetric: combined multi-score metric (accuracy + PII + latency)

All metrics are deterministic (no LLM judge) and can be used with Opik's evaluate() function for governance regression testing.

Closes #333

Pull Request

Description

Provide a clear and concise description of what this PR does.

Fixes #(issue number)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring
  • Test improvements

Changes Made

Testing

Describe the tests you ran to verify your changes:

  • Unit tests pass (pytest)
  • Type checking passes (mypy src)
  • Linting passes (ruff check src tests)
  • Manual testing performed
  • Added new tests for new functionality

Checklist

  • My code follows the project's code style
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Breaking Changes

If this PR introduces breaking changes, describe them here and provide migration instructions.

Screenshots (if applicable)

Add screenshots to help explain your changes.

Additional Notes

Add any other context about the PR here.

name=f"{self.name}_latency",
reason=f"{latency_ms:.2f}ms {'<=' if within else '>'} {self._threshold_ms}ms",
))
except (ValueError, TypeError):
Adds tealtiger.integrations.opik module with custom Opik BaseMetric
subclasses for evaluating governance policy correctness:

- GovernanceAccuracyMetric: did governance make the right ALLOW/DENY decision?
- PIIDetectionMetric: true/false positive/negative scoring for PII detection
- FalsePositiveRateMetric: specifically measures legitimate inputs incorrectly denied
- GovernanceLatencyMetric: evaluation completed within threshold (<5ms)
- GovernanceMultiMetric: combined multi-score metric (accuracy + PII + latency)

All metrics are deterministic (no LLM judge) and can be used with Opik's
evaluate() function for governance regression testing.

Closes #333
@nagasatish007
nagasatish007 force-pushed the feat/opik-governance-metrics branch from 2375f83 to 7697acd Compare July 16, 2026 08:07
@nagasatish007
nagasatish007 merged commit 54adbe8 into main Jul 16, 2026
9 of 24 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.

1 participant