Update RAG metrics#13
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the RAG metrics script and related chat service functions to align with the latest library changes and improve error handling.
- Added try/except blocks and enhanced logging in the chat functions.
- Updated dependency versions and added new dependencies in pyproject.toml to support evolved libraries.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/app/services/abst_chat.py | Improved error handling in chat calls and updated model strings. |
| pyproject.toml | Updated dependency versions for ragas and added new dependencies. |
Comments suppressed due to low confidence (1)
src/app/services/abst_chat.py:595
- The print statement in the chat_schema function may be left over from debugging. Consider replacing it with a logging statement or removing it to avoid unintended console output in production.
print(completion)
sandragjacinto
approved these changes
May 5, 2025
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
In order to evaluate future evolutions (choice of new LLM, hybrid search feature in Qdrant...), we needed to update the RAG metrics script.
Why?
Ragas library evolved quite a lot, so we had to update the metrics script to reflect those changes. Moreover, we decided to focus on metrics which don't need groundtruth data, as the way we synthesized them the first time may be not relevant for our current usecase. Finally, we added an option in the script to compute RAG metrics without context (i.e. when the LLM doesn't get resources from WeLearn database).
How?
Five RAG metrics are computed now:
The script is launched through the command line
python rag-metrics.py. Three options can be added:--all_corpusto aggregate WeLearn resources by language and provide one context only (per language) to the LLM--rerankingto rerank WeLearn resources in order to improve diversity--vanillato compute RAG metrics without any context (i.e. WeLearn resources) for the LLMTypes of changes
Checklist: