Skip to contents

A convenience wrapper around ai_text() to summarize documents using a chat function.

Usage

ai_summary(.data, chat_fn, ..., verbose = TRUE)

Arguments

.data

a character or quanteda::corpus object containing the documents to be summarized

chat_fn

function; a chat function from ellmer

...

additional arguments passed to chat_fn

verbose

logical; output a progress indicator if TRUE

Value

character; the response from the LLM with a length equal to the number of input documents, with the elements named with the input element names

Examples

if (FALSE) { # \dontrun{
library(quanteda)
library(ellmer)
summaries <- ai_summary(data_corpus_inaugural[1:3],
                        chat_fn = chat_openai, model = "gpt-4o",
                        api_args = list(temperature = 0, seed = 42))
} # }