Skip to contents

Reads each <request>.md in answers (the AI's whole answer to the request of the same name, tfl_ai_write_requests()), checks it against its request (tfl_ai_parse(), tfl_ai_check()) and, when it has no error, writes its report files (tfl_ai_unpack()). An answer with errors writes no file: its repair prompt (tfl_ai_repair_prompt()) goes to repairs, to paste into the same chat; save the new answer over the old and collect again.

Usage

tfl_ai_collect_answers(
  study_dir,
  requests = file.path("ai", "requests"),
  answers = file.path("ai", "answers"),
  repairs = file.path("ai", "repairs"),
  overwrite = TRUE
)

Arguments

study_dir

The study folder.

requests, answers, repairs

The folders, under study_dir.

overwrite

TRUE (default) to write over report files already there: an answer collected again replaces its reports.

Value

A data frame, one row a report: request, output_id, status (ok, warning, error, no answer), problems (how many), first (the first problem). Its print is a summary: each request's status, its reports and the next step.

Details

An answer is read as UTF-8, with or without the byte-order mark Windows Notepad writes, and with any line ends; an answer saved in another encoding (Shift-JIS / CP932, "ANSI") is an error that says how to save it again. An answer saved as <request>.md.txt or <request>.txt (Notepad adds .txt) is read too.