Summarize text

R/llm-summarize.R

llm_summarize

Description

Use a Large Language Model (LLM) to summarize text

Usage

 
llm_summarize( 
  .data, 
  col, 
  max_words = 10, 
  pred_name = ".summary", 
  additional_prompt = "" 
) 
 
llm_vec_summarize(x, max_words = 10, additional_prompt = "", preview = FALSE) 

Arguments

Arguments Description
.data A data.frame or tbl object that contains the text to be analyzed
col The name of the field to analyze, supports tidy-eval
max_words The maximum number of words that the LLM should use in the summary. Defaults to 10.
pred_name A character vector with the name of the new column where the prediction will be placed
additional_prompt Inserts this text into the prompt sent to the LLM
x A vector that contains the text to be analyzed
preview It returns the R call that would have been used to run the prediction. It only returns the first record in x. Defaults to FALSE Applies to vector function only.

Value

llm_summarize returns a data.frame or tbl object. llm_vec_summarize returns a vector that is the same length as x.