Skip to contents

Configure, call, and transform data

llm_config()
Create an LLM configuration (provider-agnostic)
call_llm()
Call an LLM (chat/completions or embeddings) with optional multimodal input
llm_fn()
Apply an LLM prompt over vectors/data frames
llm_mutate()
Mutate a data frame with LLM output
finish_reason() tokens() is_truncated() as.character(<llmr_response>) print(<llmr_response>)
LLMR Response Object
llm_api_key_env()
Declare an API key sourced from an environment variable
print(<llm_config>) format(<llm_config>)
Print an LLM configuration with the API key masked

Experiments and model comparisons

build_factorial_experiments()
Build Factorial Experiment Design
call_llm_par()
Parallel LLM Processing with Tibble-Based Experiments (Core Engine)
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
llm_judge()
LLM-as-a-Judge Evaluation
setup_llm_parallel()
Setup Parallel Environment for LLM Processing
reset_llm_parallel()
Reset Parallel Environment

Logs, replication, and reporting

Local call logs, repeated measurements, usage summaries, failures, and study reports.

llm_log_enable() llm_log_disable() llm_log_status() llm_log_active()
Record every LLM call in a local audit log
llm_log_read()
Read an LLMR audit log into records and a manifest
llm_replicate()
Run the same prompt several times per row
llm_agreement()
Agreement across replicated LLM annotations
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
report()
Draft a methods-section report from an LLMR-family result object
llm_methods_text()
Deprecated methods-paragraph helper

Structured and tagged outputs

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

Conversations, tools, and streaming

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
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
call_llm_stream()
Stream a chat completion token by token
llm_logprobs()
Extract token log-probabilities from a response

Embeddings

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

Asynchronous batch jobs

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

Inspection, reliability, and recovery

llm_preview()
Preview a tidy LLM call without spending anything
llm_render_messages()
Render tidy messages without calling any API
call_llm_robust()
Robustly Call LLM API (Simple Retry)
llm_par_resume()
Resume failed parallel LLM calls

Persona and transcript data

A bundled example persona dataset and functions for inspecting and validating persona data 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_demographic_fields()
Which columns of a persona frame are demographics
llm_validate_persona_frame()
Check that a data frame follows the persona contract
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)

Request records and shared methods

Reconstruct calls from logs, inspect request records, and use common diagnostics and reset methods for package results.

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
llm_hash()
Content hash for research artifacts
diagnostics()
Machine-readable diagnostics for an LLMR-family result object
reset()
Reset a stateful object to its initial position