This object is used to break a extraction and validation loop in a prompt_wrap()
evaluated by send_prompt()
. When an extraction or validation function returns
this object, the loop will be broken and no further extraction or validation
functions are applied; instead, send_prompt()
will be able to return
the result at that point. This may be useful in scenarios where
it is determined the LLM is unable to provide a response to a prompt.
Arguments
- object_to_return
The object to return as the response result from
send_prompt()
when this object is returned from an extraction or validation function.- success
A logical indicating whether the
send_prompt()
loop break should nonetheless be considered as a successful completion of the extraction and validation process. IfFALSE
, theobject_to_return
must beNULL
(as the response result ofsend_prompt()
will always be 'NULL' when the evaluation was unsuccessful); ifFALSE
,send_prompt()
will also print a warning about the unsuccessful evaluation. IfTRUE
, theobject_to_return
will be returned as the response result ofsend_prompt()
(andsend_prompt()
) will print no warning about unsuccessful evaluation).
See also
Other prompt_wrap:
llm_feedback()
,
prompt_wrap()
Other prompt_evaluation:
llm_feedback()
,
send_prompt()
Examples
# Example usage within an extraction function similar to the one in 'quit_if()':
extraction_fn <- function(x) {
quit_detect_regex <- "NO ANSWER"
if (grepl(quit_detect_regex, x)) {
return(llm_break(
object_to_return = NULL,
success = TRUE
))
}
return(x)
}
# This extraction_fn would be part of a prompt_wrap()