From fb18e392ac5033c7d4fb72658ce0e47b9f564ff5 Mon Sep 17 00:00:00 2001 From: Angelo D'Ambrosio Date: Mon, 29 Jan 2024 15:46:44 +0100 Subject: [PATCH 1/2] fix: error when > 1 output instruction was given Now is robust against users passing a vector for the output, summary and diarization instructions instead of single elements. --- R/prompts.R | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/R/prompts.R b/R/prompts.R index cb46c7d..652b648 100644 --- a/R/prompts.R +++ b/R/prompts.R @@ -260,6 +260,11 @@ generate_summarisation_prompt <- function( args$extra_output_instructions ) + # Remove extra_output_instructions since it would trigger the length check + # later + args$extra_output_instructions <- NULL + + # Collapse output instruction into a bullet point list args$output_instructions <- paste0( "- ", args$output_instructions, @@ -270,6 +275,19 @@ generate_summarisation_prompt <- function( args$output_length <- "3" } + # Aggregate arguments if length > 1 vectors + if (length(args$extra_diarization_instructions) > 1) { + args$extra_diarization_instructions <- paste( + args$extra_diarization_instructions, collapse = "\n" + ) + } + + if (length(args$summary_structure) > 1) { + args$summary_structure <- paste( + args$summary_structure, collapse = "\n" + ) + } + prompt <- paste( get_prompts("base_task"), @@ -355,6 +373,11 @@ generate_rolling_aggregation_prompt <- function( args$extra_output_instructions ) + # Remove extra_output_instructions since it would trigger the length check + # later + args$extra_output_instructions <- NULL + + # Collapse output instruction into a bullet point list args$output_instructions <- paste0( "- ", args$output_instructions, @@ -365,6 +388,13 @@ generate_rolling_aggregation_prompt <- function( args$output_length <- "3" } + # Aggregate arguments if length > 1 vectors + if (length(args$summary_structure) > 1) { + args$summary_structure <- paste( + args$summary_structure, collapse = "\n" + ) + } + summary_seq <- seq_along(summaries) summaries <- stringr::str_glue( From 1e4591cac57c8317266b222b9cf1a174f9f0edd9 Mon Sep 17 00:00:00 2001 From: Angelo D'Ambrosio Date: Mon, 29 Jan 2024 15:47:11 +0100 Subject: [PATCH 2/2] version bump --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index bfb4f25..55eec5f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: minutemaker Title: GenAI-based meeting and conferences minutes generator -Version: 0.5.1 +Version: 0.5.2 Authors@R: person("Angelo", "D'Ambrosio", , "a.dambrosioMD@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-2045-5155"))