annotate.classify_text

annotate.classify_text(
    chain,
    text,
    codebook,
    prompt_type='standard',
    use_examples=False,
    char_counts=None,
    timing_data=None,
    process_textbox=False,
    row_num=None,
    progress_bar=None,
    total_rows=None,
    process_span=False,
    retries=1,
    retry_strategy='identical',
    retry_chain=None,
    chat_session=None,
    reasoning_traces=None,
    chat_mode=None,
)

Annotate one text row across all sections in a codebook.

Parameters

Name Type Description Default
chain Runnable returned by setup_model. required
text Raw source text to annotate. required
codebook Parsed codebook dictionary. required
prompt_type Registered prompt wrapper name or callable wrapper. 'standard'
use_examples Whether codebook examples should be included in prompts. False
char_counts Optional mutable counter dict for prompt/response characters. None
timing_data Optional mutable timing dict for inference statistics. None
process_textbox Whether textbox annotations should be generated. False
row_num Optional 1-based row number for progress logging. None
progress_bar Optional progress-bar helper updated after each annotation. None
total_rows Optional total row count for progress rendering. None
chat_session Optional retained chat history for this text or run. None
reasoning_traces Optional list that receives per-query reasoning records. None
chat_mode Normalized chat-history policy for trace metadata. None

Returns

Name Type Description
Tuple of (responses, char_counts, timing_data).