-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated default model to gpt-4o-mini
- Loading branch information
1 parent
10192e3
commit 335d505
Showing
6 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#' ChatGPT: List Models | ||
#' | ||
#' @param openai_api_key OpenAI's API key. | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' list_models() | ||
#' } | ||
#' | ||
#' @importFrom httr add_headers content GET stop_for_status | ||
#' @importFrom jsonlite fromJSON | ||
#' | ||
#' @return A data.frame with the available models to be used by OpenAI's API. | ||
#' | ||
#' @export | ||
#' | ||
list_models <- function(openai_api_key = Sys.getenv("OPENAI_API_KEY")) { | ||
get_res <- GET( | ||
paste0(api_url, "/models"), | ||
add_headers("Authorization" = paste("Bearer", openai_api_key)) | ||
) | ||
stop_for_status(get_res) | ||
fromJSON(content(get_res, as = "text", encoding = "UTF-8"))$data | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.