Skip to content

Commit 58229ea

Browse files
committed
.
1 parent fd43316 commit 58229ea

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

deepeval/synthesizer/synthesizer.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,15 @@ def _merge_cross_file_contexts(
205205
)
206206

207207
for idx, current in enumerate(contexts_with_sources):
208-
target_count = (
209-
max_available_files
210-
if target_files_per_context is None
211-
else min(target_files_per_context, max_available_files)
212-
)
208+
if target_files_per_context is None:
209+
# Random cap avoids merging every distinct file (which blows up context).
210+
target_count = (
211+
random.randint(2, max_available_files)
212+
if max_available_files >= 2
213+
else 1
214+
)
215+
else:
216+
target_count = min(target_files_per_context, max_available_files)
213217
chosen_indices: List[int] = []
214218
candidate_scores: List[Tuple[int, float]] = []
215219
for candidate_idx, candidate in enumerate(contexts_with_sources):

0 commit comments

Comments
 (0)