Build a Document Summarizer Agent
Source:R/build_doc_summarizer_agent.R
build_doc_summarizer_agent.Rd
Creates an LLM-powered document summarization workflow that processes PDF, DOCX, PPTX, TXT, or plain text input and returns structured markdown summaries.
Usage
build_doc_summarizer_agent(
llm,
summary_template = NULL,
chunk_size = 4000,
overlap = 200,
verbose = TRUE
)
Arguments
- llm
A function that accepts a character prompt and returns an LLM response.
- summary_template
Optional custom summary template in markdown format.
- chunk_size
Maximum character length for document chunks (default: 4000).
- overlap
Character overlap between chunks (default: 200).
- verbose
Logical controlling progress messages (default: TRUE).
Value
A function that accepts file paths or text input and returns:
summary - The generated markdown summary
metadata - Document metadata if available
chunks - Number of processing chunks used
success - Logical indicating success
Examples
if (FALSE) { # \dontrun{
# Build document summarizer agent
summarizer_agent <- build_doc_summarizer_agent(
llm = my_llm_wrapper,
summary_template = NULL,
chunk_size = 4000,
overlap = 200,
verbose = FALSE
)
# Summarize document
final_state <- summarizer_agent("https://github.com/knowusuboaky/LLMAgentR/raw/main/\
tests/testthat/test-data/scrum.docx")
} # }