Wrap a prompt with additional functionality
Usage
prompt_wrap(
  prompt,
  modify_fn = NULL,
  extraction_fn = NULL,
  validation_fn = NULL,
  max_retries = 10,
  type = c("unspecified", "mode", "tool")
)Arguments
- prompt
- A prompt object or a single string 
- modify_fn
- A function that takes the previous prompt text and returns the new prompt text 
- extraction_fn
- A function that takes the LLM response and attempts to extract a value from it. Upon succesful extraction, the function should return the extracted value. If the extraction fails, the function should return a feedback message which will be sent back to the LLM (the feedback message should be of class 'llm_feedback'). 
- validation_fn
- A function that takes the (extracted) LLM response and attempts to validate it. Upon succesful validation, the function should return TRUE. If the validation fails, the function should return a feedback message which will be sent back to the LLM (the feedback message should be of class 'llm_feedback').#' 
- max_retries
- The maximum number of retries allowed for this prompt wrap; each failure of extraction or validation will count as a retry. 
- type
- The type of prompt wrap; one of 'unspecified', 'mode', or 'tool'. Types are used to determine the order in which prompt wraps are applied. Typically, tools are applied first, then modes, then unspecified wraps.