Returns the assistant content from a single Message, from a flat list of Message objects
(e.g. the output of llmapply with extract_responses = FALSE), or from a list of lists of
Message objects (e.g. the output of map() on an Agent with extract_responses = FALSE).
Arguments
- x
Message object, list of Message objects, or list of lists of Message objects.
Value
Character vector of assistant responses. Returns NA_character_ in slots where no
assistant message is present, so that the length of the result matches the length of x.
Examples
# Requires running Ollama server and gemma4:e4b model
if (FALSE) { # \dontrun{
llmapply(
c("burgundy", "crimson", "maroon", "ruby", "scarlet"),
"gemma4:e4b",
system_prompt = "Return the hexadecimal code for the color provided in format #FFFFFF",
temperature = 0.2
) |> responses()
} # }