Skip to content

HTTP Error after mapping over some rows #8

@rawuph

Description

@rawuph

I get a reproducible error where a fresh R session works for something like this as long as its sufficiently few rows (<5)

run_chat <- function(call_string) {
  result <- call_string %c% "message"
  return(result)
}

results <- map(test_df$call_string, run_chat)

for larger datasets, i.e. n = 10, i get something like this, although the index at which it occurs varies

HTTP error : Bad Request
Error in map():
ℹ In index: 10.
Caused by error in messages():
! Invalid parameter value. Expecting list or chatlog object.

Backtrace:

  1. ├─purrr::map(test_production$call_string, run_chat)
  2. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
  3. │ ├─purrr:::with_indexed_errors(...)
  4. │ │ └─base::withCallingHandlers(...)
  5. │ ├─purrr:::call_with_cleanup(...)
  6. │ └─global .f(.x[[i]], ...)
  7. │ └─call_string %c% "message"
  8. │ └─TheOpenAIR::chat(message = message, output = output)
  9. │ └─resp %>% messages() %>% add_to_chatlog(chatlog_id)
  10. ├─TheOpenAIR::add_to_chatlog(., chatlog_id)
  11. │ └─base::is.data.frame(msgs)
  12. └─TheOpenAIR::messages(.)
  13. └─base::stop("Invalid parameter value. Expecting list or chatlog object.")

After this error occurred once, simply using the chat() function throws the same error, which is resolved when I restart the session.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions