Spaces:
Running
Running
File size: 624 Bytes
e42fcaf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import csv
from datetime import datetime
def log_interaction(goal, sol1, sol2, evo, gpt, correct=None, source="user"):
row = {
"timestamp": datetime.utcnow().isoformat(),
"goal": goal,
"solution_1": sol1,
"solution_2": sol2,
"evo_answer": evo,
"gpt_answer": gpt,
"correct_answer": correct if correct else gpt,
"source": source
}
with open("evo_feedback_log.csv", mode="a", newline="") as file:
writer = csv.DictWriter(file, fieldnames=row.keys())
if file.tell() == 0:
writer.writeheader()
writer.writerow(row)
|