Skip to contents

Core

llm_config()
Create an LLM configuration (provider-agnostic)
print(<llm_config>) format(<llm_config>)
Print an LLM configuration with the API key masked
llm_api_key_env()
Declare an API key sourced from an environment variable
call_llm()
Call an LLM (chat/completions or embeddings) with optional multimodal input
call_llm_stream()
Stream a chat completion token by token
finish_reason() tokens() is_truncated() as.character(<llmr_response>) print(<llmr_response>)
LLMR Response Object
chat_session() as.data.frame(<llm_chat_session>) summary(<llm_chat_session>) head(<llm_chat_session>) tail(<llm_chat_session>) print(<llm_chat_session>)
Chat Session Object and Methods

Structured output

enable_structured_output()
Enable Structured Output (Provider-Agnostic)
disable_structured_output()
Disable Structured Output (clean provider toggles)
llm_parse_structured()
Parse structured output emitted by an LLM
llm_parse_structured_col()
Parse structured fields from a column into typed vectors
llm_parse_tags()
Parse XML-like tags emitted by an LLM
llm_parse_tags_col()
Parse XML-like tag fields from a column
llm_parse_rowpack_tags()
Parse a batched, row-wrapped tag response into per-row field lists
llm_validate_structured_col()
Validate structured JSON objects against a JSON Schema (locally)
llm_fn_structured()
Vectorized structured-output LLM
llm_mutate_structured()
Data-frame mutate with structured output
llm_mutate_tags()
Data-frame mutate with XML-like tag output
llm_fn_tags()
Vectorized LLM with tag extraction
call_llm_par_structured()
Parallel experiments with structured parsing
call_llm_par_tags()
Parallel experiments with tag parsing

Inspecting and summarizing runs

llm_preview()
Preview a tidy LLM call without spending anything
llm_render_messages()
Render tidy messages without calling any API
transcript_as_messages()
Build a role-flipped message array from a multi-speaker transcript
ensure_alternating_messages()
Make a message array provider-safe (alternating, user-leading)
llm_usage()
Summarize token usage and outcomes of an LLM run
llm_failures()
List the rows of an LLM run that failed or were truncated
llm_methods_text()
Draft a methods-section paragraph from an LLM run
llm_log_enable() llm_log_disable() llm_log_status() llm_log_active() llm_log_merge()
Record every LLM call in a local audit log
llm_log_read()
Read an LLMR audit log into records and a manifest
llm_logprobs()
Extract token log-probabilities from a response
llm_hash()
Content hash for research artifacts
llm_uuid()
A short, sortable, process-unique identifier

Provenance and replay

Turning an audit log back into a reproducible request: a content hash of a request, the response record it produced, and the reconstruction of a request from a logged call.

llm_request_hash()
Stable request hash for an LLM call
llm_request_from_log()
Rebuild a callable request from a logged record
llm_response_record()
Flatten one LLM response to a provenance row

Method-package generics

Shared generics implemented by the LLMR method packages (LLMRcontent, LLMRpanel, FocusGroup) on their result objects.

diagnostics()
Machine-readable diagnostics for an LLMR-family result object
report()
Draft a methods-section report from an LLMR-family result object
reset()
Reset a stateful object to its initial position

Tidy helpers and parallel

llm_fn()
Apply an LLM prompt over vectors/data frames
llm_mutate()
Mutate a data frame with LLM output
llm_replicate()
Run the same prompt several times per row
llm_agreement()
Agreement across replicated LLM annotations
build_factorial_experiments()
Build Factorial Experiment Design
call_llm_par()
Parallel LLM Processing with Tibble-Based Experiments (Core Engine)
llm_add_request_hash()
Append the audit-log request hash to a parallel-results frame
call_llm_broadcast()
Parallel API calls: Fixed Config, Multiple Messages
call_llm_sweep()
Parallel API calls: Parameter Sweep - Vary One Parameter, Fixed Message
call_llm_compare()
Parallel API calls: Multiple Configs, Fixed Message
expand_llm_config()
Expand an LLM Config Grid
llm_cross_design()
Cross a data frame with LLM configs
llm_par_resume()
Resume failed parallel LLM calls
llm_judge()
LLM-as-a-Judge Evaluation
setup_llm_parallel()
Setup Parallel Environment for LLM Processing
reset_llm_parallel()
Reset Parallel Environment

Batch APIs (asynchronous, discounted)

llm_batch_submit()
Submit a batch job to a provider's batch API
llm_batch_status()
Check the status of a batch job
llm_batch_fetch()
Fetch the results of a batch job
llm_batch_cancel()
Cancel a batch job

Tools (function calling)

llm_tool()
Define a tool the model may call
llm_tool_signature()
A stable signature for a tool's identity
call_llm_tools()
Call an LLM with tools and run the tool loop
tool_calls()
Extract tool calls from a response
bind_tools()
Bind tools to a config (provider-agnostic)

Embeddings

parse_embeddings()
Parse Embedding Response into a Numeric Matrix
get_batched_embeddings()
Generate Embeddings in Batches

Reliability

call_llm_robust()
Robustly Call LLM API (Simple Retry)
cache_llm_call()
Cache LLM API Calls
log_llm_error()
Log LLMR Errors

Persona data

A bundled example persona dataset and the small contract helpers that read such frames, shared across the LLMR family.

anes_2024_personas
Example participant profiles derived from ANES 2024
llm_persona_split()
Split one persona into labeled demographics and labeled answers
llm_persona_overview()
A compact overview of a persona frame for display
llm_persona_dictionary()
The question dictionary attached to a persona data frame
llm_persona_demographic_fields()
Which columns of a persona frame are demographics
llm_validate_persona_frame()
Check that a data frame follows the persona contract