|>
prompt_wrap(
modify_fn = function(x) {
paste(
x,
"\n\n",
"If you think that there is no table that could answer the question, \n",
"please respond with only the text 'NONE' (and use no other words)."
)
},
extraction_fn = function(input_string) {
if (any(str_detect(input_string, "NONE"))) {
return("NONE")
}
return(input_string)
}
) |>
answer_as_list()
answer_as_list is evaluated before the custom wrap.
In following scenario:
|> prompt_wrap( modify_fn = function(x) { paste( x, "\n\n", "If you think that there is no table that could answer the question, \n", "please respond with only the text 'NONE' (and use no other words)." ) }, extraction_fn = function(input_string) { if (any(str_detect(input_string, "NONE"))) { return("NONE") } return(input_string) } ) |> answer_as_list()
answer_as_list is evaluated before the custom wrap.