append_message: Append message to a list

View source: R/utils.R

append_messageR Documentation

Append message to a list

Description

Appends a message (add to end of a list) to a list of messages. The role and content will be converted to a list and appended to the input list.

Usage

append_message(content, role = "user", x = NULL, ...)

Arguments

content

The content of the message.

role

The role of the message. Can be "user", "system", "assistant". Default is "user".

x

A list of messages. Default is NULL.

...

Additional arguments such as images.

Value

A list of messages with the new message appended.

Examples

append_message("user", "Hello")
append_message("system", "Always respond nicely")

ollamar documentation built on April 3, 2025, 8:31 p.m.