This page lists every setting in harnessr: the core’s first, then the
document layer’s, stage by stage, and last the building blocks the
document settings choose between. harnessr builds the tables from
gr_settings_table() and the registries when the page is
built, so they match the installed code.
A setting with a walkthrough links to it. The walkthrough is a section of a guide that covers what the setting trades off, the signs that you should change it, where its default came from and how to test a change.
library(harnessr)
old <- hr_options(verbose = FALSE, embedder = "lexical")
settings <- gr_settings_table()
core <- c("options", "evaluate")
stages <- unique(settings$stage)
stages <- c(intersect(core, stages), setdiff(stages, core))
table(settings$stage, settings$tier)[stages, ]
#>
#> advanced basic
#> options 36 5
#> evaluate 20 10
#> ingest 18 3
#> segment 17 3
#> read 42 8
#> screen 23 11
#> extract 7 3
#> synthesise 26 5Reading the tables
Each row is one setting, and these columns describe it:
-
where: the function that takes the setting. -
default: the value used when you give none. A string appears without quotes, a set of choices shows its first choice, and anything else appears as R code. -
tier:basicfor the few settings most runs change,advancedfor the rest. -
status: where the default came from.measuredmeans a measurement backs it,citedmeans a published source gives it, anduntestedmeans it was chosen and nothing has measured it. A blank means nothing is declared, as for switches, limits and most function arguments.
gr_settings_table() also returns the source
behind each status. For the full help, see ?gr_read_spec,
?gr_segment_spec, ?gr_ingest_spec and
?hr_options.
You give a setting where its stage takes it. You set options for the
session with hr_options(), and evaluation settings are
arguments of their functions. Ingest, segment and read settings go in a
spec (gr_read_spec(top_k = 4)), in a recipe, or by name to
answer_document(), gr_read_many() and
gr_arm(), which put each on the step it belongs to. Review
settings are arguments of their functions.
To find out whether a value works better on your documents, build one
arm per value with hr_sweep() and compare the arms with
hr_benchmark() and hr_report(), as
vignette("compare") does. hr_sweep_check()
reports which values sent the same requests.
show_settings <- function(stage) {
s <- settings[settings$stage == stage, ]
esc <- function(x) gsub("|", "\\|", ifelse(is.na(x), "", x), fixed = TRUE)
# Descriptions are Markdown: a bare "<field>" would reach the page as an
# HTML tag and vanish. A < inside backticks would show as "<", so keep
# it out of code spans.
lt <- function(x) gsub("<", "<", x, fixed = TRUE)
name <- ifelse(is.na(s$guide), paste0("`", s$name, "`"),
sprintf("[`%s`](%s.html#%s)", s$name, sub("#.*", "", s$guide),
sub(".*#", "", s$guide)))
knitr::kable(data.frame(setting = name, where = paste0("`", s$where, "`"),
default = paste0("`", esc(s$default), "`"),
tier = s$tier, status = esc(s$status),
description = lt(esc(s$description))),
row.names = FALSE)
}Core settings
These settings belong to the core: the session options every call reads, and the arguments of the functions that measure configurations.
Options
Session settings. You set them with hr_options(), and a
run reads them when it starts. Most apply to every call, with or without
a document; a few, such as cache_documents and
embedder, serve the document layer. Each core guide covers
its own: the model, endpoint, retries and actor in
vignette("core"), prices and the token counter in
vignette("models"), the safety margin and the reply’s
reserve in vignette("context"), the reasoning floor in
vignette("effort"), and the limits in
vignette("runs").
| setting | where | default | tier | status | description |
|---|---|---|---|---|---|
verbose |
hr_options() |
TRUE |
basic | Print a line for each ingest, segment and read stage. | |
tokenizer |
hr_options() |
heuristic |
advanced | Token counter: “heuristic” (conservative, no dependencies), “words”, “chars”, “tiktoken” (needs reticulate), or a name registered via hr_set_tokenizer(). | |
model |
hr_options() |
gpt-5.6-terra |
basic | Default chat model. | |
embedding_model |
hr_options() |
text-embedding-3-small |
advanced | Default embedding model. | |
api_base |
hr_options() |
https://api.openai.com/v1 |
advanced | API root; point this at a proxy or a compatible endpoint. | |
api_headers |
hr_options() |
character(0) |
advanced | Named character vector of extra HTTP headers sent with every request, for gateways that do not authenticate with a bearer token. | |
api |
hr_options() |
responses |
advanced | “responses” or “chat” request shape. | |
temperature |
hr_options() |
NULL |
advanced | untested | Default sampling temperature. |
max_retries |
hr_options() |
4 |
advanced | untested | Retries for transient failures. |
retry_pause_base |
hr_options() |
2 |
advanced | untested | Seconds; exponential backoff base. |
request_timeout |
hr_options() |
120 |
advanced | untested | Per-request timeout, seconds. |
safety_margin |
hr_options() |
0.1 |
advanced | untested | Fraction of the context window left unused to absorb tokenizer error. |
min_output_tokens |
hr_options() |
256 |
advanced | untested | Floor on the completion room hr_budget() reserves when reserve_output is not given explicitly. |
cache_documents |
hr_options() |
TRUE |
advanced | Cache ingestion per file + settings. | |
cache_embeddings |
hr_options() |
TRUE |
advanced | Cache embeddings per text + model. | |
cache_dir |
hr_options() |
NULL |
basic | Directory hr_cache() stores model responses in. | |
embedder |
hr_options() |
NULL |
advanced | Which registered embedder to use. | |
parallel |
hr_options() |
FALSE |
advanced | Run per-chunk calls concurrently. | |
workers |
hr_options() |
4 |
advanced | untested | Worker processes when parallel is TRUE. |
max_cost_usd |
hr_options() |
5 |
basic | Spending limit per run, in USD. | |
max_calls |
hr_options() |
400 |
basic | Hard cap on model calls per run, checked before every request. | |
max_tokens_total |
hr_options() |
NULL |
advanced | Most tokens one run may use: the prompt and reply tokens of every call, cache hits included, and the text sent to be embedded. | |
max_output_tokens |
hr_options() |
NULL |
advanced | The largest output cap one request may be sent with. | |
allowed_models |
hr_options() |
NULL |
advanced | Character vector of the model ids a run may call, chat and embedding models alike. | |
allow_unpriced |
hr_options() |
TRUE |
advanced | untested | Whether a chat model with no registered price may be called while max_cost_usd is set. |
reserve_calls |
hr_options() |
0 |
advanced | untested | Calls held back from max_calls for a run’s closing requests, such as a reader’s final answer. |
reserve_usd |
hr_options() |
0 |
advanced | untested | Dollars held back from max_cost_usd for a run’s closing requests, in the same way. |
on_overflow |
hr_options() |
error |
advanced | untested | What a request does when the provider refuses its prompt as longer than the model’s context window (an error of class hr_context_overflow; see hr_call()). |
command_hide_env |
hr_options() |
character(0) |
advanced | untested | More variables to hide from the programs hr_step_command() runs: a character vector of regular expressions matched against variable names, without regard to case, such as “^MY_GATEWAY$”. |
command_temp_home |
hr_options() |
FALSE |
advanced | untested | Whether hr_step_command() runs its program with HOME (and USERPROFILE on Windows) set to an empty folder made for the call, so it does not read your configuration files and stored logins. |
mask_secrets |
hr_options() |
FALSE |
advanced | untested | Whether key-shaped strings are replaced with <masked> in the copies harnessr stores or shows: the output a command step keeps, the file hr_trace_save() writes, and a printed trace. |
price_max_age_days |
hr_options() |
120 |
advanced | untested | How old a price may be, in days, before a cost computed from it warns with class hr_stale_price. |
unknown_model_action |
hr_options() |
warn |
advanced | “warn” or “error” when a model id is not in the registry. | |
actor |
hr_options() |
list() |
advanced | A named list (or character vector) of the actor fields every hr_trace() records: system, owner, run_by, purpose and approved_by, each one string. | |
auto_max_tokens |
hr_options() |
50000 |
advanced | untested | The largest document, in tokens, that answer_document() with recipe = “auto” reads with “fast” (one request); a larger one is read with “thorough”. |
auto_room_share |
hr_options() |
0.5 |
advanced | untested | The second condition of that choice: the document must fill at most this share of the input room hr_budget() leaves on every model of the run. |
reasoning_floor |
hr_options() |
2048 |
advanced | untested | The smallest output cap a request to a reasoning model is sent with. |
output_reserve_share |
hr_options() |
0.25 |
advanced | untested | The share of the usable window hr_budget() reserves for the reply when no reserve_output is given, between min_output_tokens and the model’s output limit. |
near_verbatim_sim |
hr_options() |
0.9 |
advanced | measured | The least similarity a quotation of at least near_verbatim_short_chars characters (after normalising), and one shorter than that, needs for the edit-distance matcher to score it near_verbatim (see gr_verify_evidence()). |
near_verbatim_sim_short |
hr_options() |
0.95 |
advanced | measured | The least similarity a quotation of at least near_verbatim_short_chars characters (after normalising), and one shorter than that, needs for the edit-distance matcher to score it near_verbatim (see gr_verify_evidence()). |
near_verbatim_short_chars |
hr_options() |
40 |
advanced | measured | The least similarity a quotation of at least near_verbatim_short_chars characters (after normalising), and one shorter than that, needs for the edit-distance matcher to score it near_verbatim (see gr_verify_evidence()). |
Evaluation
The arguments of hr_benchmark(),
hr_report(), hr_judge(),
gr_compare(), hr_error_correlation() and
hr_step_command(). vignette("evaluate") and
vignette("compare") cover them, and “The governor of a
benchmark or a batch” in vignette("runs") covers the
governor a benchmark is held to. gr_compare()
belongs to the document layer and is listed here with the other
comparisons.
| setting | where | default | tier | status | description |
|---|---|---|---|---|---|
runs |
hr_benchmark() |
5 |
basic | How many times each arm runs on each item: a whole number, at least 1. | |
scorer |
hr_benchmark() |
hr_scorer_exact() |
basic | An hr_scorer(); hr_scorer_exact() by default. | |
split |
hr_benchmark() |
test |
advanced | The split or splits of the reference to run on. | |
governor |
hr_benchmark() |
NULL |
basic | An hr_governor() the whole benchmark is held to, or NULL to take the limits from hr_options(). | |
seed |
hr_benchmark() |
1 |
advanced | The seed of the arms’ private random stream. | |
contrasts |
hr_report() |
NULL |
advanced | Pairs of arms to compare: a two-column character matrix of arm names, each row giving first minus second. | |
B |
hr_report() |
2000 |
advanced | Number of cluster bootstrap resamples, at least 100. | |
conf |
hr_report() |
0.95 |
basic | Confidence level of every interval. | |
k |
hr_report() |
c(1, 3, 5) |
advanced | The values of k for pass^k. | |
seed |
hr_report() |
1 |
advanced | Seed of the private random stream the resamples are drawn from; the caller’s random state is left as it was. | |
method |
hr_report() |
auto |
basic | “auto”, “bootstrap”, “cluster_t”, “bayes” or “exact”, as above. | |
confirmatory |
hr_report() |
FALSE |
advanced | TRUE for a confirmatory report, which raises the default B to 5000 and refuses dev-split rows. | |
auto_bootstrap_at |
hr_report() |
c(items = 300, clusters = 30) |
advanced | Under method = “auto”, the size at which the report switches from the cluster-robust t interval to the studentised cluster bootstrap: c(items = , clusters = ), both reached. | |
min_runs |
hr_report() |
5 |
advanced | The fewest runs for which the report gives intervals; below it the report is descriptive only. | |
mode |
hr_judge() |
select |
basic | “select”, “grade” or “pairwise”. | |
model |
hr_judge() |
NULL |
basic | The judge’s model; the client’s model when NULL. | |
orders |
hr_judge() |
2 |
basic | Presentation orders. | |
governor |
hr_judge() |
NULL |
advanced | Optional hr_governor() for the judge’s requests. | |
draw_index |
hr_judge() |
0 |
advanced | Draw index passed to every request (see hr_call()). | |
recipes |
gr_compare() |
c("fast", "needle", "thorough") |
basic | A character vector of recipe names, or a list of gr_recipes. | |
allow_duplicates |
gr_compare() |
FALSE |
advanced | Run duplicates anyway (useful at temperature > 0 to measure variance). | |
on_error |
gr_compare() |
continue |
advanced | “continue” keeps going and records the failure; “stop” aborts the whole comparison. | |
strata |
hr_error_correlation() |
NULL |
advanced | untested | NULL to stratify by difficulty, or each item’s stratum: a vector named by item, or one value per item in the order of unique(bench$item). |
n_strata |
hr_error_correlation() |
3 |
advanced | untested | How many difficulty strata, when strata is NULL: a whole number from 1 to 10, default 3. |
n_check |
hr_error_correlation() |
10 |
advanced | untested | How many items every arm got wrong to sample for a hand check: a whole number, 0 or more, default 10. |
held_out |
hr_error_correlation() |
TRUE |
advanced | untested | TRUE (the default) reads only the rows that count as evidence (reportable, so not the dev split); FALSE reads every row. |
seed |
hr_error_correlation() |
1 |
advanced | untested | The seed of the private random stream the sample is drawn with; the caller’s random state is left as it was. |
parse |
hr_step_command() |
exit |
basic | untested | How the result is read: “exit” or “testthat”. |
timeout |
hr_step_command() |
60 |
advanced | untested | Seconds the program may run before it is stopped, from 1 to 86400. |
held |
hr_step_command() |
FALSE |
advanced | untested | Whether the result is kept from the steps after this one and left for the scorer. |
Document settings
The document layer’s settings, in the order a run meets its stages. A document run also reads the core options above: its requests are calls like any other, under the same model, limits and token counter.
Ingest
These settings control what comes out of a file: cleaning, OCR, the
PDF layout pass, and the floor on how much text must survive. The
entries of cleaner_opts and layout_opts appear
under their parent’s name, as
cleaner_opts.references_after.
vignette("ingest") covers them.
| setting | where | default | tier | status | description |
|---|---|---|---|---|---|
ocr |
gr_ingest_spec() |
auto |
basic | untested | When to OCR a page: with no text layer, always, or never. |
layout |
gr_ingest_spec() |
auto |
advanced | untested | How a PDF page’s text is put in reading order. |
clean |
gr_ingest_spec() |
standard |
basic | untested | A cleaning preset, or cleaner names. |
ocr_lang |
gr_ingest_spec() |
eng |
advanced | untested | Tesseract language code. |
ocr_dpi |
gr_ingest_spec() |
300 |
advanced | cited | Render density for PDF OCR. |
ocr_min_chars |
gr_ingest_spec() |
40 |
advanced | untested | A page with fewer characters is OCRed under ocr = ‘auto’. |
min_chars |
gr_ingest_spec() |
20 |
basic | untested | Refuse the document if less text than this survives. |
extractor |
gr_ingest_spec() |
NULL |
advanced | untested | Force an extractor instead of choosing by file type. |
parallel |
gr_ingest_spec() |
NULL |
advanced | untested | Parallelise page-level OCR. |
cleaner_opts |
gr_ingest_spec() |
list() |
advanced | untested | Extra options passed to individual cleaners. |
layout_opts |
gr_ingest_spec() |
list() |
advanced | untested | Settings of the PDF running-head pass under layout = ‘auto’. |
ocr_trigger |
gr_ingest_spec() |
raw_text |
advanced | untested | Which text of a PDF page ocr_min_chars is counted on under ocr = ‘auto’. |
ocr_confidence |
gr_ingest_spec() |
FALSE |
advanced | untested | Record Tesseract’s confidence on a PDF page’s OCR blocks (a second pass). |
cleaner_opts.references_after |
gr_ingest_spec() |
0.4 |
advanced | untested | For the references cleaner: the share of the text after which a References heading ends the text. |
cleaner_opts.header_max_chars |
gr_ingest_spec() |
80 |
advanced | untested | For the headers_footers cleaner: the longest line that can be taken for a running head or foot. |
cleaner_opts.header_min_repeats |
gr_ingest_spec() |
3 |
advanced | untested | For headers_footers: how many times a line must recur to be taken for a running head; values below 3 are read as 3. |
layout_opts.depth |
gr_ingest_spec() |
2 |
advanced | untested | Lines at each edge of a PDF page that are candidates for a running head or foot. |
layout_opts.share |
gr_ingest_spec() |
0.4 |
advanced | untested | The share of pages a line must recur on to be dropped as a running head or foot. |
layout_opts.min_pages |
gr_ingest_spec() |
3 |
advanced | untested | The fewest pages a document needs before any line is dropped, and the fewest a line must recur on. |
layout_opts.max_chars |
gr_ingest_spec() |
200 |
advanced | untested | The longest line, in characters, that can be a running head or foot. |
layout_opts.max_words |
gr_ingest_spec() |
5 |
advanced | untested | Above this many words, a numbered line must carry its number where a page number is set. |
Segment
harnessr cuts the text into chunks with these settings.
vignette("segment") covers them.
| setting | where | default | tier | status | description |
|---|---|---|---|---|---|
context_source |
gr_segment_spec() |
metadata |
advanced | untested | For contextual: where the context line comes from. |
max_tokens |
gr_segment_spec() |
1200 |
basic | untested | Hard cap on chunk size, in tokens. |
overlap_tokens |
gr_segment_spec() |
0 |
basic | untested | Tokens of trailing context copied into the start of the next chunk. |
min_tokens |
gr_segment_spec() |
0 |
advanced | untested | A smaller chunk is merged into the one before it. |
method |
gr_segment_spec() |
paragraph |
basic | untested | The segmentation strategy. |
separators |
gr_segment_spec() |
NULL |
advanced | untested | For recursive: the separator cascade, strongest first. |
prefix_section |
gr_segment_spec() |
TRUE |
advanced | untested | For structural: prepend the heading. |
semantic_window |
gr_segment_spec() |
2 |
advanced | untested | For semantic: sentences embedded together. |
semantic_percentile |
gr_segment_spec() |
90 |
advanced | untested | For semantic: how extreme a distance counts as a boundary. |
proposition_batch_tokens |
gr_segment_spec() |
900 |
advanced | untested | For proposition: the size of each batch sent to the model. |
parallel |
gr_segment_spec() |
NULL |
advanced | untested | Parallelise per-chunk model work. |
context_reply_tokens |
gr_segment_spec() |
90 |
advanced | untested | For contextual under llm: the output cap of each context-line request. |
context_document_tokens |
gr_segment_spec() |
1500 |
advanced | untested | For contextual under llm: how much of the document each request carries. |
proposition_reply_tokens |
gr_segment_spec() |
2000 |
advanced | untested | For proposition: the output cap of each batch’s request. |
semantic_threshold |
gr_segment_spec() |
percentile |
advanced | untested | For semantic: how the distances between windows are cut into boundaries. |
table_packing |
gr_segment_spec() |
rows |
advanced | untested | For paragraph: how the rows of a table are packed into chunks. |
proposition_check |
gr_segment_spec() |
count |
advanced | untested | For proposition: whether a proposition with no support in its batch is dropped. |
proposition_context_tokens |
gr_segment_spec() |
0 |
advanced | untested | For proposition: tokens of the batch before that each batch’s request carries. |
packing |
gr_segment_spec() |
greedy |
advanced | untested | How units are packed into chunks under the cap. |
runt_merge |
gr_segment_spec() |
backward |
advanced | untested | Which way a chunk under min_tokens is merged. |
Read
With these settings you choose how the model reads the chunks. The
stage also holds the ones gr_read_many() adds for a folder.
vignette("readers") covers them. effort,
effort_mode and context_policy hand a read the
core’s effort and context rules, which vignette("effort")
and vignette("context") explain.
| setting | where | default | tier | status | description |
|---|---|---|---|---|---|
on_overflow |
gr_read_spec() |
warn |
advanced | untested | For stuff: truncate with a warning, or stop, when the document does not fit. |
context_order |
gr_read_spec() |
relevance |
advanced | untested | Where the selected chunks sit in the prompt. |
restate |
gr_read_spec() |
auto |
advanced | untested | Whether to repeat the question before the excerpts as well as after. |
premise |
gr_read_spec() |
FALSE |
advanced | untested | Check the question’s assumptions against the document. |
verify |
gr_read_spec() |
FALSE |
basic | untested | Check the answer’s quotations against the chunks they cite. |
effort |
gr_read_spec() |
NULL |
advanced | untested | Reasoning effort, one level or a map named by call stem. |
reader |
gr_read_spec() |
map_reduce |
basic | untested | The reading strategy. |
model |
gr_read_spec() |
NULL |
basic | untested | Chat model id; NULL means the client’s. |
temperature |
gr_read_spec() |
NULL |
advanced | untested | Sampling temperature. |
max_answer_tokens |
gr_read_spec() |
1500 |
advanced | untested | Output cap for final answers and merges. |
max_chunk_tokens |
gr_read_spec() |
700 |
advanced | untested | Output cap for per-chunk calls. |
max_summary_tokens |
gr_read_spec() |
500 |
advanced | untested | Output cap for summarisation calls. |
top_k |
gr_read_spec() |
6 |
basic | untested | Chunks to use, for retrieve, rerank and iterative. |
min_score |
gr_read_spec() |
-Inf |
advanced | untested | For retrieve: chunks scoring below this are dropped. |
mmr |
gr_read_spec() |
1 |
advanced | untested | Relevance against diversity when selecting chunks; 1 is plain top-k. |
rerank_candidates |
gr_read_spec() |
20 |
advanced | untested | For rerank: how many chunks to score. |
rerank_min_score |
gr_read_spec() |
4 |
advanced | untested | For rerank: the score below which a chunk is discarded. |
fan_in |
gr_read_spec() |
5 |
advanced | untested | For hierarchical: summaries combined per call. |
max_levels |
gr_read_spec() |
5 |
advanced | untested | For hierarchical: the recursion depth cap. |
max_rounds |
gr_read_spec() |
4 |
advanced | untested | For iterative: retrieve-assess cycles. |
preview_tokens |
gr_read_spec() |
1200 |
advanced | untested | For preview: the cap on the outline the planner sees. |
members |
gr_read_spec() |
NULL |
advanced | untested | For ensemble: the reader names to combine. |
cite |
gr_read_spec() |
FALSE |
basic | untested | Ask for chunk-level citations in the answer. |
skim_model |
gr_read_spec() |
NULL |
advanced | untested | A cheaper model for skim’s extraction and rerank’s scoring. |
summary_model |
gr_read_spec() |
NULL |
advanced | untested | A cheaper model for hierarchical’s summaries. |
parallel |
gr_read_spec() |
NULL |
advanced | untested | Run per-chunk calls in parallel. |
delay_between_calls |
gr_read_spec() |
0 |
advanced | untested | Seconds to sleep between sequential calls. |
accept_near_verbatim |
gr_read_spec() |
FALSE |
advanced | untested | Under verify, let a near-verbatim quotation stop the iterative reader. |
max_merge_levels |
gr_read_spec() |
6 |
advanced | untested | Most merge levels a reader runs before it returns its findings unmerged. |
restate_tokens |
gr_read_spec() |
1200 |
advanced | untested | Under restate = ‘auto’, the body length above which the question is repeated. |
bm25_k1 |
gr_read_spec() |
1.5 |
advanced | cited | BM25 term-frequency saturation, for rerank’s prefilter and lexical retrieve. |
bm25_b |
gr_read_spec() |
0.75 |
advanced | cited | BM25 length normalisation, for rerank’s prefilter and lexical retrieve. |
lexical_blend |
gr_read_spec() |
0.5 |
advanced | untested | For retrieve on lexical embeddings: the weight of cosine against BM25. |
unskip_k |
gr_read_spec() |
0 |
advanced | untested | For preview: the sections that best match the question’s words, read even when the plan skips them. |
reread_on |
gr_read_spec() |
never |
advanced | untested | For preview: under “not_found”, an answer that found nothing reads the sections not read in full in one more request. |
low_score |
gr_read_spec() |
not_found |
advanced | untested | For rerank: when every candidate scores below rerank_min_score, answer not found, or send the 5 best to the answer request. |
fusion |
gr_read_spec() |
default |
advanced | untested | For retrieve and iterative: how embedding similarity and BM25 are combined into one ranking. |
rrf_k |
gr_read_spec() |
60 |
advanced | cited | Under fusion = ‘rrf’: the constant k in 1 / (k + rank). |
answer_format |
gr_read_spec() |
parsed |
advanced | untested | How answering requests report their outcome: parsed from free text, or in a JSON schema the request forces. |
premise_verdict |
gr_read_spec() |
sentence |
advanced | untested | Under premise = TRUE: the verdict as a sentence in the reply, or as schema fields with a quote that is checked against the excerpts. |
context_policy |
gr_read_spec() |
NULL |
advanced | untested | Which pieces of a request are never cut, which are cut first, and which part of a cut piece is kept. |
refine_state |
gr_read_spec() |
draft |
advanced | untested | For refine: carry a rewritten draft down the document, or a numbered list of findings that each request adds to, replaces or drops from. |
effort_mode |
gr_read_spec() |
static |
advanced | untested | Under “escalate”, every stage starts at
effort (“low” when unset), and the next stage is sent at
“high” when a trigger fires. |
recipe |
gr_read_many() |
thorough |
basic | One recipe, applied to every document. | |
store |
gr_read_many() |
NULL |
basic | Optional directory. | |
on_error |
gr_read_many() |
continue |
advanced | “continue” (default) records the failure and moves on; “stop” aborts. | |
max_total_usd |
gr_read_many() |
NULL |
basic | Stop once the run has spent this much, marking the remaining documents “skipped”, except any restored from store, which costs nothing. | |
max_total_calls |
gr_read_many() |
NULL |
advanced | Stop before a document once the run has made this many requests, marking the rest “skipped”, except any restored from store, which makes no request. | |
keep_answers |
gr_read_many() |
TRUE |
advanced | Keep every gr_answer in the result. | |
recursive |
gr_read_many() |
FALSE |
advanced | Descend into subdirectories when sources is a directory. |
Screening
The arguments of these functions, which
vignette("review") covers:
-
gr_screen(), which decides which documents a review reads. -
gr_reference()andgr_calibrate(), which measure the screening against a person. -
gr_screen_sample_size()andgr_stop_test(), the sample size and stopping tests.
| setting | where | default | tier | status | description |
|---|---|---|---|---|---|
recipe |
gr_screen() |
research |
basic | The ingest and segmentation to use. | |
store |
gr_screen() |
NULL |
advanced | Optional directory. | |
screen_tokens |
gr_screen() |
NULL |
basic | untested | Cap what the model is shown, in tokens, counted from the start of the document. |
on_error |
gr_screen() |
continue |
advanced | “continue” (default) records the failure and moves on; “stop” aborts. | |
max_total_usd |
gr_screen() |
NULL |
basic | Stop once the run has spent this much, marking the remaining documents “skipped”, except any restored from store, which costs nothing. | |
max_total_calls |
gr_screen() |
NULL |
advanced | Stop before a document once the run has made this many requests, marking the rest “skipped”, except any restored from store, which makes no request. | |
keep_answers |
gr_screen() |
FALSE |
advanced | Keep the underlying gr_answer objects in $answers. | |
recursive |
gr_screen() |
FALSE |
advanced | Descend into subdirectories when sources is a directory. | |
criteria_schema |
gr_screen() |
decision |
advanced | untested | What each screening reply holds. |
samples |
gr_screen() |
1 |
advanced | untested | How many times each document’s screening request is sent, from 1 to 20. |
sample_rule |
gr_screen() |
include_if_any |
advanced | untested | How draws are combined when samples is above 1. |
sample_k |
gr_screen() |
NULL |
advanced | untested | Under sample_rule = “k_of_n”, how many draws must include a document for it to be included: a whole number from 1 to samples. |
n |
gr_reference() |
50 |
basic | How many to draw: a whole number of at least 1. | |
of |
gr_reference() |
excluded |
basic | Which rows to sample from: “excluded”, “kept” (include and unclear), “all”, or “stacked” (every kept record and a sample of the excluded ones). | |
seed |
gr_reference() |
NULL |
advanced | A seed for the draw, so it is reproducible: the sample is drawn after set.seed(seed) and your session’s random number stream is put back afterwards. | |
blind |
gr_reference() |
TRUE |
advanced | Leave the model’s decision and reason out of the file. | |
frame |
gr_reference() |
NULL |
advanced | The same as of, under the name gr_screen_sample_size() uses. | |
reviewers |
gr_reference() |
1 |
advanced | How many people will judge each record. | |
positive |
gr_calibrate() |
include |
advanced | Which human decision counts as eligible: “include” or “exclude”. | |
min_positives |
gr_calibrate() |
10 |
advanced | For an “all” sample: below this many eligible studies the sensitivity estimate is reported but marked inadequate. | |
of |
gr_calibrate() |
NULL |
advanced | Which part of the screening run the reference was drawn from: “excluded”, “kept”, “all” or “stacked”; anything else is an error. | |
recall_target |
gr_calibrate() |
0.95 |
basic | untested | The recall the screener should reach, strictly between 0 and 1. |
conf |
gr_calibrate() |
0.95 |
basic | untested | Confidence level of the recall and loss bounds. |
max_lost |
gr_calibrate() |
NULL |
advanced | Optional: the most eligible records the screener may have excluded. | |
max_width |
gr_calibrate() |
0.1 |
advanced | untested | For a sample of one stratum: the widest interval, as a proportion, its headline rate may have for the sample to be adequate. |
recall_target |
gr_screen_sample_size() |
0.95 |
basic | untested | The recall to show, strictly between 0 and 1. |
conf |
gr_screen_sample_size() |
0.95 |
basic | untested | Confidence level of the one-sided bound. |
prevalence |
gr_screen_sample_size() |
NULL |
basic | Expected share of eligible records among those drawn, for frame = “all”: turns the eligible records needed into records to draw. | |
frame |
gr_screen_sample_size() |
all |
advanced | “all”, “excluded” or “stacked”, as in gr_reference(). | |
max_lost |
gr_screen_sample_size() |
NULL |
advanced | For “excluded” and “stacked”: the most eligible records the screener may have excluded while still meeting the target. | |
frame_n |
gr_screen_sample_size() |
NULL |
advanced | Number of records in the frame sampled: the excluded records for “excluded” and “stacked”, everything screened for “all”, where with prevalence it caps the draw at the whole frame. | |
target |
gr_stop_test() |
0.95 |
basic | Recall level, strictly between 0 and 1. | |
alpha |
gr_stop_test() |
0.05 |
advanced | Significance level, strictly between 0 and 1. | |
n_total |
gr_stop_test() |
NULL |
advanced | Total number of records, screened or not. |
Extraction
The arguments of gr_extract(). The recipe settings you
pass to it in ... are the ingest and segment settings
above.
| setting | where | default | tier | status | description |
|---|---|---|---|---|---|
recipe |
gr_extract() |
research |
basic | The ingest and segmentation to use. | |
store |
gr_extract() |
NULL |
advanced | Optional directory. | |
resolve |
gr_extract() |
first |
basic | untested | What to do when two parts of one document give different values for the same field. |
require_quote |
gr_extract() |
FALSE |
basic | untested | Discard any value that is not verified: one with no quote, a quote that is not verbatim in the chunk it cited, or a quote that does not state the value (see “Verifying it” below). |
on_error |
gr_extract() |
continue |
advanced | “continue” (default) records the failure and moves on; “stop” aborts. | |
max_total_usd |
gr_extract() |
NULL |
advanced | Stop once the run has spent this much, marking the remaining documents “skipped”, except any restored from store, which costs nothing. | |
max_total_calls |
gr_extract() |
NULL |
advanced | Stop before a document once the run has made this many requests, marking the rest “skipped”, except any restored from store, which makes no request. | |
keep_answers |
gr_extract() |
FALSE |
advanced | Keep the underlying gr_answer objects in $answers. | |
recursive |
gr_extract() |
FALSE |
advanced | Descend into subdirectories when sources is a directory. | |
agreement_columns |
gr_extract() |
FALSE |
advanced | untested | Add two columns per field to table, after the field columns: <field>_agreement, how many of the chunks that reported the field give its most common value, of all that reported it (“2/3”), and <field>_conflict, TRUE when they gave more than one value. |
Synthesis
The arguments of gr_claims(), gr_outline(),
gr_gaps() and gr_synthesise().
| setting | where | default | tier | status | description |
|---|---|---|---|---|---|
model |
gr_claims() |
NULL |
basic | Passed to the model call. | |
temperature |
gr_claims() |
NULL |
advanced | Passed to the model call. | |
max_claim_tokens |
gr_claims() |
1600 |
advanced | Passed to the model call. | |
include_unclear |
gr_claims() |
FALSE |
advanced | Keep rows with nothing extracted. | |
effort |
gr_claims() |
NULL |
advanced | Reasoning effort, or NULL (the default) to send none: one string, or a character vector named by stage, as effort in gr_read_spec(). | |
unverified |
gr_claims() |
exclude |
advanced | untested | What the claims prompt does with an extracted value whose quote did not verify, or that came with no quote (see gr_extract(), “Verifying it”). |
model |
gr_outline() |
NULL |
advanced | Passed to the model call. | |
temperature |
gr_outline() |
NULL |
advanced | Passed to the model call. | |
max_sections |
gr_outline() |
6 |
basic | Upper bound on sections, before the closing one. | |
closing |
gr_outline() |
What is missing |
advanced | The heading of the closing section, which receives gap claims and anything unplaced. | |
max_outline_tokens |
gr_outline() |
NULL |
advanced | The reply limit for the outline call. | |
effort |
gr_outline() |
NULL |
advanced | Reasoning effort, or NULL (the default) to send none: one string, or a character vector named by stage, as effort in gr_read_spec(). | |
alternatives |
gr_outline() |
1 |
advanced | How many outlines to ask for, from 1 to 10. | |
max_cells |
gr_gaps() |
40 |
advanced | Cap on reported empty combinations, which grow as the product of two fields’ sizes. | |
min_reported |
gr_gaps() |
0.5 |
advanced | A field missing for more than this fraction of studies is reported as not reported. | |
model |
gr_synthesise() |
NULL |
basic | Overrides for the writing calls. | |
max_section_tokens |
gr_synthesise() |
1200 |
advanced | Overrides for the writing calls. | |
temperature |
gr_synthesise() |
NULL |
advanced | Overrides for the writing calls. | |
include_unclear |
gr_synthesise() |
FALSE |
advanced | Write from rows whose extraction was incomplete. | |
cite_style |
gr_synthesise() |
auto |
basic | How citations appear in the finished prose. | |
style |
gr_synthesise() |
NULL |
advanced | A register instruction appended to the writing prompts, such as “formal academic; hedge claims; past tense for findings”. | |
coherence |
gr_synthesise() |
FALSE |
basic | untested | Revision passes over the finished draft: TRUE for all three, FALSE for none, or any of “structure” (reorder and merge), “cut” (remove repetition) and “register” (polish sentences) by name. |
references |
gr_synthesise() |
TRUE |
advanced | Append a ## References section built from the studies the finished text actually cites. | |
effort |
gr_synthesise() |
NULL |
advanced | Reasoning effort, or NULL (the default) to send none: one string, or a character vector named by stage, as effort in gr_read_spec(). | |
coherence_rounds |
gr_synthesise() |
1 |
advanced | untested | How many rounds each coherence pass may run: each round revises the text the round before it kept, and the pass stops at the first round that is discarded or changes nothing. |
figure_bands |
gr_synthesise() |
c(about = 0.1, over = 0.25, under = 0.25) |
advanced | untested | How near a value a qualified figure must be to count as found in the check of figures (see “Figures”): a named numeric vector of about (the share either way that “about 1,200” covers), over (the share above that “more than 1,000” covers) and under (the share below that “fewer than 1,000” covers). |
prominence |
gr_synthesise() |
c(top = 1/3, middle = 1/3) |
advanced | untested | How much of the writing prompt’s sentence budget the claims of a section get, by rank: c(top = , middle = ), the shares of a section’s claims (ranked by the sign test of their direction tally, lowest p first, with a claim more of whose studies contradict it than support it last, then by the weight of the studies behind them; see gr_claims(), “Direction of effect”) asked for “two or three sentences” and “one or two sentences”; the rest get “one sentence”, and a section of three claims or fewer gives each “two or three”. |
study_weights |
gr_synthesise() |
NULL |
advanced | How much each study counts when claims are ranked, among claims whose sign tests tie (and so which tier each claim gets, see prominence): NULL (the default) for the package’s weight, 0.5 + 0.5 * size + 0.5 * filled, where size is log1p(n) over its largest value (the mean of the known ones when n is missing) and filled the share of a row’s filled cells whose quotations verified (0.5 when unknown). | |
revision_check |
gr_synthesise() |
lexicon |
advanced | untested | What checks a kept revision pass beyond the citation, figure and length checks. |
context_policy |
gr_synthesise() |
NULL |
advanced | untested | NULL (the default), or an hr_context_policy() (or a named list of its arguments) for what the write-up cuts when its text does not fit: the gaps, and batch drafts too long for a merge. |
context_order |
gr_synthesise() |
relevance |
advanced | untested | Where a section’s claims sit in its prompt, with claims: “relevance” (the default) in their rank, as before; “document” by claim number; “edges” with the highest ranked at the start and the next at the end, the lowest in the middle. |
Building blocks
Some document settings choose a module from a registry:
extractor, clean, method,
reader, hr_options(embedder = ), and the
recipe you give answer_document(). The tables below show
the registries as installed, so a module you register with
gr_register_reader() or another
gr_register_*() function
(vignette("extending")) appears in them too.
Extractors
An extractor turns one kind of file into text. harnessr picks it by
the file’s extension unless you name one with
extractor.
knitr::kable(gr_extractors()[, c("name", "extensions", "needs", "description")])| name | extensions | needs | description | |
|---|---|---|---|---|
| txt | txt | txt, text, log, csv, tsv | Plain text, including delimited files | |
| md | md | md, markdown, rmd, qmd | Markdown, keeping heading structure | |
| html | html | html, htm, xhtml | xml2 | HTML via xml2, keeping heading structure |
| pdftools | PDF with per-page OCR fallback and page provenance | |||
| docx | docx | docx, dotx | xml2 | Word: headings, tables by row, footnotes and endnotes; OCRs embedded images |
| image | image | png, jpg, jpeg, tif, tiff, bmp, gif | tesseract | Image OCR |
Cleaners and presets
A cleaner removes one kind of noise from the text. Cleaners marked
default_on run unless the preset or list you give leaves
them out. early cleaners run before late ones,
whatever order you name them in.
knitr::kable(gr_cleaners()[, c("name", "stage", "default_on", "description")])| name | stage | default_on | description |
|---|---|---|---|
| captions | early | FALSE | Drop figure/table caption lines: ‘Table 2.’, ‘Figure 3:’, ‘Fig. 3 |’, ‘Table 2 Baseline …’ or the label alone, not ‘Table 2 shows …’ (OFF by default: a caption can be the only statement of a result) |
| emails | early | FALSE | Remove email addresses |
| headers_footers | early | FALSE | Drop running heads and feet: short lines repeated at the top or bottom of many pages, or at the edge of blocks where pages are not known |
| hyphenation | early | TRUE | Rejoin words split across line breaks by PDF layout (‘mito-’, ‘LIA-’ in capitals); a compound the document writes with its hyphen elsewhere (‘follow-up’) keeps it; number ranges (‘18-’) and compounds (‘Anglo-’) are left alone |
| page_numbers | early | TRUE | Drop decorated page-number lines (‘Page 4’, ‘- 12 -’, ‘[12]’, and ‘12.’ unless the line before runs on into it); bare numbers are kept |
| references | early | FALSE | Drop a trailing bibliography, from a References/Bibliography heading to the end; in a Markdown file a line indented 4 or more spaces is code, not a heading |
| urls | early | FALSE | Remove URLs (OFF by default: URLs are often the answer) |
| ascii_only | late | FALSE | Transliterate to ASCII (drops accents and non-Latin scripts) |
| collapse_whitespace | late | TRUE | Collapse runs of spaces/tabs and 2+ consecutive blank lines, and trim block edges; preserves paragraph breaks |
| control_chars | late | TRUE | Strip control and zero-width characters that survive PDF extraction |
| ligatures | late | TRUE | Expand typographic ligatures and straighten smart quotes; en and em dashes are kept |
| lowercase | late | FALSE | Lowercase everything (loses proper-noun and acronym signal) |
| remove_numbers | late | FALSE | Replace every digit with a space. OFF by default: this makes figures, dates and percentages unanswerable |
| remove_punctuation | late | FALSE | Replace punctuation with spaces. OFF by default: destroys sentence boundaries |
A preset is a named list of cleaners. This table shows the steps each preset runs, read from what it did to the example report:
presets <- c("none", "minimal", "standard", "academic", "scan", "legacy")
knitr::kable(data.frame(preset = presets, cleaners = vapply(presets, function(p) {
steps <- names(gr_ingest(gr_example(), gr_ingest_spec(clean = p))$stats$clean_log)
if (length(steps)) paste(steps, collapse = ", ") else "(none)"
}, character(1)), row.names = NULL))| preset | cleaners |
|---|---|
| none | (none) |
| minimal | control_chars, collapse_whitespace |
| standard | page_numbers, hyphenation, control_chars, ligatures, collapse_whitespace |
| academic | page_numbers, captions, references, hyphenation, control_chars, ligatures, collapse_whitespace |
| scan | page_numbers, headers_footers, hyphenation, control_chars, ligatures, collapse_whitespace |
| legacy | page_numbers, captions, urls, emails, references, remove_numbers, collapse_whitespace |
Segmenters
A segmenter decides where chunks are cut. cost says what
it spends: free, embedding for one embedding
pass, or llm for model requests.
knitr::kable(gr_segmenters()[, c("name", "cost", "needs_client", "description")])| name | cost | needs_client | description |
|---|---|---|---|
| contextual | free | FALSE | Paragraph chunks prefixed with where they sit; context_source=‘llm’ writes it per chunk, one request each (calls_max = chunks). |
| fixed | free | FALSE | Uniform token windows, ignoring structure. The control condition. |
| page | free | FALSE | One chunk per page. For forms, invoices and scanned records. |
| paragraph | free | FALSE | Greedy packing of the author’s paragraphs up to the cap. |
| proposition | llm | TRUE | Rewrite into standalone factual statements. Expensive; best for dense factual recall. |
| recursive | free | FALSE | Cascade through separators, using the strongest one that fits. |
| semantic | embedding | TRUE | Cut where consecutive embeddings diverge most. One embedding pass. |
| sentence | free | FALSE | Sentence-boundary packing; tighter, more chunks, cleaner edges. |
| structural | free | FALSE | Never merge across headings; each chunk keeps its section title. |
Readers
A reader decides how the chunks reach the model.
signature records which chunks it sends, how many requests
it makes, and how information passes between them.
cost_calls is the number of requests.
knitr::kable(gr_readers()[, c("name", "signature", "cost_calls", "description")])| name | signature | cost_calls | description |
|---|---|---|---|
| ensemble | ensemble|sum+1|none | sum of members + 1 | Run several distinct readers and adjudicate. Members must have different signatures. |
| extract | all|N+conflicts|none | N (+1 per conflict with resolve = ‘model’) | Fill a typed schema from every chunk, then reconcile.
Needs fields. |
| hierarchical | all|N+tree+1|tree | N + fan-in levels + 1 | Recursively summarise until the summaries fit, then answer. Truly recursive. |
| iterative | topk|rounds*2|forward | up to 2 x max_rounds | Agentic loop: the model names what it still needs and that drives the next retrieval. |
| map_reduce | all|N+logN|tree | N + merges | Answer each chunk independently, then tree-reduce. Parallel, order-independent. |
| preview | planned|1+s+1|none | 1 + skimmed sections + 1 | Plan from an outline first, then read only what the plan says to. Sections it skips are named. |
| refine | all|N|forward | N | Sequential draft-and-revise down the document. Order matters; not parallelisable. |
| rerank | topk|m+1|none | m + 1 | BM25 prefilter, then the model scores candidates, then answer from the winners. |
| retrieve | topk|1|none | 1 + embeddings | Embed, rank by cosine similarity, answer from the top k. Cost independent of length. |
| screen | head|1|none | 1 | Decide whether one document meets a review’s criteria,
from its opening. Needs include/exclude. |
| skim | all|N+1|none | N + 1 | Extract verbatim evidence per chunk, then answer once from the evidence. |
| stuff | all|1|none | 1 | Whole document in one prompt. The baseline; errors or truncates if it does not fit. |
Embedders
An embedder turns text into vectors for the retrieve and
iterative readers and the semantic segmenter.
A deterministic embedder gives the same vectors every run, which a
replay needs.
knitr::kable(gr_embedders()[, c("name", "deterministic", "description")])| name | deterministic | description |
|---|---|---|
| api | FALSE | Embeddings endpoint on the client’s base URL |
| lexical | TRUE | Hashed bag-of-words; free, offline, word overlap not meaning |
Recipes
A recipe names an ingestion, a segmentation and a reader, with their settings. The table shows the values each built-in recipe sets, and you can override any of them by name.
knitr::kable(do.call(rbind, lapply(names(gr_recipes()), function(n) {
r <- gr_recipes(n)
data.frame(recipe = n, clean = paste(r$ingest$clean, collapse = ", "),
method = r$segment$method, max_tokens = r$segment$max_tokens,
overlap_tokens = r$segment$overlap_tokens, reader = r$read$reader,
top_k = r$read$top_k)
})))| recipe | clean | method | max_tokens | overlap_tokens | reader | top_k |
|---|---|---|---|---|---|---|
| fast | standard | paragraph | 4000 | 0 | stuff | 6 |
| precise | standard | sentence | 600 | 60 | skim | 6 |
| needle | standard | semantic | 500 | 50 | retrieve | 8 |
| thorough | standard | paragraph | 1200 | 120 | map_reduce | 6 |
| survey | standard | structural | 1500 | 0 | hierarchical | 6 |
| narrative | standard | paragraph | 1500 | 0 | refine | 6 |
| scanned | scan | page | 2000 | 0 | rerank | 6 |
| research | academic | structural | 900 | 90 | iterative | 5 |
| consensus | standard | recursive | 1000 | 100 | ensemble | 6 |
| legacy | legacy | paragraph | 3000 | 0 | map_reduce | 6 |
Next
-
vignette("harnessr"): the basic settings of each stage, and when to change each. -
vignette("core"): the core guides, and what a call does with the options above. -
vignette("compare"): how to test a setting on a reference with dev and test splits, and read the result with intervals. -
?gr_settings_table: how the table is built, and its columns.