Skip to contents

Signatures & Inputs

Declare typed schemas for LLM operations

Signature() signature()
Create a Signature for LLM Operations
input()
Create an input specification for a Signature
input_string() input_number() input_boolean() input_integer() input_enum() input_array() input_object()
Create typed input helpers for common cases
signature_to_json_schema()
Convert a Signature to JSON Schema
dsp_trainset()
Create Training Data for DSPrrr

Signature Transforms

Add reasoning, chain-of-thought, and other prompt-level behaviors

with_instructions() append_instructions()
Signature Transforms for Advanced Reasoning Modules
with_reasoning()
Add Chain-of-Thought Reasoning to a Signature
without_reasoning()
Remove Chain-of-Thought from a Signature
has_reasoning()
Check if a Signature has Chain-of-Thought
chain_of_thought()
Create a Chain-of-Thought Module

Modules

Create, run, and inspect LLM modules

module()
Create an LLM Module
flex()
Optimize a Module's Implementation with Flex
run()
Execute an LLM Module
run_dataset()
Execute Module on Data
concurrency_control()
Control Batch Concurrency
predict(<Module>) predict(<PredictModule>)
Predict Method for Modules (tidymodels-style)
dsp()
Declarative Structured Prediction
as_module()
Create a Module from a Chat
module_fn()
Callable Module
module_graph() named_modules() named_parameters() map_modules() replace_module() freeze_modules() is_module_frozen() set_module_lm() module_children()
Traverse and Transform Module Graphs
get_last_trace()
Get the Last DSP Trace

Pipelines

Chain modules into multi-step workflows

pipeline()
Pipeline Module for Sequential Module Composition
`%>>%`
Pipe Operator for Module Composition
step()
Create a Pipeline Step with Mappings
map_inputs()
Map Inputs for Pipeline Steps
with_inputs()
Inject Static Inputs for Pipeline Steps
select_outputs()
Select Outputs for Pipeline Steps

Reasoning & Ensemble Modules

Combine and refine outputs for improved accuracy

module-wrapper
Wrapper Modules for Advanced Reasoning Patterns
best_of_n()
Create a BestOfN Wrapper Module
refine()
Create a Refine Wrapper Module
as_reward_fn()
Convert a Metric to a Reward Function
module-multichain
MultiChainComparison Module
multi_chain_comparison()
Create a MultiChainComparison Module
module-ensemble
Ensemble Module for Combining Multiple Modules
ensemble()
Create an Ensemble Module
reduce_majority()
Majority Vote Reducer
reduce_weighted_vote()
Weighted Vote Reducer
reduce_first()
First Successful Output Reducer
reduce_best_by_metric()
Best by Metric Reducer

Agentic Modules

Tool use, code execution, RAG, and recursive language models

module-react
ReAct Module
rag_module()
Create a RAG Module
r_code_runner()
Create an R Code Runner
r-code-runner
R Code Execution Backend
mcp_repl_runner()
Posit mcp-repl Code Runner
program_of_thought()
Create a Program of Thought Module
module-program-of-thought
Program of Thought Module
code_act()
Create a CodeAct Module
module-codeact
CodeAct Module
rlm_module()
Create a Recursive Language Model (RLM) Module
rlm()
Run a Recursive Language Model in one call
module-rlm
Recursive Language Model (RLM) Module

Assertions

Validate outputs and retry with automatic backtracking

Assertion() AssertionSet() assert_output() suggest_output() assertion_set()
Assertions for Output Validation
with_assertions()
Wrap a Module with Assertions
assertion-helpers
Assertion Helper Functions
assert_length()
Assert Output Length
assert_contains()
Assert Output Contains Substring
assert_not_contains()
Assert Output Does Not Contain Substring
assert_matches()
Assert Output Matches Pattern
assert_not_matches()
Assert Output Does Not Match Pattern
assert_one_of()
Assert Output is One Of
assert_custom()
Assert Custom Condition
assert_not_empty()
Assert Output is Not Empty
assert_range()
Assert Numeric Value in Range

Evaluation & Metrics

Score module outputs and measure performance

