Skip to contents

llm() needs SOME max_tokens value on every call (a provider truncates a response with no clear error otherwise – a codebook/data-check pass over many columns at once is the case most likely to need more than the built-in default). Rather than requiring every module call to repeat params = list(max_tokens = ...) individually, set it once per session here; llm() falls back to this whenever a caller's own params does not already specify max_tokens (an explicit params$max_tokens on a single call still wins, same precedence as every other params entry).

Usage

llm_max_tokens(n = NULL)

Arguments

n

the default max_tokens value, or NULL to read the current value without changing it

Value

the current default max_tokens value (invisibly when setting)

Examples

old <- options(metacheck.llm_max_tokens = NULL)
llm_max_tokens(8192)
llm_max_tokens()
#> [1] 8192
options(old)