Learn R Programming

tidyllm (version 0.2.0)

get_reply_data: Get Data from an Assistant Reply by parsing structured JSON responses

Description

Retrieves and parses the assistant's reply as JSON from an LLMMessage object at a specified index. If the reply is not marked as JSON, attempts to extract JSON content from text.

Usage

get_reply_data(.llm, .index = NULL)

Value

Parsed data content of the assistant's reply, or NULL if parsing fails.

Arguments

.llm

An LLMMessage object containing the message history.

.index

A positive integer for the assistant reply index to retrieve, defaulting to the last reply.