evaluate()
Evaluate a DSPrrr module
evaluate_dsp()
Evaluate a Compiled Module
metric_contains()
Create a Contains Metric
metric_custom()
Create a Custom Metric
metric_exact_match()
Create an Exact Match Metric
metric_f1()
Create an F1 Score Metric
metric_field_match()
Create a Field Equality Metric
metric_threshold()
Create a Threshold Metric
metric_with_feedback()
Create a Metric with Textual Feedback
metric_with_trace()
Create a Trace-Aware Metric
metric_model_graded_qa() metric_model_graded_fact() metric_detect_match() metric_detect_includes() metric_detect_pattern()
Pre-built Vitals-backed Metrics

Teleprompters

Automated prompt optimization strategies

Teleprompter()
Teleprompter Base Class
LabeledFewShot()
LabeledFewShot Teleprompter
GridSearchTeleprompter
GridSearchTeleprompter
BootstrapFewShot()
BootstrapFewShot Teleprompter
BootstrapFewShotWithRandomSearch()
BootstrapFewShotWithRandomSearch Teleprompter
KNNFewShot()
KNNFewShot Teleprompter
BetterTogether()
BetterTogether Teleprompter
Omni() print(<Omni>)
Omni Teleprompter
AutoResearch() print(<AutoResearch>)
AutoResearch Teleprompter
MetaHarness() print(<MetaHarness>)
Meta-Harness Teleprompter
SIMBA()
SIMBA Teleprompter
GEPA()
GEPA Teleprompter
MIPROv2()
MIPROv2 Teleprompter
COPRO()
COPRO Teleprompter
teleprompter-ensemble
Ensemble Teleprompter
Ensemble()
Ensemble Teleprompter
ensemble_from_programs()
Compile Programs into an Ensemble

Optimization

Compile modules and tune parameters

optimize_grid()
Grid Search Optimisation
compile()
Compile S7 Generic and Methods
compile_module()
Compile a DSPrrr Program
module_parameters()
Suggest tidymodels parameters for a module
module_trials()
Summarise optimisation trials for a module
module_metrics()
Summarise optimisation metrics per trial

Optimization Results

Inspect trials, extract best configurations, and export

optimizer-accessors
Optimizer Convenience Functions
best_params()
Extract Best Parameters from a Module
best_demos()
Extract Best Demos from a Compiled Module
module_demos_as_tibble()
Convert module demos to a tibble
apply_best_config()
Apply Best Configuration from One Module to Another
top_trials()
Get Top Performing Trials
config_diff()
Compare Module Configuration Before and After Optimization
export_module_code()
Export Module Configuration as R Code
optimization_summary()
Get Optimization Summary
print(<dsprrr_optimization_summary>)
Print method for optimization summary

Optimizer Infrastructure

Low-level building blocks for custom optimizers

OptimizerControl()
Optimizer Control Parameters
optimizer_control()
Create Optimizer Control
eval_program()
Evaluate a Program on a Dataset
sample_dataset()
Sample from a Dataset Deterministically
split_dataset()
Split Dataset into Train and Validation Sets
Trial()
Trial Record
TrialLog
Trial Log
create_trial()
Create a Trial Record
complete_trial()
Complete a Trial
write_trials_jsonl()
Write Trials to JSONL File
read_trials_jsonl()
Read Trials from JSONL File
load_trial_log()
Load Trial Log from Directory

Configuration

Set up LLM providers, caching, and global options

dsp_configure()
Configure dsprrr Default Settings
dsprrr_sitrep()
dsprrr Situation Report
default-chat
Default Chat Configuration
get_default_chat()
Get the Default Chat
set_default_chat()
Set the Default Chat
clear_default_chat()
Clear Cached Default Chat
with_lm()
Execute Code with a Scoped LM Override
local_lm()
Set Local LM Override
configure_cache()
Configure dsprrr Cache
clear_cache()
Clear dsprrr Cache
cache_stats()
Get Cache Statistics

Async & Streaming

Non-blocking execution and streaming responses

async
Asynchronous Module Operations
run_async()
Run a module asynchronously
stream_async()
Stream module output asynchronously
run_stream()
Run a Module with Streaming Listeners and Status Events
stream_listener()
Create a Stream Listener for a Module Output Field

