Skip to contents

Converts retrieved chunks into numbered source blocks for use in LLM prompts.

Usage

format_retrieved_context(chunks)

Arguments

chunks

Retrieved chunk tibble.

Value

Character scalar context block.

Examples

chunks <- tibble::tibble(
  source_type = "local_file",
  source_title = "Example report",
  file_name = "example_report.pdf",
  origin = "local-file://example_report.pdf",
  text = "This is an example retrieved passage."
)
format_retrieved_context(chunks)
#> [1] "[1] Local file example_report.pdf\nOrigin: local-file://example_report.pdf\nURL: \nLocal path: \nContext headings: \nScreening term hits: \n\nThis is an example retrieved passage."