Assemble a coding protocol
Arguments
- codebook
A
codebook().- config
An
LLMR::llm_config()for a generative model. For annotation work prefertemperature = 0.- prompt
Prompt template containing the placeholder
{text}and, optionally,{codebook}(replaced byformat_codebook()'s rendering).NULLuses a sensible default. Placeholders are substituted literally, so braces in the coded text itself are safe.- parser
A function
(text, labels) -> labelturning a model reply into one of the codebook's labels (orNA).NULLuses the package's label-matching parser.- replicates
How many times each unit is coded before its modal label is used by
tune_protocol(),validate_protocol(), andcode_corpus()(replicates make model self-disagreement measurable; seecoder_agreement()).- label
Optional human-readable tag used in tournaments and reports (e.g.
"v2-fewshot-qwen"); defaults to provider/model.
Examples
cb <- codebook("tone", "one sentence",
list(cb_category("positive", "Approving."),
cb_category("negative", "Critical.")))
cfg <- LLMR::llm_config("groq", "openai/gpt-oss-20b", temperature = 0)
p <- protocol(cb, cfg)
protocol_lock(p)