Skip to content

Commit

Permalink
Adds example to chattr(), and a "test" option for chattr_use() and do…
Browse files Browse the repository at this point in the history
…cuments it
  • Loading branch information
edgararuiz committed Apr 3, 2024
1 parent b1307e6 commit 150b05c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
10 changes: 8 additions & 2 deletions R/chattr-use.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#' Sets the LLM model to use in your session
#' @param model_label The label of the LLM model to use. Valid values are
#' 'copilot', 'gpt4', 'gpt35', and 'llamagpt'.
#' 'copilot', 'gpt4', 'gpt35', and 'llamagpt'. The value 'test' is also
#' acceptable, but it is meant for package examples, and internal testin.
#' @details
#' If the error "No model setup found" was returned, that is because none of the
#' expected setup for Copilot, OpenIA or LLama was automatically detected. Here
Expand All @@ -27,7 +28,12 @@ chattr_use <- function(model_label = NULL) {
if (interactive_label) {
model_label <- ch_get_ymls()
}
use_switch("configs", path_ext_set(model_label, "yml"))
if (model_label == "test") {
env_folder <- "apptest"

Check warning on line 32 in R/chattr-use.R

View check run for this annotation

Codecov / codecov/patch

R/chattr-use.R#L32

Added line #L32 was not covered by tests
} else {
env_folder <- "configs"
}
use_switch(env_folder, path_ext_set(model_label, "yml"))
}

ch_get_ymls <- function(menu = TRUE) {
Expand Down
6 changes: 6 additions & 0 deletions R/chattr.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
#' @inheritParams ch_submit
#' @returns The output of the LLM to the console, document or script.
#' @export
#' @examples
#' library(chattr)
#' chattr_use("test")
#' chattr("hello")
#' chattr("hello", preview = TRUE)
#'
chattr <- function(prompt = NULL,
preview = FALSE,
prompt_build = TRUE,
Expand Down
7 changes: 7 additions & 0 deletions man/chattr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/chattr_use.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 150b05c

Please sign in to comment.