-
Notifications
You must be signed in to change notification settings - Fork 751
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
feat: Non LLM based context precision #1264
Merged
Merged
Conversation
This file contains 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
Member
shahules786
commented
Sep 10, 2024
•
edited
Loading
edited
- Add Non LLM based context precision
- Rename and introduce naming convention to metrics - <llm_or_non_llm><metric_name><with_or_without_reference>
```python from ragas import evaluate from ragas.metrics import rubrics_score_without_reference from ragas.dataset_schema import EvaluationDataset, MultiTurnSample from ragas.messages import HumanMessage sample1 = MultiTurnSample(user_input=[HumanMessage(content="What is X")]) sample2 = MultiTurnSample(user_input=[HumanMessage(content="What is X")]) ds = EvaluationDataset(samples=[sample1, sample2]) evaluate(ds,metrics=[rubrics_score_without_reference]) ```
Added support for 1. BLEU SCORE 2. ROGUE SCORE 3. STRING MATCH 4. EDIT DISTANCE
```python from ragas.experimental.metrics._faithfulness import FaithfulnessExperimental, LongFormAnswerPrompt faithfulness = FaithfulnessExperimental() faithfulness.get_prompts() #{'long_form_answer_prompt': <ragas.experimental.metrics._faithfulness.LongFormAnswerPrompt at 0x7fd7baa8efb0>, #'nli_statement_prompt': <ragas.experimental.metrics._faithfulness.NLIStatementPrompt at 0x7fd7baa8f010>} long_form_prompt = LongFormAnswerPrompt() long_form_prompt.instruction = "my new instruction" prompts = {"long_form_answer_prompt":long_form_prompt} faithfulness.set_prompts(**prompts) ``` --------- Co-authored-by: Jithin James <jamesjithin97@gmail.com>
dosubot
bot
added
the
size:L
This PR changes 100-499 lines, ignoring generated files.
label
Sep 10, 2024
jjmachan
approved these changes
Sep 11, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just the suggestion for doc change
Co-authored-by: Jithin James <jamesjithin97@gmail.com>
Co-authored-by: Jithin James <jamesjithin97@gmail.com>
Co-authored-by: Jithin James <jamesjithin97@gmail.com>
shahules786
added a commit
to shahules786/ragas
that referenced
this pull request
Sep 12, 2024
1. Add Non LLM based context precision 2. Rename and introduce naming convention to metrics - <llm_or_non_llm><metric_name><with_or_without_reference> ```python from ragas import SingleTurnSample from ragas.metrics._context_precision import NonLLMContextPrecisionWithReference context_precision = NonLLMContextPrecisionWithReference() sample = SingleTurnSample( retrieved_contexts=["The Eiffel Tower is located in Paris."], reference_contexts=["Paris is the capital of France.", "The Eiffel Tower is one of the most famous landmarks in Paris."] ) await context_precision.single_turn_ascore(sample) ``` --------- Co-authored-by: Jithin James <jamesjithin97@gmail.com>
shahules786
added a commit
to shahules786/ragas
that referenced
this pull request
Sep 12, 2024
1. Add Non LLM based context precision 2. Rename and introduce naming convention to metrics - <llm_or_non_llm><metric_name><with_or_without_reference> ```python from ragas import SingleTurnSample from ragas.metrics._context_precision import NonLLMContextPrecisionWithReference context_precision = NonLLMContextPrecisionWithReference() sample = SingleTurnSample( retrieved_contexts=["The Eiffel Tower is located in Paris."], reference_contexts=["Paris is the capital of France.", "The Eiffel Tower is one of the most famous landmarks in Paris."] ) await context_precision.single_turn_ascore(sample) ``` --------- Co-authored-by: Jithin James <jamesjithin97@gmail.com>
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.