From f52efa0e40a59fc5b817ee792d079dd2f722071f Mon Sep 17 00:00:00 2001 From: Romain Francois Date: Sat, 30 Mar 2024 18:35:59 +0100 Subject: [PATCH] Less dry_run --- R/chat.R | 4 ++-- R/models.R | 8 ++------ R/stream.R | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/R/chat.R b/R/chat.R index c29a85e..b51805c 100644 --- a/R/chat.R +++ b/R/chat.R @@ -16,7 +16,7 @@ chat <- function(messages, model = "mistral-tiny", dry_run = FALSE, ..., error_call = current_env()) { check_dots_empty() - req <- req_chat(messages, model = model, error_call = error_call, dry_run = dry_run) + req <- req_chat(messages, model = model, error_call = error_call) if (is_true(dry_run)) { return(req) } @@ -31,7 +31,7 @@ print.chat <- function(x, ...) { invisible(x) } -req_chat <- function(messages, model = "mistral-tiny", stream = FALSE, dry_run = FALSE, ..., error_call = caller_env()) { +req_chat <- function(messages, model = "mistral-tiny", stream = FALSE, ..., error_call = caller_env()) { check_dots_empty() check_scalar_string(model, error_call = error_call) diff --git a/R/models.R b/R/models.R index 7455f4c..e9b134d 100644 --- a/R/models.R +++ b/R/models.R @@ -5,10 +5,10 @@ #' @return A character vector with the models available in the Mistral API #' #' @examples -#' models(dry_run = TRUE) +#' models() #' #' @export -models <- function(error_call = caller_env(), dry_run = FALSE) { +models <- function(error_call = caller_env()) { req <- request(mistral_base_url) |> req_url_path_append("v1", "models") |> authenticate() |> @@ -16,10 +16,6 @@ models <- function(error_call = caller_env(), dry_run = FALSE) { use_on_error = TRUE, max_age = 2 * 60 * 60) # 2 hours - if (is_true(dry_run)) { - return(req) - } - req_mistral_perform(req, error_call = error_call) |> resp_body_json(simplifyVector = TRUE) |> pluck("data","id") diff --git a/R/stream.R b/R/stream.R index 5180e49..d99228c 100644 --- a/R/stream.R +++ b/R/stream.R @@ -7,7 +7,7 @@ stream <- function(messages, model = "mistral-tiny", dry_run = FALSE, ..., error check_dots_empty(call = error_call) messages <- as_messages(messages) - req <- req_chat(messages, model, stream = TRUE, error_call = error_call, dry_run = dry_run) + req <- req_chat(messages, model, stream = TRUE, error_call = error_call) if (is_true(dry_run)) { return(req) }