"""Template for custom function or Pydantic model.""" import csv from pathlib import Path def record_interestingness(title: str, uninteresting: bool) -> str: """Label the interestingness of the entry. Args: title (str): The title of the entry to label. uninteresting (bool): Whether the entry is uninteresting. """ # Create result.csv if it doesn't exist result_file = Path("result.csv") file_exists = result_file.exists() with open(result_file, "a", newline="") as f: writer = csv.writer(f) # Write header if file is new if not file_exists: writer.writerow(["title", "uninteresting"]) # Write results writer.writerow([title, int(uninteresting)]) return "Entry labeled successfully."