Skip to content

Conversation

wlbksy
Copy link
Contributor

@wlbksy wlbksy commented Jul 23, 2025

No description provided.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 23, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR implements a comprehensive deprecation of legacy functions in preparation for Ragas version 0.3. The changes systematically remove the deprecated _ascore method from all metric classes across the codebase and update documentation to use new metric class names.

The core changes include:

  1. Metric Method Deprecation: Removal of the _ascore method from 20+ metric classes including Faithfulness, AnswerCorrectness, ContextRecall, AspectCritic, and many others. These methods were legacy wrappers that accepted dictionary inputs and converted them to typed SingleTurnSample or MultiTurnSample objects before calling the newer _single_turn_ascore or _multi_turn_ascore methods.

  2. Base Class Cleanup: Complete removal of the deprecated score(), ascore(), and _ascore() methods from the base Metric class, eliminating 77 lines of legacy code including synchronous scoring functionality and Jupyter environment support.

  3. Metric Class Renaming: Updates throughout documentation and examples to replace deprecated metric class names like ContextPrecision and ContextRecall with more explicit names like LLMContextPrecisionWithReference and LLMContextRecall. This provides better clarity about whether metrics use LLMs and what input data they require.

  4. Documentation Updates: Comprehensive updates to integration guides (Langfuse, Haystack, LlamaIndex, R2R, Griptape, etc.) and tutorial notebooks to use the new API patterns and metric names.

  5. Code Consolidation: Many metrics had their logic consolidated from separate _ascore and _single_turn_ascore methods into a single _single_turn_ascore implementation, eliminating unnecessary dictionary conversions and improving type safety.

The changes represent a move from dictionary-based APIs to strongly-typed object interfaces, improving type safety and API consistency. The refactoring maintains all existing functionality while providing a cleaner, more maintainable codebase aligned with modern Python practices.

Confidence score: 4/5

• This PR is mostly safe to merge with some potential compatibility concerns for users still relying on deprecated methods
• The score reflects the systematic nature of the changes and thorough documentation updates, but there are a few potential issues that need attention
• Files that need more attention: ragas/src/ragas/metrics/__init__.py (missing import for context_utilization), ragas/src/ragas/metrics/_answer_correctness.py (potential deprecated method call), and any integration tests that might still use the old API

43 files reviewed, 2 comments

Edit Code Review Bot Settings | Greptile

@shahules786 shahules786 requested a review from jjmachan July 23, 2025 03:48
@shahules786
Copy link
Member

Hey @wlbksy thanks for the PR. We will look into it. Were you able to try out ragas-experimental ? https://docs.ragas.io/en/latest/experimental/

@wlbksy
Copy link
Contributor Author

wlbksy commented Jul 23, 2025

Hey @wlbksy thanks for the PR. We will look into it. Were you able to try out ragas-experimental ? https://docs.ragas.io/en/latest/experimental/

Haven't tried it yet — will check it out when I get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants