View source: R/screen_errors.orginal.R
screen_errors.chatgpt | R Documentation |
This function supports re-screening of all failed title and abstract requests
screened with tabscreen_gpt.original()
. This function has been deprecated because
OpenAI has deprecated the function_call and and functions argument that was used
in tabscreen_gpt.original()
.
## S3 method for class 'chatgpt'
screen_errors(
object,
...,
api_key = get_api_key(),
max_tries = 4,
max_seconds,
is_transient,
backoff,
after
)
object |
An object of class |
... |
Further argument to pass to the request body.
See https://platform.openai.com/docs/api-reference/chat/create.
If used in the original screening (e.g., with |
api_key |
Numerical value with your personal API key. |
max_tries , max_seconds |
'Cap the maximum number of attempts with
|
is_transient |
'A predicate function that takes a single argument
(the response) and returns |
backoff |
'A function that takes a single argument (the number of failed
attempts so far) and returns the number of seconds to wait' (Wickham, 2023).
If missing, the |
after |
'A function that takes a single argument (the response) and
returns either a number of seconds to wait or |
Object of class 'chatgpt'
similar to the object returned by tabscreen_gpt.original()
.
See documentation value for tabscreen_gpt.original()
.
Wickham H (2023). httr2: Perform HTTP Requests and Process the Responses. https://httr2.r-lib.org, https://github.com/r-lib/httr2.
tabscreen_gpt.original()
## Not run:
set_api_key()
prompt <- "Is this study about a Functional Family Therapy (FFT) intervention?"
obj_with_error <-
tabscreen_gpt(
data = filges2015_dat[1:2,],
prompt = prompt,
studyid = studyid,
title = title,
abstract = abstract,
model = c("gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k-0613"),
max_tries = 1,
reps = 10
)
obj_rescreened <-
obj_with_error |>
screen_error()
# Alternatively re-set max_tries if errors still appear
obj_rescreened <-
obj_with_error |>
screen_error(max_tries = 16)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.