Learn R Programming

rtemis.llm (version 0.8.1)

reasoning: Extract reasoning trace(s) from a Message or list of Messages

Description

Returns the assistant's reasoning trace (if any). Only LLMMessage objects carry a reasoning field; all other Message subclasses return NA_character_. Messages whose reasoning is unset (NULL) also return NA_character_.

Usage

reasoning(x)

Value

Character vector of reasoning traces, with NA_character_ in slots where no reasoning is available.

Arguments

x

Message object, list of Message objects, or list of lists of Message objects.

Author

EDG

Examples

Run this code
# Requires running Ollama server and gemma4:e4b model
if (FALSE) {
  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
  ) |> reasoning()
}

Run the code above in your browser using DataLab