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

ModuleNotFoundError: No module named 'ragas.testset.generator' #1842

Open
ParthP8399 opened this issue Jan 13, 2025 · 6 comments
Open

ModuleNotFoundError: No module named 'ragas.testset.generator' #1842

ParthP8399 opened this issue Jan 13, 2025 · 6 comments
Labels
answered 🤖 The question has been answered. Will be closed automatically if no new comments bug Something isn't working module-testsetgen Module testset generation

Comments

@ParthP8399
Copy link

[ ] I have checked the documentation and related resources and couldn't resolve my bug.

Describe the bug
I want to generate synthetic data through RAG and evaluate the RAG using the synthentic data generated

Ragas version: 0.2.10
Python version: 3.13.1

Code to Reproduce
import ragas
from ragas.testset.generator import TestsetGenerator
from ragas.testset.evolutions import simple, reasoning, multi_context

generator with openai models

generator = TestsetGenerator.with_openai(critic_llm = "gpt-4")

Change resulting question type distribution

distributions = {
simple: 0.3,
multi_context: 0.2,
reasoning: 0.5
}

testset = generator.generate_with_langchain_docs(pages, 10, distributions)
testset.to_pandas()

Error trace
I am getting this error whenever i try to import the module. ModuleNotFoundError: No module named 'ragas.testset.generator'

@ParthP8399 ParthP8399 added the bug Something isn't working label Jan 13, 2025
@dosubot dosubot bot added module-testsetgen Module testset generation labels Jan 13, 2025
@ParthP8399
Copy link
Author

@dosu
why don't you give me the answer?

Copy link

dosubot bot commented Jan 13, 2025

I found a similar closed issue regarding the error "ModuleNotFoundError: No module named 'ragas.testset'; 'ragas' is not a package" [1]. However, no solution was found in the comments of that issue.

For Ragas version 0.2.10, the correct import paths for generating synthetic data are:

from ragas.testset.generator import TestsetGenerator
from ragas.testset.evolutions import simple, reasoning, multi_context

If you are still encountering the error, it might be worth checking if the module has been moved or renamed in recent versions, or if there are any issues with your installation of the Ragas package. Additionally, ensure that your Python environment is correctly set up and that the Ragas package is properly installed.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@Vidit-Ostwal
Copy link
Contributor

I think there is some error with the documentation, ideally this should be more like

from ragas.testset import TestsetGenerator
from ragas.testset import Testset, TestsetSample

Try this, this should work with your

ragas version == 0.2.10

Maybe another issue can be raised for the documentation error

@Vidit-Ostwal
Copy link
Contributor

@dosu What do you think?

@jjmachan
Copy link
Member

thanks a lot for helping out @Vidit-Ostwal 🙌🏽
@ParthP8399 hope it is resolved now?

@jjmachan jjmachan added the answered 🤖 The question has been answered. Will be closed automatically if no new comments label Jan 22, 2025
Copy link

dosubot bot commented Jan 22, 2025

Yes, for Ragas version 0.2.10, the correct import paths are indeed:

from ragas.testset import TestsetGenerator
from ragas.testset import Testset, TestsetSample

This is confirmed by the __init__.py file in the ragas.testset module, which makes these classes available for import from ragas.testset [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered 🤖 The question has been answered. Will be closed automatically if no new comments bug Something isn't working module-testsetgen Module testset generation
Projects
None yet
Development

No branches or pull requests

3 participants