Skip to contents

Repeats calls for rows whose success value is not TRUE and patches their results into the supplied data frame.

Usage

llm_par_resume(results, tries = 3, ...)

Arguments

results

A result data frame from call_llm_par() containing config, messages, and success.

tries

Total number of attempts allowed for each repeated call, including its first attempt. The default is 3. See call_llm_robust().

...

Other arguments passed to call_llm_par(). simplify is fixed at FALSE and must not be supplied here.

Value

After input validation, a data frame with existing result columns patched at the repeated row positions. A repeated call may fail again. Columns returned by the new calls but absent from results are not added. Other rows retain their values.

When calls are repeated, the result has class llmr_experiment. When no row needs to be repeated, the original object is returned unchanged with a message.

Details

Selection depends on success, not finish_reason. Truncated and content-filtered replies returned with success = TRUE are retained. To repeat such a request, pass its config and messages columns to call_llm_par(). For a token-limit truncation, increase max_tokens in the configuration before repeating the request.

The function rejects names consisting of a recognized result-column name followed by a numeric suffix, such as success.1 or duration.1. These names can indicate a collision between input and result columns. Rename conflicting input columns before the original call_llm_par() call. This check also applies when no row needs to be repeated.

When both structured_ok and structured_data are present, they are recomputed for the repeated rows. Extracted structured fields are not replaced. When calls are repeated, the presence of this diagnostic pair produces a warning, whether or not fields were extracted.

Tag diagnostics and extracted tag columns are not recomputed. When calls are repeated, a warning is issued if both tags_ok and tags_data are present.

To replace extracted fields, remove their old columns and use llm_parse_structured_col() or llm_parse_tags_col() with the original extraction specification. If the old columns remain, the parsers write extracted values to new names with suffixes.

Examples

if (FALSE) { # \dontrun{
results <- call_llm_par(experiments)
results <- llm_par_resume(results, tries = 3)
} # }