Skip to content

fix: distance measure in non llm CR #1787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

shahules786
Copy link
Member

from ragas import evaluate
from ragas.metrics import NonLLMContextRecall, NonLLMContextPrecisionWithReference
from ragas import SingleTurnSample, EvaluationDataset
from ragas.metrics._string import DistanceMeasure

sample = SingleTurnSample(
    retrieved_contexts=["Paris is the capital of France."], 
    reference_contexts=["Paris is the capital of France.", "The Eiffel Tower is one of the most famous landmarks in Paris."]
)
dataset = EvaluationDataset(samples=[sample, sample, sample])

scorer = NonLLMContextRecall()

result = evaluate(
    dataset,
    metrics=[scorer],
)

scorer.distance_measure = DistanceMeasure.JARO_WINKLER

result = evaluate(
    dataset,
    metrics=[scorer],
)```

@shahules786 shahules786 marked this pull request as ready for review December 23, 2024 12:59
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Dec 23, 2024
@shahules786 shahules786 merged commit e8f9232 into explodinggradients:main Dec 23, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant