File size: 726 Bytes
80cdad4
 
 
 
 
bcf74f5
80cdad4
 
 
 
bcf74f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import csv
import os

LOG_FILE = "feedback_log.csv"

def log_feedback(question, option1, option2, context, evo_output, evo_was_correct):
    file_exists = os.path.isfile(LOG_FILE)
    with open(LOG_FILE, mode='a', newline='', encoding='utf-8') as file:
        writer = csv.writer(file)
        if not file_exists:
            writer.writerow([
                "question",
                "option1",
                "option2",
                "context",
                "evo_output",
                "evo_was_correct"
            ])
        writer.writerow([
            question,
            option1,
            option2,
            context,
            evo_output,
            "yes" if evo_was_correct else "no"
        ])