blob: 15269a7352d042a20a224ab055690a29f2c4c867 [file] [log] [blame]
ben-aaron1883818e7c2022-09-08 17:49:01 +02001#' Make a test request to the GPT-3 API
2#'
3#' @description
4#' `gpt3.test_request()` sends a basic [completion request](https://beta.openai.com/docs/api-reference/completions) to the Open AI GPT-3 API.
5#' @param verbose (boolean) if TRUE prints the actual prompt and GPT-3 completion of the test request (default: FALSE).
6#' @return A message of success or failure of the connection.
7#' @examples
8#' gpt3.test_request()
9#' @export
10gpt3.test_request = function(verbose=F){
11
12 check_apikey_form()
13
14 test_prompt = 'Write a story about R Studio:'
15 test_outout = gpt3.make_request(prompt_ = test_prompt
16 , max_tokens = 100)
17 print(paste0('.. test successful ..'))
18
19 if(verbose==T){
20 print(paste0('Requested completion for this prompt --> ', test_prompt))
21 print(paste0('GPT-3 completed --> ', test_outout))
22 }
23
24}