Skip to content

Commit

Permalink
prepare for CRAN submission
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanpieper committed Oct 5, 2024
1 parent d0a2076 commit bd9cc06
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
^readme\.md$
^test/
^.github
\.rds$
\.rds$
^cran-comments\.md$
14 changes: 7 additions & 7 deletions R/batchLLM.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ batchLLM <- function(df,
batch_mutate <- function(df, df_col, df_string, col_string, system_prompt, batch_size, batch_delay, batch_num, batch_total, LLM, model, temperature, start_row, total_rows, log_name, case_convert, max_tokens, extract_XML, ...) {
build_prompt <- function(system_prompt, content_input, extract_XML) {
if (extract_XML) {
paste0(system_prompt, "(put response in a single level of XML tags <results>):", as.character(content_input))
paste0(system_prompt, "(put your response in a single level of XML tags <results></results> and continue in plain text):", as.character(content_input))
} else {
paste0(system_prompt, ":", as.character(content_input))
}
Expand Down Expand Up @@ -591,7 +591,7 @@ scrape_metadata <- function(df_name = NULL, log_name = "batchLLM-log") {
#'
#' @description This function provides an interface to interact with Claude AI models via Anthropic's API, allowing for flexible text generation based on user inputs.
#' This function was adapted from the [claudeR](https://github.com/yrvelez/claudeR) repository by [yrvelez](https://github.com/yrvelez) on GitHub (MIT License).
#'
#'
#' @param api_key Your API key for authentication.
#' @param prompt A string vector for Claude-2, or a list for Claude-3 specifying the input for the model.
#' @param model The model to use for the request. Default is the latest Claude-3 model.
Expand Down Expand Up @@ -643,14 +643,14 @@ scrape_metadata <- function(df_name = NULL, log_name = "batchLLM-log") {
#' cat(response)
#' }
claudeR <- function(
prompt,
model = "claude-3-5-sonnet-20240620",
prompt,
model = "claude-3-5-sonnet-20240620",
max_tokens = 500,
stop_sequences = NULL,
temperature = .7,
top_k = -1,
temperature = .7,
top_k = -1,
top_p = -1,
api_key = NULL,
api_key = NULL,
system_prompt = NULL) {
if (grepl("claude-3", model) && !is.list(prompt)) {
stop("Claude-3 requires the input in a list format, e.g., list(list(role = \"user\", content = \"What is the capital of France?\"))")
Expand Down
5 changes: 2 additions & 3 deletions R/batchLLM_shiny.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' @title Interact with batchLLM via a Shiny Gadget
#'
#' @description This function provides a Shiny-based user interface to interact with
#' the `batchLLM` package. It allows users to configure and execute batch processing
#' @description This function provides a Shiny-based user interface to interact with
#' the `batchLLM` package. It allows users to configure and execute batch processing
#' through an interactive dashboard.
#'
#' @export
Expand Down Expand Up @@ -30,7 +30,6 @@
#' @importFrom jsonlite write_json
#' @import batchLLM
batchLLM_shiny <- function() {

df_objects <- "beliefs"

create_exportable_datatable <- function(data, filename_prefix) {
Expand Down
8 changes: 4 additions & 4 deletions R/beliefs.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#' @title Beliefs Dataset
#'
#'
#' @description The beliefs dataset consists of 20 statements representing opposing views on various scientific, environmental, and societal topics.
#'
#'
#' @format A data frame with 20 rows and 1 variable:
#' \describe{
#' \item{statement}{A character string with a statement representing a belief.}
#' }
#'
#'
#' @examples
#' head(beliefs)
"beliefs"
"beliefs"
5 changes: 5 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## R CMD check results

0 errors | 0 warnings | 0 notes

* This is a new release.

0 comments on commit bd9cc06

Please sign in to comment.