library(jsonlite)

read_json_lines <- function(file){
  con <- file(file, open = "r")
  on.exit(close(con))
  jsonlite::stream_in(con, verbose = FALSE)
}

read_jsonl <- function(file) {
  read_json_lines(file) %>%
    as_tibble()
}


read_jsonl("~/projects/comps/data/results/mini_comps_base_text-davinci-003_results.jsonl") %>%
  filter(acceptable_score > unacceptable_score)
