From 6488ac824c685922341b4446fea88d05930ea54a Mon Sep 17 00:00:00 2001 From: Anatoliy Sokolov Date: Tue, 17 Dec 2024 11:45:43 -0500 Subject: [PATCH] linting --- R/cache.R | 2 +- R/service-azure_openai.R | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/cache.R b/R/cache.R index 5989c64..8d36758 100644 --- a/R/cache.R +++ b/R/cache.R @@ -1,5 +1,5 @@ #' a function that determines the appropriate directory to cache a token #' @export -gptstudio_cache_directory = function(){ +gptstudio_cache_directory <- function() { tools::R_user_dir(package = "gptstudio") } diff --git a/R/service-azure_openai.R b/R/service-azure_openai.R index 7c73ae5..035d925 100644 --- a/R/service-azure_openai.R +++ b/R/service-azure_openai.R @@ -119,7 +119,7 @@ retrieve_azure_token_object <- function() { rlang::check_installed("AzureGraph") ## Set this so that get_graph_login properly caches - azure_data_env = Sys.getenv("R_AZURE_DATA_DIR") + azure_data_env <- Sys.getenv("R_AZURE_DATA_DIR") Sys.setenv("R_AZURE_DATA_DIR" = gptstudio_cache_directory()) @@ -127,12 +127,15 @@ retrieve_azure_token_object <- function() { app = Sys.getenv("AZURE_OPENAI_CLIENT_ID"), scopes = NULL, refresh = FALSE), - silent=TRUE) |> + silent = TRUE) |> suppressMessages() - if(inherits(login, "try-error")) { + if (inherits(login, "try-error")) { - if(!dir.exists(gptstudio_cache_directory())) dir.create(gptstudio_cache_directory()) |> suppressWarnings() + if (!dir.exists(gptstudio_cache_directory())) { + dir.create(gptstudio_cache_directory()) |> + suppressWarnings() + } login <- AzureGraph::create_graph_login(tenant = Sys.getenv("AZURE_OPENAI_TENANT_ID"), @@ -173,8 +176,5 @@ stream_azure_openai <- function(messages = list(list(role = "user", content = "h }, round = "line" ) - invisible(response) } - -