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: random sampling for eval #461

Closed
wants to merge 3 commits into from
Closed
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
4 changes: 3 additions & 1 deletion evals/eval_on_hotpot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
from evals.qa_dataset_utils import load_qa_dataset
from evals.qa_metrics_utils import get_metrics
from evals.qa_context_provider_utils import qa_context_providers, valid_pipeline_slices
import random

logger = logging.getLogger(__name__)
random.seed(42)


async def answer_qa_instance(instance, context_provider):
Expand Down Expand Up @@ -77,7 +79,7 @@ async def eval_on_QA_dataset(
dataset = load_qa_dataset(dataset_name_or_filename)
context_provider = qa_context_providers[context_provider_name]
eval_metrics = get_metrics(metric_name_list)
instances = dataset if not num_samples else dataset[:num_samples]
instances = dataset if not num_samples else random.sample(dataset, num_samples)
alekszievr marked this conversation as resolved.
Show resolved Hide resolved

if "promptfoo_metrics" in eval_metrics:
promptfoo_results = await eval_metrics["promptfoo_metrics"].measure(
Expand Down
Loading