Skip to content

Commit 16cf5d7

Browse files
authored
fix: remove experimental filters (#743)
fixes: #742
1 parent 7ba0c28 commit 16cf5d7

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

src/ragas/testset/filters.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,6 @@
2222
logger = logging.getLogger(__name__)
2323

2424

25-
def patch_save_json(data, filename):
26-
import json
27-
import os
28-
29-
path = f"/Users/shahules/Myprojects/ragas/experiments/{filename}.json"
30-
if os.path.exists(path):
31-
database = json.load(open(path))
32-
database = database if isinstance(database, list) else [database]
33-
database.append(data)
34-
else:
35-
database = [data]
36-
with open(path, "w") as f:
37-
json.dump(database, f, indent=4)
38-
39-
4025
@dataclass
4126
class Filter(ABC):
4227
llm: BaseRagasLLM
@@ -71,8 +56,6 @@ async def filter(self, node: Node) -> t.Dict:
7156
score = await json_loader.safe_load(output, llm=self.llm)
7257
score = score if isinstance(score, dict) else {}
7358
logger.debug("node filter: %s", score)
74-
score.update({"context": node.page_content})
75-
patch_save_json(score, "node_filter")
7659
score.update({"score": score.get("score", 0) >= self.threshold})
7760
return score
7861

@@ -104,8 +87,6 @@ async def filter(self, question: str) -> t.Tuple[bool, str]:
10487
results = results.generations[0][0].text.strip()
10588
json_results = await json_loader.safe_load(results, llm=self.llm)
10689
json_results = json_results if isinstance(json_results, dict) else {}
107-
json_results.update({"question": question})
108-
patch_save_json(json_results, "question_filter")
10990
logger.debug("filtered question: %s", json_results)
11091
return json_results.get("verdict") == "1", json_results.get("feedback", "")
11192

@@ -139,8 +120,6 @@ async def filter(self, simple_question: str, compressed_question: str) -> bool:
139120
results = results.generations[0][0].text.strip()
140121
json_results = await json_loader.safe_load(results, llm=self.llm)
141122
json_results = json_results if isinstance(json_results, dict) else {}
142-
json_results.update({"questions": [simple_question, compressed_question]})
143-
patch_save_json(json_results, "evolution_filter")
144123
logger.debug("evolution filter: %s", json_results)
145124
return json_results.get("verdict") == "1"
146125

0 commit comments

Comments
 (0)