From 6508ef2e80ae8e537226e3338851021926a974d5 Mon Sep 17 00:00:00 2001 From: simonpcouch Date: Tue, 15 Oct 2024 09:56:21 -0700 Subject: [PATCH] various R CMD check NOTE fixes * global variables * escaped special LaTeX characters * man-roxygen at top-level * example URLs beyond max character width --- .Rbuildignore | 1 + R/doc-pal-cli.R | 4 ++-- R/doc-pal-roxygen.R | 4 ++-- R/doc-pal-testthat.R | 4 ++-- R/pal-package.R | 2 +- R/prompt.R | 17 ++++++++++++++--- man/pal_cli.Rd | 4 ++-- man/pal_roxygen.Rd | 4 ++-- man/pal_testthat.Rd | 4 ++-- man/prompt.Rd | 17 ++++++++++++++--- 10 files changed, 42 insertions(+), 19 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index e64aae2..47624e3 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,3 +10,4 @@ inst/figs/ ^pkgdown$ .env inst/slides/ +man-roxygen diff --git a/R/doc-pal-cli.R b/R/doc-pal-cli.R index 64e22fa..db2bcaf 100644 --- a/R/doc-pal-cli.R +++ b/R/doc-pal-cli.R @@ -28,9 +28,9 @@ #' receives, so we'll call that 100 output tokens per refactor. #' #' As of the time of writing (October 2024), the default pal model Claude -#' Sonnet 3.5 costs \\$3 per million input tokens and $15 per million output +#' Sonnet 3.5 costs $3 per million input tokens and $15 per million output #' tokens. So, using the default model, -#' **cli pals cost around \\$15 for every 1,000 refactored pieces of code**. GPT-4o +#' **cli pals cost around $15 for every 1,000 refactored pieces of code**. GPT-4o #' Mini, by contrast, doesn't tend to get cli markup classes right but _does_ #' return syntactically valid calls to cli functions, and it would cost around #' 75 cents per 1,000 refactored pieces of code. diff --git a/R/doc-pal-roxygen.R b/R/doc-pal-roxygen.R index 74f6229..7edd368 100644 --- a/R/doc-pal-roxygen.R +++ b/R/doc-pal-roxygen.R @@ -20,9 +20,9 @@ #' documentation, so we'll call that 200 output tokens per refactor. #' #' As of the time of writing (October 2024), the default pal model Claude -#' Sonnet 3.5 costs \\$3 per million input tokens and $15 per million output +#' Sonnet 3.5 costs $3 per million input tokens and $15 per million output #' tokens. So, using the default model, -#' **roxygen pals cost around \\$4 for every 1,000 generated roxygen documentation +#' **roxygen pals cost around $4 for every 1,000 generated roxygen documentation #' entries**. GPT-4o Mini, by contrast, doesn't tend to infer argument types #' correctly as often and #' often fails to line-break properly, but _does_ usually return syntactically diff --git a/R/doc-pal-testthat.R b/R/doc-pal-testthat.R index 75076c3..7fed1da 100644 --- a/R/doc-pal-testthat.R +++ b/R/doc-pal-testthat.R @@ -25,9 +25,9 @@ #' receives, so we'll call that 100 output tokens per refactor. #' #' As of the time of writing (October 2024), the default pal model Claude -#' Sonnet 3.5 costs \\$3 per million input tokens and $15 per million output +#' Sonnet 3.5 costs $3 per million input tokens and $15 per million output #' tokens. So, using the default model, -#' **testthat pals cost around \\$4 for every 1,000 refactored pieces of code**. GPT-4o +#' **testthat pals cost around $4 for every 1,000 refactored pieces of code**. GPT-4o #' Mini, by contrast, doesn't tend to get many pieces of formatting right and #' often fails to line-break properly, but _does_ usually return syntactically #' valid calls to testthat functions, and it would cost around diff --git a/R/pal-package.R b/R/pal-package.R index 1e5245b..2acf5e5 100644 --- a/R/pal-package.R +++ b/R/pal-package.R @@ -6,7 +6,7 @@ ## usethis namespace: end NULL -utils::globalVariables(c(".pal_last", "modifyList")) +utils::globalVariables(c(".pal_last", "file.edit", "modifyList")) # address "not imported from" R CMD check error #' @importFrom elmer content_image_file diff --git a/R/prompt.R b/R/prompt.R index 211cbc7..4581ff5 100644 --- a/R/prompt.R +++ b/R/prompt.R @@ -46,13 +46,24 @@ #' #' # pull prompts from files on local drives or the web with #' # `prompt_new(contents)`. for example, here is a GitHub Gist: -#' # https://gist.githubusercontent.com/simonpcouch/daaa6c4155918d6f3efd6706d022e584/raw/ed1da68b3f38a25b58dd9fdc8b9c258d58c9b4da/summarize-prefix.md +#' # paste0( +#' # "https://gist.githubusercontent.com/simonpcouch/", +#' # "daaa6c4155918d6f3efd6706d022e584/raw/ed1da68b3f38a25b58dd9fdc8b9c258d", +#' # "58c9b4da/summarize-prefix.md" +#' # ) #' # -#' # press "Raw" and then supply that url as `contents`: +#' # press "Raw" and then supply that URL as `contents` (you don't actually +#' # have to use the paste0() to write out the URL--we're just keeping +#' # the characters per line under 80): #' prompt_new( #' role = "summarize", #' interface = "prefix", -#' contents = "https://gist.githubusercontent.com/simonpcouch/daaa6c4155918d6f3efd6706d022e584/raw/ed1da68b3f38a25b58dd9fdc8b9c258d58c9b4da/summarize-prefix.md" +#' contents = +#' paste0( +#' "https://gist.githubusercontent.com/simonpcouch/", +#' "daaa6c4155918d6f3efd6706d022e584/raw/ed1da68b3f38a25b58dd9fdc8b9c258d", +#' "58c9b4da/summarize-prefix.md" +#' ) #' ) #' #' @name prompt diff --git a/man/pal_cli.Rd b/man/pal_cli.Rd index 7fd1c09..334a55a 100644 --- a/man/pal_cli.Rd +++ b/man/pal_cli.Rd @@ -29,9 +29,9 @@ The model returns approximately the same number of output tokens as it receives, so we'll call that 100 output tokens per refactor. As of the time of writing (October 2024), the default pal model Claude -Sonnet 3.5 costs \\$3 per million input tokens and $15 per million output +Sonnet 3.5 costs $3 per million input tokens and $15 per million output tokens. So, using the default model, -\strong{cli pals cost around \\$15 for every 1,000 refactored pieces of code}. GPT-4o +\strong{cli pals cost around $15 for every 1,000 refactored pieces of code}. GPT-4o Mini, by contrast, doesn't tend to get cli markup classes right but \emph{does} return syntactically valid calls to cli functions, and it would cost around 75 cents per 1,000 refactored pieces of code. diff --git a/man/pal_roxygen.Rd b/man/pal_roxygen.Rd index dba2dcf..e77aab1 100644 --- a/man/pal_roxygen.Rd +++ b/man/pal_roxygen.Rd @@ -23,9 +23,9 @@ The model returns maybe 10 to 15 lines of relatively barebones royxgen documentation, so we'll call that 200 output tokens per refactor. As of the time of writing (October 2024), the default pal model Claude -Sonnet 3.5 costs \\$3 per million input tokens and $15 per million output +Sonnet 3.5 costs $3 per million input tokens and $15 per million output tokens. So, using the default model, -\strong{roxygen pals cost around \\$4 for every 1,000 generated roxygen documentation +\strong{roxygen pals cost around $4 for every 1,000 generated roxygen documentation entries}. GPT-4o Mini, by contrast, doesn't tend to infer argument types correctly as often and often fails to line-break properly, but \emph{does} usually return syntactically diff --git a/man/pal_testthat.Rd b/man/pal_testthat.Rd index f8a3a8a..153acda 100644 --- a/man/pal_testthat.Rd +++ b/man/pal_testthat.Rd @@ -28,9 +28,9 @@ The model returns approximately the same number of output tokens as it receives, so we'll call that 100 output tokens per refactor. As of the time of writing (October 2024), the default pal model Claude -Sonnet 3.5 costs \\$3 per million input tokens and $15 per million output +Sonnet 3.5 costs $3 per million input tokens and $15 per million output tokens. So, using the default model, -\strong{testthat pals cost around \\$4 for every 1,000 refactored pieces of code}. GPT-4o +\strong{testthat pals cost around $4 for every 1,000 refactored pieces of code}. GPT-4o Mini, by contrast, doesn't tend to get many pieces of formatting right and often fails to line-break properly, but \emph{does} usually return syntactically valid calls to testthat functions, and it would cost around diff --git a/man/prompt.Rd b/man/prompt.Rd index 25b6aba..fa7c754 100644 --- a/man/prompt.Rd +++ b/man/prompt.Rd @@ -65,13 +65,24 @@ prompt_remove("boop") # pull prompts from files on local drives or the web with # `prompt_new(contents)`. for example, here is a GitHub Gist: -# https://gist.githubusercontent.com/simonpcouch/daaa6c4155918d6f3efd6706d022e584/raw/ed1da68b3f38a25b58dd9fdc8b9c258d58c9b4da/summarize-prefix.md +# paste0( +# "https://gist.githubusercontent.com/simonpcouch/", +# "daaa6c4155918d6f3efd6706d022e584/raw/ed1da68b3f38a25b58dd9fdc8b9c258d", +# "58c9b4da/summarize-prefix.md" +# ) # -# press "Raw" and then supply that url as `contents`: +# press "Raw" and then supply that URL as `contents` (you don't actually +# have to use the paste0() to write out the URL--we're just keeping +# the characters per line under 80): prompt_new( role = "summarize", interface = "prefix", - contents = "https://gist.githubusercontent.com/simonpcouch/daaa6c4155918d6f3efd6706d022e584/raw/ed1da68b3f38a25b58dd9fdc8b9c258d58c9b4da/summarize-prefix.md" + contents = + paste0( + "https://gist.githubusercontent.com/simonpcouch/", + "daaa6c4155918d6f3efd6706d022e584/raw/ed1da68b3f38a25b58dd9fdc8b9c258d", + "58c9b4da/summarize-prefix.md" + ) ) \dontshow{\}) # examplesIf} }