Debugging & Traces

Inspect prompts, execution history, and traces

prompt-visibility
Prompt Visibility and Inspection
get_last_prompt()
Get the Last Prompt
inspect_history()
Inspect LLM Call History
clear_prompt_history()
Clear Prompt History
export_traces()
Export Module Traces
summarize_traces()
Summarize Module Traces
clear_traces()
Clear Module Traces

Results & Printing

Extract outputs, costs, and display formatted results

accessors
Accessor Functions for DSPrrr Results
get_output()
Get output from a result
get_metadata()
Get metadata from a result
get_tokens()
Get token counts from a result
get_cost()
Get cost from a result
session_cost()
Session Cost Summary
print(<dsprrr_evaluation>)
Print method for dsprrr_evaluation
print(<dsprrr_batch_result>)
Print method for dsprrr_batch_result
print(<dsprrr_cost_summary>)
Print method for dsprrr_cost_summary
print(<EvalResult>)
Print method for EvalResult
print(<Trial>)
Print method for Trial
print(<BootstrapFewShot>)
Print method for BootstrapFewShot
print(<BootstrapFewShotWithRandomSearch>)
Print method for BootstrapFewShotWithRandomSearch
print(<GEPA>)
Print method for GEPA
AutoResearch() print(<AutoResearch>)
AutoResearch Teleprompter
MetaHarness() print(<MetaHarness>)
Meta-Harness Teleprompter
print(<SIMBA>)
Print method for SIMBA
print(<COPRO>)
Print method for COPRO

Production & Deployment

Pin configurations, validate workflows, and deploy to production

program_artifact() save_program() load_program()
Persist Complete dsprrr Programs
orchestration
Orchestration Helpers for Production Workflows
pin_module_config()
Pin a Module Configuration
restore_module_config()
Restore a Module from Pinned Configuration
pin_trace()
Pin Module Traces
pin_vitals_log()
Pin Vitals Evaluation Log
use_dsprrr_template()
Use dsprrr Workflow Templates
validate_workflow()
Validate Workflow Configuration

Vitals Integration

Bridge to the vitals evaluation framework

as_vitals_solver()
Convert a dsprrr module into a vitals solver
as_vitals_task()
Create a vitals Task from a dsprrr module
as_vitals_cost()
Convert dsprrr cost data to vitals format
as_vitals_samples()
Convert dsprrr traces to vitals samples format
as_dsprrr_traces()
Convert vitals samples to dsprrr traces format
summarize_traces_df()
Summarize a traces data frame
as_dsprrr_metric()
Adapt a vitals scorer for use as a dsprrr metric
metric_model_graded_qa() metric_model_graded_fact() metric_detect_match() metric_detect_includes() metric_detect_pattern()
Pre-built Vitals-backed Metrics

ellmer & RAG

Tool registration with ellmer and retrieval with ragnar

as_ellmer_tool()
Convert a DSPrrr Module to an ellmer Tool
register_dsprrr_tool()
Register a DSPrrr Module as a Tool in a Chat
ragnar_tool()
Create a ragnar Search Tool for ReAct Modules
create_search_tool()
Create a Semantic Search Tool from Documents
print(<ragnar_tool>)
Print method for ragnar_tool

tidymodels Integration

Use LLM modules as parsnip model engines with dials parameters

llm_predict()
LLM Prediction Model Specification
fit_llm_predict()
Fit LLM Predict Model
predict_llm_class()
Predict Class Labels with LLM
predict_llm_numeric()
Predict Numeric Values with LLM
register_dsprrr_engine()
Register dsprrr Engine with parsnip
temperature()
Temperature Parameter for dials
top_p()
Top-p Parameter for dials
reasoning_effort()
Reasoning Effort Parameter for dials

Demo & Interactive Tools

Interactive demonstrations and exploration tools

run_demo()
Run the Interactive RLM Demo

Utilities

Model detection, provider defaults, and helper functions

is_reasoning_model()
Check if a model is a reasoning model
provider_defaults()
Get default parameters for a provider
eval_vignette()
Determine if vignettes should be evaluated
has_ellmer_credentials()
Check for ellmer credentials