Skip to content

Commit cb62190

Browse files
authored
chore: add tracking for new testset generation (#1419)
1 parent 407c2e0 commit cb62190

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/ragas/_analytics.py

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class TestsetGenerationEvent(BaseEvent):
9797
num_rows: int
9898
language: str
9999
is_experiment: bool = False
100+
version: str = "3" # the version of testset generation pipeline
100101

101102

102103
@silent

src/ragas/testset/synthesizers/generate.py

+14
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import typing as t
55
from dataclasses import dataclass, field
66

7+
from ragas._analytics import TestsetGenerationEvent, track
78
from ragas.callbacks import new_group
89
from ragas.executor import Executor
910
from ragas.llms import BaseRagasLLM, LangchainLLMWrapper
@@ -202,4 +203,17 @@ def generate(
202203
testsets.append(TestsetSample(eval_sample=sample, **additional_info))
203204
testset = Testset(samples=testsets)
204205
testset_generation_rm.on_chain_end({"testset": testset})
206+
207+
# tracking how many samples were generated
208+
track(
209+
TestsetGenerationEvent(
210+
event_type="testset_generation",
211+
evolution_names=[
212+
e.__class__.__name__.lower() for e, _ in query_distribution
213+
],
214+
evolution_percentages=[p for _, p in query_distribution],
215+
num_rows=test_size,
216+
language="english",
217+
)
218+
)
205219
return testset

0 commit comments

Comments
 (0)