hal_history: View Conversation History

View source: R/history.R

hal_historyR Documentation

View Conversation History

Description

Display or return the conversation turns from the active session.

Usage

hal_history(
  role = NULL,
  pattern = NULL,
  format = c("console", "data.frame", "text"),
  n = NULL
)

Arguments

role

Filter by role: "user", "assistant", "system", or NULL for all.

pattern

Optional regex to filter turn content.

format

Output format: "console" (print to screen), "data.frame", or "text" (character vector).

n

Maximum number of turns to return (most recent). NULL for all.

Value

Depends on format: invisible NULL for console, a data.frame, or a character vector.

Examples

# with no active session this returns an empty data frame
hal_history(format = "data.frame")
## Not run: 
hal_history()                      # print all turns
hal_history(role = "user", n = 5)  # last five user prompts
hal_history(pattern = "ggplot")    # turns mentioning ggplot

## End(Not run)

hal documentation built on Oct. 6, 2026, 5:07 p.m.