Learn R Programming

tidyllm (version 0.1.0)

last_reply: Retrieve Last Reply from an Assistant

Description

This function extracts the last reply made by the assistant from a given LLMMessage object. It is particularly useful for fetching the most recent response from the assistant to display or log it separately.

Usage

last_reply(.llm = NULL, .json = FALSE)

Value

Returns the content of the last reply made by the assistant. If the assistant has not replied yet, or if there are no assistant messages in the history, NULL is returned.

Arguments

.llm

An LLMMessage object containing the history of messages exchanged. This must be a valid LLMMessage object; otherwise, the function will stop with an error.

.json

Should structured json data from the last reply be returned as R list (default: FALSE)

See Also

LLMMessage for details on the message object structure.