From 0ad79611b236c58f283b68167862cf72c79bce7b Mon Sep 17 00:00:00 2001 From: jacqueline-98 Date: Thu, 14 Mar 2024 10:32:16 +0100 Subject: [PATCH] history option added for mergenstudio break --- R/selfcorrect.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/R/selfcorrect.R b/R/selfcorrect.R index 1662a0c..17e89de 100644 --- a/R/selfcorrect.R +++ b/R/selfcorrect.R @@ -26,7 +26,7 @@ #' response <- selfcorrect(agent,prompt,context=rbionfoExp, max_tokens = 500) #' } #' @export -selfcorrect<-function(agent,prompt,context=rbionfoExp,attempts=3,output.file=NULL,responseWithError=NULL,...){ +selfcorrect<-function(agent,prompt,context=rbionfoExp,attempts=3,output.file=NULL,responseWithError=NULL, history=NULL,...){ #--------------------------------------------------------------------------- # Validate arguments @@ -76,7 +76,11 @@ selfcorrect<-function(agent,prompt,context=rbionfoExp,attempts=3,output.file=NUL # Send prompt - response <- sendPrompt(agent,prompt,context,return.type="text",...) + if (is.null(history)){ + response <- sendPrompt(agent,prompt,context,return.type="text",...) + }else{ + response <- sendPrompt(agent,prompt,context,return.type="text",previous.msgs=history) + } # Clean the code backtick structure and install.packages calls init.response <- response