From 90477702585eb981b31eeefc6765678c7cf06f14 Mon Sep 17 00:00:00 2001 From: Edgar Ruiz Date: Mon, 29 Jul 2024 09:19:54 -0500 Subject: [PATCH 1/3] Version bump --- DESCRIPTION | 2 +- NEWS.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4a2d63d..51a97ab 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: chattr Title: Interact with Large Language Models in 'RStudio' -Version: 0.1.0.9006 +Version: 0.2.0 Authors@R: c( person("Edgar", "Ruiz", , "edgar@posit.co", role = c("aut", "cre")), person(given = "Posit Software, PBC", role = c("cph", "fnd")) diff --git a/NEWS.md b/NEWS.md index a41640b..45f5e65 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# chattr (dev) +# chattr 0.2.0 ## General From 3ea8f7b00c399d64a196196fae827f4b511d959f Mon Sep 17 00:00:00 2001 From: Edgar Ruiz Date: Mon, 29 Jul 2024 09:29:02 -0500 Subject: [PATCH 2/3] Updates CRAN comments --- cran-comments.md | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/cran-comments.md b/cran-comments.md index c086e13..e176b66 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,24 +1,30 @@ -## New package re-submission +## Pakcage Submission -Addresses CRAN comments +* Fixes how it identifies the user's current UI (console, app, notebook) and +appropriately outputs the response from the model end-point (#92) -Original: +* Adding support for Databricks foundation model API (DBRX, Meta Llama 3 70B, +Mixtral 8x7B) (#99) -This is a new package submission. Enables user interactivity with large-language -models ('LLM') inside the 'RStudio' integrated development environment ('IDE'). -The user can interact with the model using the 'Shiny' app included in this -package, or directly in the 'R' console. It comes with back-ends for 'OpenAI', -'GitHub' 'Copilot', and 'LlamaGPT'. +* Fixes how it displays error from the model end-point when being used in a +notebook or the app for OpenAI + +* Fixes how the errors from OpenAI are parsed and processed. This should make +it easier for users to determine where an downstream issue could be. + +* Adds `model` to defaults for Copilot + +* Improves Copilot token discovery ## R CMD check environments -- Mac OS M3 (aarch64-apple-darwin23), R 4.3.3 (Local) +- Mac OS M3 (aarch64-apple-darwin23), R 4.4.1 (Local) -- Mac OS x86_64-apple-darwin20.0 (64-bit), R 4.3.3 (GH Actions) -- Windows x86_64-w64-mingw32 (64-bit), R 4.3.3 (GH Actions) -- Linux x86_64-pc-linux-gnu (64-bit), R 4.3.3 (GH Actions) -- Linux x86_64-pc-linux-gnu (64-bit), R 4.4.0 (dev) (GH Actions) -- Linux x86_64-pc-linux-gnu (64-bit), R 4.2.3 (old release) (GH Actions) +- Mac OS x86_64-apple-darwin20.0 (64-bit), R 4.4.1 (GH Actions) +- Windows x86_64-w64-mingw32 (64-bit), R 4.4.1 (GH Actions) +- Linux x86_64-pc-linux-gnu (64-bit), R 4.4.1 (GH Actions) +- Linux x86_64-pc-linux-gnu (64-bit), (dev) (GH Actions) +- Linux x86_64-pc-linux-gnu (64-bit), R 4.3.3 (old release) (GH Actions) ## R CMD check results From 7a22cc1d86f5e8ed8eb678df39a861dca0c02dc1 Mon Sep 17 00:00:00 2001 From: Edgar Ruiz Date: Mon, 29 Jul 2024 09:30:00 -0500 Subject: [PATCH 3/3] styler updates --- R/backend-databricks.R | 4 ++-- R/backend-openai.R | 3 +-- R/ch-r.R | 2 +- R/chattr-defaults.R | 1 - R/chattr.R | 2 +- tests/testthat/test-chattr-use.R | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/R/backend-databricks.R b/R/backend-databricks.R index 132fef7..7300a40 100644 --- a/R/backend-databricks.R +++ b/R/backend-databricks.R @@ -34,9 +34,9 @@ ch_databricks_complete <- function(prompt, defaults, stream = TRUE) { host <- ch_databricks_host(defaults) host_url <- url_parse(host) - if(is.null(host_url$scheme)) host_url$scheme <- "https" + if (is.null(host_url$scheme)) host_url$scheme <- "https" - user_agent <-paste0("chattr/", utils::packageVersion('chattr')) + user_agent <- paste0("chattr/", utils::packageVersion("chattr")) req_result <- host_url %>% url_build() %>% diff --git a/R/backend-openai.R b/R/backend-openai.R index 7876bbc..4b64f3c 100644 --- a/R/backend-openai.R +++ b/R/backend-openai.R @@ -201,12 +201,11 @@ ch_openai_error <- function(x, use_abort = TRUE) { "Error from OpenAI\n", substr(x, 10, nchar(x)) ) - if(use_abort) { + if (use_abort) { abort(error_msg) } else { cli_alert_warning(error_msg) } - } invisible() } diff --git a/R/ch-r.R b/R/ch-r.R index 6555193..c4cd8e6 100644 --- a/R/ch-r.R +++ b/R/ch-r.R @@ -49,7 +49,7 @@ ch_r_error <- function() { err <- ch_env$r_session$read_error() if (err != "") { error_marker <- "! {error}" - if(substr(err, 1, nchar(error_marker)) == error_marker) { + if (substr(err, 1, nchar(error_marker)) == error_marker) { err <- substr(err, nchar(error_marker) + 1, nchar(err)) } out <- err diff --git a/R/chattr-defaults.R b/R/chattr-defaults.R index 6bf3dd8..78eb89b 100644 --- a/R/chattr-defaults.R +++ b/R/chattr-defaults.R @@ -68,7 +68,6 @@ chattr_defaults <- function(type = "default", type <- "console" } else { type <- ui_current() - } } diff --git a/R/chattr.R b/R/chattr.R index b8f1ec2..d4825e4 100644 --- a/R/chattr.R +++ b/R/chattr.R @@ -43,7 +43,7 @@ chattr <- function(prompt = NULL, while (ch_r_state() == "busy") { curr_text <- ch_r_output() ret <- c(ret, curr_text) - if(ui_current() == "markdown") { + if (ui_current() == "markdown") { cat(curr_text) } else { ide_paste_text(curr_text) diff --git a/tests/testthat/test-chattr-use.R b/tests/testthat/test-chattr-use.R index 0c98c7f..5f780d7 100644 --- a/tests/testthat/test-chattr-use.R +++ b/tests/testthat/test-chattr-use.R @@ -20,7 +20,7 @@ test_that("Menu works", { return(1) } ) - print(ch_get_ymls(menu = TRUE) ) + print(ch_get_ymls(menu = TRUE)) expect_true( ch_get_ymls(menu = TRUE) %in% c("gpt35", "gpt4", "gpt4o") )