Skip to content
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: Update Ragas integration #1312

Merged
merged 9 commits into from
Jan 28, 2025

Conversation

sahusiddharth
Copy link
Contributor

Added RagasEvaluator component for Ragas version 0.2. support*

This update introduces the new RagasEvaluator component, designed to be fully compatible with Ragas version 0.2.*. The component integrates with the latest changes and enhancements in the Ragas framework.

@github-actions github-actions bot added integration:ragas type:documentation Improvements or additions to documentation labels Jan 21, 2025
@sahusiddharth sahusiddharth marked this pull request as ready for review January 22, 2025 05:47
@sahusiddharth sahusiddharth requested a review from a team as a code owner January 22, 2025 05:47
@sahusiddharth sahusiddharth requested review from davidsbatista and removed request for a team January 22, 2025 05:47
@sahusiddharth
Copy link
Contributor Author

Hi @davidsbatista,

The test cases are failing in Python 3.9 due to a regex mismatch, although they are passing in Python 3.10. Could you please advise on the best way to proceed?

@julian-risch julian-risch self-requested a review January 22, 2025 08:40
Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

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

Hello @sahusiddharth and thank you for opening this pull request! I left a few comments, just smaller change requests. Regarding the failing test, I have an idea what's happening here. The regex and the output don't match for Python 3.9 because type(expected_type) outputs typing.Dict, which is not the same as Dict. In Python 3.10+, type(expected_type) outputs dict. typing.Dict[str, str] is just making it even more complex. (see https://peps.python.org/pep-0585/)

Regex: "The 'rubrics' field expected 'one of Dict, NoneType', but got 'list'."
E Input: "Validation error occured while running RagasEvaluator Component:\nThe 'rubrics' field expected 'one of typing.Dict[str, str], NoneType', but got 'list'.\nHint: Provide {'score1': 'high_similarity'}"

This regex matching of the message is anyway error-prone and we should make the test more robust. Let's not try to match the exact error message with a regex.

evaluation_dataset = EvaluationDataset.from_list(evals_list)

llm = ChatOpenAI(model="gpt-4o-mini")
evaluator_llm = LangchainLLMWrapper(llm)
Copy link
Member

Choose a reason for hiding this comment

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

I guess we could think about a HaystackLLMWrapper? What do you think? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We use Langchain wrappers underneath to handle the evaluations, so if we move forward with Haystack, we might need to implement similar functionality ourselves or at least ensure the integration aligns with the existing workflow.

But we can definitely explore this further if you think it’s worth the effort!

integrations/ragas/pydoc/config.yml Outdated Show resolved Hide resolved
Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thank you for addressing the review comments so quickly. I will take care of releasing a new version of the integration now. Feel free to open a PR that edits the example code in this file to update this overview page: https://haystack.deepset.ai/integrations/ragas

And yes, let's explore a HaystackLLMWrapper!

@julian-risch julian-risch merged commit ee1eb91 into deepset-ai:main Jan 28, 2025
11 checks passed
@sahusiddharth
Copy link
Contributor Author

I’m currently working on the code example and will raise a PR for it shortly. I’ll keep you updated once it’s ready!

@sahusiddharth
Copy link
Contributor Author

Hi @julian-risch,

I’ve raised the PR for the code example. Could you please take a look when you have a moment and let me know your thoughts?

jjmachan pushed a commit to explodinggradients/ragas that referenced this pull request Jan 30, 2025
@sahusiddharth sahusiddharth deleted the ragas_integration branch February 1, 2025 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration:ragas type:documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants