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.
last_reply(.llm = NULL, .json = FALSE)
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.
An LLMMessage object containing the history of messages exchanged. This must be a valid LLMMessage object; otherwise, the function will stop with an error.
Should structured json data from the last reply be returned as R list (default: FALSE)
LLMMessage
for details on the message object structure.