changes method for API key retrieval
diff --git a/NAMESPACE b/NAMESPACE
index d8580fc..1d7cf39 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand
export(gpt3.authenticate)
+export(gpt3.make_request)
export(gpt3.test_request)
export(url.completions)
diff --git a/R/authenticate.R b/R/authenticate.R
index e896cec..c6a3a69 100644
--- a/R/authenticate.R
+++ b/R/authenticate.R
@@ -2,8 +2,9 @@
#'
#' @description
#' Access to GPT-3's functions requires an API key that you obtain from [https://openai.com/api/](https://openai.com/api/). `gpt3.authenticate()` accepts your API key and ensures that you can connect to the models. `gpt3.endsession()` overwrites your API key _for this session_ (it is recommended that you run this when you are done). `check_apikey_form()` is a simple check if any information has been provided at all.
-#' @param apikey A character vector that is your personal API key
+#' @param path The file path to the API key
#' @return A confirmation message
+#' @details The easiest way to store you API key is in a `.txt` file with _only_ the API key in it (without quotation marks or other common string indicators). `gpt3.authenticate()` reads the single file you point it to and retrieves the content as authentication key for all requests.
#' @examples
#' # Starting a session:
#' gpt3.authenticate(apikey = 'REPLACE_THIS_WITH_YOUR_KEY')
@@ -11,8 +12,9 @@
#' # After you are finished:
#' gpt3.endsession()
#' @export
-gpt3.authenticate = function(apikey){
- api_key <<- apikey
+gpt3.authenticate = function(path){
+ apikey_ = readLines(path)
+ api_key <<- apikey_
print(paste0("Will use --> ", api_key, " for authentication."))
}
diff --git a/man/gpt3.authenticate.Rd b/man/gpt3.authenticate.Rd
index b8c519d..d8751ad 100644
--- a/man/gpt3.authenticate.Rd
+++ b/man/gpt3.authenticate.Rd
@@ -4,10 +4,10 @@
\alias{gpt3.authenticate}
\title{Set up the authentication with your API key}
\usage{
-gpt3.authenticate(apikey)
+gpt3.authenticate(path)
}
\arguments{
-\item{apikey}{A character vector that is your personal API key}
+\item{path}{The file path to the API key}
}
\value{
A confirmation message
@@ -15,6 +15,9 @@
\description{
Access to GPT-3's functions requires an API key that you obtain from \url{https://openai.com/api/}. \code{gpt3.authenticate()} accepts your API key and ensures that you can connect to the models. \code{gpt3.endsession()} overwrites your API key \emph{for this session} (it is recommended that you run this when you are done). \code{check_apikey_form()} is a simple check if any information has been provided at all.
}
+\details{
+The easiest way to store you API key is in a \code{.txt} file with \emph{only} the API key in it (without quotation marks or other common string indicators). \code{gpt3.authenticate()} reads the single file you point it to and retrieves the content as authentication key for all requests.
+}
\examples{
# Starting a session:
gpt3.authenticate(apikey = 'REPLACE_THIS_WITH_YOUR_KEY')
diff --git a/man/gpt3.make_request.Rd b/man/gpt3.make_request.Rd
new file mode 100644
index 0000000..dcdff54
--- /dev/null
+++ b/man/gpt3.make_request.Rd
@@ -0,0 +1,37 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/make_request.R
+\name{gpt3.make_request}
+\alias{gpt3.make_request}
+\title{Make a test request to the GPT-3 API}
+\usage{
+gpt3.make_request(
+ prompt_,
+ model_ = "text-davinci-002",
+ output_type_ = "string_only",
+ suffix_ = NULL,
+ max_tokens_ = 256,
+ temperature_ = 0.9,
+ top_p_ = 1,
+ n_ = 1,
+ stream_ = F,
+ logprobs_ = NULL,
+ echo_ = F,
+ stop_ = NULL,
+ presence_penalty_ = 0,
+ frequency_penalty_ = 0,
+ best_of_ = 1,
+ logit_bias_ = NULL
+)
+}
+\arguments{
+\item{verbose}{(boolean) if TRUE prints the actual prompt and GPT-3 completion of the test request (default: FALSE).}
+}
+\value{
+A message of success or failure of the connection.
+}
+\description{
+\code{gpt3.test_request()} sends a basic \href{https://beta.openai.com/docs/api-reference/completions}{completion request} to the Open AI GPT-3 API.
+}
+\examples{
+gpt3.test_request()
+}