Run one annotation job and persist its outputs to disk.
Parameters
Name
Type
Description
Default
model
Ollama model identifier such as "gemma3:270m".
required
csv_path
Path to the input CSV file to annotate.
required
codebook_path
Path to the matching codebook.json file.
required
output_path
Path where the annotated CSV should be written.
required
experiment_directory
Directory for metadata and sidecar output files.
required
prompt_type
Registered prompt wrapper name or callable wrapper.
'standard'
use_examples
Whether codebook examples should be included in prompts.
DEFAULT_USE_EXAMPLES
temperature
Optional sampling temperature.
DEFAULT_TEMPERATURE
top_p
Optional nucleus-sampling value.
DEFAULT_TOP_P
process_textbox
Whether textbox annotations should be generated.
False
process_span
Whether span annotations should be generated.
False
chat_mode
How model calls share chat history: "per_text", "per_query", or "continuous".
DEFAULT_CHAT_MODE
reasoning
Optional Ollama reasoning mode passed to ChatOllama.
DEFAULT_REASONING
run_id
Optional run identifier written into config.json.
None
reasoning_traces_path
Optional JSONL path for per-query reasoning traces.
None
country_iso_code
Three-letter ISO 3166-1 alpha-3 country code for CodeCarbon.
'USA'
start_ollama_if_needed
If True, try to start a local ollama serve process when the default local server is not already reachable. Defaults to True so annotation runs can bring up the local Ollama server automatically when needed.
True
Returns
Name
Type
Description
codebook_lab.types.AnnotationRunResult describing the completed run.
Send Feedback
Opens a pre-filled issue on GitHub — you review and submit it there.