Learn R Programming

tidyllm (version 0.3.4)

get_reply: Retrieve Assistant Reply as Text

Description

Extracts the plain text content of the assistant's reply from an LLMMessage object. Use get_reply_data() for structured replies in JSON format.

Usage

get_reply(.llm, .index = NULL)

last_reply(.llm)

Value

Returns a character string containing the assistant's reply, or NA_character_ if no reply exists.

Arguments

.llm

An LLMMessage object containing the message history.

.index

A positive integer indicating the index of the assistant reply to retrieve. Defaults to NULL, which retrieves the last reply.

Details

This function is the core utility for retrieving assistant replies by index. For convenience, last_reply() is provided as a wrapper to retrieve the latest assistant reply.

See Also

get_reply_data(), last_reply()