Spaces:
Sleeping
Sleeping
Commit ·
9123c8c
1
Parent(s): 74813e5
removed similarity step
Browse files
uw_programmatic/uw_machine.py
CHANGED
|
@@ -26,8 +26,6 @@ class UWMachine(UWBaseMachine):
|
|
| 26 |
"""Starts the machine."""
|
| 27 |
# Clear input history.
|
| 28 |
# Clear csv file
|
| 29 |
-
with Path(Path.cwd().joinpath("outputs/similarity_step.csv")).open("w") as file:
|
| 30 |
-
file.write("")
|
| 31 |
self.send("enter_first_state")
|
| 32 |
|
| 33 |
def on_event_gather_parameters(self, event_: dict) -> None:
|
|
@@ -85,21 +83,6 @@ class UWMachine(UWBaseMachine):
|
|
| 85 |
def on_enter_assess_generated_q(self) -> None:
|
| 86 |
# TODO: Should it append it to the list already and remove duplicates? or not?
|
| 87 |
# TODO: Merge incoming lists
|
| 88 |
-
with Path(Path.cwd().joinpath("outputs/similarity_step.csv")).open(
|
| 89 |
-
"a", newline=""
|
| 90 |
-
) as file:
|
| 91 |
-
writer = csv.DictWriter(
|
| 92 |
-
file,
|
| 93 |
-
fieldnames=[
|
| 94 |
-
"Question",
|
| 95 |
-
"Answer",
|
| 96 |
-
"Wrong Answers",
|
| 97 |
-
"Page",
|
| 98 |
-
"Taxonomy",
|
| 99 |
-
],
|
| 100 |
-
)
|
| 101 |
-
writer.writerow({"Question": "LIST OF QUESTIONS GENERATED THIS ROUND"})
|
| 102 |
-
writer.writerows(self.most_recent_questions)
|
| 103 |
merged_list = [*self.question_list, *self.most_recent_questions]
|
| 104 |
prompt = f"{merged_list}"
|
| 105 |
self.get_structure("similarity_auditor").run(prompt)
|
|
@@ -136,26 +119,6 @@ class UWMachine(UWBaseMachine):
|
|
| 136 |
for question2 in new_question_list
|
| 137 |
)
|
| 138 |
]
|
| 139 |
-
with Path(
|
| 140 |
-
Path.cwd().joinpath("outputs/similarity_step.csv")
|
| 141 |
-
).open("a", newline="") as file:
|
| 142 |
-
writer = csv.DictWriter(
|
| 143 |
-
file,
|
| 144 |
-
fieldnames=[
|
| 145 |
-
"Question",
|
| 146 |
-
"Answer",
|
| 147 |
-
"Wrong Answers",
|
| 148 |
-
"Page",
|
| 149 |
-
"Taxonomy",
|
| 150 |
-
],
|
| 151 |
-
)
|
| 152 |
-
writer.writerow(
|
| 153 |
-
{"Question": "QUESTIONS REMOVED THIS ROUND!"}
|
| 154 |
-
)
|
| 155 |
-
if len(deleted_q):
|
| 156 |
-
writer.writerows(deleted_q)
|
| 157 |
-
else:
|
| 158 |
-
writer.writerow({"Question": "No q removed"})
|
| 159 |
self.question_list = new_question_list
|
| 160 |
self.send("next_state") # move on
|
| 161 |
|
|
|
|
| 26 |
"""Starts the machine."""
|
| 27 |
# Clear input history.
|
| 28 |
# Clear csv file
|
|
|
|
|
|
|
| 29 |
self.send("enter_first_state")
|
| 30 |
|
| 31 |
def on_event_gather_parameters(self, event_: dict) -> None:
|
|
|
|
| 83 |
def on_enter_assess_generated_q(self) -> None:
|
| 84 |
# TODO: Should it append it to the list already and remove duplicates? or not?
|
| 85 |
# TODO: Merge incoming lists
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
merged_list = [*self.question_list, *self.most_recent_questions]
|
| 87 |
prompt = f"{merged_list}"
|
| 88 |
self.get_structure("similarity_auditor").run(prompt)
|
|
|
|
| 119 |
for question2 in new_question_list
|
| 120 |
)
|
| 121 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
self.question_list = new_question_list
|
| 123 |
self.send("next_state") # move on
|
| 124 |
|