Skip to content

Are SemanticSimilarity and AnswerSimilarity supposed to be different?Β #2409

@sanjeed5

Description

@sanjeed5

Problem

The collections API has two implementations that appear to be identical:

The implementations are 100% identical - same cosine similarity algorithm, same parameters. The only differences are:

  1. Class name
  2. Default metric name: "semantic_similarity" vs "answer_similarity"

Context

In the legacy API (_answer_similarity.py), AnswerSimilarity was simply a subclass alias of SemanticSimilarity:

class AnswerSimilarity(SemanticSimilarity):
name: str = "answer_similarity"When migrating to collections API, both were implemented as separate standalone classes with duplicated code.

Current State

  • SemanticSimilarity has documentation and is in the metrics index
  • AnswerSimilarity has no documentation and is not in the metrics index
  • Both are exported in ragas.metrics.collections.__all__

Question

Should we consolidate these, or is there a reason to keep both as separate implementations?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions