Creates a function compatible with vitals Tasks that executes a DSPrrr
module against batches of inputs. The solver uses run_dataset() internally,
ensuring that the module's demos, templates, and input descriptions are
properly used in prompt construction.
For multi-input modules, the solver expects the vitals input column to
contain nested data (list of tibbles/lists) where each element has fields
matching the module's signature inputs. Use as_vitals_task() to
automatically create this structure from a flat dataset.
Batch execution is sequential unless .concurrency requests another
backend. For structured outputs, mock Chat objects are created for vitals
logging compatibility (following the same pattern as vitals'
generate_structured()).
Arguments
- module
A DSPrrr module (e.g., created via
module()).- .llm
An ellmer chat object. If
NULL(default), uses the module's stored chat or falls back toget_default_chat(). The chat is cloned for each batch invocation.- .concurrency
Optional policy created by
concurrency_control(). Omission uses sequential execution.- ...
Additional arguments forwarded to
run_dataset().
Value
A function accepting a list of input objects and returning a list
with components result, solver_chat, and optionally solver_metadata.
Examples
chat <- ellmer::chat_openai(
credentials = function() "example-key",
echo = "none"
)
#> Using model = "gpt-5.4".
solver <- as_vitals_solver(
module(signature("question -> answer")),
.llm = chat
)