From 54e9f4db7056d7b2cd95e44fb0098354d8eabef4 Mon Sep 17 00:00:00 2001 From: Shahul ES Date: Tue, 21 May 2024 16:49:52 +0530 Subject: [PATCH] fix: patch type issue in evolution parsing (#980) fixes: #900 --- src/ragas/testset/evolutions.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ragas/testset/evolutions.py b/src/ragas/testset/evolutions.py index f7feb761b..54bea450a 100644 --- a/src/ragas/testset/evolutions.py +++ b/src/ragas/testset/evolutions.py @@ -202,7 +202,13 @@ async def generate_datarow( if isinstance(relevant_contexts_result, dict) else None ) - if relevant_context_indices is None: + + if relevant_context_indices is not None: + relevant_context_indices = [ + idx for idx in relevant_context_indices if isinstance(idx, int) + ] + + if relevant_context_indices is None or not relevant_context_indices: relevant_context = CurrentNodes( root_node=current_nodes.root_node, nodes=current_nodes.nodes )