Function to extract a specific element from a list
Source:R/extract_from_return_list.R
extract_from_return_list.Rd
This function is intended as a helper function for piping with output from
send_prompt()
when using return_mode = "full"
. It allows to
extract a specific element from the list returned by send_prompt()
, which
can be useful for further piping.
Arguments
- list
A list, typically the output from
send_prompt()
withreturn_mode = "full"
- name_of_element
A character string with the name of the element to extract from the list
Examples
if (FALSE) { # \dontrun{
"Hi!" |>
send_prompt(llm_provider_ollama(), return_mode = "full") |>
extract_from_return_list("response")
# --- Sending request to LLM provider (llama3.1:8b): ---
# Hi!
# --- Receiving response from LLM provider: ---
# It's nice to meet you. Is there something I can help you with or would you like to chat?
# [1] "It's nice to meet you. Is there something I can help you with or would you like to chat?"
} # }