fix(nli): expose model_name property on NLIJudge#213
Merged
himanshu231204 merged 1 commit intoJul 22, 2026
Conversation
Add a public model_name accessor and use it in faithfulness/relevancy metadata instead of reaching into the private _model_name attribute. Fixes OpenAgentHQ#73
Member
|
/oc review the pr in detail |
PR Review:
|
| File | Δ | Change |
|---|---|---|
openagent_eval/metrics/nli/judge.py:79-82 |
+5/-0 | Adds @property model_name exposing self._model_name |
openagent_eval/metrics/generation/faithfulness.py:138 |
+1/-1 | judge._model_name → judge.model_name |
openagent_eval/metrics/generation/relevancy.py:132 |
+1/-1 | judge._model_name → judge.model_name |
tests/unit/test_metrics/test_nli.py:221-224 |
+5/-0 | Tests both custom and default model_name |
Assessment: APPROVE
Strengths:
- Correctly adds a read-only
@property model_nameonNLIJudgefollowing standard Python convention faithfulness.py:L138andrelevancy.py:L132now access the public API instead of the private_model_nameattribute — this is the right fix, as private attribute access is fragile- The test covers both paths: custom model name (via constructor) and
DEFAULT_MODELfallback - Minimal, focused diff (+12/-2), easy to verify
- No behavioral change beyond switching from private→public accessor
One minor note: since _model_name is set once in __init__ and never mutated, you could simplify by renaming the attribute to model_name directly and dropping the property. But the property approach is more conventional for a public API and avoids any ambiguity — fine as-is.
No bugs, no regressions. Ship it.
|
🎉 Congratulations @syf2211! Your pull request has been successfully merged into main. 🚀 Thank you for contributing to OpenAgentHQ and helping improve the project. We truly appreciate your contribution and hope to see you back with more amazing PRs! Happy Open Sourcing! ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Add a public
model_nameproperty onNLIJudgeand update faithfulness/relevancy metrics to use it instead of accessing the private_model_nameattribute.Type of Change
Related Issues
Closes #73
How Has This Been Tested?
pytest tests/unit/test_metrics/test_nli.py— 37/37 passed)uv run mypy openagent_eval/)Checklist
Additional Notes
Summary
Expose
NLIJudge.model_nameas a read-only public accessor and route faithfulness/relevancy metadata through it.Motivation
FaithfulnessandAnswerRelevancywere readingjudge._model_name, coupling metrics to private implementation details. A futureNLIJudgerefactor could silently break scoring via the broadexcept Exceptionfallback.Changes
@property model_nameonNLIJudgejudge._model_namewithjudge.model_nameinfaithfulness.pyandrelevancy.pytest_model_name_propertyunit testTests
pytest tests/unit/test_metrics/test_nli.py # 37 passedNotes