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

fix(testset): Ensure each document is used only once for question gen… #880

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ragas/llms/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from dataclasses import dataclass
from functools import partial

from langchain_community.chat_models import ChatVertexAI
from langchain_community.chat_models.vertexai import ChatVertexAI
from langchain_community.llms import VertexAI
from langchain_core.language_models import BaseLanguageModel
from langchain_core.outputs import LLMResult
Expand Down
8 changes: 6 additions & 2 deletions src/ragas/testset/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,19 @@ def generate(
for n in self.docstore.get_random_nodes(k=test_size)
]
total_evolutions = 0
start_index = 0
for evolution, probability in distributions.items():
for i in range(round(probability * test_size)):
end_index = start_index + round(probability * test_size)
for i in range(start_index, end_index):
exec.submit(
evolution.evolve,
current_nodes[i],
name=f"{evolution.__class__.__name__}-{i}",
)
total_evolutions += 1
if total_evolutions <= test_size:
start_index = end_index

if total_evolutions < test_size:
filler_evolutions = choices(
list(distributions), k=test_size - total_evolutions
)
Expand Down
Loading