last_reply: Retrieve Last Reply from an Assistant

View source: R/tidyllm.R

last_replyR Documentation

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)

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)

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.

Note

This function only returns the content of the last assistant message and does not include media or other types of content that might be attached to the message.

See Also

LLMMessage for details on the message object structure.


tidyllm documentation built on Oct. 10, 2024, 5:07 p.m.