Skip to content

Progress is stuck (or maybe too long) for generate_with_langchain_docs !!! #2142

@noaft

Description

@noaft

🚨 Bug Report: progress is stuck (or maybe too long) for generate_with_langchain_docs

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

📄 Describe the bug

The execution of generate_with_langchain_docs() is stuck at 50% with no progress for over an hour. No error is thrown, and CPU usage is minimal. It seems like the generation process either hangs or is too long for practical usage.


🐍 Python version

Python 3.132.2

💻 Ragas version

Ragas 0.3.0


📌 Code to Reproduce

from ragas.testset import TestsetGenerator
from pandas import DataFrame, concat
from PDF_load.pdf_loader import get_content
from LLM.settings import generator_llm, generator_embeddings
import pathlib
import asyncio

# Load PDF content
docs = get_content()

# Create generator
generator = TestsetGenerator(
    llm=generator_llm, embedding_model=generator_embeddings
)

output_dir = pathlib.Path("Output")
output_dir.mkdir(exist_ok=True)

async def run():
    docs = get_content()
    for item in docs:
        file_name = item.get("file_name")
        doc = item.get("doc")

        dataset = generator.generate_with_langchain_docs(doc, testset_size=10)
        df = dataset.to_pandas()

        output_path = output_dir / f"{file_name.split('.')[0]}.csv"
        df.to_csv(output_path, index=False)

asyncio.run(run())

Generating Scenarios: 50%|████████████████ | 1/2 [27:14<27:14, 1634.71s/it]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmodule-testsetgenModule testset generation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions